Skip to contentSkip to conversation

net/af_packet: set default blocksize to pagesize

PATCH Applied [email protected] 2 participants 4 messages Jun 24, 2019 – Jul 3, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/af_packet: set default blocksize to pagesize

From: Krzysztof Kanas <[email protected]>

Kernel validates block size to be aligned to page size. Code works on platforms with page size 4k, but on others e.g. Arm64 fails with default parameters.

---
 drivers/net/af_packet/rte_eth_af_packet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +2 -2
index 4a660d5f013f..ec3d2cbb5202 100644
@@ -32,7 +32,6 @@
 #define ETH_AF_PACKET_FRAMECOUNT_ARG	"framecnt"
 #define ETH_AF_PACKET_QDISC_BYPASS_ARG	"qdisc_bypass"
 
-#define DFLT_BLOCK_SIZE		(1 << 12)
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
@@ -811,7 +810,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 	struct rte_kvargs_pair *pair = NULL;
 	unsigned k_idx;
 	unsigned int blockcount;
-	unsigned int blocksize = DFLT_BLOCK_SIZE;
+	unsigned int blocksize;
 	unsigned int framesize = DFLT_FRAME_SIZE;
 	unsigned int framecount = DFLT_FRAME_COUNT;
 	unsigned int qpairs = 1;
@@ -821,6 +820,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 	if (*sockfd < 0)
 		return -1;
 
+	blocksize = getpagesize();
 	/*
 	 * Walk arguments for configurable settings
 	 */
Signature · 1 line
2.21.0
#1 lore raw
Quoted 5 lines · On 6/24/2019 3:32 PM, [email protected] wrote:

From: Krzysztof Kanas <[email protected]>

Kernel validates block size to be aligned to page size. Code works on platforms with page size 4k, but on others e.g. Arm64 fails with default parameters.

What is the pagesize in arm64?

Quoted 36 lines
---
 drivers/net/af_packet/rte_eth_af_packet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +2 -2
index 4a660d5f013f..ec3d2cbb5202 100644
@@ -32,7 +32,6 @@
 #define ETH_AF_PACKET_FRAMECOUNT_ARG	"framecnt"
 #define ETH_AF_PACKET_QDISC_BYPASS_ARG	"qdisc_bypass"
 
-#define DFLT_BLOCK_SIZE		(1 << 12)
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
@@ -811,7 +810,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 	struct rte_kvargs_pair *pair = NULL;
 	unsigned k_idx;
 	unsigned int blockcount;
-	unsigned int blocksize = DFLT_BLOCK_SIZE;
+	unsigned int blocksize;
 	unsigned int framesize = DFLT_FRAME_SIZE;
 	unsigned int framecount = DFLT_FRAME_COUNT;
 	unsigned int qpairs = 1;
@@ -821,6 +820,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 	if (*sockfd < 0)
 		return -1;
 
+	blocksize = getpagesize();
 	/*
 	 * Walk arguments for configurable settings
 	 */
#2 lore raw
Quoted 11 lines · Ferruh Yigit

External Email

----------------------------------------------------------------------

Quoted 5 lines · On 6/24/2019 3:32 PM, [email protected] wrote:

From: Krzysztof Kanas <[email protected]>

Kernel validates block size to be aligned to page size. Code works on platforms with page size 4k, but on others e.g. Arm64 fails with default parameters.

What is the pagesize in arm64?

On aarch64 it is configurable. Linux kernel, supports sizes 4k, 16k, 64k see ARM64_64K_PAGES in arch/arm64/Kconfig.

Quoted 38 lines
Quoted 37 lines
---
 drivers/net/af_packet/rte_eth_af_packet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +2 -2
index 4a660d5f013f..ec3d2cbb5202 100644
@@ -32,7 +32,6 @@
 #define ETH_AF_PACKET_FRAMECOUNT_ARG	"framecnt"
 #define ETH_AF_PACKET_QDISC_BYPASS_ARG	"qdisc_bypass"
 
-#define DFLT_BLOCK_SIZE		(1 << 12)
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
@@ -811,7 +810,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 	struct rte_kvargs_pair *pair = NULL;
 	unsigned k_idx;
 	unsigned int blockcount;
-	unsigned int blocksize = DFLT_BLOCK_SIZE;
+	unsigned int blocksize;
 	unsigned int framesize = DFLT_FRAME_SIZE;
 	unsigned int framecount = DFLT_FRAME_COUNT;
 	unsigned int qpairs = 1;
@@ -821,6 +820,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 	if (*sockfd < 0)
 		return -1;
 
+	blocksize = getpagesize();
 	/*
 	 * Walk arguments for configurable settings
 	 */
Signature · 3 lines
-
Regards,
Krzysztof(Chris) Kanas
Reviewed-by on v1 1/1 Applied
#3 lore raw
In reply to [email protected]
Quoted 7 lines · On 6/24/2019 3:32 PM, [email protected] wrote:

From: Krzysztof Kanas <[email protected]>

Kernel validates block size to be aligned to page size. Code works on platforms with page size 4k, but on others e.g. Arm64 fails with default parameters.

Applied to dpdk-next-net/master, thanks.