Skip to contentSkip to conversation

net/i40e: fix compile error

PATCH Superseded Qi Zhang 3 participants 7 messages Feb 20, 2017 – Feb 22, 2017 Network drivers

lore
Share & tools
lore

Qi Zhang

author
#0 lore raw

PATCH v2 1/1 net/i40e: fix compile error

This patch fix the compile error when RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC is disabled.

Fixes 9ed94e5bb04e ("i40e: add vector Rx")
---
 drivers/net/i40e/i40e_rxtx.c | 2 +-
 drivers/net/i40e/i40e_rxtx.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_rxtx.c +1 -1
index 48429cc..40f4a45 100644
@@ -2209,11 +2209,11 @@ i40e_reset_rx_queue(struct i40e_rx_queue *rxq)
 	for (i = 0; i < len * sizeof(union i40e_rx_desc); i++)
 		((volatile char *)rxq->rx_ring)[i] = 0;
 
-#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	memset(&rxq->fake_mbuf, 0x0, sizeof(rxq->fake_mbuf));
 	for (i = 0; i < RTE_PMD_I40E_RX_MAX_BURST; ++i)
 		rxq->sw_ring[rxq->nb_rx_desc + i].mbuf = &rxq->fake_mbuf;
 
+#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	rxq->rx_nb_avail = 0;
 	rxq->rx_next_avail = 0;
 	rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
drivers/net/i40e/i40e_rxtx.h +1 -1
index 9df8a56..4f7f319 100644
@@ -119,11 +119,11 @@ struct i40e_rx_queue {
 	uint16_t nb_rx_hold; /**< number of held free RX desc */
 	struct rte_mbuf *pkt_first_seg; /**< first segment of current packet */
 	struct rte_mbuf *pkt_last_seg; /**< last segment of current packet */
+	struct rte_mbuf fake_mbuf; /**< dummy mbuf */
 #ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	uint16_t rx_nb_avail; /**< number of staged packets ready */
 	uint16_t rx_next_avail; /**< index of next staged packets */
 	uint16_t rx_free_trigger; /**< triggers rx buffer allocation */
-	struct rte_mbuf fake_mbuf; /**< dummy mbuf */
 	struct rte_mbuf *rx_stage[RTE_PMD_I40E_RX_MAX_BURST * 2];
 #endif
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 2 lines · Qi Zhang

This patch fix the compile error when RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC is disabled.

Compile error:
CC i40e_rxtx_vec_sse.o
.../drivers/net/i40e/i40e_rxtx_vec_sse.c:72:26:
error: no member named 'fake_mbuf' in 'struct i40e_rx_queue'

            rxep[i].mbuf = &rxq->fake_mbuf;
                            ~~~  ^
Quoted 15 lines
Fixes 9ed94e5bb04e ("i40e: add vector Rx")
---
 drivers/net/i40e/i40e_rxtx.c | 2 +-
 drivers/net/i40e/i40e_rxtx.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_rxtx.c +0 -0
index 48429cc..40f4a45 100644

drivers/net/i40e/i40e_rxtx.c i40e_reset_rx_queue(struct i40e_rx_queue *rxq) · line 2216

Quoted 9 lines
drivers/net/i40e/i40e_rxtx.c +1 -1
@@ -2209,11 +2209,11 @@ i40e_reset_rx_queue(struct i40e_rx_queue *rxq)
 	for (i = 0; i < len * sizeof(union i40e_rx_desc); i++)
 		((volatile char *)rxq->rx_ring)[i] = 0;
 
-#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	memset(&rxq->fake_mbuf, 0x0, sizeof(rxq->fake_mbuf));
 	for (i = 0; i < RTE_PMD_I40E_RX_MAX_BURST; ++i)
 		rxq->sw_ring[rxq->nb_rx_desc + i].mbuf = &rxq->fake_mbuf;
 
+#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC

Hi Qi,

Just to double check, below update in i40e_rxtx.h is enough to fix the build error.

Can you please confirm assigning fake_mbuf to sw_ring[] is required step, independent from RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC enabled or not? And it can be good to document this in commit log.

Thanks,
ferruh

Quoted 21 lines
drivers/net/i40e/i40e_rxtx.c +0 -0
 	rxq->rx_nb_avail = 0;
 	rxq->rx_next_avail = 0;
 	rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
drivers/net/i40e/i40e_rxtx.h +1 -1
index 9df8a56..4f7f319 100644
@@ -119,11 +119,11 @@ struct i40e_rx_queue {
 	uint16_t nb_rx_hold; /**< number of held free RX desc */
 	struct rte_mbuf *pkt_first_seg; /**< first segment of current packet */
 	struct rte_mbuf *pkt_last_seg; /**< last segment of current packet */
+	struct rte_mbuf fake_mbuf; /**< dummy mbuf */
 #ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	uint16_t rx_nb_avail; /**< number of staged packets ready */
 	uint16_t rx_next_avail; /**< index of next staged packets */
 	uint16_t rx_free_trigger; /**< triggers rx buffer allocation */
-	struct rte_mbuf fake_mbuf; /**< dummy mbuf */
 	struct rte_mbuf *rx_stage[RTE_PMD_I40E_RX_MAX_BURST * 2];
 #endif
 
author
#3 lore raw

PATCH v3 1/1 net/i40e: fix compile error

In reply to Qi Zhang

This patch fix the compile error when RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC is disabled. fake_mbuf is also required to be initialized and assigned to additional sw_ring entries for vector PMD.

Fixes 9ed94e5bb04e ("i40e: add vector Rx")
---
 drivers/net/i40e/i40e_rxtx.c | 2 +-
 drivers/net/i40e/i40e_rxtx.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_rxtx.c +1 -1
index 48429cc..40f4a45 100644
@@ -2209,11 +2209,11 @@ i40e_reset_rx_queue(struct i40e_rx_queue *rxq)
 	for (i = 0; i < len * sizeof(union i40e_rx_desc); i++)
 		((volatile char *)rxq->rx_ring)[i] = 0;
 
-#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	memset(&rxq->fake_mbuf, 0x0, sizeof(rxq->fake_mbuf));
 	for (i = 0; i < RTE_PMD_I40E_RX_MAX_BURST; ++i)
 		rxq->sw_ring[rxq->nb_rx_desc + i].mbuf = &rxq->fake_mbuf;
 
+#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	rxq->rx_nb_avail = 0;
 	rxq->rx_next_avail = 0;
 	rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
drivers/net/i40e/i40e_rxtx.h +1 -1
index 9df8a56..4f7f319 100644
@@ -119,11 +119,11 @@ struct i40e_rx_queue {
 	uint16_t nb_rx_hold; /**< number of held free RX desc */
 	struct rte_mbuf *pkt_first_seg; /**< first segment of current packet */
 	struct rte_mbuf *pkt_last_seg; /**< last segment of current packet */
+	struct rte_mbuf fake_mbuf; /**< dummy mbuf */
 #ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	uint16_t rx_nb_avail; /**< number of staged packets ready */
 	uint16_t rx_next_avail; /**< index of next staged packets */
 	uint16_t rx_free_trigger; /**< triggers rx buffer allocation */
-	struct rte_mbuf fake_mbuf; /**< dummy mbuf */
 	struct rte_mbuf *rx_stage[RTE_PMD_I40E_RX_MAX_BURST * 2];
 #endif
 
Signature · 1 line
2.7.4
#2 lore raw
In reply to Ferruh Yigit

Hi Ferruh:

Quoted 48 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, February 20, 2017 7:44 PM
To: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-stable] [PATCH v2] net/i40e: fix compile error

Quoted 3 lines · Qi Zhang

This patch fix the compile error when
RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
is disabled.

Compile error:
CC i40e_rxtx_vec_sse.o
.../drivers/net/i40e/i40e_rxtx_vec_sse.c:72:26:
error: no member named 'fake_mbuf' in 'struct i40e_rx_queue'

            rxep[i].mbuf = &rxq->fake_mbuf;
                            ~~~  ^

drivers/net/i40e/i40e_rxtx.c i40e_reset_rx_queue(struct i40e_rx_queue

Quoted 15 lines
Fixes 9ed94e5bb04e ("i40e: add vector Rx")
---
 drivers/net/i40e/i40e_rxtx.c | 2 +-
 drivers/net/i40e/i40e_rxtx.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_rxtx.c index 48429cc..40f4a45 100644

drivers/net/i40e/i40e_rxtx.c +0 -0
@@ -2209,11 +2209,11 @@ i40e_reset_rx_queue(struct i40e_rx_queue

*rxq)

drivers/net/i40e/i40e_rxtx.c i40e_reset_rx_queue(struct i40e_rx_queue *rxq) · line 2216

Quoted 9 lines
drivers/net/i40e/i40e_rxtx.c +1 -1
 	for (i = 0; i < len * sizeof(union i40e_rx_desc); i++)
 		((volatile char *)rxq->rx_ring)[i] = 0;
 
-#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	memset(&rxq->fake_mbuf, 0x0, sizeof(rxq->fake_mbuf));
 	for (i = 0; i < RTE_PMD_I40E_RX_MAX_BURST; ++i)
 		rxq->sw_ring[rxq->nb_rx_desc + i].mbuf = &rxq->fake_mbuf;
 
+#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC

Hi Qi,

Quoted 5 lines

Just to double check, below update in i40e_rxtx.h is enough to fix the build error.

Can you please confirm assigning fake_mbuf to sw_ring[] is required step, independent from RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC enabled or not?

I think it's necessary to assign fake_mbuf for couple additional entries in sw_ring
Because there is no place to initialize these entries (i40e_rxq_rearm only cover entries round in nb_rx_desc) while _recv_raw_pkts_vec require these entries in some situation.(though only RTE_I40E_DESCS_PER_LOOP-1 entries are required, but we can reuse the code)

Quoted 1 line

And it can be good to document this in commit log.

OK, I will add it in v3

Quoted 26 lines

Thanks,
ferruh

Quoted 21 lines
drivers/net/i40e/i40e_rxtx.c +0 -1
 	rxq->rx_nb_avail = 0;
 	rxq->rx_next_avail = 0;
 	rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1); diff
--git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h

index 9df8a56..4f7f319 100644

drivers/net/i40e/i40e_rxtx.h +1 -1
@@ -119,11 +119,11 @@ struct i40e_rx_queue {
 	uint16_t nb_rx_hold; /**< number of held free RX desc */
 	struct rte_mbuf *pkt_first_seg; /**< first segment of current packet */
 	struct rte_mbuf *pkt_last_seg; /**< last segment of current packet
 */
+	struct rte_mbuf fake_mbuf; /**< dummy mbuf */
 #ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 	uint16_t rx_nb_avail; /**< number of staged packets ready */
 	uint16_t rx_next_avail; /**< index of next staged packets */
 	uint16_t rx_free_trigger; /**< triggers rx buffer allocation */
-	struct rte_mbuf fake_mbuf; /**< dummy mbuf */
 	struct rte_mbuf *rx_stage[RTE_PMD_I40E_RX_MAX_BURST * 2];  #endif
 
#4 lore raw
In reply to Qi Zhang

Hi Qi,

Quoted 12 lines

-----Original Message-----
From: stable [mailto:[email protected]] On Behalf Of Qi Zhang
Sent: Monday, February 20, 2017 6:12 PM
To: Wu, Jingjing; Zhang, Helin
Cc: [email protected]; Zhang, Qi Z; [email protected]
Subject: [dpdk-stable] [PATCH v3] net/i40e: fix compile error

This patch fix the compile error when RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
is disabled. fake_mbuf is also required to be initialized and assigned to additional sw_ring entries for vector PMD.

Quoted 5 lines
Fixes 9ed94e5bb04e ("i40e: add vector Rx")

---

Please, try to remember to include the changes you have made in the different revisions, after the "---".

Thanks,
Pablo

#5 lore raw

Thanks for reminder, will follow:)

Quoted 34 lines

-----Original Message-----
From: De Lara Guarch, Pablo
Sent: Tuesday, February 21, 2017 4:15 PM
To: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; [email protected]
Subject: RE: [dpdk-stable] [PATCH v3] net/i40e: fix compile error

Hi Qi,

Quoted 12 lines

-----Original Message-----
From: stable [mailto:[email protected]] On Behalf Of Qi Zhang
Sent: Monday, February 20, 2017 6:12 PM
To: Wu, Jingjing; Zhang, Helin
Cc: [email protected]; Zhang, Qi Z; [email protected]
Subject: [dpdk-stable] [PATCH v3] net/i40e: fix compile error

This patch fix the compile error when RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
is disabled. fake_mbuf is also required to be initialized and assigned to additional sw_ring entries for vector PMD.

Quoted 5 lines
Fixes 9ed94e5bb04e ("i40e: add vector Rx")

---

Please, try to remember to include the changes you have made in the different revisions, after the "---".

Thanks,
Pablo

Applied
#6 lore raw
In reply to Qi Zhang
Quoted 8 lines · Qi Zhang

This patch fix the compile error when RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC is disabled. fake_mbuf is also required to be initialized and assigned to additional sw_ring entries for vector PMD.

Fixes 9ed94e5bb04e ("i40e: add vector Rx")
    Fixes: 4861cde46116 ("i40e: new poll mode driver")

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