mirror of https://github.com/ipxe/ipxe.git
[mtnic] Add multiport support and some minor fixes
Signed-off-by: Michael Brown <mcb30@etherboot.org>pull/1/head
parent
e9c10ca158
commit
750c19466a
File diff suppressed because it is too large
Load Diff
|
@ -38,24 +38,28 @@
|
||||||
/*
|
/*
|
||||||
* Device setup
|
* Device setup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
Note port number can be changed under mtnic.c !
|
|
||||||
*/
|
|
||||||
#define MTNIC_MAX_PORTS 2
|
#define MTNIC_MAX_PORTS 2
|
||||||
|
#define MTNIC_PORT1 0
|
||||||
|
#define MTNIC_PORT2 1
|
||||||
#define NUM_TX_RINGS 1
|
#define NUM_TX_RINGS 1
|
||||||
#define NUM_RX_RINGS 1
|
#define NUM_RX_RINGS 1
|
||||||
#define NUM_CQS (NUM_RX_RINGS + NUM_TX_RINGS)
|
#define NUM_CQS (NUM_RX_RINGS + NUM_TX_RINGS)
|
||||||
#define GO_BIT_TIMEOUT 6000
|
#define GO_BIT_TIMEOUT 6000
|
||||||
#define TBIT_RETRIES 100
|
#define TBIT_RETRIES 100
|
||||||
#define UNITS_BUFFER_SIZE 8 /* can be configured to 4/8/16 */
|
#define UNITS_BUFFER_SIZE 8 /* can be configured to 4/8/16 */
|
||||||
#define MAX_GAP_PROD_CONS (UNITS_BUFFER_SIZE/4)
|
#define MAX_GAP_PROD_CONS ( UNITS_BUFFER_SIZE / 4 )
|
||||||
#define DEF_MTU 1600
|
#define ETH_DEF_LEN 1540 /* 40 bytes used by the card */
|
||||||
#define DEF_IOBUF_SIZE 1600
|
#define ETH_FCS_LEN 14
|
||||||
|
#define DEF_MTU ETH_DEF_LEN + ETH_FCS_LEN
|
||||||
|
#define DEF_IOBUF_SIZE ETH_DEF_LEN
|
||||||
|
|
||||||
#define MAC_ADDRESS_SIZE 6
|
#define MAC_ADDRESS_SIZE 6
|
||||||
#define NUM_EQES 16
|
#define NUM_EQES 16
|
||||||
#define ROUND_TO_CHECK 0x400
|
#define ROUND_TO_CHECK 0x400
|
||||||
|
|
||||||
|
#define DELAY_LINK_CHECK 300
|
||||||
|
#define CHECK_LINK_TIMES 7
|
||||||
|
|
||||||
|
|
||||||
#define XNOR(x,y) (!(x) == !(y))
|
#define XNOR(x,y) (!(x) == !(y))
|
||||||
#define dma_addr_t unsigned long
|
#define dma_addr_t unsigned long
|
||||||
|
@ -193,14 +197,7 @@ enum {
|
||||||
MTNIC_CLR_INT_SIZE = 0x00008,
|
MTNIC_CLR_INT_SIZE = 0x00008,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MELLANOX_VENDOR_ID 0x15b3
|
|
||||||
#define MTNIC_DEVICE_ID 0x00a00190
|
|
||||||
#define MTNIC_RESET_OFFSET 0xF0010
|
#define MTNIC_RESET_OFFSET 0xF0010
|
||||||
#define MTNIC_DEVICE_ID_OFFSET 0xF0014
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -359,7 +356,8 @@ struct mtnic_eq {
|
||||||
enum mtnic_state {
|
enum mtnic_state {
|
||||||
CARD_DOWN,
|
CARD_DOWN,
|
||||||
CARD_INITIALIZED,
|
CARD_INITIALIZED,
|
||||||
CARD_UP
|
CARD_UP,
|
||||||
|
CARD_LINK_DOWN,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FW */
|
/* FW */
|
||||||
|
@ -395,12 +393,15 @@ struct mtnic_txcq_db {
|
||||||
* Device private data
|
* Device private data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct mtnic_priv {
|
struct mtnic {
|
||||||
struct net_device *dev;
|
struct net_device *netdev[MTNIC_MAX_PORTS];
|
||||||
|
struct mtnic_if_cmd_reg *hcr;
|
||||||
|
struct mtnic_cmd cmd;
|
||||||
struct pci_device *pdev;
|
struct pci_device *pdev;
|
||||||
u8 port;
|
|
||||||
|
|
||||||
enum mtnic_state state;
|
struct mtnic_eq eq;
|
||||||
|
u32 *eq_db;
|
||||||
|
|
||||||
/* Firmware and board info */
|
/* Firmware and board info */
|
||||||
u64 fw_ver;
|
u64 fw_ver;
|
||||||
struct {
|
struct {
|
||||||
|
@ -417,18 +418,27 @@ struct mtnic_priv {
|
||||||
u32 txcq_db_offset;
|
u32 txcq_db_offset;
|
||||||
u32 eq_db_offset;
|
u32 eq_db_offset;
|
||||||
} fw;
|
} fw;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct mtnic_if_cmd_reg *hcr;
|
|
||||||
struct mtnic_cmd cmd;
|
|
||||||
|
|
||||||
|
struct mtnic_port {
|
||||||
|
|
||||||
|
struct mtnic *mtnic;
|
||||||
|
u8 port;
|
||||||
|
|
||||||
|
enum mtnic_state state;
|
||||||
|
|
||||||
/* TX, RX, CQs, EQ */
|
/* TX, RX, CQs, EQ */
|
||||||
struct mtnic_ring tx_ring;
|
struct mtnic_ring tx_ring;
|
||||||
struct mtnic_ring rx_ring;
|
struct mtnic_ring rx_ring;
|
||||||
struct mtnic_cq cq[NUM_CQS];
|
struct mtnic_cq cq[NUM_CQS];
|
||||||
struct mtnic_eq eq;
|
|
||||||
u32 *eq_db;
|
|
||||||
u32 poll_counter;
|
u32 poll_counter;
|
||||||
|
struct net_device *netdev;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -519,6 +529,7 @@ struct mtnic_if_open_nic_in_mbox {
|
||||||
u8 log_mac_p2; /* log2 mac per rx port1 */
|
u8 log_mac_p2; /* log2 mac per rx port1 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* CMD CONFIG_RX */
|
/* CMD CONFIG_RX */
|
||||||
struct mtnic_if_config_rx_in_imm {
|
struct mtnic_if_config_rx_in_imm {
|
||||||
u16 spkt_size; /* size of small packets interrupts enabled on CQ */
|
u16 spkt_size; /* size of small packets interrupts enabled on CQ */
|
||||||
|
|
Loading…
Reference in New Issue