/** * struct nfp_net_tx_ring - TX ring structure * @r_vec: Back pointer to ring vector structure * @idx: Ring index from Linux's perspective * @data_pending: number of bytes added to current block (NFDK only) * @qcp_q: Pointer to base of the QCP TX queue * @txrwb: TX pointer write back area * @cnt: Size of the queue in number of descriptors * @wr_p: TX ring write pointer (free running) * @rd_p: TX ring read pointer (free running) * @qcp_rd_p: Local copy of QCP TX queue read pointer * @wr_ptr_add: Accumulated number of buffers to add to QCP write pointer * (used for .xmit_more delayed kick) * @txbufs: Array of transmitted TX buffers, to free on transmit (NFD3) * @ktxbufs: Array of transmitted TX buffers, to free on transmit (NFDK) * @txds: Virtual address of TX ring in host memory (NFD3) * @ktxds: Virtual address of TX ring in host memory (NFDK) * * @qcidx: Queue Controller Peripheral (QCP) queue index for the TX queue * @dma: DMA address of the TX ring * @size: Size, in bytes, of the TX ring (needed to free) * @is_xdp: Is this a XDP TX ring?
*/ struct nfp_net_tx_ring { struct nfp_net_r_vector *r_vec;
struct nfp_net_rx_desc { union { struct {
__le16 dma_addr_hi; /* High bits of the buf address */
u8 reserved; /* Must be zero */
u8 meta_len_dd; /* Must be zero */
__le32 dma_addr_lo; /* Low bits of the buffer address */
} __packed fld;
struct {
__le16 data_len; /* Length of the frame + meta data */
u8 reserved;
u8 meta_len_dd; /* Length of meta data prepended + * descriptor done flag.
*/
__le16 flags; /* RX flags. See @PCIE_DESC_RX_* */
__le16 vlan; /* VLAN if stripped */
} __packed rxd;
/** * struct nfp_net_rx_ring - RX ring structure * @r_vec: Back pointer to ring vector structure * @cnt: Size of the queue in number of descriptors * @wr_p: FL/RX ring write pointer (free running) * @rd_p: FL/RX ring read pointer (free running) * @idx: Ring index from Linux's perspective * @fl_qcidx: Queue Controller Peripheral (QCP) queue index for the freelist * @qcp_fl: Pointer to base of the QCP freelist queue * @rxbufs: Array of transmitted FL/RX buffers * @xsk_rxbufs: Array of transmitted FL/RX buffers (for AF_XDP) * @rxds: Virtual address of FL/RX ring in host memory * @xdp_rxq: RX-ring info avail for XDP * @dma: DMA address of the FL/RX ring * @size: Size, in bytes, of the FL/RX ring (needed to free)
*/ struct nfp_net_rx_ring { struct nfp_net_r_vector *r_vec;
/** * struct nfp_net_r_vector - Per ring interrupt vector configuration * @nfp_net: Backpointer to nfp_net structure * @napi: NAPI structure for this ring vec * @tasklet: ctrl vNIC, tasklet for servicing the r_vec * @queue: ctrl vNIC, send queue * @lock: ctrl vNIC, r_vec lock protects @queue * @tx_ring: Pointer to TX ring * @rx_ring: Pointer to RX ring * @xdp_ring: Pointer to an extra TX ring for XDP * @xsk_pool: XSK buffer pool active on vector queue pair (for AF_XDP) * @irq_entry: MSI-X table entry (use for talking to the device) * @event_ctr: Number of interrupt * @rx_dim: Dynamic interrupt moderation structure for RX * @tx_dim: Dynamic interrupt moderation structure for TX * @rx_sync: Seqlock for atomic updates of RX stats * @rx_pkts: Number of received packets * @rx_bytes: Number of received bytes * @rx_drops: Number of packets dropped on RX due to lack of resources * @hw_csum_rx_ok: Counter of packets where the HW checksum was OK * @hw_csum_rx_inner_ok: Counter of packets where the inner HW checksum was OK * @hw_csum_rx_complete: Counter of packets with CHECKSUM_COMPLETE reported * @hw_csum_rx_error: Counter of packets with bad checksums * @hw_tls_rx: Number of packets with TLS decrypted by hardware * @tx_sync: Seqlock for atomic updates of TX stats * @tx_pkts: Number of Transmitted packets * @tx_bytes: Number of Transmitted bytes * @hw_csum_tx: Counter of packets with TX checksum offload requested * @hw_csum_tx_inner: Counter of inner TX checksum offload requests * @tx_gather: Counter of packets with Gather DMA * @tx_lso: Counter of LSO packets sent * @hw_tls_tx: Counter of TLS packets sent with crypto offloaded to HW * @tls_tx_fallback: Counter of TLS packets sent which had to be encrypted * by the fallback path because packets came out of order * @tls_tx_no_fallback: Counter of TLS packets not sent because the fallback * path could not encrypt them * @tx_errors: How many TX errors were encountered * @tx_busy: How often was TX busy (no space)? * @rx_replace_buf_alloc_fail: Counter of RX buffer allocation failures * @irq_vector: Interrupt vector number (use for talking to the OS) * @handler: Interrupt handler for this ring vector * @name: Name of the interrupt vector * @affinity_mask: SMP affinity mask for this vector * * This structure ties RX and TX rings to interrupt vectors and a NAPI * context. This currently only supports one RX and TX ring per * interrupt vector but might be extended in the future to allow * association of multiple rings per vector.
*/ struct nfp_net_r_vector { struct nfp_net *nfp_net; union { struct napi_struct napi; struct { struct tasklet_struct tasklet; struct sk_buff_head queue;
spinlock_t lock;
};
};
/** * struct nfp_net_dp - NFP network device datapath data structure * @dev: Backpointer to struct device * @netdev: Backpointer to net_device structure * @is_vf: Is the driver attached to a VF? * @chained_metadata_format: Firemware will use new metadata format * @ktls_tx: Is kTLS TX enabled? * @rx_dma_dir: Mapping direction for RX buffers * @rx_dma_off: Offset at which DMA packets (for XDP headroom) * @rx_offset: Offset in the RX buffers where packet data starts * @ctrl: Local copy of the control register/word. * @ctrl_w1: Local copy of the control register/word1. * @fl_bufsz: Currently configured size of the freelist buffers * @xdp_prog: Installed XDP program * @tx_rings: Array of pre-allocated TX ring structures * @rx_rings: Array of pre-allocated RX ring structures * @ctrl_bar: Pointer to mapped control BAR * * @ops: Callbacks and parameters for this vNIC's NFD version * @txrwb: TX pointer write back area (indexed by queue id) * @txrwb_dma: TX pointer write back area DMA address * @txd_cnt: Size of the TX ring in number of min size packets * @rxd_cnt: Size of the RX ring in number of min size packets * @num_r_vecs: Number of used ring vectors * @num_tx_rings: Currently configured number of TX rings * @num_stack_tx_rings: Number of TX rings used by the stack (not XDP) * @num_rx_rings: Currently configured number of RX rings * @mtu: Device MTU * @xsk_pools: XSK buffer pools, @max_r_vecs in size (for AF_XDP).
*/ struct nfp_net_dp { struct device *dev; struct net_device *netdev;
/** * struct nfp_net - NFP network device structure * @dp: Datapath structure * @dev_info: NFP ASIC params * @id: vNIC id within the PF (0 for VFs) * @fw_ver: Firmware version * @cap: Capabilities advertised by the Firmware * @cap_w1: Extended capabilities word advertised by the Firmware * @max_mtu: Maximum support MTU advertised by the Firmware * @rss_hfunc: RSS selected hash function * @rss_cfg: RSS configuration * @rss_key: RSS secret key * @rss_itbl: RSS indirection table * @xdp: Information about the driver XDP program * @xdp_hw: Information about the HW XDP program * @max_r_vecs: Number of allocated interrupt vectors for RX/TX * @max_tx_rings: Maximum number of TX rings supported by the Firmware * @max_rx_rings: Maximum number of RX rings supported by the Firmware * @stride_rx: Queue controller RX queue spacing * @stride_tx: Queue controller TX queue spacing * @r_vecs: Pre-allocated array of ring vectors * @irq_entries: Pre-allocated array of MSI-X entries * @lsc_handler: Handler for Link State Change interrupt * @lsc_name: Name for Link State Change interrupt * @exn_handler: Handler for Exception interrupt * @exn_name: Name for Exception interrupt * @shared_handler: Handler for shared interrupts * @shared_name: Name for shared interrupt * @reconfig_lock: Protects @reconfig_posted, @reconfig_timer_active, * @reconfig_sync_present and HW reconfiguration request * regs/machinery from async requests (sync must take * @bar_lock) * @reconfig_posted: Pending reconfig bits coming from async sources * @reconfig_timer_active: Timer for reading reconfiguration results is pending * @reconfig_sync_present: Some thread is performing synchronous reconfig * @reconfig_timer: Timer for async reading of reconfig results * @reconfig_in_progress_update: Update FW is processing now (debug only) * @bar_lock: vNIC config BAR access lock, protects: update, * mailbox area, crypto TLV * @link_up: Is the link up? * @link_status_lock: Protects @link_* and ensures atomicity with BAR reading * @rx_coalesce_adapt_on: Is RX interrupt moderation adaptive? * @tx_coalesce_adapt_on: Is TX interrupt moderation adaptive? * @rx_coalesce_usecs: RX interrupt moderation usecs delay parameter * @rx_coalesce_max_frames: RX interrupt moderation frame count parameter * @tx_coalesce_usecs: TX interrupt moderation usecs delay parameter * @tx_coalesce_max_frames: TX interrupt moderation frame count parameter * @qcp_cfg: Pointer to QCP queue used for configuration notification * @tx_bar: Pointer to mapped TX queues * @rx_bar: Pointer to mapped FL/RX queues * @xa_ipsec: IPsec xarray SA data * @tlv_caps: Parsed TLV capabilities * @ktls_tx_conn_cnt: Number of offloaded kTLS TX connections * @ktls_rx_conn_cnt: Number of offloaded kTLS RX connections * @ktls_conn_id_gen: Trivial generator for kTLS connection ids (for TX) * @ktls_no_space: Counter of firmware rejecting kTLS connection due to * lack of space * @ktls_rx_resync_req: Counter of TLS RX resync requested * @ktls_rx_resync_ign: Counter of TLS RX resync requests ignored * @ktls_rx_resync_sent: Counter of TLS RX resync completed * @mbox_cmsg: Common Control Message via vNIC mailbox state * @mbox_cmsg.queue: CCM mbox queue of pending messages * @mbox_cmsg.wq: CCM mbox wait queue of waiting processes * @mbox_cmsg.workq: CCM mbox work queue for @wait_work and @runq_work * @mbox_cmsg.wait_work: CCM mbox posted msg reconfig wait work * @mbox_cmsg.runq_work: CCM mbox posted msg queue runner work * @mbox_cmsg.tag: CCM mbox message tag allocator * @debugfs_dir: Device directory in debugfs * @vnic_list: Entry on device vNIC list * @pdev: Backpointer to PCI device * @app: APP handle if available * @vnic_no_name: For non-port PF vNIC make ndo_get_phys_port_name return * -EOPNOTSUPP to keep backwards compatibility (set by app) * @port: Pointer to nfp_port structure if vNIC is a port * @mbox_amsg: Asynchronously processed message via mailbox * @mbox_amsg.lock: Protect message list * @mbox_amsg.list: List of message to process * @mbox_amsg.work: Work to process message asynchronously * @fs: Flow steering * @fs.count: Flow count * @fs.list: List of flows * @app_priv: APP private data for this vNIC
*/ struct nfp_net { struct nfp_net_dp dp;
/* Flush posted PCI writes by reading something without side effects */ staticinlinevoid nn_pci_flush(struct nfp_net *nn)
{
nn_readl(nn, NFP_NET_CFG_VERSION);
}
/* Queue Controller Peripheral access functions and definitions. * * Some of the BARs of the NFP are mapped to portions of the Queue * Controller Peripheral (QCP) address space on the NFP. A QCP queue * has a read and a write pointer (as well as a size and flags, * indicating overflow etc). The QCP offers a number of different * operation on queue pointers, but here we only offer function to * either add to a pointer or to read the pointer value.
*/ #define NFP_QCP_QUEUE_ADDR_SZ 0x800 #define NFP_QCP_QUEUE_OFF(_x) ((_x) * NFP_QCP_QUEUE_ADDR_SZ) #define NFP_QCP_QUEUE_ADD_RPTR 0x0000 #define NFP_QCP_QUEUE_ADD_WPTR 0x0004 #define NFP_QCP_QUEUE_STS_LO 0x0008 #define NFP_QCP_QUEUE_STS_LO_READPTR_mask 0x3ffff #define NFP_QCP_QUEUE_STS_HI 0x000c #define NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask 0x3ffff
/* nfp_qcp_ptr - Read or Write Pointer of a queue */ enum nfp_qcp_ptr {
NFP_QCP_READ_PTR = 0,
NFP_QCP_WRITE_PTR
};
/** * nfp_qcp_rd_ptr_add() - Add the value to the read pointer of a queue * * @q: Base address for queue structure * @val: Value to add to the queue pointer
*/ staticinlinevoid nfp_qcp_rd_ptr_add(u8 __iomem *q, u32 val)
{
writel(val, q + NFP_QCP_QUEUE_ADD_RPTR);
}
/** * nfp_qcp_wr_ptr_add() - Add the value to the write pointer of a queue * * @q: Base address for queue structure * @val: Value to add to the queue pointer
*/ staticinlinevoid nfp_qcp_wr_ptr_add(u8 __iomem *q, u32 val)
{
writel(val, q + NFP_QCP_QUEUE_ADD_WPTR);
}
if (ptr == NFP_QCP_READ_PTR)
off = NFP_QCP_QUEUE_STS_LO; else
off = NFP_QCP_QUEUE_STS_HI;
val = readl(q + off);
if (ptr == NFP_QCP_READ_PTR) return val & NFP_QCP_QUEUE_STS_LO_READPTR_mask; else return val & NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask;
}
/** * nfp_qcp_rd_ptr_read() - Read the current read pointer value for a queue * @q: Base address for queue structure * * Return: Value read.
*/ staticinline u32 nfp_qcp_rd_ptr_read(u8 __iomem *q)
{ return _nfp_qcp_read(q, NFP_QCP_READ_PTR);
}
/** * nfp_qcp_wr_ptr_read() - Read the current write pointer value for a queue * @q: Base address for queue structure * * Return: Value read.
*/ staticinline u32 nfp_qcp_wr_ptr_read(u8 __iomem *q)
{ return _nfp_qcp_read(q, NFP_QCP_WRITE_PTR);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.