From: Adrien Mazarguil Date: Tue, 14 Apr 2015 14:23:55 +0000 (+0200) Subject: enic: fix port id in received mbufs X-Git-Tag: spdx-start~9308 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2c46f7ffe1ae0e6973c06c22c1385ac684003f83;p=dpdk.git enic: fix port id in received mbufs This field is not supposed to contain the RX queue index. Applications can rely on it to determine the port a given mbuf comes from. Signed-off-by: Adrien Mazarguil Acked-by: Sujith Sankar --- diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h index a50bff1498..0eba334231 100644 --- a/lib/librte_pmd_enic/enic.h +++ b/lib/librte_pmd_enic/enic.h @@ -99,6 +99,7 @@ struct enic { struct vnic_dev_bar bar0; struct vnic_dev *vdev; + unsigned int port_id; struct rte_eth_dev *rte_dev; struct enic_fdir fdir; char bdf_name[ENICPMD_BDF_LENGTH]; diff --git a/lib/librte_pmd_enic/enic_ethdev.c b/lib/librte_pmd_enic/enic_ethdev.c index 3e53f86601..a319e1eca9 100644 --- a/lib/librte_pmd_enic/enic_ethdev.c +++ b/lib/librte_pmd_enic/enic_ethdev.c @@ -567,6 +567,7 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev) ENICPMD_FUNC_TRACE(); + enic->port_id = eth_dev->data->port_id; enic->rte_dev = eth_dev; eth_dev->dev_ops = &enicpmd_eth_dev_ops; eth_dev->rx_pkt_burst = &enicpmd_recv_pkts; diff --git a/lib/librte_pmd_enic/enic_main.c b/lib/librte_pmd_enic/enic_main.c index 0e40d4665d..15313c2ebb 100644 --- a/lib/librte_pmd_enic/enic_main.c +++ b/lib/librte_pmd_enic/enic_main.c @@ -344,7 +344,7 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq) hdr_mbuf->data_off = RTE_PKTMBUF_HEADROOM; hdr_mbuf->nb_segs = 2; - hdr_mbuf->port = rq->index; + hdr_mbuf->port = enic->port_id; hdr_mbuf->next = mbuf; dma_addr = (dma_addr_t) @@ -359,7 +359,7 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq) type = RQ_ENET_TYPE_NOT_SOP; } else { mbuf->nb_segs = 1; - mbuf->port = rq->index; + mbuf->port = enic->port_id; } mbuf->data_off = RTE_PKTMBUF_HEADROOM;