From patchwork Thu Mar 28 09:26:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Panis X-Patchwork-Id: 13608282 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E02575102E for ; Thu, 28 Mar 2024 09:26:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711618013; cv=none; b=aSegKPNJHNeU2BKzd14N3cFfvN2w+5vQgh+6+rYOwKPV3Cj9svOjnrj0jJGeEXJwEl9tGMDWh7jS2w/NERZmgZO/CG8CrMCd0pDQUl6RhhpMRa83ooDf++DbnOk240+BlHqRd19+3G8QI6IRE8ymIgc71ln8g3yACyVzP84jNuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711618013; c=relaxed/simple; bh=mxI3dtUqp9zmMAmwAry/PSUUjVo2cudQ7Rm8VoOQs1o=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=YGMNSL9MW3Fedis+t4TjqwJaf6bCZ1+F5rj4mQMAYi3FakGeMeDs91tOl/BNxlvqb3BOGxYPmiKbymq4geFMsfD7e/dUS0eZv2/wWMXoBkQTgdZB6a8UmKHLXE3hV/iblwsg81dcCd8X3OJ+dgFjcHoZddgawQuBrW/zQEraZ9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=TUKHQUch; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="TUKHQUch" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4154464f150so2247085e9.0 for ; Thu, 28 Mar 2024 02:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1711618009; x=1712222809; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=037yUICN8Zj6LjDic8LC2UDwvIudLoxg0PS899BrnwU=; b=TUKHQUchjhoO0nR/bEkcRvFBBLcQ+v73egJvFiDoFfZt63yLIM0MLcnqFDztLUhrmH 6aT2E1IaMWlooJovSlDuz1qsNHVyxp/Y4KCciYPXOUE5Prwic6+MEsyfaIVBfmPk/GVF mvrKYJXIII+UKz2z2Ks2KUJPdKiB5AOSq0kwG48rOiSHCZmWI784qHlG/MBltGvU1Lsa Gc3KJ8Bpd+iXdYuFhWXm/vpGaK/xX9GbqUWFHIYXT8GkX0jnVX33V8woR96MrV6N+ll3 p34r2+Ou7atLn2Zeo6MtjEL1xHJQ8JsPplmuv3t2vsq6+x6QPVopFiYLpiD8SUzSzuMH HCTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711618009; x=1712222809; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=037yUICN8Zj6LjDic8LC2UDwvIudLoxg0PS899BrnwU=; b=KlN+9Og7ZNKQvH8xxHQv9xh/5oUUrD0zonr0mltYv0UdtVEhq6dVwHBzeeJ6Hq0qgR dBpIgcOytjKzR6apc6CiOesHOyqGI3DfZ54RThihX/Z35j1gYoneIf9UfBZ/ErDkjRBJ daAx/ZIPJi9nholaN/xeqnftcRYNLI01ejOSJ0JIQmIbc9WnTLy3z/g2qy+RBe3rO1uj aPgsS623180nFsjD4t8T+8ar2krTrF4FM7+fIiMug3DrRKKgDNRLM3AZ8DTDJDS9g+eS 7Iwh4Bt7idKSwSPoXorgn+yPITcNRPJbSyfI3aUOfLXYiHXrmRJnUbebK95I3QC01RVe 9sUA== X-Forwarded-Encrypted: i=1; AJvYcCUKHami7tGcYVoXmJ3eltg96ePbb6ixlfYHPcAgWU2E7sNgPaklFmuBsmbmWhORc+ZxGkWsKKpDIQj+4w1Dr7iDUk4M X-Gm-Message-State: AOJu0YybjjCIEMqCugGXtLKvY9X1KOcoBimKXguIpTPpphWY3UrRKuWs lqPlWdKxPM6i2txukQmbQLyNKCFN63kGAqeAQPgNrT8bc+i98IRDqnS8L9mNsDw= X-Google-Smtp-Source: AGHT+IHLaIIbZsEZxQrLnlbH1qW6VXrNaf2xZGc7tS9bHD/eGEFPYn/1xJdx7j9BXHFyl+/lKz2TvQ== X-Received: by 2002:a05:600c:4ec9:b0:413:4299:ec9f with SMTP id g9-20020a05600c4ec900b004134299ec9fmr1547318wmq.5.1711618009022; Thu, 28 Mar 2024 02:26:49 -0700 (PDT) Received: from [127.0.1.1] (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id bd17-20020a05600c1f1100b0041493615585sm1673414wmb.39.2024.03.28.02.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 02:26:48 -0700 (PDT) From: Julien Panis Subject: [PATCH net-next v5 0/3] Add minimal XDP support to TI AM65 CPSW Ethernet driver Date: Thu, 28 Mar 2024 10:26:39 +0100 Message-Id: <20240223-am65-cpsw-xdp-basic-v5-0-bc1739170bc6@baylibre.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAM83BWYC/42OzWrDMBCEX8XonG31Z6Hk1PcoJaykTa0Sy0Yyr kPwu1fxrSUUH2dn5tu5s0I5UmGn5s4yzbHEIVXRHhrmO0yfBDFUzSSXmkupAHvTgh/LNyxhBIc letDBWWlbbp22rDbrlcBlTL57dL9GTLG81vy5x5iuMdF55o/gmOkSl+39O0s0QaJlYh/V6WKZh nzbds1i8/+dMAsQcLxwZ7wLqAR/c3i7RpfpxQ/9hpzlDowEDlx44xE9OmeeYNQOjKqYNhy1xmO wGp+t0TswumKUVUagUait+405NDvqknRLbSDPtf2zYl3XHyFW71IAAgAA To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Simon Horman , Andrew Lunn , Ratheesh Kannoth Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Julien Panis X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711618007; l=2325; i=jpanis@baylibre.com; s=20230526; h=from:subject:message-id; bh=mxI3dtUqp9zmMAmwAry/PSUUjVo2cudQ7Rm8VoOQs1o=; b=pjxRZGc0ZNpjhrrYX6GeGUAvpeXEIOE/nsO2hVShrS5g59uZ1sRp2gLtRwpsGynFeMC9ZhpZa 6vct8jvI5BHCfrrVXO25rVE271WkqGcmgRGQbW51w0gjb7g5yqOrSao X-Developer-Key: i=jpanis@baylibre.com; a=ed25519; pk=8eSM4/xkiHWz2M1Cw1U3m2/YfPbsUdEJPCWY3Mh9ekQ= X-Patchwork-Delegate: kuba@kernel.org This patch adds XDP support to TI AM65 CPSW Ethernet driver. The following features are implemented: NETDEV_XDP_ACT_BASIC, NETDEV_XDP_ACT_REDIRECT, and NETDEV_XDP_ACT_NDO_XMIT. Zero-copy and non-linear XDP buffer supports are NOT implemented. Besides, the page pool memory model is used to get better performance. Signed-off-by: Julien Panis --- Changes in v5: - In k3_cppi_desc_pool_destroy(), free memory allocated for desc_infos. - Link to v4: https://lore.kernel.org/r/20240223-am65-cpsw-xdp-basic-v4-0-2e45e5dec048@baylibre.com Changes in v4: - Add skb_mark_for_recycle() in am65_cpsw_nuss_rx_packets() function. - Specify napi page pool parameter in am65_cpsw_create_xdp_rxqs() function. - Add benchmark numbers (with VS without page pool) in the commit description. - Add xdp_do_flush() in am65_cpsw_run_xdp() function for XDP_REDIRECT case. - Link to v3: https://lore.kernel.org/r/20240223-am65-cpsw-xdp-basic-v3-0-5d944a9d84a0@baylibre.com Changes in v3: - Fix a potential issue with TX buffer type, which is now set for each buffer. - Link to v2: https://lore.kernel.org/r/20240223-am65-cpsw-xdp-basic-v2-0-01c6caacabb6@baylibre.com Changes in v2: - Use page pool memory model instead of MEM_TYPE_PAGE_ORDER0. - In am65_cpsw_alloc_skb(), release reference on the page pool page in case of error returned by build_skb(). - [nit] Cleanup am65_cpsw_nuss_common_open/stop() functions. - [nit] Arrange local variables in reverse xmas tree order. - Link to v1: https://lore.kernel.org/r/20240223-am65-cpsw-xdp-basic-v1-1-9f0b6cbda310@baylibre.com --- Julien Panis (3): net: ethernet: ti: Add accessors for struct k3_cppi_desc_pool members net: ethernet: ti: Add desc_infos member to struct k3_cppi_desc_pool net: ethernet: ti: am65-cpsw: Add minimal XDP support drivers/net/ethernet/ti/am65-cpsw-nuss.c | 536 +++++++++++++++++++++++++--- drivers/net/ethernet/ti/am65-cpsw-nuss.h | 13 + drivers/net/ethernet/ti/k3-cppi-desc-pool.c | 37 ++ drivers/net/ethernet/ti/k3-cppi-desc-pool.h | 4 + 4 files changed, 540 insertions(+), 50 deletions(-) --- base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d change-id: 20240223-am65-cpsw-xdp-basic-4db828508b48 Best regards,