58 #define TXNICCOL(x) ( &txnic_pfs + (x)->node ) 78 DBGC ( vnic,
"TXNIC %s SQ %05zx(%05llx)/%05zx(%05llx) %08llx\n",
85 DBGC ( vnic,
"TXNIC %s RQ %05zx(%05llx)/%05zx(%05llx) %016llx\n",
92 DBGC ( vnic,
"TXNIC %s CQ xxxxx(%05llx)/%05x(%05llx) %08llx:%08llx\n",
126 DBGC ( vnic,
"TXNIC %s SQ at [%08lx,%08lx)\n",
157 DBGC ( vnic,
"TXNIC %s SQ disable timed out\n", vnic->
name );
194 DBGC ( vnic,
"TXNIC %s out of send queue entries\n",
203 memset ( &sqe, 0,
sizeof ( sqe ) );
210 DBGC2 ( vnic,
"TXNIC %s SQE %#03x is [%08lx,%08lx)\n",
248 DBGC ( vnic,
"TXNIC %s SQE %#03x complete (status %#02x)\n",
252 DBGC2 ( vnic,
"TXNIC %s SQE %#03x complete\n",
253 vnic->
name, sq_idx );
290 DBGC ( vnic,
"TXNIC %s RQ at [%08lx,%08lx)\n",
321 DBGC ( vnic,
"TXNIC %s RQ disable timed out\n", vnic->
name );
364 unsigned int rq_iobuf_idx;
365 unsigned int refilled = 0;
384 DBGC2 ( vnic,
"TXNIC %s RQE %#03x is [%08lx,%08lx)\n",
395 vnic->
rq.
iobuf[rq_iobuf_idx] = iobuf;
415 unsigned int rq_iobuf_idx;
427 iobuf = vnic->
rq.
iobuf[rq_iobuf_idx];
436 DBGC ( vnic,
"TXNIC %s RQE %#03x error (length %zd, errop " 437 "%#02x)\n", vnic->
name, rq_idx,
len, errop );
440 DBGC2 ( vnic,
"TXNIC %s RQE %#03x complete (length %zd)\n",
471 DBGC ( vnic,
"TXNIC %s CQ at [%08lx,%08lx)\n",
502 DBGC ( vnic,
"TXNIC %s CQ disable timed out\n", vnic->
name );
544 for ( i = 0 ; i < qcount ; i++ ) {
560 DBGC ( vnic,
"TXNIC %s unknown completion type %d\n",
563 &cqe, sizeof ( cqe ) );
653 unsigned long membase ) {
660 goto err_alloc_netdev;
673 if ( ! vnic->
cq.
cqe )
678 if ( ! vnic->
sq.
sqe )
683 if ( ! vnic->
rq.
rqe )
760 DBGC ( vnic,
"TXNIC %s SPU %02llx:%04llx%s%s%s\n",
772 DBGC ( vnic,
"TXNIC %s BR %04llx:%04llx%s%s%s%s%s\n",
773 vnic->
name, br_status2, br_status2,
779 " LATCHED_LOCK" :
"" ),
781 " LATCHED_BER" :
"" ) );
785 DBGC ( vnic,
"TXNIC %s BR ALGN %016llx%s\n", vnic->
name, br_algn_status,
791 DBGC ( vnic,
"TXNIC %s BR PMD %04llx\n", vnic->
name, br_pmd_status );
797 DBGC ( vnic,
"TXNIC %s BR AN %04llx%s%s%s%s%s\n", vnic->
name, an_status,
801 " AN_COMPLETE" :
"" ),
803 " LINK_STATUS" :
"" ),
805 " LP_AN_ABLE" :
"" ) );
808 DBGC ( vnic,
"TXNIC %s TXF xc %#llx xd %#llx mc %#llx sc %#llx ok " 809 "%#llx bc %#llx mc %#llx un %#llx pa %#llx\n", vnic->
name,
819 DBGC ( vnic,
"TXNIC %s TXB ok %#llx hist %#llx:%#llx:%#llx:%#llx:" 820 "%#llx:%#llx:%#llx:%#llx\n", vnic->
name,
832 DBGC ( vnic,
"TXNIC %s RXF ok %#llx pa %#llx nm %#llx ov %#llx er " 833 "%#llx nc %#llx\n", vnic->
name,
840 DBGC ( vnic,
"TXNIC %s RXB ok %#llx pa %#llx nm %#llx ov %#llx nc " 841 "%#llx\n", vnic->
name,
884 DBGC ( vnic,
"TXNIC %s INT %04llx%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
941 unsigned int vnic_idx = lmac->
idx;
1096 unsigned long membase;
1179 unsigned int bgx_idx;
1191 pf->
bgx[bgx_idx] = bgx;
1196 for ( lmac_idx = 0 ; lmac_idx <
count ; lmac_idx++ ) {
1205 for ( lmac_idx-- ; lmac_idx >= 0 ; lmac_idx-- )
1220 unsigned int lmac_idx;
1227 for ( lmac_idx = 0 ; lmac_idx < bgx->
count ; lmac_idx++ )
1251 unsigned long membase;
1271 DBGC (
TXNICCOL (
pf ),
"TXNIC %d/*/* PF %s at %#lx (VF %#lx+%#lx)\n",
1357 PCI_ROM ( 0x177d, 0xa01e,
"thunder-pf",
"ThunderX NIC PF", 0 ),
1380 .lane_to_sds = 0xe4,
1385 .lane_to_sds = 0x0e04,
1388 .name =
"10GBASE-R",
1390 .lane_to_sds = 0x00000000,
1393 .name =
"40GBASE-R",
1395 .lane_to_sds = 0xe4,
1422 DBGC (
TXNICCOL ( bgx ),
"TXNIC %d/%d/* BGX unknown type %d\n",
1438 DBGC (
TXNICCOL ( bgx ),
"TXNIC %d/%d/* assuming %d LMACs\n",
1465 for ( i = 0 ; i < bgx->
count ; i++ ) {
1511 DBGC (
TXNICCOL ( bgx ),
"TXNIC %d/%d/%d could not get " 1512 "MAC address: %s\n", bgx->
node, bgx->
idx,
1516 DBGC (
TXNICCOL ( bgx ),
"TXNIC %d/%d/%d has no board " 1517 "configuration protocol\n", bgx->
node, bgx->
idx,
1523 DBGC (
TXNICCOL ( bgx ),
"TXNIC %d/%d/%d has no MAC address\n",
1570 unsigned int lmac_idx ) {
1611 unsigned long membase;
1655 for ( i = 0 ; i <
bgx->
count ; i++ )
1707 PCI_ROM ( 0x177d, 0xa026,
"thunder-bgx",
"ThunderX BGX", 0 ),
#define BGX_SPU_STATUS2_RCVFLT
static void txnic_bgx_remove(struct pci_device *pci)
Remove PCI device.
#define TXNIC_PF_PKIND_CFG(pk)
Port kind configuration.
#define TXNIC_PF_BAR_SIZE
Physical function BAR size.
#define BGX_CMR_TX_STAT12
CMR transmit statistics 12.
unsigned int idx
BGX index.
#define BGX_CMR_TX_STAT3
CMR transmit statistics 3.
#define TXNIC_PF_INTF_BP_CFG(in)
Interface backpressure configuration.
#define BGX_CMR_CONFIG_LMAC_TYPE_GET(config)
static int txnic_lmac_open(struct net_device *netdev)
Open network device.
#define BGX_CMR_TX_STAT14
CMR transmit statistics 14.
static void txnic_lmac_close(struct net_device *netdev)
Close network device.
static void txnic_bgx_init(struct txnic_bgx *bgx, unsigned int type)
Initialise BGX Ethernet interface.
#define TXNIC_QS_RQ_CFG_ENA
static void txnic_complete_rqe(struct txnic *vnic, struct txnic_cqe_rx *cqe)
Complete receive queue entry.
#define BGX_SPU_AN_STATUS
SPU autonegotiation status.
static EFI_THUNDER_CONFIG_PROTOCOL * txcfg
Board configuration protocol.
#define TXNIC_PF_QS_SQ_CFG_CQ_QS(qs)
A receive completion queue entry.
struct txnic * vnic
Virtual NIC (if applicable)
#define TXNIC_PF_TL4_CFG_RR_QUANTUM_DEFAULT
struct arbelprm_rc_send_wqe rc
#define TXNIC_PF_INTF_BP_CFG_BP_ENA
static int txnic_bgx_probe(struct pci_device *pci)
Probe PCI device.
uint16_t sqe_ptr
Send queue entry pointer.
#define BGX_SPU_BR_STATUS1_RCV_LNK
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
#define BGX_CMR_CONFIG
CMR configuration.
#define TXNIC_PF_TL3_CFG(tl)
Traffic limiter 3 configuration.
#define TXNIC_PF_CHAN_RX_BP_CFG_BPID(bp)
#define TXNIC_PF_CHAN_RX_CFG_CPI_BASE(ix)
#define TXNIC_RQE_SIZE
Receive queue entry size.
#define BGX_SPU_BR_ALGN_STATUS_ALIGND
unsigned int count
Number of LMACs.
#define BGX_SPU_STATUS1_RCV_LNK
static int txnic_create_sq(struct txnic *vnic)
Create send queue.
#define TXNIC_PF_LMAC_CFG2_MAX_PKT_SIZE(sz)
#define TXNIC_QS_RQ_CFG(q)
Receive queue configuration.
#define TXNIC_QS_SQ_DOOR(q)
Send queue doorbell.
int(* open)(struct net_device *netdev)
Open network device.
#define TXNIC_QS_CQ_HEAD(q)
Completion queue head pointer.
#define BGX_CMR_TX_STAT15
CMR transmit statistics 15.
#define TXNIC_QS_RBDR_CFG_QSIZE_8K
#define BGX_CMR_RX_STAT3
CMR receive statistics 3.
#define BGX_SPU_INT
SPU interrupt.
#define TXNIC_PF_RSSI_RQ(ix)
RSS indirection receive queue.
#define BGX_CMR_TX_STAT10
CMR transmit statistics 10.
#define BGX_CMR_CHAN_MSK_AND_ALL(count)
#define BGX_SPU_BR_STATUS1_HI_BER
#define TXNIC_NUM_DMAC
Maximum number of destination MAC addresses (per BGX)
#define BGX_CMR_RX_STEERING(i)
CMR receive steering.
#define TXNIC_QS_RBDR_DOOR(q)
Receive buffer descriptor ring doorbell.
uint64_t readq(volatile uint64_t *io_addr)
Read 64-bit qword from memory-mapped device.
#define TXNIC_PF_QS_RQ_BP_CFG_CQ_BP_ENA
#define TXNIC_QS_SQ_BASE(q)
Send queue base address.
static struct pci_device_id txnic_bgx_ids[]
BGX PCI device IDs.
static void netdev_tx_complete_next(struct net_device *netdev)
Complete network transmission.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
#define TXNIC_LINE_SIZE
Size of a cache line.
#define BGX_CMR_RX_STAT2
CMR receive statistics 2.
uint32_t type
Operating system type.
const char * name
Device name (for debugging)
#define BGX_CMR_RX_DMAC_CTL_MCST_MODE_ACCEPT
#define BGX_SPU_FEC_CONTROL
SPU forward error correction control.
#define BGX_SPU_AN_CONTROL
SPU autonegotation control.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
static int txnic_lmac_probe(struct txnic_lmac *lmac)
Probe logical MAC virtual NIC.
#define TXNIC_QS_CQ_CFG_QSIZE_256
static void txnic_lmac_reset(struct txnic_lmac *lmac)
Reset LMAC.
static void txnic_lmac_diag(struct txnic_lmac *lmac)
Show LMAC diagnostics (for debugging)
static int txnic_disable_sq(struct txnic *vnic)
Disable send queue.
#define TXNIC_QS_SQ_CFG_RESET
static struct pci_device_id txnic_pf_ids[]
NIC physical function PCI device IDs.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
#define TXNIC_NUM_BGX
Maximum number of BGX Ethernet interfaces (per node)
#define TXNIC_PF_CFG
Physical function configuration.
#define BGX_CMR_TX_STAT0
CMR transmit statistics 0.
static void txnic_destroy_sq(struct txnic *vnic)
Destroy send queue.
#define BGX_SPU_BR_STATUS2_LATCHED_BER
#define TXNIC_PF_INTF_BP_CFG_BP_ID(bp)
static void txnic_destroy_cq(struct txnic *vnic)
Destroy completion queue.
#define TXNIC_PF_RSSI_RQ_RQ_QS(qs)
unsigned long long uint64_t
#define BGX_SPU_INT_FEC_UNCORR
uint8_t errop
Error opcode.
#define BGX_SPU_STATUS1_FLT
#define BGX_SPU_BR_PMD_LD_REP
SPU local device status report.
#define TXNIC_CQE_TYPE_SEND
Send completion queue entry type.
#define TXNIC_PF_PKIND_CFG_MAXLEN_DISABLE
unsigned long vf_stride
Virtual function BAR stride.
static void txnic_poll_cq(struct txnic *vnic)
Poll completion queue.
struct txnic_rbdr_entry rbdre
Receive buffer descriptor ring entry.
#define cpu_to_le64(value)
#define BGX_SPU_AN_STATUS_XNP_STAT
#define BGX_CMR_TX_STAT7
CMR transmit statistics 7.
void netdev_tx_complete_next_err(struct net_device *netdev, int rc)
Complete network transmission.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
#define TXNIC_QS_SQ_CFG_QSIZE_1K
#define TXNIC_PF_PKIND_CFG_MINLEN_DISABLE
#define BGX_SPU_INT_AN_PAGE_RX
uint8_t mac[ETH_ALEN]
MAC address.
#define TXNIC_RQ_SIZE
Receive queue size.
struct txnic_sq sq
Send queue.
#define TXNIC_PF_BP_CFG_BP_POLL_DLY_DEFAULT
#define BGX_SPU_CONTROL1
SPU control 1.
#define BGX_SPU_BR_PMD_STATUS
SPU BASE-R link training status.
uint8_t send_status
Status.
#define TXNIC_SEND_HDR_FLAGS
Flags for send header subdescriptor.
#define BGX_CMR_TX_STAT6
CMR transmit statistics 6.
unsigned int cons
Consumer counter.
#define TXNIC_PF_TL2_CFG(tl)
Traffic limiter 2 configuration.
#define TXNIC_QS_CQ_CFG_RESET
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
unsigned int prod
Producer counter.
#define TXNIC_PF_LMAC_CFG
LMAC configuration.
#define TXNIC_QS_RBDR_CFG_RESET
#define BGX_SPU_INT_ERR_BLK
static void txnic_poll(struct txnic *vnic)
Poll virtual NIC.
#define BGX_SPU_INT_BIP_ERR
struct device dev
Generic device.
#define BGX_SPU_RESET_DELAY_MS
SPU reset delay.
#define BGX_SPU_AN_STATUS_PAGE_RX
#define TXNIC_PF_QS_RQ_CFG_RBDR_STRT_QS(qs)
#define TXNIC_PF_LMAC_CFG2
LMAC configuration 2.
#define TXNIC_SQ_STRIDE
Send queue stride.
#define TXNIC_PF_INTF_SEND_CFG(in)
Interface send configuration.
uint32_t lane_to_sds
Lane-to-SDS mapping.
#define TXNIC_PF_QS_SQ_CFG2_TL4(tl)
#define TXNIC_PF_TL4_CFG_SQ_QS(qs)
Dynamic memory allocation.
#define BGX_SPU_BR_STATUS1_BLK_LOCK
static int txnic_send(struct txnic *vnic, struct io_buffer *iobuf)
Send packet.
#define BGX_CMR_RX_DMAC_CTL_BCST_ACCEPT
#define TXNIC_SEND_GATHER_FLAGS
Flags for send gather subdescriptor.
#define TXNIC_SQE_SUBDESCS
Number of subdescriptors per send queue entry.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
#define BGX_SPU_BR_PMD_CONTROL_TRAIN_EN
#define list_del(list)
Delete an entry from a list.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define BGX_SPU_BR_STATUS2_LATCHED_LOCK
#define ENOMEM
Not enough space.
#define TXNIC_QS_CQ_BASE(q)
Completion queue base address.
static struct net_device_operations txnic_lmac_operations
Network device operations.
#define TXNIC_PF_QS_SQ_CFG2(q)
Send queue configuration 2.
#define TXNIC_TL2_IDX(vnic_idx)
Calculate traffic limiter 2 index.
#define BGX_SPU_INT_TRAINING_FAIL
static int txnic_create_cq(struct txnic *vnic)
Create completion queue.
struct txnic_pf * pf
Physical function (if known)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int txnic_open(struct txnic *vnic)
Open virtual NIC.
#define TXNIC_QS_SQ_STATUS(q)
Send queue status.
static int txnic_disable_cq(struct txnic *vnic)
Disable completion queue.
#define BGX_CMR_TX_STAT2
CMR transmit statistics 2.
#define TXNIC_QS_CQ_DOOR(q)
Completion queue doorbell.
#define TXNIC_PF_QS_RQ_CFG_RBDR_CONT_QS(qs)
unsigned int cons
Consumer counter.
#define BGX_SPU_INT_AN_LINK_GOOD
#define BGX_CMR_RX_DMAC_CAM(i)
CMR destination MAC CAM.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
#define BGX_SPU_BR_ALGN_STATUS
SPU BASE-R alignment status.
#define TXNIC_PF_MPI_CFG(ix)
Match parse index configuration.
unsigned int node
Node ID.
struct pci_device * pci
PCI device.
#define TXNIC_VNIC_IDX(bgx_idx, lmac_idx)
Calculate virtual NIC index.
#define TXNIC_PF_QS_CFG_ENA
#define TXNIC_CQE_RX_APAD_LEN(apad)
Applied padding.
#define TXNIC_QS_CQ_STATUS_QCOUNT(status)
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define TXNIC_CQE_TYPE_RX
Receive completion queue entry type.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define TXNIC_PF_PKIND_CFG_LENERR_EN
#define BGX_CMR_RX_STAT5
CMR receive statistics 5.
#define TXNIC_QS_SQ_STATUS_STOPPED
uint8_t intr
Interrupts enabled.
EFI_THUNDER_CONFIG_PROTOCOL_GET_LMAC_PROP GetLmacProp
#define TXNIC_PF_TL3_CHAN_CHAN(ch)
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
void * priv
Driver private data.
static LIST_HEAD(txnic_bgxs)
List of BGX Ethernet interfaces.
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
#define TXNIC_PF_LMAC(lm)
LMAC registers.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
#define TXNIC_PF_CHAN_RX_BP_CFG_ENA
#define TXNIC_PF_QS_RQ_DROP_CFG(q)
Receive queue drop configuration.
unsigned int cons
Consumer counter.
#define BGX_SPU_INT_SYNLOS
static void txnic_lmac_remove_all(struct txnic_pf *pf, struct txnic_bgx *bgx)
Remove all LMACs on a BGX Ethernet interface.
#define TXNIC_PF_INTF_SEND_CFG_BLOCK_BGX
static struct net_device * netdev
#define BGX_SPU_BR_STATUS1
SPU BASE-R status 1.
#define TXNIC_CQ_STRIDE
Completion queue stride.
uint16_t count
Number of entries.
static void txnic_bgx_mac(struct txnic_lmac *lmac)
Get MAC address.
#define TXNIC_QS_RBDR_BASE(q)
Receive buffer descriptor ring base address.
#define BGX_SPU_BR_PMD_LD_CUP
SPU local device coefficient update.
#define TXNIC_PF_LMAC_CREDIT
LMAC credit.
struct txnic_rq rq
Receive queue.
#define TXNIC_QS_RBDR_CFG_ENA
#define BGX_SPU_INT_AN_COMPLETE
void unregister_netdev(struct net_device *netdev)
Unregister network device.
static void txnic_bgx_lmac_init(struct txnic_bgx *bgx, unsigned int lmac_idx)
Initialise LMAC.
#define TXNIC_TL3_IDX(vnic_idx)
Calculate traffic limiter 3 index.
#define cpu_to_le32(value)
static void txnic_pf_remove(struct pci_device *pci)
Remove PCI device.
#define TXNIC_PF_QS_RQ_CFG_CQ_QS(qs)
#define TXNIC_QS_CQ_CFG(q)
Completion queue configuration.
#define TXNIC_PF_CHAN_RX_CFG
Channel receive configuration.
#define TXNIC_PF_QS_CFG_VNIC(vn)
A send completion queue entry.
#define BGX_CMR_RX_LMACS_LMACS_GET(lmacs)
#define TXNIC_PF_CHAN(ch)
Channel registers.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
#define BGX_SPU_STATUS2
SPU status 2.
struct list_head list
List of physical functions.
#define TXNIC_RQ_DISABLE_MAX_WAIT_MS
Maximum time to wait for a receive queue to disable.
void * zalloc(size_t size)
Allocate cleared memory.
#define BGX_CMR_CONFIG_DATA_PKT_RX_EN
#define BGX_CMR_GLOBAL_CONFIG
CMR global configuration.
#define TXNIC_PF_QS_RQ_BP_CFG_BPID(bp)
Cavium ThunderX Board Configuration.
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
static void txnic_free(struct txnic *vnic)
Free virtual NIC.
#define TXNIC_PF_MPI_CFG_VNIC(vn)
#define BGX_SPU_BR_PMD_LP_CUP
SPU link partner coefficient update.
#define TXNICCOL(x)
Debug colour for physical function and BGX messages.
#define BGX_LMAC(lm)
Per-LMAC registers.
#define TXNIC_PF_QS_RQ_BP_CFG(q)
Receive queue backpressure configuration.
struct txnic_bgx * bgx[TXNIC_NUM_BGX]
BGX Ethernet interfaces (if known)
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
static void txnic_lmac_remove(struct txnic_lmac *lmac)
Remove logical MAC virtual NIC.
static struct txnic * txnic_alloc(struct pci_device *pci, unsigned long membase)
Allocate virtual NIC.
#define BGX_CMR_RX_STAT6
CMR receive statistics 6.
EFI_REQUEST_PROTOCOL(EFI_THUNDER_CONFIG_PROTOCOL, &txcfg)
static int txnic_disable_rq(struct txnic *vnic)
Disable receive queue.
#define TXNIC_QS_CQ_TAIL(q)
Completion queue tail pointer.
#define ENODEV
No such device.
#define BGX_SPU_BR_STATUS2
SPU BASE-R status 2.
#define TXNIC_QS_SQ_HEAD(q)
Send queue head pointer.
#define BGX_CMR_RX_STAT1
CMR receive statistics 1.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
#define TXNIC_TL4_IDX(vnic_idx)
Calculate traffic limiter 4 index.
#define BGX_CMR_TX_STAT13
CMR transmit statistics 13.
#define BGX_CMR_CHAN_MSK_AND
CMR backpressure channel mask AND.
#define BGX_CMR_TX_STAT1
CMR transmit statistics 1.
unsigned long pciea_bar_size(struct pci_device *pci, unsigned int bei)
Find the size of a PCI Enhanced Allocation BAR equivalent.
#define TXNIC_PF_LMAC_CREDIT_CC_PACKET_CNT_DEFAULT
userptr_t cqe
Completion queue entries.
#define BGX_SPU_AN_STATUS_AN_COMPLETE
#define BGX_CMR_CONFIG_LMAC_TYPE_SET(ty)
#define TXNIC_CHAN_IDX(vnic_idx)
Calculate channel index.
#define TXNIC_RQES
Number of receive queue entries.
#define TXNIC_PF_INTF_SEND_CFG_BLOCK(bl)
#define TXNIC_RQ_FILL
Receive queue maximum fill level.
#define TXNIC_PF_BP_CFG
Backpressure configuration.
#define BGX_SPU_INT_DBG_SYNC
Cavium ThunderX Ethernet driver.
A PCI device ID list entry.
#define le16_to_cpu(value)
A BGX Ethernet interface.
#define BGX_CMR_TX_STAT9
CMR transmit statistics 9.
#define TXNIC_CQES
Number of completion queue entries.
static void txnic_bgx_spu_init(struct txnic_lmac *lmac)
Initialise Super PHY Unit (SPU)
userptr_t sqe
Send queue entries.
#define BGX_CMR_RX_STAT9
CMR receive statistics 9.
#define TXNIC_NUM_STEERING
Maximum number of steering rules (per BGX)
#define TXNIC_PF_TL2_CFG_RR_QUANTUM_DEFAULT
#define BGX_SPU_INT_FEC_CORR
struct txnic_lmac_type * type
LMAC type.
#define TXNIC_PF_CHAN_TX_CFG_BP_ENA
#define BGX_SPU_STATUS1
SPU status 1.
static struct xen_remove_from_physmap * remove
#define BGX_CMR_RX_LMACS_LMACS_SET(ct)
struct io_buffer * iobuf[TXNIC_RQ_FILL]
I/O buffers.
#define TXNIC_LMAC_IDX(vnic_idx)
Calculate logical MAC index.
#define TXNIC_PF_QS_RQ_CFG(q)
Receive queue configuration.
#define BGX_CMR_TX_STAT4
CMR transmit statistics 4.
txnic_lmac_types
LMAC types.
Network device operations.
struct txnic_send_header hdr
Send header descriptor.
static unsigned int txnic_address_node(uint64_t addr)
Calculate node ID.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
struct txnic_cqe_common common
Common fields.
#define TXNIC_PF_BP_CFG_BP_POLL_ENA
uint8_t count
Number of LMACs.
#define BGX_SPU_BR_PMD_CONTROL
SPU BASE-R link training control.
Network device management.
#define BGX_CMR_TX_STAT17
CMR transmit statistics 17.
#define BGX_CMR_RX_STAT10
CMR receive statistics 10.
struct txnic_lmac lmac[TXNIC_NUM_LMAC]
Logical MACs.
#define BGX_CMR_TX_STAT16
CMR transmit statistics 16.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
#define BGX_CMR_RX_STAT4
CMR receive statistics 4.
static void txnic_lmac_update_link(struct txnic_lmac *lmac)
Update LMAC link state.
unsigned int node
Node ID.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
#define iob_reserve(iobuf, len)
#define TXNIC_PF_LMAC_CFG_MIN_PKT_SIZE(sz)
#define TXNIC_QS_CQ_STATUS2(q)
Completion queue status 2.
#define TXNIC_SQ_FILL
Send queue maximum fill level.
#define TXNIC_QS_SQ_CFG(q)
Send queue configuration.
char name[NETDEV_NAME_LEN]
Name of this network device.
struct txnic_send_gather gather
Send gather descriptor.
#define BGX_SPU_CONTROL1_LO_PWR
#define TXNIC_QS_RBDR_CFG_LINES(sz)
#define TXNIC_PF_QS_RQ_BP_CFG_RBDR_BP_ENA
static __always_inline void ufree(userptr_t userptr)
Free external memory.
#define TXNIC_PF_INTF_BP_CFG_BP_ID_BGX
#define TXNIC_PF_LMAC_CFG_ADJUST_DEFAULT
static __always_inline userptr_t umalloc(size_t size)
Allocate external memory.
#define BGX_SPU_INT_BITLCKLS
#define TXNIC_QS_CQ_STATUS(q)
Completion queue status.
#define ENOBUFS
No buffer space available.
unsigned long pciea_bar_start(struct pci_device *pci, unsigned int bei)
Find the start of a PCI Enhanced Allocation BAR equivalent.
#define ENOTTY
Inappropriate I/O control operation.
static int txnic_create_rq(struct txnic *vnic)
Create receive queue.
int(* probe)(struct pci_device *pci)
Probe device.
#define TXNIC_QS_RBDR_STATUS0(q)
Receive buffer descriptor ring status 0.
unsigned long vf_membase
Virtual function BAR base.
#define BGX_SPU_INT_RX_LINK_UP
static void txnic_lmac_poll_link(struct txnic_lmac *lmac)
Poll LMAC link state.
static void txnic_lmac_poll(struct net_device *netdev)
Poll network device.
void * data
Start of data.
#define BGX_CMR_TX_STAT8
CMR transmit statistics 8.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
struct pci_device * pci
PCI device.
#define EIO
Input/output error.
#define TXNIC_PF_CHAN_TX_CFG
Channel transmit configuration.
#define BGX_CMR_CONFIG_LANE_TO_SDS(ls)
userptr_t rqe
Receive queue entries.
#define TXNIC_QS_RBDR_TAIL(q)
Receive buffer descriptor ring tail pointer.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
#define BGX_SPU_INT_RX_LINK_DOWN
static void txnic_diag(struct txnic *vnic)
Show virtual NIC diagnostics (for debugging)
#define cpu_to_le16(value)
static void txnic_complete_sqe(struct txnic *vnic, struct txnic_cqe_send *cqe)
Complete send queue entry.
struct txnic_cqe_send send
Send completion.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
#define cpu_to_be64(value)
static void txnic_close(struct txnic *vnic)
Close virtual NIC.
#define BGX_CMR_RX_STAT0
CMR receive statistics 0.
#define TXNIC_PF_MPI_CFG_RSSI_BASE(ix)
#define BGX_CMR_CONFIG_DATA_PKT_TX_EN
#define BGX_CMR_CONFIG_ENABLE
unsigned int idx
Virtual NIC index.
#define TXNIC_PF_LMAC_CREDIT_CC_ENABLE
static void txnic_refill_rq(struct txnic *vnic)
Refill receive queue.
#define TXNIC_SQES
Number of send queue entries.
#define TXNIC_SQ_SIZE
Send queue size.
uint16_t offset
Offset to command line.
#define BGX_SPU_AN_STATUS_LINK_STATUS
struct pci_driver txnic_pf_driver __pci_driver
NIC physical function PCI driver.
#define TXNIC_VF_BAR_SIZE
Virtual function BAR size.
#define TXNIC_PF_TL3_CHAN(tl)
Traffic limiter 3 channel mapping.
#define TXNIC_NUM_LMAC
Maximum number of Logical MACs (per BGX)
#define TXNIC_PF_TL3_CFG_RR_QUANTUM_DEFAULT
struct net_device * netdev
Network device.
#define BGX_SPU_INT_TRAINING_DONE
#define TXNIC_PF_CHAN_RX_BP_CFG
Channel receive backpressure configuration.
#define BGX_CMR_RX_LMACS
CMR receive logical MACs.
#define TXNIC_BGX_BAR_SIZE
BGX BAR size.
#define TXNIC_PF_QS_SQ_CFG(q)
Send queue configuration.
size_t max_pkt_len
Maximum packet length.
#define TXNIC_PF_QS(qs)
Queue set registers.
#define BGX_SPU_CONTROL1_RESET
int training
Link training is in use.
struct list_head list
List of BGX Ethernet interfaces.
#define BGX_CMR_TX_LMACS
CMR transmit logical MACs.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define TXNIC_PF_TL4_CFG(tl)
Traffic limiter 4 configuration.
static void txnic_destroy_rq(struct txnic *vnic)
Destroy receive queue.
struct txnic_cq cq
Completion queue.
#define BGX_CMR_GLOBAL_CONFIG_FCS_STRIP
#define TXNIC_PF_LMAC_CREDIT_CC_UNIT_CNT_DEFAULT
#define BGX_CMR_RX_STAT7
CMR receive statistics 7.
#define TXNIC_CQ_DISABLE_MAX_WAIT_MS
Maximum time to wait for a completion queue to disable.
#define TXNIC_QS_RBDR_CFG(q)
Receive buffer descriptor ring configuration.
A completion queue entry.
unsigned int prod
Producer counter.
union txnic_lmac_address mac
MAC address.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
#define ETIMEDOUT
Connection timed out.
static int txnic_lmac_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
#define TXNIC_QS_SQ_CFG_ENA
#define PCI_ROM(_vendor, _device, _name, _description, _data)
#define BGX_CMR_TX_STAT5
CMR transmit statistics 5.
static int txnic_pf_probe(struct pci_device *pci)
Probe PCI device.
#define TXNIC_CQ_SIZE
Completion queue size.
void writeq(uint64_t data, volatile uint64_t *io_addr)
Write 64-bit qword to memory-mapped device.
static int txnic_lmac_probe_all(struct txnic_pf *pf, struct txnic_bgx *bgx)
Probe all LMACs on a BGX Ethernet interface.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define TXNIC_PF_QS_CFG
Queue set configuration.
void eth_random_addr(void *hw_addr)
Generate random Ethernet address.
#define BGX_CMR_RX_DMAC_CTL
CMR destination MAC control.
struct txnic_bgx * bgx
Containing BGX Ethernet interface.
#define TXNIC_PF_QS_RQ_CFG_CACHING_ALL
static int txnic_bgx_detect(struct txnic_bgx *bgx)
Detect BGX Ethernet interface LMAC type.
#define BGX_CMR_TX_LMACS_LMACS_SET(ct)
#define TXNIC_RQ_STRIDE
Receive queue stride.
#define TXNIC_QS_RBDR_HEAD(q)
Receive buffer descriptor ring head pointer.
#define TXNIC_QS_CQ_CFG_ENA
#define BGX_SPU_AN_STATUS_LP_AN_ABLE
#define TXNIC_QS_SQ_TAIL(q)
Send queue tail pointer.
#define BGX_SPU_INT_ALGNLOS
struct txnic_cqe_rx rx
Receive completion.
void * memset(void *dest, int character, size_t len) __nonnull
#define TXNIC_SQ_STOP_MAX_WAIT_MS
Maximum time to wait for a send queue to stop.
#define BGX_CMR_TX_STAT11
CMR transmit statistics 11.
static unsigned int txnic_address_bgx(uint64_t addr)
Calculate BGX Ethernet interface index.
#define BGX_CMR_RX_STAT8
CMR receive statistics 8.