net/af_packet: set default block size to page size
authorKrzysztof Kanas <kkanas@marvell.com>
Mon, 24 Jun 2019 14:32:00 +0000 (16:32 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 4 Jul 2019 23:52:01 +0000 (01:52 +0200)
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.

Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/af_packet/rte_eth_af_packet.c

index 4a660d5..db1a751 100644 (file)
@@ -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,8 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
        if (*sockfd < 0)
                return -1;
 
+       blocksize = getpagesize();
+
        /*
         * Walk arguments for configurable settings
         */