Received: by 10.213.65.68 with SMTP id h4csp2113741imn; Sun, 8 Apr 2018 20:03:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx483jiaDsKgJgVbX2FEXC0JIDcej7jeRSJNhKXFzLqKkGmr9L2O1Iyp4K3mXUnTLbfUBQqZm X-Received: by 10.99.114.1 with SMTP id n1mr23799446pgc.107.1523243028391; Sun, 08 Apr 2018 20:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243028; cv=none; d=google.com; s=arc-20160816; b=wjxQj0v4tdU+pN2CYEKOLilENOQfUS2MNU8o6h087Paw8bOoCX0subkOQ/t3HYzUkY iTVpLqHfSqk26AzHxYH9jEr0tinkutweffMgujz8UsgsiNDWYCKBno2Gw+G06eX/b6in ZubvihcmGd7ZRwn2dhfJmLwYMwIwYH5RvGh9cpATV3rQYIWPQ3Y4BPHqKdxlAuwcPi37 EtoolajWss3AyDhD0ADvBWa7PaeM8ZDKd2EXlgTqpxPo/4txoZWjgxszFZFOCwtsWet3 ueW5HTg/ffWD/JXmfrB0OD7S8sJgpmr9NIdv8miv8aETTFHMoBB+bn8K00fVIfm9dukX RPOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=aqA+bVgbH5DFnFVTGaKIPeDpk6hZZcoYAWGtx3mX2Uw=; b=ktswtAzMKYZuhjokQg0R2JT7cYTuKFPyVAFAMh/BnbGYxZUNJkD0rIvWdUvSXsOgRu Yvu1o2E0OUnpfa72kbSNuwubpAyQC4Fc03JujRrMtIn7jnVlZVsCckdyDZmA0FlkZXxf 5w9ytiNv0ECkNHNKItdwDKEDP8os0LlaxWEEeRYVJu93i2NylaS0QMXNmoIgVWiHSTRg ++Tj0sf9BJRLYuOWdPk3pvFS7AsqG2jpYvWzHixItTe4nKoF+gc8gOiLzj1eegEz2WSU dc5mXKg8AFs+wuaju4ICdR5s/txIKHVj8foBJgIGACzLpIs6L47YR5lKhnL5jj0dF93v lSAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Vdmj9yeY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14-v6si15377881plk.706.2018.04.08.20.03.11; Sun, 08 Apr 2018 20:03:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Vdmj9yeY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755525AbeDIA1E (ORCPT + 99 others); Sun, 8 Apr 2018 20:27:04 -0400 Received: from mail-by2nam03on0126.outbound.protection.outlook.com ([104.47.42.126]:2432 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755453AbeDIA0u (ORCPT ); Sun, 8 Apr 2018 20:26:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=aqA+bVgbH5DFnFVTGaKIPeDpk6hZZcoYAWGtx3mX2Uw=; b=Vdmj9yeYHdZiBV814nx50a9c3VRSwjAvt6nttroQQNMI6x+2og366vuTVG3Mn0mdmfcahyuPlOvG6Xau4FzHSSaPunQnYv8W5Uk+WDtPBi6jS6biJxXV9Kvxg1tSrah7CzjULWSo/ehKnhRjI0rOjJcqAvUUn/Z1GVbSOCbCRfs= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0885.namprd21.prod.outlook.com (52.132.132.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:26:43 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:26:43 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Girish Moodalbail , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 024/293] geneve: add missing rx stats accounting Thread-Topic: [PATCH AUTOSEL for 4.9 024/293] geneve: add missing rx stats accounting Thread-Index: AQHTz5jvangZuMdkFUeUwFjNM9elCA== Date: Mon, 9 Apr 2018 00:23:08 +0000 Message-ID: <20180409002239.163177-24-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0885;7:cxCIiHgGLNnlOuhf5QaNmHJjQsIqmGxXJgirMfkYd++AVPFr7Rk5ggHJeC8IoxNYQnPtNF3/Q80F9045sdVFDmm4An2uoaLI0q+eT4fLO6nmDYtX/UjONO2xf4iFtNUitEvEdZ+jjIxV4oERlCXvjqrnNgYRrO7C5+CWxRZLDEBe+IergSEJ1g/axKMU5cFrjbSie9TTgezW6MyIpQ4YkZ4R30scZYVMx0tz3ggKkPVOvFFAMOCsgqMvG71cR2jt;20:vZxG1X6dgtRl8jIVZBzr1fkQYAu8tOLbXqWdswdOA0MIZR+5Z66ABpiEXFVOg840vwRPsBJzNK5A/fLVjzW8AkaxC4ydtn0IJzdfF9F+f7XsGoLumNyHtGxgoNnV+tAJuGFnyXPHkUddfKYmwSP3XklVaopl9tid0IfW1SFURmc= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 8ba01d40-80c6-42b7-9b89-08d59db0925a x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0885; x-ms-traffictypediagnostic: DM5PR2101MB0885: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0885;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0885; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(366004)(346002)(376002)(396003)(39380400002)(189003)(199004)(2906002)(68736007)(22452003)(316002)(6512007)(5660300001)(6666003)(54906003)(110136005)(486006)(6486002)(102836004)(36756003)(14454004)(99286004)(86612001)(105586002)(72206003)(106356001)(2900100001)(15650500001)(1076002)(97736004)(10090500001)(3280700002)(5250100002)(6436002)(3660700001)(6116002)(3846002)(305945005)(86362001)(59450400001)(66066001)(10290500003)(186003)(81166006)(8936002)(478600001)(476003)(25786009)(81156014)(8676002)(4326008)(7736002)(2501003)(107886003)(6506007)(2616005)(26005)(76176011)(446003)(53936002)(11346002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0885;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 8UQkqM1tFMApqOH1odh2XvxtnnQprsxGJea0gEAojRoJz8nRrQLMAm8lu3Fm/+RTTVQ82uYsgZ9r11dclEmKvis/wYOmpftuUzWt6pHbVJ9cHRpBuW8lDFdQXxs8o852XwTLKhOHLhAUrHhjq0EHExiyXCYRGua8CrQX3n3tShD8QvTgQbxVGHEIphNovbe27hBwP5W/mSUGHFYzb9gvCs1gZY8LDqrgeH2TXsBtFIpnhYdd4jyDe+ES0ne3Ye4qWdQNWPdM9yGiOIrTK/h4G1VS62mJCf+77UsBAYGQRKgyEVl6zu+BE3W01FXlVN1uhioS6IWydlF3+gMojcXXK066/Y8FoMLVB16J1nQXbM28vnmGp/g0SG6WLMDnZcQGtyseo2vCcim+ilOYdDp9aC1xrwpGDISR0kfU/D/t9E8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ba01d40-80c6-42b7-9b89-08d59db0925a X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:08.7842 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0885 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Girish Moodalbail [ Upstream commit fe741e2362f33bbea813bcc3a921de356c6653db ] There are few places on the receive path where packet drops and packet errors were not accounted for. This patch fixes that issue. Signed-off-by: Girish Moodalbail Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/geneve.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 3c1f89ab0110..92ad43e53c72 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -209,6 +209,7 @@ static void geneve_rx(struct geneve_dev *geneve, struct= geneve_sock *gs, struct genevehdr *gnvh =3D geneve_hdr(skb); struct metadata_dst *tun_dst =3D NULL; struct pcpu_sw_netstats *stats; + unsigned int len; int err =3D 0; void *oiph; =20 @@ -222,8 +223,10 @@ static void geneve_rx(struct geneve_dev *geneve, struc= t geneve_sock *gs, tun_dst =3D udp_tun_rx_dst(skb, geneve_get_sk_family(gs), flags, vni_to_tunnel_id(gnvh->vni), gnvh->opt_len * 4); - if (!tun_dst) + if (!tun_dst) { + geneve->dev->stats.rx_dropped++; goto drop; + } /* Update tunnel dst according to Geneve options. */ ip_tunnel_info_opts_set(&tun_dst->u.tun_info, gnvh->options, gnvh->opt_len * 4); @@ -231,8 +234,11 @@ static void geneve_rx(struct geneve_dev *geneve, struc= t geneve_sock *gs, /* Drop packets w/ critical options, * since we don't support any... */ - if (gnvh->critical) + if (gnvh->critical) { + geneve->dev->stats.rx_frame_errors++; + geneve->dev->stats.rx_errors++; goto drop; + } } =20 skb_reset_mac_header(skb); @@ -243,8 +249,10 @@ static void geneve_rx(struct geneve_dev *geneve, struc= t geneve_sock *gs, skb_dst_set(skb, &tun_dst->dst); =20 /* Ignore packet loops (and multicast echo) */ - if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr)) + if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr)) { + geneve->dev->stats.rx_errors++; goto drop; + } =20 oiph =3D skb_network_header(skb); skb_reset_network_header(skb); @@ -276,13 +284,15 @@ static void geneve_rx(struct geneve_dev *geneve, stru= ct geneve_sock *gs, } } =20 - stats =3D this_cpu_ptr(geneve->dev->tstats); - u64_stats_update_begin(&stats->syncp); - stats->rx_packets++; - stats->rx_bytes +=3D skb->len; - u64_stats_update_end(&stats->syncp); - - gro_cells_receive(&geneve->gro_cells, skb); + len =3D skb->len; + err =3D gro_cells_receive(&geneve->gro_cells, skb); + if (likely(err =3D=3D NET_RX_SUCCESS)) { + stats =3D this_cpu_ptr(geneve->dev->tstats); + u64_stats_update_begin(&stats->syncp); + stats->rx_packets++; + stats->rx_bytes +=3D len; + u64_stats_update_end(&stats->syncp); + } return; drop: /* Consume bad packet */ @@ -332,7 +342,7 @@ static int geneve_udp_encap_recv(struct sock *sk, struc= t sk_buff *skb) struct geneve_sock *gs; int opts_len; =20 - /* Need Geneve and inner Ethernet header to be present */ + /* Need UDP and Geneve header to be present */ if (unlikely(!pskb_may_pull(skb, GENEVE_BASE_HLEN))) goto drop; =20 @@ -355,8 +365,10 @@ static int geneve_udp_encap_recv(struct sock *sk, stru= ct sk_buff *skb) opts_len =3D geneveh->opt_len * 4; if (iptunnel_pull_header(skb, GENEVE_BASE_HLEN + opts_len, htons(ETH_P_TEB), - !net_eq(geneve->net, dev_net(geneve->dev)))) + !net_eq(geneve->net, dev_net(geneve->dev)))) { + geneve->dev->stats.rx_dropped++; goto drop; + } =20 geneve_rx(geneve, gs, skb); return 0; --=20 2.15.1