Skip to content

Commit

Permalink
net/kni: set packet input port in Rx
Browse files Browse the repository at this point in the history
[ upstream commit cb4a65d ]

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>
  • Loading branch information
Jecky Pei authored and kevintraynor committed Aug 28, 2020
1 parent 55ae014 commit 15f7abe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/kni/rte_eth_kni.c
Expand Up @@ -45,6 +45,7 @@ struct pmd_queue {

struct pmd_internals {
struct rte_kni *kni;
uint16_t port_id;
int is_kni_started;

pthread_t thread;
Expand Down Expand Up @@ -76,8 +77,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;
kni_q->rx.err_pkts += nb_bufs - nb_pkts;
Expand Down Expand Up @@ -352,6 +356,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;
Expand Down

0 comments on commit 15f7abe

Please sign in to comment.