Re: [PATCH net-next v2 6/6] tsnep: Add XDP socket zero-copy TX support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18.04.23 10:27, Paolo Abeni wrote:
On Sat, 2023-04-15 at 16:42 +0200, Gerhard Engleder wrote:
Send and complete XSK pool frames within TX NAPI context. NAPI context
is triggered by ndo_xsk_wakeup.

Test results with A53 1.2GHz:

xdpsock txonly copy mode:
                    pps            pkts           1.00
tx                 284,409        11,398,144
Two CPUs with 100% and 10% utilization.

xdpsock txonly zero-copy mode:
                    pps            pkts           1.00
tx                 511,929        5,890,368
Two CPUs with 100% and 1% utilization.

Packet rate increases and CPU utilization is reduced.

Signed-off-by: Gerhard Engleder <gerhard@xxxxxxxxxxxxxxxxxxxxx>
---
  drivers/net/ethernet/engleder/tsnep.h      |   2 +
  drivers/net/ethernet/engleder/tsnep_main.c | 131 +++++++++++++++++++--
  2 files changed, 123 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/engleder/tsnep.h b/drivers/net/ethernet/engleder/tsnep.h
index d0bea605a1d1..11b29f56aaf9 100644
--- a/drivers/net/ethernet/engleder/tsnep.h
+++ b/drivers/net/ethernet/engleder/tsnep.h
@@ -70,6 +70,7 @@ struct tsnep_tx_entry {
  	union {
  		struct sk_buff *skb;
  		struct xdp_frame *xdpf;
+		bool zc;
  	};
  	size_t len;
  	DEFINE_DMA_UNMAP_ADDR(dma);
@@ -88,6 +89,7 @@ struct tsnep_tx {
  	int read;
  	u32 owner_counter;
  	int increment_owner_counter;
+	struct xsk_buff_pool *xsk_pool;
u32 packets;
  	u32 bytes;
diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
index 13e5d4438082..de51d0cc8935 100644
--- a/drivers/net/ethernet/engleder/tsnep_main.c
+++ b/drivers/net/ethernet/engleder/tsnep_main.c
@@ -54,6 +54,8 @@
  #define TSNEP_TX_TYPE_SKB_FRAG	BIT(1)
  #define TSNEP_TX_TYPE_XDP_TX	BIT(2)
  #define TSNEP_TX_TYPE_XDP_NDO	BIT(3)
+#define TSNEP_TX_TYPE_XDP	(TSNEP_TX_TYPE_XDP_TX | TSNEP_TX_TYPE_XDP_NDO)
+#define TSNEP_TX_TYPE_XSK	BIT(4)
#define TSNEP_XDP_TX BIT(0)
  #define TSNEP_XDP_REDIRECT	BIT(1)
@@ -322,13 +324,51 @@ static void tsnep_tx_init(struct tsnep_tx *tx)
  	tx->increment_owner_counter = TSNEP_RING_SIZE - 1;
  }
+static void tsnep_tx_enable(struct tsnep_tx *tx)
+{
+	struct netdev_queue *nq;
+
+	nq = netdev_get_tx_queue(tx->adapter->netdev, tx->queue_index);
+
+	local_bh_disable();
+	__netif_tx_lock(nq, smp_processor_id());

The above 2 statements could be replaced with:

	__netif_tx_lock_bh()

+	netif_tx_wake_queue(nq);
+	__netif_tx_unlock(nq);
+	local_bh_enable();

__netif_tx_unlock_bh()

+}
+
+static void tsnep_tx_disable(struct tsnep_tx *tx, struct napi_struct *napi)
+{
+	struct netdev_queue *nq;
+	u32 val;
+
+	nq = netdev_get_tx_queue(tx->adapter->netdev, tx->queue_index);
+
+	local_bh_disable();
+	__netif_tx_lock(nq, smp_processor_id());

Same here.

Will be done.

Thank you!

Gerhard



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux