DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/kni: set packet input port in eth_kni_rx()
@ 2020-07-01  7:49 Ferruh Yigit
  2020-07-24 14:45 ` Ferruh Yigit
  2020-07-24 15:10 ` [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx Ferruh Yigit
  0 siblings, 2 replies; 6+ messages in thread
From: Ferruh Yigit @ 2020-07-01  7:49 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit, jiancheng pei

From: jiancheng pei <jpei@sonicwall.com>

Store port_id in pmd_internals when eth kni device is created.
Then set packet port of rte_mbuf in function eth_kni_rx.

Signed-off-by: Jecky Pei <jpei@sonicwall.com>
---
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(-)

diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index d88cb1778..e3f5b101d 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -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;
-- 
2.25.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] net/kni: set packet input port in eth_kni_rx()
  2020-07-01  7:49 [dpdk-dev] [PATCH] net/kni: set packet input port in eth_kni_rx() Ferruh Yigit
@ 2020-07-24 14:45 ` Ferruh Yigit
  2020-07-24 15:10 ` [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx Ferruh Yigit
  1 sibling, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2020-07-24 14:45 UTC (permalink / raw)
  To: dev; +Cc: jiancheng pei

On 7/1/2020 8:49 AM, Ferruh Yigit wrote:
> From: jiancheng pei <jpei@sonicwall.com>
> 
> Store port_id in pmd_internals when eth kni device is created.
> Then set packet port of rte_mbuf in function eth_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"

> 
> Signed-off-by: Jecky Pei <jpei@sonicwall.com>
> ---
> 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(-)
> 
> diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
> index d88cb1778..e3f5b101d 100644
> --- a/drivers/net/kni/rte_eth_kni.c
> +++ b/drivers/net/kni/rte_eth_kni.c
> @@ -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;
> +	}

You can remove the curly braces.

> +	

There is trailing whitespace.

>  	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;
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx
  2020-07-01  7:49 [dpdk-dev] [PATCH] net/kni: set packet input port in eth_kni_rx() Ferruh Yigit
  2020-07-24 14:45 ` Ferruh Yigit
@ 2020-07-24 15:10 ` Ferruh Yigit
  2020-07-29 17:02   ` David Marchand
  1 sibling, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2020-07-24 15:10 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Jecky Pei

From: jiancheng pei <jpei@sonicwall.com>

Store port_id in pmd_internals when eth kni device is created.
Then set packet port of rte_mbuf in function eth_kni_rx.

Signed-off-by: Jecky Pei <jpei@sonicwall.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/kni/rte_eth_kni.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index cde98f0bb2..831fe96c96 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx
  2020-07-24 15:10 ` [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx Ferruh Yigit
@ 2020-07-29 17:02   ` David Marchand
  2020-07-29 17:06     ` Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: David Marchand @ 2020-07-29 17:02 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Jecky Pei

On Fri, Jul 24, 2020 at 5:10 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> From: jiancheng pei <jpei@sonicwall.com>
>
> Store port_id in pmd_internals when eth kni device is created.
> Then set packet port of rte_mbuf in function eth_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).


>
> Signed-off-by: Jecky Pei <jpei@sonicwall.com>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
>  drivers/net/kni/rte_eth_kni.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
> index cde98f0bb2..831fe96c96 100644
> --- a/drivers/net/kni/rte_eth_kni.c
> +++ b/drivers/net/kni/rte_eth_kni.c
> @@ -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
>



-- 
David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx
  2020-07-29 17:02   ` David Marchand
@ 2020-07-29 17:06     ` Ferruh Yigit
  2020-07-29 22:28       ` Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2020-07-29 17:06 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Jecky Pei

On 7/29/2020 6:02 PM, David Marchand wrote:
> On Fri, Jul 24, 2020 at 5:10 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>> From: jiancheng pei <jpei@sonicwall.com>
>>
>> Store port_id in pmd_internals when eth kni device is created.
>> Then set packet port of rte_mbuf in function eth_kni_rx.
> 
> LGTM.
> 
> Is this fix worth a backport?

Makes sense, +1 to add stable tag.

> A net driver is expected to set the port in all mbufs (m->port is
> initialised/reset to MBUF_INVALID_PORT).
> 
> 
>>
>> Signed-off-by: Jecky Pei <jpei@sonicwall.com>
>> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>>  drivers/net/kni/rte_eth_kni.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
>> index cde98f0bb2..831fe96c96 100644
>> --- a/drivers/net/kni/rte_eth_kni.c
>> +++ b/drivers/net/kni/rte_eth_kni.c
>> @@ -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
>>
> 
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx
  2020-07-29 17:06     ` Ferruh Yigit
@ 2020-07-29 22:28       ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2020-07-29 22:28 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Jecky Pei

On 7/29/2020 6:06 PM, Ferruh Yigit wrote:
> On 7/29/2020 6:02 PM, David Marchand wrote:
>> On Fri, Jul 24, 2020 at 5:10 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>
>>> From: jiancheng pei <jpei@sonicwall.com>
>>>
>>> Store port_id in pmd_internals when eth kni device is created.
>>> Then set packet port of rte_mbuf in function eth_kni_rx.
>>
>> LGTM.
>>
>> Is this fix worth a backport?
> 
> Makes sense, +1 to add stable tag.
> 
>> A net driver is expected to set the port in all mbufs (m->port is
>> initialised/reset to MBUF_INVALID_PORT).
>>
>>
>>>
>>> Signed-off-by: Jecky Pei <jpei@sonicwall.com>
>>> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Cc: stable@dpdk.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-29 22:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01  7:49 [dpdk-dev] [PATCH] net/kni: set packet input port in eth_kni_rx() Ferruh Yigit
2020-07-24 14:45 ` Ferruh Yigit
2020-07-24 15:10 ` [dpdk-dev] [PATCH v2] net/kni: set packet input port in Rx Ferruh Yigit
2020-07-29 17:02   ` David Marchand
2020-07-29 17:06     ` Ferruh Yigit
2020-07-29 22:28       ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).