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); \
81 /* Queue/Ring definitions */
83 #define NFP_NET_MAX_RX_RINGS 64 /* Max. # of Rx rings per device */
89 #define NFP_NET_MIN_RX_DESCS 256 /* Min. # of Rx descs per ring */
91 #define NFP_NET_MAX_RX_DESCS (256 * 1024) /* Max. # of Rx descs per ring */
94 #define NFP_NET_RX_DESCS_DEFAULT 4096 /* Default # of Rx descs per ring */
114 #define D_IDX(ring, idx) ((idx) & ((ring)->cnt - 1))
116 /* Convenience macro for writing dma address into RX/TX descriptors */
122 __d->dma_addr_lo = cpu_to_le32(lower_32_bits(__addr)); \
123 __d->dma_addr_hi = upper_32_bits(__addr) & 0xff; \
170 * struct nfp_net_tx_buf - software TX buffer descriptor
174 * @fidx: Fragment index (-1 for the head and [0..nr_frags-1] for frags)
177 * Will be 1 for all non-TSO packets.
179 * on the head's buffer). Equal to skb->len for non-TSO packets.
193 * struct nfp_net_tx_ring - TX ring structure
196 * @qcidx: Queue Controller Peripheral (QCP) queue index for the TX queue
197 * @qcp_q: Pointer to base of the QCP TX queue
198 * @cnt: Size of the queue in number of descriptors
201 * @qcp_rd_p: Local copy of QCP TX queue read pointer
232 /* RX and freelist descriptor format */
237 /* Flags in the RX descriptor */
283 __le16 flags; /* RX flags. See @PCIE_DESC_RX_* */
291 #define NFP_NET_META_FIELD_MASK GENMASK(NFP_NET_META_FIELD_SIZE - 1, 0)
308 * struct nfp_net_rx_buf - software RX buffer descriptor
318 * struct nfp_net_rx_ring - RX ring structure
320 * @cnt: Size of the queue in number of descriptors
321 * @wr_p: FL/RX ring write pointer (free running)
322 * @rd_p: FL/RX ring read pointer (free running)
324 * @fl_qcidx: Queue Controller Peripheral (QCP) queue index for the freelist
325 * @qcp_fl: Pointer to base of the QCP freelist queue
326 * @rxbufs: Array of transmitted FL/RX buffers
327 * @rxds: Virtual address of FL/RX ring in host memory
328 * @xdp_rxq: RX-ring info avail for XDP
329 * @dma: DMA address of the FL/RX ring
330 * @size: Size, in bytes, of the FL/RX ring (needed to free)
354 * struct nfp_net_r_vector - Per ring interrupt vector configuration
358 * @queue: ctrl vNIC, send queue
359 * @lock: ctrl vNIC, r_vec lock protects @queue
361 * @rx_ring: Pointer to RX ring
363 * @irq_entry: MSI-X table entry (use for talking to the device)
365 * @rx_dim: Dynamic interrupt moderation structure for RX
367 * @rx_sync: Seqlock for atomic updates of RX stats
370 * @rx_drops: Number of packets dropped on RX due to lack of resources
390 * @rx_replace_buf_alloc_fail: Counter of RX buffer allocation failures
396 * This structure ties RX and TX rings to interrupt vectors and a NAPI
397 * context. This currently only supports one RX and TX ring per
407 struct sk_buff_head queue; member
469 return fw_ver->resv == resv && in nfp_net_fw_ver_eq()
470 fw_ver->class == class && in nfp_net_fw_ver_eq()
471 fw_ver->major == major && in nfp_net_fw_ver_eq()
472 fw_ver->minor == minor; in nfp_net_fw_ver_eq()
481 * struct nfp_net_dp - NFP network device datapath data structure
487 * @rx_dma_dir: Mapping direction for RX buffers
489 * @rx_offset: Offset in the RX buffers where packet data starts
493 * @tx_rings: Array of pre-allocated TX ring structures
494 * @rx_rings: Array of pre-allocated RX ring structures
498 * @rxd_cnt: Size of the RX ring in number of descriptors
502 * @num_rx_rings: Currently configured number of RX rings
543 * struct nfp_net - NFP network device structure
555 * @max_r_vecs: Number of allocated interrupt vectors for RX/TX
557 * @max_rx_rings: Maximum number of RX rings supported by the Firmware
558 * @stride_rx: Queue controller RX queue spacing
559 * @stride_tx: Queue controller TX queue spacing
560 * @r_vecs: Pre-allocated array of ring vectors
561 * @irq_entries: Pre-allocated array of MSI-X entries
582 * @rx_coalesce_adapt_on: Is RX interrupt moderation adaptive?
584 * @rx_coalesce_usecs: RX interrupt moderation usecs delay parameter
585 * @rx_coalesce_max_frames: RX interrupt moderation frame count parameter
588 * @qcp_cfg: Pointer to QCP queue used for configuration notification
590 * @rx_bar: Pointer to mapped FL/RX queues
593 * @ktls_rx_conn_cnt: Number of offloaded kTLS RX connections
597 * @ktls_rx_resync_req: Counter of TLS RX resync requested
598 * @ktls_rx_resync_ign: Counter of TLS RX resync requests ignored
599 * @ktls_rx_resync_sent: Counter of TLS RX resync completed
601 * @mbox_cmsg.queue: CCM mbox queue of pending messages
602 * @mbox_cmsg.wq: CCM mbox wait queue of waiting processes
603 * @mbox_cmsg.workq: CCM mbox work queue for @wait_work and @runq_work
605 * @mbox_cmsg.runq_work: CCM mbox posted msg queue runner work
611 * @vnic_no_name: For non-port PF vNIC make ndo_get_phys_port_name return
612 * -EOPNOTSUPP to keep backwards compatibility (set by app)
692 struct sk_buff_head queue; member
719 return readb(nn->dp.ctrl_bar + off); in nn_readb()
724 writeb(val, nn->dp.ctrl_bar + off); in nn_writeb()
729 return readw(nn->dp.ctrl_bar + off); in nn_readw()
734 writew(val, nn->dp.ctrl_bar + off); in nn_writew()
739 return readl(nn->dp.ctrl_bar + off); in nn_readl()
744 writel(val, nn->dp.ctrl_bar + off); in nn_writel()
749 return readq(nn->dp.ctrl_bar + off); in nn_readq()
754 writeq(val, nn->dp.ctrl_bar + off); in nn_writeq()
763 /* Queue Controller Peripheral access functions and definitions.
765 * Some of the BARs of the NFP are mapped to portions of the Queue
766 * Controller Peripheral (QCP) address space on the NFP. A QCP queue
769 * operation on queue pointers, but here we only offer function to
785 /* nfp_qcp_ptr - Read or Write Pointer of a queue */
792 * one can add to a queue and that value is either 0x3f or 0x7f. We
809 val -= NFP_QCP_MAX_ADD; in _nfp_qcp_ptr_add()
816 * nfp_qcp_rd_ptr_add() - Add the value to the read pointer of a queue
818 * @q: Base address for queue structure
819 * @val: Value to add to the queue pointer
829 * nfp_qcp_wr_ptr_add() - Add the value to the write pointer of a queue
831 * @q: Base address for queue structure
832 * @val: Value to add to the queue pointer
860 * nfp_qcp_rd_ptr_read() - Read the current read pointer value for a queue
861 * @q: Base address for queue structure
871 * nfp_qcp_wr_ptr_read() - Read the current write pointer value for a queue
872 * @q: Base address for queue structure
883 WARN_ON_ONCE(!nn->dp.netdev && nn->port); in nfp_net_is_data_vnic()
884 return !!nn->dp.netdev; in nfp_net_is_data_vnic()
889 return nn->dp.ctrl & NFP_NET_CFG_CTRL_ENABLE; in nfp_net_running()
894 return nn->dp.netdev ? nn->dp.netdev->name : "ctrl"; in nfp_net_name()
898 __acquires(&nn->r_vecs[0].lock) in nfp_ctrl_lock()
900 spin_lock_bh(&nn->r_vecs[0].lock); in nfp_ctrl_lock()
904 __releases(&nn->r_vecs[0].lock) in nfp_ctrl_unlock()
906 spin_unlock_bh(&nn->r_vecs[0].lock); in nfp_ctrl_unlock()
911 down(&nn->bar_lock); in nn_ctrl_bar_lock()
916 return !down_trylock(&nn->bar_lock); in nn_ctrl_bar_trylock()
921 up(&nn->bar_lock); in nn_ctrl_bar_unlock()
931 return netdev->netdev_ops == &nfp_net_netdev_ops; in nfp_netdev_is_nfp_net()
936 if ((usecs >= ((1 << 16) - 1)) || (pkts >= ((1 << 16) - 1))) in nfp_net_coalesce_para_check()
937 return -EINVAL; in nfp_net_coalesce_para_check()