netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] igb: Add support for AF_XDP zero-copy
@ 2023-07-04  9:59 Sriram Yagnaraman
  2023-07-04  9:59 ` [PATCH 1/4] igb: prepare for AF_XDP zero-copy support Sriram Yagnaraman
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Sriram Yagnaraman @ 2023-07-04  9:59 UTC (permalink / raw)
  Cc: intel-wired-lan, bpf, netdev, Jesse Brandeburg, Tony Nguyen,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
	John Fastabend, Sriram Yagnaraman

Disclaimer: My first patches to Intel drivers, implemented AF_XDP
zero-copy feature which seemed to be missing for igb. Not sure if it was
a conscious choice to not spend time implementing this for older
devices, nevertheless I send them to the list for review.

The first couple of patches adds helper funcctions to prepare for AF_XDP
zero-copy support which comes in the last couple of patches, one each
for Rx and TX paths.

Sriram Yagnaraman (4):
  igb: prepare for AF_XDP zero-copy support
  igb: Introduce txrx ring enable/disable functions
  igb: add AF_XDP zero-copy Rx support
  igb: add AF_XDP zero-copy Tx support

 drivers/net/ethernet/intel/igb/Makefile   |   2 +-
 drivers/net/ethernet/intel/igb/igb.h      |  52 ++-
 drivers/net/ethernet/intel/igb/igb_main.c | 178 +++++++--
 drivers/net/ethernet/intel/igb/igb_xsk.c  | 434 ++++++++++++++++++++++
 4 files changed, 633 insertions(+), 33 deletions(-)
 create mode 100644 drivers/net/ethernet/intel/igb/igb_xsk.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH 2/4] igb: Introduce txrx ring enable/disable functions
@ 2023-07-04 10:01 Sriram Yagnaraman
  0 siblings, 0 replies; 11+ messages in thread
From: Sriram Yagnaraman @ 2023-07-04 10:01 UTC (permalink / raw)
  Cc: intel-wired-lan, bpf, netdev, Jesse Brandeburg, Tony Nguyen,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
	John Fastabend, Sriram Yagnaraman

Add enable/disable functions for TX and RX rings, will be used in later
patches when AF_XDP zero-copy support is added.

Signed-off-by: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
---
 drivers/net/ethernet/intel/igb/igb.h      |  5 ++-
 drivers/net/ethernet/intel/igb/igb_main.c | 41 +++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index 94440af6cf4b..5fa011c6ef2f 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -384,7 +384,8 @@ enum e1000_ring_flags_t {
 	IGB_RING_FLAG_RX_SCTP_CSUM,
 	IGB_RING_FLAG_RX_LB_VLAN_BSWAP,
 	IGB_RING_FLAG_TX_CTX_IDX,
-	IGB_RING_FLAG_TX_DETECT_HANG
+	IGB_RING_FLAG_TX_DETECT_HANG,
+	IGB_RING_FLAG_TX_DISABLED
 };
 
 #define ring_uses_large_buffer(ring) \
@@ -735,6 +736,8 @@ void igb_free_tx_resources(struct igb_ring *);
 void igb_free_rx_resources(struct igb_ring *);
 void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *);
 void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *);
+void igb_txrx_ring_disable(struct igb_adapter *adapter, u16 qid);
+void igb_txrx_ring_enable(struct igb_adapter *adapter, u16 qid);
 void igb_setup_tctl(struct igb_adapter *);
 void igb_setup_rctl(struct igb_adapter *);
 void igb_setup_srrctl(struct igb_adapter *, struct igb_ring *);
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index dadc3d423cfd..391c0eb136d9 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4856,6 +4856,47 @@ static void igb_configure_rx(struct igb_adapter *adapter)
 	}
 }
 
+void igb_txrx_ring_disable(struct igb_adapter *adapter, u16 qid)
+{
+	struct e1000_hw *hw = &adapter->hw;
+	struct igb_ring *tx_ring = adapter->tx_ring[qid];
+	struct igb_ring *rx_ring = adapter->rx_ring[qid];
+
+	set_bit(IGB_RING_FLAG_TX_DISABLED, &tx_ring->flags);
+
+	wr32(E1000_TXDCTL(tx_ring->reg_idx), 0);
+	wr32(E1000_RXDCTL(rx_ring->reg_idx), 0);
+
+	/* Rx/Tx share the same napi context. */
+	napi_disable(&rx_ring->q_vector->napi);
+
+	igb_clean_tx_ring(tx_ring);
+	igb_clean_rx_ring(rx_ring);
+
+	memset(&rx_ring->rx_stats, 0, sizeof(rx_ring->rx_stats));
+	memset(&tx_ring->tx_stats, 0, sizeof(tx_ring->tx_stats));
+}
+
+void igb_txrx_ring_enable(struct igb_adapter *adapter, u16 qid)
+{
+	struct igb_ring *tx_ring = adapter->tx_ring[qid];
+	struct igb_ring *rx_ring = adapter->rx_ring[qid];
+
+	/* Rx/Tx share the same napi context. */
+	napi_enable(&rx_ring->q_vector->napi);
+
+	igb_configure_tx_ring(adapter, tx_ring);
+	igb_configure_rx_ring(adapter, rx_ring);
+
+	/* call igb_desc_unused which always leaves
+	 * at least 1 descriptor unused to make sure
+	 * next_to_use != next_to_clean
+	 */
+	igb_alloc_rx_buffers(rx_ring, igb_desc_unused(rx_ring));
+
+	clear_bit(IGB_RING_FLAG_TX_DISABLED, &tx_ring->flags);
+}
+
 /**
  *  igb_free_tx_resources - Free Tx Resources per Queue
  *  @tx_ring: Tx descriptor ring for a specific queue
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-07-05 17:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-04  9:59 [PATCH 0/4] igb: Add support for AF_XDP zero-copy Sriram Yagnaraman
2023-07-04  9:59 ` [PATCH 1/4] igb: prepare for AF_XDP zero-copy support Sriram Yagnaraman
2023-07-04  9:59 ` [PATCH 2/4] igb: Introduce txrx ring enable/disable functions Sriram Yagnaraman
2023-07-04 15:38   ` Maciej Fijalkowski
2023-07-04  9:59 ` [PATCH 3/4] igb: add AF_XDP zero-copy Rx support Sriram Yagnaraman
2023-07-04 19:30   ` Simon Horman
2023-07-05 17:16   ` kernel test robot
2023-07-04  9:59 ` [PATCH 4/4] igb: add AF_XDP zero-copy Tx support Sriram Yagnaraman
2023-07-04 15:37 ` [PATCH 0/4] igb: Add support for AF_XDP zero-copy Maciej Fijalkowski
2023-07-04 18:48   ` Sriram Yagnaraman
  -- strict thread matches above, loose matches on Subject: below --
2023-07-04 10:01 [PATCH 2/4] igb: Introduce txrx ring enable/disable functions Sriram Yagnaraman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).