Lines Matching +full:queue +full:- +full:rx

1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2 /* Copyright (C) 2015-2018 Netronome Systems, Inc. */
21 #include <linux/io-64-nonatomic-hi-lo.h>
32 if (__nn->dp.netdev) \
33 netdev_printk(lvl, __nn->dp.netdev, fmt, ## args); \
35 dev_printk(lvl, __nn->dp.dev, "ctrl: " fmt, ## args); \
48 if (__dp->netdev) \
49 netdev_warn(__dp->netdev, fmt, ## args); \
51 dev_warn(__dp->dev, fmt, ## args); \
78 /* Queue/Ring definitions */
80 #define NFP_NET_MAX_RX_RINGS 64 /* Max. # of Rx rings per device */
86 #define NFP_NET_RX_DESCS_DEFAULT 4096 /* Default # of Rx descs per ring */
118 #define D_IDX(ring, idx) ((idx) & ((ring)->cnt - 1))
120 /* Convenience macro for writing dma address into RX/TX descriptors */
126 __d->dma_addr_lo = cpu_to_le32(lower_32_bits(__addr)); \
127 __d->dma_addr_hi = upper_32_bits(__addr) & 0xff; \
135 __d->dma_addr_hi = cpu_to_le16(upper_32_bits(__addr)); \
136 __d->dma_addr_lo = cpu_to_le32(lower_32_bits(__addr)); \
140 * struct nfp_net_tx_ring - TX ring structure
144 * @qcp_q: Pointer to base of the QCP TX queue
146 * @cnt: Size of the queue in number of descriptors
149 * @qcp_rd_p: Local copy of QCP TX queue read pointer
157 * @qcidx: Queue Controller Peripheral (QCP) queue index for the TX queue
194 /* RX and freelist descriptor format */
199 /* Flags in the RX descriptor */
245 __le16 flags; /* RX flags. See @PCIE_DESC_RX_* */
253 #define NFP_NET_META_FIELD_MASK GENMASK(NFP_NET_META_FIELD_SIZE - 1, 0)
281 * struct nfp_net_rx_buf - software RX buffer descriptor
291 * struct nfp_net_xsk_rx_buf - software RX XSK buffer descriptor
301 * struct nfp_net_rx_ring - RX ring structure
303 * @cnt: Size of the queue in number of descriptors
304 * @wr_p: FL/RX ring write pointer (free running)
305 * @rd_p: FL/RX ring read pointer (free running)
307 * @fl_qcidx: Queue Controller Peripheral (QCP) queue index for the freelist
308 * @qcp_fl: Pointer to base of the QCP freelist queue
309 * @rxbufs: Array of transmitted FL/RX buffers
310 * @xsk_rxbufs: Array of transmitted FL/RX buffers (for AF_XDP)
311 * @rxds: Virtual address of FL/RX ring in host memory
312 * @xdp_rxq: RX-ring info avail for XDP
313 * @dma: DMA address of the FL/RX ring
314 * @size: Size, in bytes, of the FL/RX ring (needed to free)
339 * struct nfp_net_r_vector - Per ring interrupt vector configuration
343 * @queue: ctrl vNIC, send queue
344 * @lock: ctrl vNIC, r_vec lock protects @queue
346 * @rx_ring: Pointer to RX ring
348 * @xsk_pool: XSK buffer pool active on vector queue pair (for AF_XDP)
349 * @irq_entry: MSI-X table entry (use for talking to the device)
351 * @rx_dim: Dynamic interrupt moderation structure for RX
353 * @rx_sync: Seqlock for atomic updates of RX stats
356 * @rx_drops: Number of packets dropped on RX due to lack of resources
376 * @rx_replace_buf_alloc_fail: Counter of RX buffer allocation failures
382 * This structure ties RX and TX rings to interrupt vectors and a NAPI
383 * context. This currently only supports one RX and TX ring per
393 struct sk_buff_head queue; member
460 return fw_ver->extend == extend && in nfp_net_fw_ver_eq()
461 fw_ver->class == class && in nfp_net_fw_ver_eq()
462 fw_ver->major == major && in nfp_net_fw_ver_eq()
463 fw_ver->minor == minor; in nfp_net_fw_ver_eq()
472 * struct nfp_net_dp - NFP network device datapath data structure
478 * @rx_dma_dir: Mapping direction for RX buffers
480 * @rx_offset: Offset in the RX buffers where packet data starts
485 * @tx_rings: Array of pre-allocated TX ring structures
486 * @rx_rings: Array of pre-allocated RX ring structures
490 * @txrwb: TX pointer write back area (indexed by queue id)
493 * @rxd_cnt: Size of the RX ring in number of min size packets
497 * @num_rx_rings: Currently configured number of RX rings
547 * struct nfp_net - NFP network device structure
561 * @max_r_vecs: Number of allocated interrupt vectors for RX/TX
563 * @max_rx_rings: Maximum number of RX rings supported by the Firmware
564 * @stride_rx: Queue controller RX queue spacing
565 * @stride_tx: Queue controller TX queue spacing
566 * @r_vecs: Pre-allocated array of ring vectors
567 * @irq_entries: Pre-allocated array of MSI-X entries
587 * @rx_coalesce_adapt_on: Is RX interrupt moderation adaptive?
589 * @rx_coalesce_usecs: RX interrupt moderation usecs delay parameter
590 * @rx_coalesce_max_frames: RX interrupt moderation frame count parameter
593 * @qcp_cfg: Pointer to QCP queue used for configuration notification
595 * @rx_bar: Pointer to mapped FL/RX queues
599 * @ktls_rx_conn_cnt: Number of offloaded kTLS RX connections
603 * @ktls_rx_resync_req: Counter of TLS RX resync requested
604 * @ktls_rx_resync_ign: Counter of TLS RX resync requests ignored
605 * @ktls_rx_resync_sent: Counter of TLS RX resync completed
607 * @mbox_cmsg.queue: CCM mbox queue of pending messages
608 * @mbox_cmsg.wq: CCM mbox wait queue of waiting processes
609 * @mbox_cmsg.workq: CCM mbox work queue for @wait_work and @runq_work
611 * @mbox_cmsg.runq_work: CCM mbox posted msg queue runner work
617 * @vnic_no_name: For non-port PF vNIC make ndo_get_phys_port_name return
618 * -EOPNOTSUPP to keep backwards compatibility (set by app)
709 struct sk_buff_head queue; member
782 return readb(nn->dp.ctrl_bar + off); in nn_readb()
787 writeb(val, nn->dp.ctrl_bar + off); in nn_writeb()
792 return readw(nn->dp.ctrl_bar + off); in nn_readw()
797 writew(val, nn->dp.ctrl_bar + off); in nn_writew()
802 return readl(nn->dp.ctrl_bar + off); in nn_readl()
807 writel(val, nn->dp.ctrl_bar + off); in nn_writel()
812 return readq(nn->dp.ctrl_bar + off); in nn_readq()
817 writeq(val, nn->dp.ctrl_bar + off); in nn_writeq()
826 /* Queue Controller Peripheral access functions and definitions.
828 * Some of the BARs of the NFP are mapped to portions of the Queue
829 * Controller Peripheral (QCP) address space on the NFP. A QCP queue
832 * operation on queue pointers, but here we only offer function to
844 /* nfp_qcp_ptr - Read or Write Pointer of a queue */
851 * nfp_qcp_rd_ptr_add() - Add the value to the read pointer of a queue
853 * @q: Base address for queue structure
854 * @val: Value to add to the queue pointer
862 * nfp_qcp_wr_ptr_add() - Add the value to the write pointer of a queue
864 * @q: Base address for queue structure
865 * @val: Value to add to the queue pointer
891 * nfp_qcp_rd_ptr_read() - Read the current read pointer value for a queue
892 * @q: Base address for queue structure
902 * nfp_qcp_wr_ptr_read() - Read the current write pointer value for a queue
903 * @q: Base address for queue structure
912 u32 nfp_qcp_queue_offset(const struct nfp_dev_info *dev_info, u16 queue);
916 WARN_ON_ONCE(!nn->dp.netdev && nn->port); in nfp_net_is_data_vnic()
917 return !!nn->dp.netdev; in nfp_net_is_data_vnic()
922 return nn->dp.ctrl & NFP_NET_CFG_CTRL_ENABLE; in nfp_net_running()
927 return nn->dp.netdev ? nn->dp.netdev->name : "ctrl"; in nfp_net_name()
931 __acquires(&nn->r_vecs[0].lock) in nfp_ctrl_lock()
933 spin_lock_bh(&nn->r_vecs[0].lock); in nfp_ctrl_lock()
937 __releases(&nn->r_vecs[0].lock) in nfp_ctrl_unlock()
939 spin_unlock_bh(&nn->r_vecs[0].lock); in nfp_ctrl_unlock()
944 down(&nn->bar_lock); in nn_ctrl_bar_lock()
949 return !down_trylock(&nn->bar_lock); in nn_ctrl_bar_trylock()
954 up(&nn->bar_lock); in nn_ctrl_bar_unlock()
965 return netdev->netdev_ops == &nfp_nfd3_netdev_ops || in nfp_netdev_is_nfp_net()
966 netdev->netdev_ops == &nfp_nfdk_netdev_ops; in nfp_netdev_is_nfp_net()
971 if (param >= ((1 << 16) - 1)) in nfp_net_coalesce_para_check()
972 return -EINVAL; in nfp_net_coalesce_para_check()