From patchwork Fri May 24 22:27:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ariel Levkovich X-Patchwork-Id: 1105186 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="BNT0yUKc"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 459gwh5d9Wz9s3l for ; Sat, 25 May 2019 08:27:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404367AbfEXW1c (ORCPT ); Fri, 24 May 2019 18:27:32 -0400 Received: from mail-eopbgr10071.outbound.protection.outlook.com ([40.107.1.71]:32916 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404287AbfEXW12 (ORCPT ); Fri, 24 May 2019 18:27:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IwX+38+H+tk8sc6X1RXbf/70tWby43NBe4Jprh7iXIc=; b=BNT0yUKc1o8LufBvFS6nM/y37xmW+kF31aa9wPIWLs/0dyolq01Aa926Of7JUkRocO2xVPrmmTR8VNhX9Uy8gpSd9uQURtlBhA/Q1651A7PY+kNtVU3W8FtGGqzAgi83GkeUTEdVzqS4Wx85HK9bh0QhENEKXYAd5wounFrXAwQ= Received: from VI1PR05MB3328.eurprd05.prod.outlook.com (10.170.238.141) by VI1PR05MB5039.eurprd05.prod.outlook.com (20.177.52.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.16; Fri, 24 May 2019 22:27:24 +0000 Received: from VI1PR05MB3328.eurprd05.prod.outlook.com ([fe80::d054:c1d5:5865:9092]) by VI1PR05MB3328.eurprd05.prod.outlook.com ([fe80::d054:c1d5:5865:9092%4]) with mapi id 15.20.1922.019; Fri, 24 May 2019 22:27:24 +0000 From: Ariel Levkovich To: "netdev@vger.kernel.org" CC: Ariel Levkovich , Jay Vosburgh , Veaceslav Falico , Andy Gospodarek Subject: [PATCH RFC 1/2] net: bonding: Inherit MPLS features from slave devices Thread-Topic: [PATCH RFC 1/2] net: bonding: Inherit MPLS features from slave devices Thread-Index: AQHVEn/bipscF4q+2Uy7K/LTx0dDaQ== Date: Fri, 24 May 2019 22:27:23 +0000 Message-ID: <1558736809-23258-2-git-send-email-lariel@mellanox.com> References: <1558736809-23258-1-git-send-email-lariel@mellanox.com> In-Reply-To: <1558736809-23258-1-git-send-email-lariel@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.226.120.58] x-mailer: git-send-email 1.8.3.1 x-clientproxiedby: LO2P265CA0457.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::13) To VI1PR05MB3328.eurprd05.prod.outlook.com (2603:10a6:802:1d::13) authentication-results: spf=none (sender IP is ) smtp.mailfrom=lariel@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 23d33fc9-325a-42fa-0c9c-08d6e096fe07 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600147)(711020)(4605104)(1401326)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VI1PR05MB5039; x-ms-traffictypediagnostic: VI1PR05MB5039: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3968; x-forefront-prvs: 0047BC5ADE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(136003)(366004)(396003)(346002)(199004)(189003)(66556008)(66946007)(66476007)(305945005)(4326008)(76176011)(64756008)(66446008)(2501003)(25786009)(4720700003)(5660300002)(86362001)(81156014)(478600001)(8676002)(81166006)(386003)(102836004)(1730700003)(186003)(2906002)(14444005)(26005)(50226002)(316002)(6506007)(14454004)(8936002)(256004)(6486002)(6436002)(476003)(36756003)(53936002)(7736002)(2616005)(71190400001)(73956011)(5640700003)(71200400001)(99286004)(446003)(11346002)(3846002)(54906003)(68736007)(6512007)(6116002)(6916009)(2351001)(486006)(66066001)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB5039; H:VI1PR05MB3328.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: hvsXR0f5b44zmMLstKgz6GCnWGYxmsgeA5bS40YDN6xqW2mjxU9RLZqyoZJcpohw9ST0sX+qh6SYInVfYINJJMVSKaEU7w0V+lHu0fdqxd3sO41sWsLbfVsUnxHI+cJKrm0embwE487HlACywduCXjSstWhMm9+of4y2MgJuAyE5t1PO+yENVnbRxJhJ0Tc5NPsILRyzH/jntuOwdENq02VxnCPHykPjzc68RpaLnw0Ftm3RdKtqJ2F93bxW0hkRZ2BNHjQGpLyLcQxzYCgHOeOs6DsvSIIizc+ddiiyDgiaoN5mHobTXX8ZgMV98WgcwccAdBzixbjO7lgvNeJaBSNsFuEzQKvSDbqZjOEBIFTsch6v4BkLE/+TZERbmM6DwMhM9Itry5xDEgMFdi8GGcvkFCxD5tgjBpGdSfoVRV4= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23d33fc9-325a-42fa-0c9c-08d6e096fe07 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 May 2019 22:27:23.5112 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lariel@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5039 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When setting the bonding interface net device features, the kernel code doesn't address the slaves' MPLS features and doesn't inherit them. Therefore, HW offloads that enhance performance such as checksumming and TSO are disabled for MPLS tagged traffic flowing via the bonding interface. The patch add the inheritance of the MPLS features from the slave devices with a similar logic to setting the bonding device's VLAN and encapsulation features. CC: Jay Vosburgh CC: Veaceslav Falico CC: Andy Gospodarek Signed-off-by: Ariel Levkovich --- drivers/net/bonding/bond_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 062fa7e..46b5f6d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1077,12 +1077,16 @@ static netdev_features_t bond_fix_features(struct net_device *dev, #define BOND_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ NETIF_F_RXCSUM | NETIF_F_ALL_TSO) +#define BOND_MPLS_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ + NETIF_F_ALL_TSO) + static void bond_compute_features(struct bonding *bond) { unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM; netdev_features_t vlan_features = BOND_VLAN_FEATURES; netdev_features_t enc_features = BOND_ENC_FEATURES; + netdev_features_t mpls_features = BOND_MPLS_FEATURES; struct net_device *bond_dev = bond->dev; struct list_head *iter; struct slave *slave; @@ -1093,6 +1097,7 @@ static void bond_compute_features(struct bonding *bond) if (!bond_has_slaves(bond)) goto done; vlan_features &= NETIF_F_ALL_FOR_ALL; + mpls_features &= NETIF_F_ALL_FOR_ALL; bond_for_each_slave(bond, slave, iter) { vlan_features = netdev_increment_features(vlan_features, @@ -1101,6 +1106,11 @@ static void bond_compute_features(struct bonding *bond) enc_features = netdev_increment_features(enc_features, slave->dev->hw_enc_features, BOND_ENC_FEATURES); + + mpls_features = netdev_increment_features(mpls_features, + slave->dev->mpls_features, + BOND_MPLS_FEATURES); + dst_release_flag &= slave->dev->priv_flags; if (slave->dev->hard_header_len > max_hard_header_len) max_hard_header_len = slave->dev->hard_header_len; @@ -1114,6 +1124,7 @@ static void bond_compute_features(struct bonding *bond) bond_dev->vlan_features = vlan_features; bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4; + bond_dev->mpls_features = mpls_features; bond_dev->gso_max_segs = gso_max_segs; netif_set_gso_max_size(bond_dev, gso_max_size); From patchwork Fri May 24 22:27:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ariel Levkovich X-Patchwork-Id: 1105190 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="o1G/iLPf"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 459gwn3S1qz9s3l for ; Sat, 25 May 2019 08:27:37 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404463AbfEXW1g (ORCPT ); Fri, 24 May 2019 18:27:36 -0400 Received: from mail-eopbgr10071.outbound.protection.outlook.com ([40.107.1.71]:32916 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404421AbfEXW1b (ORCPT ); Fri, 24 May 2019 18:27:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vHTpNX/9HtwuZ2OPp+C+3MdRhI8Sb79JfX2p81AA7t0=; b=o1G/iLPfwl82BHhTWEXvf0RC4z5TtIgvZEA6dyKjgO+xYVRnclS7YQ0mlSVbWFHp4xynfqxUmvmneqCTbQdacJnOfCs9yBhoEz6CT/VRRGQVUbrhTVnPWog0giS0hXciNyzMfJXWsAxdqoGtvdLPEqJuWqLEywbbQthQaq69PLM= Received: from VI1PR05MB3328.eurprd05.prod.outlook.com (10.170.238.141) by VI1PR05MB5039.eurprd05.prod.outlook.com (20.177.52.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.16; Fri, 24 May 2019 22:27:24 +0000 Received: from VI1PR05MB3328.eurprd05.prod.outlook.com ([fe80::d054:c1d5:5865:9092]) by VI1PR05MB3328.eurprd05.prod.outlook.com ([fe80::d054:c1d5:5865:9092%4]) with mapi id 15.20.1922.019; Fri, 24 May 2019 22:27:24 +0000 From: Ariel Levkovich To: "netdev@vger.kernel.org" CC: Ariel Levkovich Subject: [PATCH RFC 2/2] net: vlan: Inherit MPLS features from parent device Thread-Topic: [PATCH RFC 2/2] net: vlan: Inherit MPLS features from parent device Thread-Index: AQHVEn/cEOSSiGcu60GqnjvwcH/Kwg== Date: Fri, 24 May 2019 22:27:24 +0000 Message-ID: <1558736809-23258-3-git-send-email-lariel@mellanox.com> References: <1558736809-23258-1-git-send-email-lariel@mellanox.com> In-Reply-To: <1558736809-23258-1-git-send-email-lariel@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.226.120.58] x-mailer: git-send-email 1.8.3.1 x-clientproxiedby: LO2P265CA0457.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::13) To VI1PR05MB3328.eurprd05.prod.outlook.com (2603:10a6:802:1d::13) authentication-results: spf=none (sender IP is ) smtp.mailfrom=lariel@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6f50d136-479c-4148-b4b9-08d6e096fe8d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600147)(711020)(4605104)(1401326)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VI1PR05MB5039; x-ms-traffictypediagnostic: VI1PR05MB5039: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 0047BC5ADE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(136003)(366004)(396003)(346002)(199004)(189003)(66556008)(66946007)(66476007)(305945005)(4326008)(76176011)(64756008)(107886003)(66446008)(2501003)(25786009)(4720700003)(5660300002)(86362001)(81156014)(478600001)(8676002)(81166006)(386003)(102836004)(1730700003)(186003)(2906002)(14444005)(26005)(50226002)(316002)(6506007)(14454004)(8936002)(256004)(6486002)(6436002)(476003)(36756003)(53936002)(7736002)(2616005)(71190400001)(73956011)(5640700003)(71200400001)(99286004)(446003)(11346002)(3846002)(68736007)(6512007)(6116002)(6916009)(2351001)(486006)(66066001)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB5039; H:VI1PR05MB3328.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: q3huX3PBe/PhscEPE3y+L0QilIseyZZzohdeEG6LaCjLQic5i8mq2HvWwEjrYQyWwyxcQkLR+LhxV+woyzjUpe0sSJir0lbw/jpjxdQEYxQg0sWM+vcWRb3X9kljwY6/lhwxe+sICHe8THHA34IGG9CNJL1Jnig8aX5nJ56G5ZV5s7KPzRHIKWclKwLduR59200/ng4ISNIV2W3bk5q/4946/U7iwe1EfMGDpOuq2+NZiq/uMmpzQDVda8kmhNr526pQxbOeJf+ura2U7mECZ5r1PWEVJdhYi8zo5ANhWssJfU4Qciwc6q2DY+IjTR6ugbUf8tiCXR85v+czRMrl9n/uNHAhxf5BD+gyITBjJBeRMIOnJnuLeNSQ0QkfTF/XssW1QkAVaBTCSZ1yamKg+FlyTYq5mzcVJdnpNvTs8S8= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f50d136-479c-4148-b4b9-08d6e096fe8d X-MS-Exchange-CrossTenant-originalarrivaltime: 24 May 2019 22:27:24.3677 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lariel@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5039 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org During the creation of the VLAN interface net device, the various device features and offloads are being set based on the parent device's features. The code initiates the basic, vlan and encapsulation features but doesn't address the MPLS features set and they remain blank. As a result, all device offloads that have significant performance effect are disabled for MPLS traffic going via this VLAN device such as checksumming and TSO. This patch makes sure that MPLS features are also set for the VLAN device based on the parent which will allow HW offloads of checksumming and TSO to be performed on MPLS tagged packets. Signed-off-by: Ariel Levkovich --- net/8021q/vlan_dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index f044ae5..585e73d 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -582,6 +582,7 @@ static int vlan_dev_init(struct net_device *dev) dev->vlan_features = real_dev->vlan_features & ~NETIF_F_ALL_FCOE; dev->hw_enc_features = vlan_tnl_features(real_dev); + dev->mpls_features = real_dev->mpls_features; /* ipv6 shared card related stuff */ dev->dev_id = real_dev->dev_id;