[v3,4/6] net/macb: zero ol_flags in each recv function

Message ID 1733814479-412155-1-git-send-email-liwencheng@phytium.com.cn (mailing list archive)
State Changes Requested
Delegated to: Stephen Hemminger
Headers
Series [v2,1/3] net/macb: add new driver |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Wencheng Li Dec. 10, 2024, 7:07 a.m. UTC
Because macb driver does not support hardware offload, ol_flags
field of mbuf structure needs to be zeroed in recv function.

Fixes: 97fd6a929cf8 ("net/macb: add new driver")
Cc: liwencheng@phytium.com.cn

Signed-off-by: Wencheng Li <liwencheng@phytium.com.cn>
---
 drivers/net/macb/macb_rxtx.c          |  2 ++
 drivers/net/macb/macb_rxtx_vec_neon.c | 10 ++++++++++
 2 files changed, 12 insertions(+)
  

Comments

Stephen Hemminger March 20, 2025, 6:53 p.m. UTC | #1
On Tue, 10 Dec 2024 07:07:59 +0000
Wencheng Li <liwencheng@phytium.com.cn> wrote:

> Because macb driver does not support hardware offload, ol_flags
> field of mbuf structure needs to be zeroed in recv function.
> 
> Fixes: 97fd6a929cf8 ("net/macb: add new driver")
> Cc: liwencheng@phytium.com.cn
> 
> Signed-off-by: Wencheng Li <liwencheng@phytium.com.cn>

Don't send incremental patches like this.
Driver is not yet merged. Pleas fix the first commit instead.
  

Patch

diff --git a/drivers/net/macb/macb_rxtx.c b/drivers/net/macb/macb_rxtx.c
index fa36a1e..d381e77 100644
--- a/drivers/net/macb/macb_rxtx.c
+++ b/drivers/net/macb/macb_rxtx.c
@@ -235,6 +235,7 @@  uint16_t eth_macb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			rxm->pkt_len = len;
 			rxm->data_len = len;
 			rxm->port = rxq->port_id;
+			rxm->ol_flags = 0;
 
 			eth_hdr = rte_pktmbuf_mtod(rxm, struct rte_ether_hdr *);
 			ether_type = eth_hdr->ether_type;
@@ -459,6 +460,7 @@  uint16_t eth_macb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			}
 
 			first_seg->port = rxq->port_id;
+			first_seg->ol_flags = 0;
 			/*
 			 * Store the mbuf address into the next entry of the array
 			 * of returned packets.
diff --git a/drivers/net/macb/macb_rxtx_vec_neon.c b/drivers/net/macb/macb_rxtx_vec_neon.c
index 3888d5d..8734d44 100644
--- a/drivers/net/macb/macb_rxtx_vec_neon.c
+++ b/drivers/net/macb/macb_rxtx_vec_neon.c
@@ -133,6 +133,14 @@  static inline void macb_pkts_to_port_v(struct rte_mbuf **rx_pkts, uint16_t port_
 	rx_pkts[3]->port = port_id;
 }
 
+static inline void macb_desc_to_olflags_v(struct rte_mbuf **rx_pkts)
+{
+	rx_pkts[0]->ol_flags = 0;
+	rx_pkts[1]->ol_flags = 0;
+	rx_pkts[2]->ol_flags = 0;
+	rx_pkts[3]->ol_flags = 0;
+}
+
 static inline void macb_free_rx_pkts(struct macb_rx_queue *rxq,
 				     struct rte_mbuf **rx_pkts, int pos, uint16_t count)
 {
@@ -289,6 +297,8 @@  static uint16_t macb_recv_raw_pkts_vec(struct macb_rx_queue *rxq,
 		/* C.2 get 4 pkts RX_USED value */
 		staterr = vzipq_u8(sterr_tmp1.val[0], sterr_tmp2.val[0]).val[0];
 
+		macb_desc_to_olflags_v(&rx_pkts[pos]);
+
 		/* C.3 expand RX_USED bit to saturate UINT8 */
 		staterr = vshlq_n_u8(staterr, MACB_UINT8_BIT - 1);
 		staterr = vreinterpretq_u8_s8(vshrq_n_s8(vreinterpretq_s8_u8(staterr),