From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-f68.google.com (mail-ua1-f68.google.com [209.85.222.68]) by dpdk.org (Postfix) with ESMTP id 1F1E22C18 for ; Tue, 5 Mar 2019 09:25:47 +0100 (CET) Received: by mail-ua1-f68.google.com with SMTP id e15so6998523uam.3 for ; Tue, 05 Mar 2019 00:25:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zvedpCB5rwqc2WS/ifgH/EfvhTjQZTAoG9HB4DkBN2g=; b=GCEJRorsoeYOjc12oC169x38e0CpdTfx4EoBSlIWU2nM6rx0wiLWXc12vGetOqVeyL GtbKYcCsnTlShBQ+mDeUOrIdJflJqj+wNpPnQbQa7k3Uh9JRfFKfJzlSiZjIvt4/rgzl uY1TiY1/Pgzrxkgs2rCSXS6d/jsGJBmTgw8H6G1CJwDog5hXiVVBo1xWsXA/M/yL5kmG ZBcbcfCt8Cp2dm/5k+yPtJC2y3NfLgANyHNb4kzYAjfMgStp0WD9aVs06ywsm0Pvbpea p/Gc2VhfhGfc+WWGNI4OE8BIJXJSxcoE1LFrrEyPAX07HFo1oJW+OdSeZbx2yN/WmrIr s5Nw== X-Gm-Message-State: APjAAAW959y1kKc/IUJKvYw3mM5OdR4wZ71SzhGcWFcWqdxvsBIxxTVs Zdg0gro9GHb/nXQJK3ZZ9uSyY3EQ8jtB/TXvPcl4ng== X-Google-Smtp-Source: APXvYqyvF3s3iRNI098obnje3RQG/zCQWl5eN9UbV6umONxz0fNlI5KPqJVnGeIvsRUFoKUQjpDa3EbCaJvX5lswpSA= X-Received: by 2002:a67:f69a:: with SMTP id n26mr552668vso.105.1551774345575; Tue, 05 Mar 2019 00:25:45 -0800 (PST) MIME-Version: 1.0 References: <20190301080947.91086-1-xiaolong.ye@intel.com> <20190301080947.91086-2-xiaolong.ye@intel.com> In-Reply-To: <20190301080947.91086-2-xiaolong.ye@intel.com> From: David Marchand Date: Tue, 5 Mar 2019 09:25:34 +0100 Message-ID: To: Xiaolong Ye Cc: dev , Qi Zhang Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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: Tue, 05 Mar 2019 08:25:48 -0000 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. 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 ? + > + 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. + > + 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; > > + stats->obytes += stats->q_obytes[i]; > + } > + > + return 0; > +} > > -- David Marchand