Lines Matching +full:rx +full:- +full:ctrl
1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2 /* Copyright (C) 2015-2018 Netronome Systems, Inc. */
20 #include <linux/io-64-nonatomic-hi-lo.h>
31 if (__nn->dp.netdev) \
32 netdev_printk(lvl, __nn->dp.netdev, fmt, ## args); \
34 dev_printk(lvl, __nn->dp.dev, "ctrl: " fmt, ## args); \
47 if (__dp->netdev) \
48 netdev_warn(__dp->netdev, fmt, ## args); \
50 dev_warn(__dp->dev, fmt, ## args); \
82 #define NFP_NET_MAX_RX_RINGS 64 /* Max. # of Rx rings per device */
88 #define NFP_NET_MIN_RX_DESCS 256 /* Min. # of Rx descs per ring */
90 #define NFP_NET_MAX_RX_DESCS (256 * 1024) /* Max. # of Rx descs per ring */
93 #define NFP_NET_RX_DESCS_DEFAULT 4096 /* Default # of Rx descs per ring */
113 #define D_IDX(ring, idx) ((idx) & ((ring)->cnt - 1))
115 /* Convenience macro for writing dma address into RX/TX descriptors */
121 __d->dma_addr_lo = cpu_to_le32(lower_32_bits(__addr)); \
122 __d->dma_addr_hi = upper_32_bits(__addr) & 0xff; \
169 * struct nfp_net_tx_buf - software TX buffer descriptor
173 * @fidx: Fragment index (-1 for the head and [0..nr_frags-1] for frags)
176 * Will be 1 for all non-TSO packets.
178 * on the head's buffer). Equal to skb->len for non-TSO packets.
192 * struct nfp_net_tx_ring - TX ring structure
231 /* RX and freelist descriptor format */
236 /* Flags in the RX descriptor */
282 __le16 flags; /* RX flags. See @PCIE_DESC_RX_* */
290 #define NFP_NET_META_FIELD_MASK GENMASK(NFP_NET_META_FIELD_SIZE - 1, 0)
307 * struct nfp_net_rx_buf - software RX buffer descriptor
317 * struct nfp_net_rx_ring - RX ring structure
320 * @wr_p: FL/RX ring write pointer (free running)
321 * @rd_p: FL/RX ring read pointer (free running)
325 * @rxbufs: Array of transmitted FL/RX buffers
326 * @rxds: Virtual address of FL/RX ring in host memory
327 * @xdp_rxq: RX-ring info avail for XDP
328 * @dma: DMA address of the FL/RX ring
329 * @size: Size, in bytes, of the FL/RX ring (needed to free)
353 * struct nfp_net_r_vector - Per ring interrupt vector configuration
356 * @tasklet: ctrl vNIC, tasklet for servicing the r_vec
357 * @queue: ctrl vNIC, send queue
358 * @lock: ctrl vNIC, r_vec lock protects @queue
360 * @rx_ring: Pointer to RX ring
362 * @irq_entry: MSI-X table entry (use for talking to the device)
363 * @rx_sync: Seqlock for atomic updates of RX stats
366 * @rx_drops: Number of packets dropped on RX due to lack of resources
386 * @rx_replace_buf_alloc_fail: Counter of RX buffer allocation failures
392 * This structure ties RX and TX rings to interrupt vectors and a NAPI
393 * context. This currently only supports one RX and TX ring per
461 return fw_ver->resv == resv && in nfp_net_fw_ver_eq()
462 fw_ver->class == class && in nfp_net_fw_ver_eq()
463 fw_ver->major == major && in nfp_net_fw_ver_eq()
464 fw_ver->minor == minor; in nfp_net_fw_ver_eq()
473 * struct nfp_net_dp - NFP network device datapath data structure
479 * @rx_dma_dir: Mapping direction for RX buffers
481 * @rx_offset: Offset in the RX buffers where packet data starts
482 * @ctrl: Local copy of the control register/word.
485 * @tx_rings: Array of pre-allocated TX ring structures
486 * @rx_rings: Array of pre-allocated RX ring structures
490 * @rxd_cnt: Size of the RX ring in number of descriptors
494 * @num_rx_rings: Currently configured number of RX rings
510 u32 ctrl; member
535 * struct nfp_net - NFP network device structure
547 * @max_r_vecs: Number of allocated interrupt vectors for RX/TX
549 * @max_rx_rings: Maximum number of RX rings supported by the Firmware
550 * @stride_rx: Queue controller RX queue spacing
552 * @r_vecs: Pre-allocated array of ring vectors
553 * @irq_entries: Pre-allocated array of MSI-X entries
574 * @rx_coalesce_usecs: RX interrupt moderation usecs delay parameter
575 * @rx_coalesce_max_frames: RX interrupt moderation frame count parameter
580 * @rx_bar: Pointer to mapped FL/RX queues
583 * @ktls_rx_conn_cnt: Number of offloaded kTLS RX connections
587 * @ktls_rx_resync_req: Counter of TLS RX resync requested
588 * @ktls_rx_resync_ign: Counter of TLS RX resync requests ignored
589 * @ktls_rx_resync_sent: Counter of TLS RX resync completed
601 * @vnic_no_name: For non-port PF vNIC make ndo_get_phys_port_name return
602 * -EOPNOTSUPP to keep backwards compatibility (set by app)
707 return readb(nn->dp.ctrl_bar + off); in nn_readb()
712 writeb(val, nn->dp.ctrl_bar + off); in nn_writeb()
717 return readw(nn->dp.ctrl_bar + off); in nn_readw()
722 writew(val, nn->dp.ctrl_bar + off); in nn_writew()
727 return readl(nn->dp.ctrl_bar + off); in nn_readl()
732 writel(val, nn->dp.ctrl_bar + off); in nn_writel()
737 return readq(nn->dp.ctrl_bar + off); in nn_readq()
742 writeq(val, nn->dp.ctrl_bar + off); in nn_writeq()
773 /* nfp_qcp_ptr - Read or Write Pointer of a queue */
797 val -= NFP_QCP_MAX_ADD; in _nfp_qcp_ptr_add()
804 * nfp_qcp_rd_ptr_add() - Add the value to the read pointer of a queue
817 * nfp_qcp_wr_ptr_add() - Add the value to the write pointer of a queue
848 * nfp_qcp_rd_ptr_read() - Read the current read pointer value for a queue
859 * nfp_qcp_wr_ptr_read() - Read the current write pointer value for a queue
871 WARN_ON_ONCE(!nn->dp.netdev && nn->port); in nfp_net_is_data_vnic()
872 return !!nn->dp.netdev; in nfp_net_is_data_vnic()
877 return nn->dp.ctrl & NFP_NET_CFG_CTRL_ENABLE; in nfp_net_running()
882 return nn->dp.netdev ? nn->dp.netdev->name : "ctrl"; in nfp_net_name()
886 __acquires(&nn->r_vecs[0].lock) in nfp_ctrl_lock()
888 spin_lock_bh(&nn->r_vecs[0].lock); in nfp_ctrl_lock()
892 __releases(&nn->r_vecs[0].lock) in nfp_ctrl_unlock()
894 spin_unlock_bh(&nn->r_vecs[0].lock); in nfp_ctrl_unlock()
899 down(&nn->bar_lock); in nn_ctrl_bar_lock()
904 return !down_trylock(&nn->bar_lock); in nn_ctrl_bar_trylock()
909 up(&nn->bar_lock); in nn_ctrl_bar_unlock()
919 return netdev->netdev_ops == &nfp_net_netdev_ops; in nfp_netdev_is_nfp_net()