From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id B85731DA4 for ; Thu, 7 Mar 2019 04:22:19 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2019 19:22:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,450,1544515200"; d="scan'208";a="138713519" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206]) by FMSMGA003.fm.intel.com with ESMTP; 06 Mar 2019 19:22:17 -0800 Date: Thu, 7 Mar 2019 11:19:10 +0800 From: Ye Xiaolong To: David Marchand Cc: dev , Qi Zhang Message-ID: <20190307031909.GA89956@intel.com> References: <20190301080947.91086-1-xiaolong.ye@intel.com> <20190301080947.91086-2-xiaolong.ye@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v1 1/6] net/af_xdp: introduce AF_XDP PMD driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2019 03:22:20 -0000 Hi, David Thanks for your review. On 03/05, David Marchand wrote: >On Fri, Mar 1, 2019 at 9:13 AM Xiaolong Ye wrote: > >> diff --git a/doc/guides/rel_notes/release_18_11.rst >> b/doc/guides/rel_notes/release_18_11.rst >> index 65bab557d..e0918441a 100644 >> --- a/doc/guides/rel_notes/release_18_11.rst >> +++ b/doc/guides/rel_notes/release_18_11.rst >> @@ -229,6 +229,13 @@ New Features >> The AESNI MB PMD has been updated with additional support for the >> AES-GCM >> algorithm. >> >> +* **Added the AF_XDP PMD.** >> + >> + Added a Linux-specific PMD driver for AF_XDP, it can create the AF_XDP >> socket >> + and bind it to a specific netdev queue, it allows a DPDK application to >> send >> + and receive raw packets through the socket which would bypass the kernel >> + network stack to achieve high performance packet processing. >> + >> > >Should be in 19.05 release notes. Ooops, my bad, will swith to 19.05 in next version. > > >diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c >> b/drivers/net/af_xdp/rte_eth_af_xdp.c >> new file mode 100644 >> index 000000000..6de769650 >> --- /dev/null >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c >> >> [snip] > >+struct pkt_rx_queue { >> + struct xsk_ring_cons rx; >> + struct xsk_umem_info *umem; >> + struct xsk_socket *xsk; >> + struct rte_mempool *mb_pool; >> + >> + unsigned long rx_pkts; >> + unsigned long rx_bytes; >> + unsigned long rx_dropped; >> > >ethdev stats are uint64_t, why declare those internal stats as unsigned >long ? You are right, should use uint64_t instead. > >+ >> + struct pkt_tx_queue *pair; >> + uint16_t queue_idx; >> +}; >> + >> +struct pkt_tx_queue { >> + struct xsk_ring_prod tx; >> + >> + unsigned long tx_pkts; >> + unsigned long err_pkts; >> + unsigned long tx_bytes; >> > >Idem. Will change to uint64_t. > >+ >> + struct pkt_rx_queue *pair; >> + uint16_t queue_idx; >> +}; >> > >[snip] > >+static int >> +eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) >> +{ >> + struct pmd_internals *internals = dev->data->dev_private; >> + struct xdp_statistics xdp_stats; >> + struct pkt_rx_queue *rxq; >> + socklen_t optlen; >> + int i; >> + >> + optlen = sizeof(struct xdp_statistics); >> + for (i = 0; i < dev->data->nb_rx_queues; i++) { >> + rxq = &internals->rx_queues[i]; >> + stats->q_ipackets[i] = internals->rx_queues[i].rx_pkts; >> + stats->q_ibytes[i] = internals->rx_queues[i].rx_bytes; >> + >> + stats->q_opackets[i] = internals->tx_queues[i].tx_pkts; >> + stats->q_errors[i] = internals->tx_queues[i].err_pkts; >> > >q_errors[] are for reception errors, see the patchset I sent: >http://mails.dpdk.org/archives/dev/2019-March/125703.html > >If you want per queue stats, use xstats. >You can still account those errors in the global stats->oerrors below. > >+ stats->q_obytes[i] = internals->tx_queues[i].tx_bytes; >> + >> + stats->ipackets += stats->q_ipackets[i]; >> + stats->ibytes += stats->q_ibytes[i]; >> + stats->imissed += internals->rx_queues[i].rx_dropped; >> + getsockopt(xsk_socket__fd(rxq->xsk), SOL_XDP, >> XDP_STATISTICS, >> + &xdp_stats, &optlen); >> + stats->imissed += xdp_stats.rx_dropped; >> + >> + stats->opackets += stats->q_opackets[i]; >> + stats->oerrors += stats->q_errors[i]; >> > >- stats->oerrors += stats->q_errors[i]; >+ stats->oerrors += internals->tx_queues[i].err_pkts; will correct according to your patch. Thanks, Xiaolong > >> >> + stats->obytes += stats->q_obytes[i]; >> + } >> + >> + return 0; >> +} >> >> > >-- >David Marchand