From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id EDD45A00E6 for ; Wed, 20 Mar 2019 10:23:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C993344C3; Wed, 20 Mar 2019 10:23:14 +0100 (CET) Received: from mail-vs1-f67.google.com (mail-vs1-f67.google.com [209.85.217.67]) by dpdk.org (Postfix) with ESMTP id 9E6A62956 for ; Wed, 20 Mar 2019 10:23:13 +0100 (CET) Received: by mail-vs1-f67.google.com with SMTP id i207so1023586vsd.10 for ; Wed, 20 Mar 2019 02:23:13 -0700 (PDT) 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=J7whH6VRxCDulYG9ddWg/xTknRik7YGeX40Z4HTcMIk=; b=q+uwiFbQFvN0n0XYPV61svmJUJkNHqL3yR+VKP+qZSBpnI7rBIHSy1I+YFPpbnZimq qLosbcJJO9+FFMsoyOj6H1dC10frr5FOBLrGtdxk43R1IQFfRBj4saPrVTkFUe2ycI26 hAGitb/4DUAszUPFIOA/i176WvyNd9hCOd2DsRpRD6MVwVJM3254tcQZ4jsj5Q0nUgct MthwJctgDvOxrOD43jWcNXfqRK7psvbbwTcKEl1zuULxU+R6vYJzWZNPNXxi6FDZg+B1 rk7m+6r9hsD6x+415anAzYx7r37RcYJ7gWoS9r01VWmKuWZJ8vjERS4e/xwlsz5wyfUY ZAdA== X-Gm-Message-State: APjAAAWWJ8t4NjWp5tbtu72Wi7VKVvJDSUKHdaqNcUX0UQ8CI26vYzcQ 3XoaSQJPWKD51AMSY0KPDubkTEbuzGhqbn/z1TrzwZVI X-Google-Smtp-Source: APXvYqwmi13hXun+FN23039Ut3uwunSSW/GhDWhuKYwho5xDtOIMPv0fUPIPohjad1p6fYTaJQzqTbQ1Ff/9awttd0Q= X-Received: by 2002:a67:c78e:: with SMTP id t14mr4197674vsk.180.1553073793024; Wed, 20 Mar 2019 02:23:13 -0700 (PDT) MIME-Version: 1.0 References: <20190301080947.91086-1-xiaolong.ye@intel.com> <20190319071256.26302-1-xiaolong.ye@intel.com> <20190319071256.26302-2-xiaolong.ye@intel.com> In-Reply-To: <20190319071256.26302-2-xiaolong.ye@intel.com> From: David Marchand Date: Wed, 20 Mar 2019 10:23:01 +0100 Message-ID: To: Xiaolong Ye Cc: dev , Qi Zhang , Karlsson Magnus , Topel Bjorn Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190320092301.AppHSS_VXawa_rZYl_ACfvuLfdYEHWheS4Nq6Rs9izo@z> On Tue, Mar 19, 2019 at 8:17 AM Xiaolong Ye wrote: > diff --git a/doc/guides/nics/features/af_xdp.ini > b/doc/guides/nics/features/af_xdp.ini > new file mode 100644 > index 000000000..7b8fcce00 > --- /dev/null > +++ b/doc/guides/nics/features/af_xdp.ini > @@ -0,0 +1,11 @@ > +; > +; Supported features of the 'af_xdp' network poll mode driver. > +; > +; Refer to default.ini for the full list of available PMD features. > +; > +[Features] > +Link status = Y > +MTU update = Y > +Promiscuous mode = Y > +Stats per queue = Y > +x86-64 = Y > Is there really a limitation on x86? diff --git a/drivers/net/Makefile b/drivers/net/Makefile > index 502869a87..5d401b8c5 100644 > --- a/drivers/net/Makefile > +++ b/drivers/net/Makefile > @@ -9,6 +9,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD),d) > endif > > DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet > +DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_XDP) += af_xdp > DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark > DIRS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atlantic > DIRS-$(CONFIG_RTE_LIBRTE_AVP_PMD) += avp > diff --git a/drivers/net/af_xdp/Makefile b/drivers/net/af_xdp/Makefile > new file mode 100644 > index 000000000..6cf0ed7db > --- /dev/null > +++ b/drivers/net/af_xdp/Makefile > @@ -0,0 +1,33 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2018 Intel Corporation > 2018? 2019? + > +include $(RTE_SDK)/mk/rte.vars.mk > + > +# > +# library name > +# > +LIB = librte_pmd_af_xdp.a > + > +EXPORT_MAP := rte_pmd_af_xdp_version.map > + > +LIBABIVER := 1 > + > +CFLAGS += -O3 > + > +# require kernel version >= v5.1-rc1 > +LINUX_VERSION := $(shell uname -r) > +CFLAGS += -I/lib/modules/$(LINUX_VERSION)/build/tools/include > +CFLAGS += -I/lib/modules/$(LINUX_VERSION)/build/tools/lib/bpf > We can reuse RTE_KERNELDIR here (even if the docs state that this was to build kmods so far). > 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..96dedc0c4 > --- /dev/null > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c > [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_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]; > You forgot to remove stats->q_errors[i]; + stats->oerrors += internals->tx_queues[i].err_pkts; > + stats->obytes += stats->q_obytes[i]; > + } > + > + return 0; > +} -- David Marchand