Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/745019/?format=api
{ "id": 745019, "url": "http://patchwork.ozlabs.org/api/patches/745019/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1490833375-2788-7-git-send-email-sridhar.samudrala@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1490833375-2788-7-git-send-email-sridhar.samudrala@intel.com>", "list_archive_url": null, "date": "2017-03-30T00:22:54", "name": "[next-queue,v6,6/7] i40e: Add support for exposing switch port statistics via port netdevs", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "3f5384bc48825f32554afa604cb6d487f7065201", "submitter": { "id": 65219, "url": "http://patchwork.ozlabs.org/api/people/65219/?format=api", "name": "Samudrala, Sridhar", "email": "sridhar.samudrala@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1490833375-2788-7-git-send-email-sridhar.samudrala@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/745019/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/745019/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3vtlhz5wclz9s79\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 30 Mar 2017 11:23:15 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 5439A2EB56;\n\tThu, 30 Mar 2017 00:23:14 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id W2ojIBZ5ryFP; Thu, 30 Mar 2017 00:23:06 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id E23EA2F114;\n\tThu, 30 Mar 2017 00:23:00 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 5AFB31CE8BC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:58 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 5445B8902A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:58 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id jTig2SGVQEZ1 for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:57 +0000 (UTC)", "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 408A789039\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 30 Mar 2017 00:22:57 +0000 (UTC)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga105.jf.intel.com with ESMTP; 29 Mar 2017 17:22:56 -0700", "from arch-p28.jf.intel.com ([10.166.187.27])\n\tby orsmga003.jf.intel.com with ESMTP; 29 Mar 2017 17:22:56 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.36,244,1486454400\"; d=\"scan'208\";a=\"949601333\"", "From": "Sridhar Samudrala <sridhar.samudrala@intel.com>", "To": "intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,\n\talexander.h.duyck@intel.com, anjali.singhai@intel.com,\n\tjakub.kicinski@netronome.com, gerlitz.or@gmail.com, jiri@resnulli.us, \n\tsridhar.samudrala@intel.com", "Date": "Wed, 29 Mar 2017 17:22:54 -0700", "Message-Id": "<1490833375-2788-7-git-send-email-sridhar.samudrala@intel.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1490833375-2788-1-git-send-email-sridhar.samudrala@intel.com>", "References": "<1490833375-2788-1-git-send-email-sridhar.samudrala@intel.com>", "Subject": "[Intel-wired-lan] [next-queue v6 PATCH 6/7] i40e: Add support for\n\texposing switch port statistics via port netdevs", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "By default stats counted by HW are returned via the original\nndo_get_stats64() api. Stats counted in SW are returned via\nndo_get_offload_stats() api.\n\nSmall script to demonstrate port stats in switchdev mode.\nPF: p4p1, VFs: p4p1_0,p4p1_1 VF Port Reps:p4p1-vf0, p4p1-vf1\nPF Port rep: p4p1-pf\n\n# rmmod i40e; modprobe i40e\n# devlink dev eswitch set pci/0000:05:00.0 mode switchdev\n# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs\n# ip link set p4p1 vf 0 mac 00:11:22:33:44:55\n# ip link set p4p1 vf 1 mac 00:11:22:33:44:56\n# rmmod i40evf; modprobe i40evf\n\n/* Create 2 namespaces and move the VFs to the corresponding ns */\n# ip netns add ns0\n# ip link set p4p1_0 netns ns0\n# ip netns exec ns0 ip addr add 192.168.1.10/24 dev p4p1_0\n# ip netns exec ns0 ip link set p4p1_0 up\n# ip netns add ns1\n# ip link set p4p1_1 netns ns1\n# ip netns exec ns1 ip addr add 192.168.1.11/24 dev p4p1_1\n# ip netns exec ns1 ip link set p4p1_1 up\n\n/* bring up pf and port netdevs */\n# ip addr add 192.168.1.1/24 dev p4p1\n# ip link set p4p1 up\n# ip link set p4p1-vf0 up\n# ip link set p4p1-vf1 up\n# ip link set p4p1-pf up\n\n# ip netns exec ns0 ping -c3 192.168.1.11 /* VF0 -> VF1 */\n# ip netns exec ns1 ping -c3 192.168.1.10 /* VF1 -> VF0 */\n# ping -c3 192.168.1.10 /* PF -> VF0 */\n# ping -c3 192.168.1.11 /* PF -> VF1 */\n\n/* VF0 -> IP in same subnet - broadcasts will be seen on p4p1-vf0 */\n# ip netns exec ns0 ping -c1 -W1 192.168.1.200\n/* VF1 -> IP in same subnet- broadcasts will be seen on p4p1-vf1 */\n# ip netns exec ns0 ping -c1 -W1 192.168.1.200\n/* port rep VF0 -> IP in same subnet - broadcasts will be seen on p4p1_0 */\n# ping -I p4p1-vf0 -c1 -W1 192.168.1.200\n/* port rep VF1 -> IP in same subnet - broadcasts will be seen on p4p1_1 */\n# ping -I p4p1-vf1 -c1 -W1 192.168.1.200\n\nHW STATS\n# ip netns exec ns0 ip -s l show p4p1_0\n41: p4p1_0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000\n link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff\n RX: bytes packets errors dropped overrun mcast\n 1274 21 0 0 0 0\n TX: bytes packets errors dropped carrier collsns\n 980 14 0 0 0 0\n# ip -s l show p4p1-vf0\n37: p4p1-vf0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000\n link/ether f6:07:98:0e:cd:97 brd ff:ff:ff:ff:ff:ff\n RX: bytes packets errors dropped overrun mcast\n 980 14 0 0 0 0\n TX: bytes packets errors dropped carrier collsns\n 1274 21 0 0 0 0\n# ip netns exec ns1 ip -s l show p4p1_1\n42: p4p1_1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000\n link/ether 00:11:22:33:44:56 brd ff:ff:ff:ff:ff:ff\n RX: bytes packets errors dropped overrun mcast\n 1246 19 0 0 0 0\n TX: bytes packets errors dropped carrier collsns\n 1078 15 0 0 0 0\n# ip -s l show p4p1-vf1\n38: p4p1-vf1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000\n link/ether 2a:cf:ff:6a:f3:66 brd ff:ff:ff:ff:ff:ff\n RX: bytes packets errors dropped overrun mcast\n 1078 15 0 0 0 0\n TX: bytes packets errors dropped carrier collsns\n 1246 19 0 0 0 0\n# ip -s l show p4p1\n34: p4p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000\n link/ether 3c:fd:fe:a3:18:f8 brd ff:ff:ff:ff:ff:ff\n RX: bytes packets errors dropped overrun mcast\n 1134 17 0 0 0 0\n TX: bytes packets errors dropped carrier collsns\n 966 19 0 0 0 0\n# ip -s l show p4p1-pf\n36: p4p1-pf: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000\n link/ether da:0f:67:fe:2e:66 brd ff:ff:ff:ff:ff:ff\n RX: bytes packets errors dropped overrun mcast\n 966 19 0 0 0 0\n TX: bytes packets errors dropped carrier collsns\n 882 17 0 0 0 0\n\nSW STATS\n# ifstat -a -x c\n#kernel\nInterface RX Pkts/Rate TX Pkts/Rate RX Data/Rate TX Data/Rate\n RX Errs/Drop TX Errs/Drop RX Over/Rate TX Coll/Rate\np4p1-pf 0 0 3 0 0 0 126 0\n 0 0 0 0 0 0 0 0\np4p1-vf0 4 0 6 0 184 0 252 0\n 0 0 0 0 0 0 0 0\np4p1-vf1 3 0 3 0 138 0 126 0\n 0 0 0 0 0 0 0 0\n\nSigned-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h | 10 +++\n drivers/net/ethernet/intel/i40e/i40e_main.c | 125 ++++++++++++++++++++++++++++\n drivers/net/ethernet/intel/i40e/i40e_txrx.c | 24 +++++-\n 3 files changed, 158 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex ac11005..72e11b2 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -328,8 +328,18 @@ enum i40e_port_netdev_type {\n \tI40E_PORT_NETDEV_VF\n };\n \n+struct port_netdev_pcpu_stats {\n+\tu64\t\t\ttx_packets;\n+\tu64\t\t\ttx_bytes;\n+\tu64\t\t\ttx_drops;\n+\tu64\t\t\trx_packets;\n+\tu64\t\t\trx_bytes;\n+\tstruct u64_stats_sync\tsyncp;\n+};\n+\n /* Port representor netdev private structure */\n struct i40e_port_netdev_priv {\n+\tstruct port_netdev_pcpu_stats __percpu *stats;\n \tenum i40e_port_netdev_type type;\t/* type - PF or VF */\n \tstruct metadata_dst *dst;\t\t/* port id */\n \tvoid *f;\t\t\t\t/* ptr to PF or VF struct */\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex e9c5c6b..4f0eebc 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -11001,10 +11001,123 @@ static int i40e_port_netdev_stop(struct net_device *dev)\n \treturn err;\n }\n \n+/**\n+ * i40e_port_netdev_get_stats64\n+ * @dev: network interface device structure\n+ * @stats: netlink stats structure\n+ *\n+ * Fills the hw statistics from the VSI corresponding to the associated port\n+ * netdev\n+ **/\n+static void\n+i40e_port_netdev_get_stats64(struct net_device *netdev,\n+\t\t\t struct rtnl_link_stats64 *stats)\n+{\n+\tstruct i40e_port_netdev_priv *priv = netdev_priv(netdev);\n+\tstruct i40e_vf *vf;\n+\tstruct i40e_pf *pf;\n+\tstruct i40e_vsi *vsi;\n+\tstruct i40e_eth_stats *estats;\n+\n+\tswitch (priv->type) {\n+\tcase I40E_PORT_NETDEV_VF:\n+\t\tvf = (struct i40e_vf *)priv->f;\n+\t\tpf = vf->pf;\n+\t\tvsi = pf->vsi[vf->lan_vsi_idx];\n+\t\tbreak;\n+\tcase I40E_PORT_NETDEV_PF:\n+\t\tpf = (struct i40e_pf *)priv->f;\n+\t\tvsi = pf->vsi[pf->lan_vsi];\n+\t\tbreak;\n+\tdefault:\n+\t\treturn;\n+\t}\n+\n+\ti40e_update_stats(vsi);\n+\testats = &vsi->eth_stats;\n+\n+\t/* TX and RX stats are flipped as we are returning the stats as seen\n+\t * at the switch port corresponding to the VF.\n+\t */\n+\tstats->rx_packets = estats->tx_unicast + estats->tx_multicast +\n+\t\t\t estats->tx_broadcast;\n+\tstats->tx_packets = estats->rx_unicast + estats->rx_multicast +\n+\t\t\t estats->rx_broadcast;\n+\tstats->rx_bytes = estats->tx_bytes;\n+\tstats->tx_bytes = estats->rx_bytes;\n+\tstats->rx_dropped = estats->tx_discards;\n+\tstats->tx_dropped = estats->rx_discards;\n+}\n+\n+/**\n+ * i40e_port_netdev_get_cpu_hit_stats64\n+ * @dev: network interface device structure\n+ * @stats: netlink stats structure\n+ *\n+ * stats are filled from the priv structure. correspond to the packets\n+ * that are seen by the cpu and sent/received via port netdev.\n+ **/\n+static int\n+i40e_port_netdev_get_cpu_hit_stats64(const struct net_device *dev,\n+\t\t\t\t struct rtnl_link_stats64 *stats)\n+{\n+\tstruct i40e_port_netdev_priv *priv = netdev_priv(dev);\n+\tint i;\n+\n+\tfor_each_possible_cpu(i) {\n+\t\tstruct port_netdev_pcpu_stats *port_netdev_stats;\n+\t\tu64 tbytes, tpkts, tdrops, rbytes, rpkts;\n+\t\tunsigned int start;\n+\n+\t\tport_netdev_stats = per_cpu_ptr(priv->stats, i);\n+\t\tdo {\n+\t\t\tstart = u64_stats_fetch_begin_irq(&port_netdev_stats->syncp);\n+\t\t\ttbytes = port_netdev_stats->tx_bytes;\n+\t\t\ttpkts = port_netdev_stats->tx_packets;\n+\t\t\ttdrops = port_netdev_stats->tx_drops;\n+\t\t\trbytes = port_netdev_stats->rx_bytes;\n+\t\t\trpkts = port_netdev_stats->rx_packets;\n+\t\t} while (u64_stats_fetch_retry_irq(&port_netdev_stats->syncp, start));\n+\t\tstats->tx_bytes += tbytes;\n+\t\tstats->tx_packets += tpkts;\n+\t\tstats->tx_dropped += tdrops;\n+\t\tstats->rx_bytes += rbytes;\n+\t\tstats->rx_packets += rpkts;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static bool\n+i40e_port_netdev_has_offload_stats(const struct net_device *dev, int attr_id)\n+{\n+\tswitch (attr_id) {\n+\tcase IFLA_OFFLOAD_XSTATS_CPU_HIT:\n+\t\treturn true;\n+\t}\n+\n+\treturn false;\n+}\n+\n+static int\n+i40e_port_netdev_get_offload_stats(int attr_id, const struct net_device *dev,\n+\t\t\t\t void *sp)\n+{\n+\tswitch (attr_id) {\n+\tcase IFLA_OFFLOAD_XSTATS_CPU_HIT:\n+\t\treturn i40e_port_netdev_get_cpu_hit_stats64(dev, sp);\n+\t}\n+\n+\treturn -EINVAL;\n+}\n+\n static const struct net_device_ops i40e_port_netdev_ops = {\n \t.ndo_open\t\t= i40e_port_netdev_open,\n \t.ndo_stop\t\t= i40e_port_netdev_stop,\n \t.ndo_start_xmit\t\t= i40e_port_netdev_start_xmit,\n+\t.ndo_get_stats64\t= i40e_port_netdev_get_stats64,\n+\t.ndo_has_offload_stats\t= i40e_port_netdev_has_offload_stats,\n+\t.ndo_get_offload_stats\t= i40e_port_netdev_get_offload_stats,\n };\n \n /**\n@@ -11077,6 +11190,16 @@ int i40e_alloc_port_netdev(void *f, enum i40e_port_netdev_type type)\n \t\treturn -EINVAL;\n \t}\n \n+\tpriv->stats = netdev_alloc_pcpu_stats(struct port_netdev_pcpu_stats);\n+\tif (!priv->stats) {\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"alloc_pcpu_stats failed for port netdev: %s\\n\",\n+\t\t\tport_netdev->name);\n+\t\tdst_release((struct dst_entry *)priv->dst);\n+\t\tfree_netdev(port_netdev);\n+\t\treturn -ENOMEM;\n+\t}\n+\n \tport_netdev->netdev_ops = &i40e_port_netdev_ops;\n \teth_hw_addr_random(port_netdev);\n \n@@ -11144,6 +11267,7 @@ void i40e_free_port_netdev(void *f, enum i40e_port_netdev_type type)\n \t\t\t pf->port_netdev->name);\n \t\tpriv = netdev_priv(pf->port_netdev);\n \t\tdst_release((struct dst_entry *)priv->dst);\n+\t\tfree_percpu(priv->stats);\n \t\tunregister_netdev(pf->port_netdev);\n \t\tfree_netdev(pf->port_netdev);\n \t\tpf->port_netdev = NULL;\n@@ -11163,6 +11287,7 @@ void i40e_free_port_netdev(void *f, enum i40e_port_netdev_type type)\n \t\t\t vf->port_netdev->name);\n \t\tpriv = netdev_priv(vf->port_netdev);\n \t\tdst_release((struct dst_entry *)priv->dst);\n+\t\tfree_percpu(priv->stats);\n \t\tunregister_netdev(vf->port_netdev);\n \t\tfree_netdev(vf->port_netdev);\n \t\tvf->port_netdev = NULL;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex 86d2510..449a35c 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -1309,7 +1309,9 @@ static bool i40e_alloc_mapped_page(struct i40e_ring *rx_ring,\n static void i40e_handle_lpbk_skb(struct i40e_ring *rx_ring, struct sk_buff *skb)\n {\n \tstruct i40e_q_vector *q_vector = rx_ring->q_vector;\n+\tstruct port_netdev_pcpu_stats *port_netdev_stats;\n \tstruct i40e_pf *pf = rx_ring->vsi->back;\n+\tstruct i40e_port_netdev_priv *priv;\n \tstruct sk_buff *nskb;\n \tstruct i40e_vf *vf;\n \tstruct ethhdr *eth;\n@@ -1334,6 +1336,12 @@ static void i40e_handle_lpbk_skb(struct i40e_ring *rx_ring, struct sk_buff *skb)\n \t\t\t\tbreak;\n \t\t\tnskb->offload_fwd_mark = 1;\n \t\t\tnskb->dev = vf->port_netdev;\n+\t\t\tpriv = netdev_priv(vf->port_netdev);\n+\t\t\tport_netdev_stats = this_cpu_ptr(priv->stats);\n+\t\t\tu64_stats_update_begin(&port_netdev_stats->syncp);\n+\t\t\tport_netdev_stats->rx_packets++;\n+\t\t\tport_netdev_stats->rx_bytes += nskb->len;\n+\t\t\tu64_stats_update_end(&port_netdev_stats->syncp);\n \t\t\tnapi_gro_receive(&q_vector->napi, nskb);\n \t\t\tbreak;\n \t\t}\n@@ -3283,6 +3291,7 @@ netdev_tx_t i40e_port_netdev_start_xmit(struct sk_buff *skb,\n \tstruct i40e_vsi *vsi;\n \tstruct i40e_pf *pf;\n \tstruct i40e_vf *vf;\n+\tint ret;\n \n \tswitch (priv->type) {\n \tcase I40E_PORT_NETDEV_VF:\n@@ -3302,5 +3311,18 @@ netdev_tx_t i40e_port_netdev_start_xmit(struct sk_buff *skb,\n \tskb_dst_set(skb, &priv->dst->dst);\n \tskb->dev = vsi->netdev;\n \n-\treturn dev_queue_xmit(skb);\n+\tret = dev_queue_xmit(skb);\n+\tif (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {\n+\t\tstruct port_netdev_pcpu_stats *port_netdev_stats;\n+\n+\t\tport_netdev_stats = this_cpu_ptr(priv->stats);\n+\t\tu64_stats_update_begin(&port_netdev_stats->syncp);\n+\t\tport_netdev_stats->tx_packets++;\n+\t\tport_netdev_stats->tx_bytes += skb->len;\n+\t\tu64_stats_update_end(&port_netdev_stats->syncp);\n+\t} else {\n+\t\tthis_cpu_inc(priv->stats->tx_drops);\n+\t}\n+\n+\treturn ret;\n }\n", "prefixes": [ "next-queue", "v6", "6/7" ] }