Re: [RFC 1/7] net/af_xdp: new PMD driver
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2018-02-28 23:45:25
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2018-02-28 23:45:25
On Tue, 27 Feb 2018 17:33:00 +0800 Qi Zhang [off-list ref] wrote:
+
+static uint16_t
+eth_af_xdp_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
+{
+ struct pmd_internals *internals = queue;
+ struct xdp_queue *rxq = &internals->rx;
+ struct rte_mbuf *mbuf;
+ unsigned long dropped = 0;
+ unsigned long rx_bytes = 0;
+ uint16_t count = 0;
+
+ nb_pkts = nb_pkts < ETH_AF_XDP_RX_BATCH_SIZE ?
+ nb_pkts : ETH_AF_XDP_RX_BATCH_SIZE;
+Put declarations first. Why not iterate if nb_pkts is huge?
+ struct xdp_desc descs[ETH_AF_XDP_RX_BATCH_SIZE];
+ void *indexes[ETH_AF_XDP_RX_BATCH_SIZE];
+ int rcvd, i;
+ /* fill rx ring */
+ if (rxq->num_free >= ETH_AF_XDP_RX_BATCH_SIZE) {Blank line after declarations before code please.