net/kni: set packet input port in eth_kni_rx()
PATCH 1/1 net/kni: set packet input port in eth_kni_rx()
From: jiancheng pei <[email protected]>
Store port_id in pmd_internals when eth kni device is created. Then set packet port of rte_mbuf in function eth_kni_rx.
---
Sending patch to the email list on behalf of the Jecky, initially he sent as github pull request.
--- drivers/net/kni/rte_eth_kni.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/kni/rte_eth_kni.c +7 -1
@@ -47,6 +47,7 @@ struct pmd_queue {struct pmd_internals {struct rte_kni *kni; +uint16_t port_id;int is_kni_started;pthread_t thread;
@@ -78,9 +79,13 @@ eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)struct pmd_queue *kni_q = q;struct rte_kni *kni = kni_q->internals->kni;uint16_t nb_pkts; +int i; nb_pkts =rte_kni_rx_burst (kni, bufs, nb_bufs); - +for (i =0 ; i < nb_pkts; i++) { + bufs[i]->port = kni_q->internals->port_id; + } + kni_q->rx.pkts += nb_pkts;return nb_pkts;
@@ -372,6 +377,7 @@ eth_kni_create(struct rte_vdev_device *vdev,return NULL ; internals = eth_dev->data->dev_private; + internals->port_id = eth_dev->data->port_id; data = eth_dev->data; data->nb_rx_queues =1 ; data->nb_tx_queues =1 ;
Signature · 1 line
2.25.4
Quoted 4 lines · Ferruh Yigit
From: jiancheng pei <[email protected]>
Store
port_idinpmd_internalswhen eth kni device is created. Then set packet port ofrte_mbufin functioneth_kni_rx.
Overall looks good, except minor issues commented below.
Since I have sent on behalf of the Jecky, I will send a new version with below modifications.
Suggested title:
"net/kni: set packet input port in Rx"
Quoted 22 lines
Signed-off-by Jecky Pei <[email protected]>---
Sending patch to the email list on behalf of the Jecky, initially he sent as github pull request.--- drivers/net/kni/rte_eth_kni.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/kni/rte_eth_kni.c +1
-0@@ -47,6 +47,7 @@ struct pmd_queue {struct pmd_internals {struct rte_kni *kni; +uint16_t port_id;int is_kni_started;pthread_t thread;
drivers/net/kni/rte_eth_kni.c eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) · line 87
Quoted 10 lines
drivers/net/kni/rte_eth_kni.c +4
-1@@ -78,9 +79,13 @@ eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)struct pmd_queue *kni_q = q;struct rte_kni *kni = kni_q->internals->kni;uint16_t nb_pkts; +int i; nb_pkts =rte_kni_rx_burst (kni, bufs, nb_bufs); - +for (i =0 ; i < nb_pkts; i++) { + bufs[i]->port = kni_q->internals->port_id; + }
You can remove the curly braces.
drivers/net/kni/rte_eth_kni.c eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) · line 88
Quoted 1 line
drivers/net/kni/rte_eth_kni.c +1
-0+
There is trailing whitespace.
Quoted 12 lines
drivers/net/kni/rte_eth_kni.c +1
-0kni_q->rx.pkts += nb_pkts;return nb_pkts;@@ -372,6 +377,7 @@ eth_kni_create(struct rte_vdev_device *vdev,return NULL ; internals = eth_dev->data->dev_private; + internals->port_id = eth_dev->data->port_id; data = eth_dev->data; data->nb_rx_queues =1 ; data->nb_tx_queues =1 ;
PATCH v2 1/1 net/kni: set packet input port in Rx
In reply to Ferruh YigitFrom: jiancheng pei <[email protected]>
Store port_id in pmd_internals when eth kni device is created. Then set packet port of rte_mbuf in function eth_kni_rx.
--- drivers/net/kni/rte_eth_kni.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/kni/rte_eth_kni.c +5 -0
@@ -47,6 +47,7 @@ struct pmd_queue {struct pmd_internals {struct rte_kni *kni; +uint16_t port_id;int is_kni_started;pthread_t thread;
@@ -78,8 +79,11 @@ eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)struct pmd_queue *kni_q = q;struct rte_kni *kni = kni_q->internals->kni;uint16_t nb_pkts; +int i; nb_pkts =rte_kni_rx_burst (kni, bufs, nb_bufs); +for (i =0 ; i < nb_pkts; i++) + bufs[i]->port = kni_q->internals->port_id; kni_q->rx.pkts += nb_pkts;
@@ -372,6 +376,7 @@ eth_kni_create(struct rte_vdev_device *vdev,return NULL ; internals = eth_dev->data->dev_private; + internals->port_id = eth_dev->data->port_id; data = eth_dev->data; data->nb_rx_queues =1 ; data->nb_tx_queues =1 ;
Signature · 1 line
2.25.4
Re: [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx
Quoted 5 lines · Ferruh Yigit
From: jiancheng pei <[email protected]>
Store
port_idinpmd_internalswhen eth kni device is created. Then set packet port ofrte_mbufin functioneth_kni_rx.
LGTM.
Is this fix worth a backport?
A net driver is expected to set the port in all mbufs (m->port is initialised/reset to MBUF_INVALID_PORT).
Quoted 42 lines
Signed-off-by Jecky Pei <[email protected]>Reviewed-by Ferruh Yigit <[email protected]>--- drivers/net/kni/rte_eth_kni.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/net/kni/rte_eth_kni.c +5
-1@@ -47,6 +47,7 @@ struct pmd_queue {struct pmd_internals {struct rte_kni *kni; +uint16_t port_id;int is_kni_started;pthread_t thread;@@ -78,8 +79,11 @@ eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)struct pmd_queue *kni_q = q;struct rte_kni *kni = kni_q->internals->kni;uint16_t nb_pkts; +int i; nb_pkts =rte_kni_rx_burst (kni, bufs, nb_bufs); +for (i =0 ; i < nb_pkts; i++) + bufs[i]->port = kni_q->internals->port_id; kni_q->rx.pkts += nb_pkts;@@ -372,6 +376,7 @@ eth_kni_create(struct rte_vdev_device *vdev,return NULL ; internals = eth_dev->data->dev_private; + internals->port_id = eth_dev->data->port_id; data = eth_dev->data; data->nb_rx_queues =1 ; data->nb_tx_queues =1 ; --2.25.4
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx
Quoted 10 lines · David Marchand
Quoted 5 lines · Ferruh Yigit
From: jiancheng pei <[email protected]>
Store
port_idinpmd_internalswhen eth kni device is created. Then set packet port ofrte_mbufin functioneth_kni_rx.LGTM.
Is this fix worth a backport?
Makes sense, +1 to add stable tag.
Quoted 49 lines
A net driver is expected to set the port in all mbufs (
m->portis initialised/reset toMBUF_INVALID_PORT).Quoted 42 lines
Signed-off-by Jecky Pei <[email protected]>Reviewed-by Ferruh Yigit <[email protected]>--- drivers/net/kni/rte_eth_kni.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/net/kni/rte_eth_kni.c +5
-1@@ -47,6 +47,7 @@ struct pmd_queue {struct pmd_internals {struct rte_kni *kni; +uint16_t port_id;int is_kni_started;pthread_t thread;@@ -78,8 +79,11 @@ eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)struct pmd_queue *kni_q = q;struct rte_kni *kni = kni_q->internals->kni;uint16_t nb_pkts; +int i; nb_pkts =rte_kni_rx_burst (kni, bufs, nb_bufs); +for (i =0 ; i < nb_pkts; i++) + bufs[i]->port = kni_q->internals->port_id; kni_q->rx.pkts += nb_pkts;@@ -372,6 +376,7 @@ eth_kni_create(struct rte_vdev_device *vdev,return NULL ; internals = eth_dev->data->dev_private; + internals->port_id = eth_dev->data->port_id; data = eth_dev->data; data->nb_rx_queues =1 ; data->nb_tx_queues =1 ; --2.25.4
Ferruh Yigit
AppliedRe: [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx
Quoted 5 lines · Ferruh Yigit
Quoted 4 lines · David Marchand
Quoted 3 lines · Ferruh Yigit
From: jiancheng pei <[email protected]>
Quoted 16 lines
Quoted 6 lines
Quoted 2 lines
Store
port_idinpmd_internalswhen eth kni device is created. Then set packet port ofrte_mbufin functioneth_kni_rx.LGTM.
Is this fix worth a backport?
Makes sense, +1 to add stable tag.
Quoted 7 lines
A net driver is expected to set the port in all mbufs (
m->portis initialised/reset toMBUF_INVALID_PORT).Quoted 3 lines
Signed-off-by Jecky Pei <[email protected]>Reviewed-by Ferruh Yigit <[email protected]>
Applied to dpdk-next-net/master, thanks.