net/af_packet: fix indentation
Subsystems (2)
PATCH v2 1/2 net/af_packet: fix indentation
DPDK code is supposed to be indented with TABS not spaces. Also, used "unsigned int" to keep checkpatch happy.
--- drivers/net/af_packet/rte_eth_af_packet.c | 64 +++++++++++------------ 1 file changed, 32 insertions(+), 32 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +32 -32
@@ -79,7 +79,7 @@ struct __rte_cache_aligned pkt_tx_queue { };struct pmd_internals { -unsigned nb_queues; +unsigned int nb_queues;int if_index;char *if_name;
@@ -602,7 +602,7 @@ eth_dev_close(struct rte_eth_dev *dev)static int eth_link_update (struct rte_eth_dev *dev, - int wait_to_complete __rte_unused) + int wait_to_complete __rte_unused) {const struct pmd_internals *internals = dev->data->dev_private;struct rte_eth_link *dev_link = &dev->data->dev_link;
@@ -622,11 +622,11 @@ eth_link_update(struct rte_eth_dev *dev,static int eth_rx_queue_setup (struct rte_eth_dev *dev, -uint16_t rx_queue_id, - uint16_t nb_rx_desc __rte_unused, - unsigned int socket_id __rte_unused, - const struct rte_eth_rxconf *rx_conf __rte_unused, -struct rte_mempool *mb_pool) +uint16_t rx_queue_id, + uint16_t nb_rx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_rxconf *rx_conf __rte_unused, +struct rte_mempool *mb_pool) {struct pmd_internals *internals = dev->data->dev_private;struct pkt_rx_queue *pkt_q = &internals->rx_queue[rx_queue_id];
@@ -660,10 +660,10 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,static int eth_tx_queue_setup (struct rte_eth_dev *dev, -uint16_t tx_queue_id, - uint16_t nb_tx_desc __rte_unused, - unsigned int socket_id __rte_unused, - const struct rte_eth_txconf *tx_conf __rte_unused) +uint16_t tx_queue_id, + uint16_t nb_tx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_txconf *tx_conf __rte_unused) {struct pmd_internals *internals = dev->data->dev_private;
@@ -790,8 +790,8 @@ static const struct eth_dev_ops ops = {*/ static int open_packet_iface(const char *key __rte_unused, - const char *value __rte_unused, -void *extra_args) + const char *value __rte_unused, +void *extra_args) {int *sockfd = extra_args;
@@ -854,17 +854,17 @@ get_fanout(const char *fanout_mode, int if_index)static int rte_pmd_init_internals (struct rte_vdev_device *dev, -const int sockfd, -const unsigned nb_queues, -unsigned int blocksize, -unsigned int blockcnt, -unsigned int framesize, -unsigned int framecnt, +const int sockfd, +const unsigned int nb_queues, +unsigned int blocksize, +unsigned int blockcnt, +unsigned int framesize, +unsigned int framecnt,unsigned int qdisc_bypass,const char *fanout_mode, -struct pmd_internals **internals, -struct rte_eth_dev **eth_dev, -struct rte_kvargs *kvlist) +struct pmd_internals **internals, +struct rte_eth_dev **eth_dev, +struct rte_kvargs *kvlist) {const char *name =rte_vdev_device_name (dev);const unsigned int numa_node = dev->device.numa_node;
@@ -890,7 +890,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,if (pair ==NULL ) {PMD_LOG (ERR ,"%s: no interface specified for AF_PACKET ethdev" , - name); + name);return -1 ; }
@@ -899,7 +899,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, name, numa_node); *internals =rte_zmalloc_socket (name,sizeof (**internals), -0 , numa_node); +0 , numa_node);if (*internals ==NULL )return -1 ;
@@ -1140,8 +1140,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,static int rte_eth_from_packet (struct rte_vdev_device *dev, -int const *sockfd, -struct rte_kvargs *kvlist) +int const *sockfd, +struct rte_kvargs *kvlist) {const char *name =rte_vdev_device_name (dev);struct pmd_internals *internals =NULL ;
@@ -1172,7 +1172,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (qpairs <1 ) {PMD_LOG (ERR ,"%s: invalid qpairs value" , - name); + name);return -1 ; }continue ;
@@ -1182,7 +1182,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!blocksize) {PMD_LOG (ERR ,"%s: invalid blocksize value" , - name); + name);return -1 ; }continue ;
@@ -1192,7 +1192,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!framesize) {PMD_LOG (ERR ,"%s: invalid framesize value" , - name); + name);return -1 ; }continue ;
@@ -1202,7 +1202,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!framecount) {PMD_LOG (ERR ,"%s: invalid framecount value" , - name); + name);return -1 ; }continue ;
@@ -1226,7 +1226,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (framesize > blocksize) {PMD_LOG (ERR ,"%s: AF_PACKET MMAP frame size exceeds block size!" , - name); + name);return -1 ; }
@@ -1301,7 +1301,7 @@ rte_pmd_af_packet_probe(struct rte_vdev_device *dev)if (rte_kvargs_count (kvlist,ETH_AF_PACKET_IFACE_ARG ) ==1 ) { ret =rte_kvargs_process (kvlist,ETH_AF_PACKET_IFACE_ARG , - &open_packet_iface, &sockfd); + &open_packet_iface, &sockfd);if (ret <0 ) goto exit; }
Signature · 1 line
2.53.0
PATCH v2 2/2 test: add test for af_packet
Add a test for AF_PACKET PMD.
This test was generated with Claude AI based off of existing test_pmd_ring.c with some cleanup afterwards.
--- app/test/meson.build | 1 + app/test/test_pmd_af_packet.c | 1166 +++++++++++++++++++++++++++++++++ 2 files changed, 1167 insertions(+) create mode 100644 app/test/test_pmd_af_packet.c
app/test/meson.build +1 -0
@@ -141,6 +141,7 @@ source_file_deps = { 'test_per_lcore.c': [], 'test_pflock.c': [], 'test_pie.c': ['sched'], + 'test_pmd_af_packet.c': ['net_af_packet', 'ethdev', 'bus_vdev'], 'test_pmd_perf.c': ['ethdev', 'net'] + packet_burst_generator_deps, 'test_pmd_ring.c': ['net_ring', 'ethdev', 'bus_vdev'], 'test_pmd_ring_perf.c': ['ethdev', 'net_ring', 'bus_vdev'],
app/test/test_pmd_af_packet.c new file +1166 -0
1,166 lines not on this page · raw message
Signature · 1 line
2.53.0
v2 cover af_packet: cleanup and test
In reply to Stephen HemmingerA couple of small patches for the af_packet PMD.
Fix indentation and add a basic test.
v2 - fix test to always check write() return value
Stephen Hemminger (2):
net/af_packet: whitespace cleanup
test: add test for af_packet
app/test/meson.build | 1 + app/test/test_pmd_af_packet.c | 1166 +++++++++++++++++++++ drivers/net/af_packet/rte_eth_af_packet.c | 64 +- 3 files changed, 1199 insertions(+), 32 deletions(-) create mode 100644 app/test/test_pmd_af_packet.c
Signature · 1 line
2.53.0
PATCH v2 1/2 net/af_packet: whitespace cleanup
DPDK code is supposed to be indented with TABS not spaces. Also, used "unsigned int" to keep checkpatch happy.
--- drivers/net/af_packet/rte_eth_af_packet.c | 64 +++++++++++------------ 1 file changed, 32 insertions(+), 32 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +32 -32
@@ -79,7 +79,7 @@ struct __rte_cache_aligned pkt_tx_queue { };struct pmd_internals { -unsigned nb_queues; +unsigned int nb_queues;int if_index;char *if_name;
@@ -602,7 +602,7 @@ eth_dev_close(struct rte_eth_dev *dev)static int eth_link_update (struct rte_eth_dev *dev, - int wait_to_complete __rte_unused) + int wait_to_complete __rte_unused) {const struct pmd_internals *internals = dev->data->dev_private;struct rte_eth_link *dev_link = &dev->data->dev_link;
@@ -622,11 +622,11 @@ eth_link_update(struct rte_eth_dev *dev,static int eth_rx_queue_setup (struct rte_eth_dev *dev, -uint16_t rx_queue_id, - uint16_t nb_rx_desc __rte_unused, - unsigned int socket_id __rte_unused, - const struct rte_eth_rxconf *rx_conf __rte_unused, -struct rte_mempool *mb_pool) +uint16_t rx_queue_id, + uint16_t nb_rx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_rxconf *rx_conf __rte_unused, +struct rte_mempool *mb_pool) {struct pmd_internals *internals = dev->data->dev_private;struct pkt_rx_queue *pkt_q = &internals->rx_queue[rx_queue_id];
@@ -660,10 +660,10 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,static int eth_tx_queue_setup (struct rte_eth_dev *dev, -uint16_t tx_queue_id, - uint16_t nb_tx_desc __rte_unused, - unsigned int socket_id __rte_unused, - const struct rte_eth_txconf *tx_conf __rte_unused) +uint16_t tx_queue_id, + uint16_t nb_tx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_txconf *tx_conf __rte_unused) {struct pmd_internals *internals = dev->data->dev_private;
@@ -790,8 +790,8 @@ static const struct eth_dev_ops ops = {*/ static int open_packet_iface(const char *key __rte_unused, - const char *value __rte_unused, -void *extra_args) + const char *value __rte_unused, +void *extra_args) {int *sockfd = extra_args;
@@ -854,17 +854,17 @@ get_fanout(const char *fanout_mode, int if_index)static int rte_pmd_init_internals (struct rte_vdev_device *dev, -const int sockfd, -const unsigned nb_queues, -unsigned int blocksize, -unsigned int blockcnt, -unsigned int framesize, -unsigned int framecnt, +const int sockfd, +const unsigned int nb_queues, +unsigned int blocksize, +unsigned int blockcnt, +unsigned int framesize, +unsigned int framecnt,unsigned int qdisc_bypass,const char *fanout_mode, -struct pmd_internals **internals, -struct rte_eth_dev **eth_dev, -struct rte_kvargs *kvlist) +struct pmd_internals **internals, +struct rte_eth_dev **eth_dev, +struct rte_kvargs *kvlist) {const char *name =rte_vdev_device_name (dev);const unsigned int numa_node = dev->device.numa_node;
@@ -890,7 +890,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,if (pair ==NULL ) {PMD_LOG (ERR ,"%s: no interface specified for AF_PACKET ethdev" , - name); + name);return -1 ; }
@@ -899,7 +899,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, name, numa_node); *internals =rte_zmalloc_socket (name,sizeof (**internals), -0 , numa_node); +0 , numa_node);if (*internals ==NULL )return -1 ;
@@ -1140,8 +1140,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,static int rte_eth_from_packet (struct rte_vdev_device *dev, -int const *sockfd, -struct rte_kvargs *kvlist) +int const *sockfd, +struct rte_kvargs *kvlist) {const char *name =rte_vdev_device_name (dev);struct pmd_internals *internals =NULL ;
@@ -1172,7 +1172,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (qpairs <1 ) {PMD_LOG (ERR ,"%s: invalid qpairs value" , - name); + name);return -1 ; }continue ;
@@ -1182,7 +1182,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!blocksize) {PMD_LOG (ERR ,"%s: invalid blocksize value" , - name); + name);return -1 ; }continue ;
@@ -1192,7 +1192,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!framesize) {PMD_LOG (ERR ,"%s: invalid framesize value" , - name); + name);return -1 ; }continue ;
@@ -1202,7 +1202,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!framecount) {PMD_LOG (ERR ,"%s: invalid framecount value" , - name); + name);return -1 ; }continue ;
@@ -1226,7 +1226,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (framesize > blocksize) {PMD_LOG (ERR ,"%s: AF_PACKET MMAP frame size exceeds block size!" , - name); + name);return -1 ; }
@@ -1301,7 +1301,7 @@ rte_pmd_af_packet_probe(struct rte_vdev_device *dev)if (rte_kvargs_count (kvlist,ETH_AF_PACKET_IFACE_ARG ) ==1 ) { ret =rte_kvargs_process (kvlist,ETH_AF_PACKET_IFACE_ARG , - &open_packet_iface, &sockfd); + &open_packet_iface, &sockfd);if (ret <0 ) goto exit; }
Signature · 1 line
2.53.0
PATCH v2 2/2 test: add test for af_packet
In reply to Stephen HemmingerAdd a test for AF_PACKET PMD.
This test was generated with Claude AI based off of existing test_pmd_ring.c with some cleanup afterwards.
--- app/test/meson.build | 1 + app/test/test_pmd_af_packet.c | 1166 +++++++++++++++++++++++++++++++++ 2 files changed, 1167 insertions(+) create mode 100644 app/test/test_pmd_af_packet.c
app/test/meson.build +1 -0
@@ -141,6 +141,7 @@ source_file_deps = { 'test_per_lcore.c': [], 'test_pflock.c': [], 'test_pie.c': ['sched'], + 'test_pmd_af_packet.c': ['net_af_packet', 'ethdev', 'bus_vdev'], 'test_pmd_perf.c': ['ethdev', 'net'] + packet_burst_generator_deps, 'test_pmd_ring.c': ['net_ring', 'ethdev', 'bus_vdev'], 'test_pmd_ring_perf.c': ['ethdev', 'net_ring', 'bus_vdev'],
app/test/test_pmd_af_packet.c new file +1166 -0
1,166 lines not on this page · raw message
Signature · 1 line
2.53.0
v5 cover af_packet: cleanup and add test
In reply to Stephen HemmingerA couple of small patches for the af_packet PMD.
Fix indentation and add a basic test.
Stephen Hemminger (2):
net/af_packet: fix indentation
test: add test for af_packet
v5 - end test after 10 packets or timeout
v4 - fix test to use stdatomic correctly
Stephen Hemminger (2):
net/af_packet: fix indentation
test: add test for af_packet
app/test/meson.build | 1 + app/test/test_pmd_af_packet.c | 1123 +++++++++++++++++++++ drivers/net/af_packet/rte_eth_af_packet.c | 64 +- 3 files changed, 1156 insertions(+), 32 deletions(-) create mode 100644 app/test/test_pmd_af_packet.c
Signature · 1 line
2.53.0
PATCH v5 1/2 net/af_packet: fix indentation
DPDK code is supposed to be indented with TABS not spaces. Also, used "unsigned int" to keep checkpatch happy.
--- drivers/net/af_packet/rte_eth_af_packet.c | 64 +++++++++++------------ 1 file changed, 32 insertions(+), 32 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +32 -32
@@ -79,7 +79,7 @@ struct __rte_cache_aligned pkt_tx_queue { };struct pmd_internals { -unsigned nb_queues; +unsigned int nb_queues;int if_index;char *if_name;
@@ -602,7 +602,7 @@ eth_dev_close(struct rte_eth_dev *dev)static int eth_link_update (struct rte_eth_dev *dev, - int wait_to_complete __rte_unused) + int wait_to_complete __rte_unused) {const struct pmd_internals *internals = dev->data->dev_private;struct rte_eth_link *dev_link = &dev->data->dev_link;
@@ -622,11 +622,11 @@ eth_link_update(struct rte_eth_dev *dev,static int eth_rx_queue_setup (struct rte_eth_dev *dev, -uint16_t rx_queue_id, - uint16_t nb_rx_desc __rte_unused, - unsigned int socket_id __rte_unused, - const struct rte_eth_rxconf *rx_conf __rte_unused, -struct rte_mempool *mb_pool) +uint16_t rx_queue_id, + uint16_t nb_rx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_rxconf *rx_conf __rte_unused, +struct rte_mempool *mb_pool) {struct pmd_internals *internals = dev->data->dev_private;struct pkt_rx_queue *pkt_q = &internals->rx_queue[rx_queue_id];
@@ -660,10 +660,10 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,static int eth_tx_queue_setup (struct rte_eth_dev *dev, -uint16_t tx_queue_id, - uint16_t nb_tx_desc __rte_unused, - unsigned int socket_id __rte_unused, - const struct rte_eth_txconf *tx_conf __rte_unused) +uint16_t tx_queue_id, + uint16_t nb_tx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_txconf *tx_conf __rte_unused) {struct pmd_internals *internals = dev->data->dev_private;
@@ -790,8 +790,8 @@ static const struct eth_dev_ops ops = {*/ static int open_packet_iface(const char *key __rte_unused, - const char *value __rte_unused, -void *extra_args) + const char *value __rte_unused, +void *extra_args) {int *sockfd = extra_args;
@@ -854,17 +854,17 @@ get_fanout(const char *fanout_mode, int if_index)static int rte_pmd_init_internals (struct rte_vdev_device *dev, -const int sockfd, -const unsigned nb_queues, -unsigned int blocksize, -unsigned int blockcnt, -unsigned int framesize, -unsigned int framecnt, +const int sockfd, +const unsigned int nb_queues, +unsigned int blocksize, +unsigned int blockcnt, +unsigned int framesize, +unsigned int framecnt,unsigned int qdisc_bypass,const char *fanout_mode, -struct pmd_internals **internals, -struct rte_eth_dev **eth_dev, -struct rte_kvargs *kvlist) +struct pmd_internals **internals, +struct rte_eth_dev **eth_dev, +struct rte_kvargs *kvlist) {const char *name =rte_vdev_device_name (dev);const unsigned int numa_node = dev->device.numa_node;
@@ -890,7 +890,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,if (pair ==NULL ) {PMD_LOG (ERR ,"%s: no interface specified for AF_PACKET ethdev" , - name); + name);return -1 ; }
@@ -899,7 +899,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, name, numa_node); *internals =rte_zmalloc_socket (name,sizeof (**internals), -0 , numa_node); +0 , numa_node);if (*internals ==NULL )return -1 ;
@@ -1140,8 +1140,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,static int rte_eth_from_packet (struct rte_vdev_device *dev, -int const *sockfd, -struct rte_kvargs *kvlist) +int const *sockfd, +struct rte_kvargs *kvlist) {const char *name =rte_vdev_device_name (dev);struct pmd_internals *internals =NULL ;
@@ -1172,7 +1172,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (qpairs <1 ) {PMD_LOG (ERR ,"%s: invalid qpairs value" , - name); + name);return -1 ; }continue ;
@@ -1182,7 +1182,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!blocksize) {PMD_LOG (ERR ,"%s: invalid blocksize value" , - name); + name);return -1 ; }continue ;
@@ -1192,7 +1192,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!framesize) {PMD_LOG (ERR ,"%s: invalid framesize value" , - name); + name);return -1 ; }continue ;
@@ -1202,7 +1202,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!framecount) {PMD_LOG (ERR ,"%s: invalid framecount value" , - name); + name);return -1 ; }continue ;
@@ -1226,7 +1226,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (framesize > blocksize) {PMD_LOG (ERR ,"%s: AF_PACKET MMAP frame size exceeds block size!" , - name); + name);return -1 ; }
@@ -1301,7 +1301,7 @@ rte_pmd_af_packet_probe(struct rte_vdev_device *dev)if (rte_kvargs_count (kvlist,ETH_AF_PACKET_IFACE_ARG ) ==1 ) { ret =rte_kvargs_process (kvlist,ETH_AF_PACKET_IFACE_ARG , - &open_packet_iface, &sockfd); + &open_packet_iface, &sockfd);if (ret <0 ) goto exit; }
Signature · 1 line
2.53.0
PATCH v5 2/2 test: add test for af_packet
In reply to Stephen HemmingerAdd a test for AF_PACKET PMD.
This test was generated with Claude AI based off of existing test_pmd_ring.c with some cleanup afterwards.
--- app/test/meson.build | 1 + app/test/test_pmd_af_packet.c | 1123 +++++++++++++++++++++++++++++++++ 2 files changed, 1124 insertions(+) create mode 100644 app/test/test_pmd_af_packet.c
app/test/meson.build +1 -0
@@ -141,6 +141,7 @@ source_file_deps = { 'test_per_lcore.c': [], 'test_pflock.c': [], 'test_pie.c': ['sched'], + 'test_pmd_af_packet.c': ['net_af_packet', 'ethdev', 'bus_vdev'], 'test_pmd_perf.c': ['ethdev', 'net'] + packet_burst_generator_deps, 'test_pmd_ring.c': ['net_ring', 'ethdev', 'bus_vdev'], 'test_pmd_ring_perf.c': ['ethdev', 'net_ring', 'bus_vdev'],
app/test/test_pmd_af_packet.c new file +1123 -0
1,123 lines not on this page · raw message
Signature · 1 line
2.53.0
v6 cover af_packet: cleanup and add test
In reply to Stephen HemmingerA couple of small patches for the af_packet PMD.
Fix indentation and add a basic test.
Stephen Hemminger (2):
net/af_packet: fix indentation
test: add test for af_packet
v6 - add myself as maintainer
v5 - end test after 10 packets or timeout
v4 - fix test to use stdatomic correctly
Stephen Hemminger (3):
maintainers: nominate myself for af_packet
net/af_packet: fix indentation
test: add test for af_packet
MAINTAINERS | 3 +- app/test/meson.build | 1 + app/test/test_pmd_af_packet.c | 1123 +++++++++++++++++++++ drivers/net/af_packet/rte_eth_af_packet.c | 64 +- 4 files changed, 1158 insertions(+), 33 deletions(-) create mode 100644 app/test/test_pmd_af_packet.c
Signature · 1 line
2.53.0
PATCH v6 1/3 maintainers: nominate myself for af_packet
John Linville has retired from RedHat is no longer actively involved with DPDK. I am retired but still active and do the review for this.
--- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
@@ -671,7 +671,7 @@ F: app/test/test_link_bonding* F: examples/bond/ Linux AF_PACKET -M: John W. Linville <[email protected]> +M: Stephen Hemminger <[email protected]> F: drivers/net/af_packet/ F: doc/guides/nics/features/afpacket.ini
Signature · 1 line
2.53.0
PATCH v6 2/3 net/af_packet: fix indentation
In reply to Stephen HemmingerDPDK code is supposed to be indented with TABS not spaces. Also, used "unsigned int" to keep checkpatch happy.
--- drivers/net/af_packet/rte_eth_af_packet.c | 64 +++++++++++------------ 1 file changed, 32 insertions(+), 32 deletions(-)
drivers/net/af_packet/rte_eth_af_packet.c +32 -32
@@ -79,7 +79,7 @@ struct __rte_cache_aligned pkt_tx_queue { };struct pmd_internals { -unsigned nb_queues; +unsigned int nb_queues;int if_index;char *if_name;
@@ -602,7 +602,7 @@ eth_dev_close(struct rte_eth_dev *dev)static int eth_link_update (struct rte_eth_dev *dev, - int wait_to_complete __rte_unused) + int wait_to_complete __rte_unused) {const struct pmd_internals *internals = dev->data->dev_private;struct rte_eth_link *dev_link = &dev->data->dev_link;
@@ -622,11 +622,11 @@ eth_link_update(struct rte_eth_dev *dev,static int eth_rx_queue_setup (struct rte_eth_dev *dev, -uint16_t rx_queue_id, - uint16_t nb_rx_desc __rte_unused, - unsigned int socket_id __rte_unused, - const struct rte_eth_rxconf *rx_conf __rte_unused, -struct rte_mempool *mb_pool) +uint16_t rx_queue_id, + uint16_t nb_rx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_rxconf *rx_conf __rte_unused, +struct rte_mempool *mb_pool) {struct pmd_internals *internals = dev->data->dev_private;struct pkt_rx_queue *pkt_q = &internals->rx_queue[rx_queue_id];
@@ -660,10 +660,10 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,static int eth_tx_queue_setup (struct rte_eth_dev *dev, -uint16_t tx_queue_id, - uint16_t nb_tx_desc __rte_unused, - unsigned int socket_id __rte_unused, - const struct rte_eth_txconf *tx_conf __rte_unused) +uint16_t tx_queue_id, + uint16_t nb_tx_desc __rte_unused, + unsigned int socket_id __rte_unused, + const struct rte_eth_txconf *tx_conf __rte_unused) {struct pmd_internals *internals = dev->data->dev_private;
@@ -790,8 +790,8 @@ static const struct eth_dev_ops ops = {*/ static int open_packet_iface(const char *key __rte_unused, - const char *value __rte_unused, -void *extra_args) + const char *value __rte_unused, +void *extra_args) {int *sockfd = extra_args;
@@ -854,17 +854,17 @@ get_fanout(const char *fanout_mode, int if_index)static int rte_pmd_init_internals (struct rte_vdev_device *dev, -const int sockfd, -const unsigned nb_queues, -unsigned int blocksize, -unsigned int blockcnt, -unsigned int framesize, -unsigned int framecnt, +const int sockfd, +const unsigned int nb_queues, +unsigned int blocksize, +unsigned int blockcnt, +unsigned int framesize, +unsigned int framecnt,unsigned int qdisc_bypass,const char *fanout_mode, -struct pmd_internals **internals, -struct rte_eth_dev **eth_dev, -struct rte_kvargs *kvlist) +struct pmd_internals **internals, +struct rte_eth_dev **eth_dev, +struct rte_kvargs *kvlist) {const char *name =rte_vdev_device_name (dev);const unsigned int numa_node = dev->device.numa_node;
@@ -890,7 +890,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,if (pair ==NULL ) {PMD_LOG (ERR ,"%s: no interface specified for AF_PACKET ethdev" , - name); + name);return -1 ; }
@@ -899,7 +899,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, name, numa_node); *internals =rte_zmalloc_socket (name,sizeof (**internals), -0 , numa_node); +0 , numa_node);if (*internals ==NULL )return -1 ;
@@ -1140,8 +1140,8 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,static int rte_eth_from_packet (struct rte_vdev_device *dev, -int const *sockfd, -struct rte_kvargs *kvlist) +int const *sockfd, +struct rte_kvargs *kvlist) {const char *name =rte_vdev_device_name (dev);struct pmd_internals *internals =NULL ;
@@ -1172,7 +1172,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (qpairs <1 ) {PMD_LOG (ERR ,"%s: invalid qpairs value" , - name); + name);return -1 ; }continue ;
@@ -1182,7 +1182,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!blocksize) {PMD_LOG (ERR ,"%s: invalid blocksize value" , - name); + name);return -1 ; }continue ;
@@ -1192,7 +1192,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!framesize) {PMD_LOG (ERR ,"%s: invalid framesize value" , - name); + name);return -1 ; }continue ;
@@ -1202,7 +1202,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (!framecount) {PMD_LOG (ERR ,"%s: invalid framecount value" , - name); + name);return -1 ; }continue ;
@@ -1226,7 +1226,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,if (framesize > blocksize) {PMD_LOG (ERR ,"%s: AF_PACKET MMAP frame size exceeds block size!" , - name); + name);return -1 ; }
@@ -1301,7 +1301,7 @@ rte_pmd_af_packet_probe(struct rte_vdev_device *dev)if (rte_kvargs_count (kvlist,ETH_AF_PACKET_IFACE_ARG ) ==1 ) { ret =rte_kvargs_process (kvlist,ETH_AF_PACKET_IFACE_ARG , - &open_packet_iface, &sockfd); + &open_packet_iface, &sockfd);if (ret <0 ) goto exit; }
Signature · 1 line
2.53.0
PATCH v6 3/3 test: add test for af_packet
In reply to Stephen HemmingerAdd a test for AF_PACKET PMD.
This test was generated with Claude AI based off of existing test_pmd_ring.c with some cleanup afterwards.
--- MAINTAINERS | 1 + app/test/meson.build | 1 + app/test/test_pmd_af_packet.c | 1123 +++++++++++++++++++++++++++++++++ 3 files changed, 1125 insertions(+) create mode 100644 app/test/test_pmd_af_packet.c
MAINTAINERS +1 -0
@@ -674,6 +674,7 @@ Linux AF_PACKET M: Stephen Hemminger <[email protected]> F: drivers/net/af_packet/ F: doc/guides/nics/features/afpacket.ini +F: app/test/test_pmd_af_packet.c Linux AF_XDP M: Ciara Loftus <[email protected]>
app/test/meson.build +1 -0
@@ -141,6 +141,7 @@ source_file_deps = { 'test_per_lcore.c': [], 'test_pflock.c': [], 'test_pie.c': ['sched'], + 'test_pmd_af_packet.c': ['net_af_packet', 'ethdev', 'bus_vdev'], 'test_pmd_perf.c': ['ethdev', 'net'] + packet_burst_generator_deps, 'test_pmd_ring.c': ['net_ring', 'ethdev', 'bus_vdev'], 'test_pmd_ring_perf.c': ['ethdev', 'net_ring', 'bus_vdev'],
app/test/test_pmd_af_packet.c new file +1123 -0
1,123 lines not on this page · raw message
Signature · 1 line
2.53.0
Re: [PATCH v6 3/3] test: add test for af_packet
29/04/2026 20:19, Stephen Hemminger:
app/test/test_pmd_af_packet.c line 16
Quoted 12 lines
app/test/test_pmd_af_packet.c new file +12
-0+#include <errno.h> +#include <fcntl.h> +#include <inttypes.h> +#include <linux/if.h> +#include <linux/if_tun.h> +#include <linux/sockios.h> +#include <pthread.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/socket.h>
There is a compilation failure for ppc about sockaddr. It seems sys/socket.h must be included before linux/if.h. I'll do the change while pulling.
Stephen Hemminger
AppliedRe: [PATCH v6 0/3] af_packet: cleanup and add test
In reply to Stephen HemmingerQuoted 18 lines · On Wed, 29 Apr 2026 11:18:58 -0700 Stephen Hemminger…
A couple of small patches for the
af_packetPMD.
Fix indentation and add a basic test.Stephen Hemminger (2):
net/af_packet: fix indentation
test: add test foraf_packetv6 - add myself as maintainer
v5 - end test after 10 packets or timeout
v4 - fix test to use stdatomic correctly
Stephen Hemminger (3):
maintainers: nominate myself foraf_packet
net/af_packet: fix indentation
test: add test foraf_packet
Quoted 7 lines
MAINTAINERS | 3 +- app/test/meson.build | 1 + app/test/test_pmd_af_packet.c | 1123 +++++++++++++++++++++ drivers/net/af_packet/rte_eth_af_packet.c | 64 +- 4 files changed, 1158 insertions(+), 33 deletions(-) create mode 100644 app/test/test_pmd_af_packet.c
Applied to next-net