drivers/net: do not touch mbuf next or nb segs on Rx
authorOlivier Matz <olivier.matz@6wind.com>
Tue, 4 Apr 2017 16:28:03 +0000 (18:28 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 5 Apr 2017 09:30:29 +0000 (11:30 +0200)
Now that the m->next pointer and m->nb_segs is expected to be set (to
NULL and 1 respectively) after a mempool_get(), we can avoid to write them
in the Rx functions of drivers.

Only some drivers are patched, it's not an exhaustive patch. It gives
the idea to do the same in other drivers.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
drivers/net/i40e/i40e_rxtx_vec_sse.c
drivers/net/ixgbe/ixgbe_rxtx.c
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
drivers/net/null/rte_eth_null.c
drivers/net/virtio/virtio_rxtx.c

index deed7e2..1a8d88d 100644 (file)
@@ -424,12 +424,6 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
                        /* store the resulting 32-bit value */
                        *(int *)split_packet = _mm_cvtsi128_si32(eop_bits);
                        split_packet += RTE_I40E_DESCS_PER_LOOP;
-
-                       /* zero-out next pointers */
-                       rx_pkts[pos]->next = NULL;
-                       rx_pkts[pos + 1]->next = NULL;
-                       rx_pkts[pos + 2]->next = NULL;
-                       rx_pkts[pos + 3]->next = NULL;
                }
 
                /* C.3 calc available number of desc */
index 0808a4c..e8b5107 100644 (file)
@@ -1585,8 +1585,6 @@ ixgbe_rx_alloc_bufs(struct ixgbe_rx_queue *rxq, bool reset_mbuf)
                /* populate the static rte mbuf fields */
                mb = rxep[i].mbuf;
                if (reset_mbuf) {
-                       mb->next = NULL;
-                       mb->nb_segs = 1;
                        mb->port = rxq->port_id;
                }
 
@@ -2194,12 +2192,6 @@ next_desc:
                        goto next_desc;
                }
 
-               /*
-                * This is the last buffer of the received packet - return
-                * the current cluster to the user.
-                */
-               rxm->next = NULL;
-
                /* Initialize the first mbuf of the returned packet */
                ixgbe_fill_cluster_head_buf(first_seg, &rxd, rxq, staterr);
 
index 5930aa1..28345e6 100644 (file)
@@ -330,12 +330,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
                        *(int *)split_packet = ~stat & IXGBE_VPMD_DESC_EOP_MASK;
 
                        split_packet += RTE_IXGBE_DESCS_PER_LOOP;
-
-                       /* zero-out next pointers */
-                       rx_pkts[pos]->next = NULL;
-                       rx_pkts[pos + 1]->next = NULL;
-                       rx_pkts[pos + 2]->next = NULL;
-                       rx_pkts[pos + 3]->next = NULL;
                }
 
                rte_prefetch_non_temporal(rxdp + RTE_IXGBE_DESCS_PER_LOOP);
index 0861d91..2212754 100644 (file)
@@ -425,12 +425,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
                        /* store the resulting 32-bit value */
                        *(int *)split_packet = _mm_cvtsi128_si32(eop_bits);
                        split_packet += RTE_IXGBE_DESCS_PER_LOOP;
-
-                       /* zero-out next pointers */
-                       rx_pkts[pos]->next = NULL;
-                       rx_pkts[pos + 1]->next = NULL;
-                       rx_pkts[pos + 2]->next = NULL;
-                       rx_pkts[pos + 3]->next = NULL;
                }
 
                /* C.3 calc available number of desc */
index 57203e2..7e14da0 100644 (file)
@@ -112,8 +112,6 @@ eth_null_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
                        break;
                bufs[i]->data_len = (uint16_t)packet_size;
                bufs[i]->pkt_len = packet_size;
-               bufs[i]->nb_segs = 1;
-               bufs[i]->next = NULL;
                bufs[i]->port = h->internals->port_id;
        }
 
index fcd9e93..ea0bd9d 100644 (file)
@@ -772,8 +772,6 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                rxm->ol_flags = 0;
                rxm->vlan_tci = 0;
 
-               rxm->nb_segs = 1;
-               rxm->next = NULL;
                rxm->pkt_len = (uint32_t)(len[i] - hdr_size);
                rxm->data_len = (uint16_t)(len[i] - hdr_size);
 
@@ -900,7 +898,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,
 
                rxm->data_off = RTE_PKTMBUF_HEADROOM;
                rxm->nb_segs = seg_num;
-               rxm->next = NULL;
                rxm->ol_flags = 0;
                rxm->vlan_tci = 0;
                rxm->pkt_len = (uint32_t)(len[0] - hdr_size);
@@ -945,7 +942,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,
                                rxm = rcv_pkts[extra_idx];
 
                                rxm->data_off = RTE_PKTMBUF_HEADROOM - hdr_size;
-                               rxm->next = NULL;
                                rxm->pkt_len = (uint32_t)(len[extra_idx]);
                                rxm->data_len = (uint16_t)(len[extra_idx]);