From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 0CCC4A0577;
	Wed, 15 Apr 2020 01:07:13 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 40F141D173;
	Wed, 15 Apr 2020 01:07:13 +0200 (CEST)
Received: from us-smtp-delivery-181.mimecast.com
 (us-smtp-delivery-181.mimecast.com [63.128.21.181])
 by dpdk.org (Postfix) with ESMTP id C38F41D16E
 for <dev@dpdk.org>; Wed, 15 Apr 2020 01:07:11 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rbbn.com;
 s=mimecast20180816; t=1586905631;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding;
 bh=uzzchXrwoLi7DFRyvh8Vhwqr+Yg5lldL4lBUOaydTq0=;
 b=Z7Y9znuR1TJn37eZDxmoCp19sExDro7bTOSTm1GwqqVz8FsbHv66lp7TDRiMCBKjSHDz8N
 hcXMaA5tCxhqhHABej3kwrstMk06BHmvvCV6ZocWjX+Uipps3MNp98mE6yAOiT3IZUNCSs
 qHn0VWStHLHVUqu4/Q1GUM5a/761iIk=
Received: from NAM12-BN8-obe.outbound.protection.outlook.com
 (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174])
 (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-468-1tXs7pcINN2FZPd1HbruuQ-1; Tue, 14 Apr 2020 19:07:09 -0400
X-MC-Unique: 1tXs7pcINN2FZPd1HbruuQ-1
Received: from DM6PR03MB4777.namprd03.prod.outlook.com (2603:10b6:5:18b::26)
 by DM6PR03MB4171.namprd03.prod.outlook.com (2603:10b6:5:5d::19) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15; Tue, 14 Apr
 2020 23:07:08 +0000
Received: from DM6PR03MB4777.namprd03.prod.outlook.com
 ([fe80::7cc8:d76f:2733:b128]) by DM6PR03MB4777.namprd03.prod.outlook.com
 ([fe80::7cc8:d76f:2733:b128%3]) with mapi id 15.20.2900.028; Tue, 14 Apr 2020
 23:07:08 +0000
From: Souvik Dey <sodey@rbbn.com>
To: beilei.xing@intel.com,
	qi.z.zhang@intel.com
Cc: dev@dpdk.org,
	Souvik Dey <sodey@rbbn.com>
Date: Tue, 14 Apr 2020 19:06:59 -0400
Message-Id: <20200414230659.14520-1-sodey@rbbn.com>
X-Mailer: git-send-email 2.9.3.windows.1
X-ClientProxiedBy: MN2PR07CA0016.namprd07.prod.outlook.com
 (2603:10b6:208:1a0::26) To DM6PR03MB4777.namprd03.prod.outlook.com
 (2603:10b6:5:18b::26)
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
Received: from SODEY-LMA.sonusnet.com (72.70.55.110) by
 MN2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:208:1a0::26) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2900.15 via Frontend
 Transport; Tue, 14 Apr 2020 23:07:07 +0000
X-Mailer: git-send-email 2.9.3.windows.1
X-Originating-IP: [72.70.55.110]
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: c4732808-fb89-443d-52a5-08d7e0c88e07
X-MS-TrafficTypeDiagnostic: DM6PR03MB4171:
X-MS-Exchange-Transport-Forked: True
X-Microsoft-Antispam-PRVS: <DM6PR03MB4171030CB0486DB077D3596BCDDA0@DM6PR03MB4171.namprd03.prod.outlook.com>
X-MS-Oob-TLC-OOBClassifiers: OLM:8882;
X-Forefront-PRVS: 0373D94D15
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:DM6PR03MB4777.namprd03.prod.outlook.com; PTR:; CAT:NONE;
 SFTY:;
 SFS:(10009020)(4636009)(376002)(346002)(136003)(366004)(39850400004)(396003)(86362001)(66946007)(2906002)(186003)(66556008)(66476007)(8936002)(316002)(5660300002)(1076003)(6506007)(8676002)(16526019)(81156014)(52116002)(6666004)(6486002)(2616005)(956004)(4326008)(26005)(6512007)(478600001)(107886003)(36756003);
 DIR:OUT; SFP:1101; 
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: kqGvXWroYMFdO/lrV5tmHo6J2j2R4+zoLWPNhq32BUAFnI22U7QQdmaAMWSIzQYx4Yqhj8vOTfNUh1VFSkBEON4c75I72pkin3hRfXUROMlPE7wWHuwXn3gcucL69N6T8LbYb1dY7jUCdMwggDQK1AU78JWhss0hpZqSjTgKXMICbU5V3MWeFdWjuyK70y/AzCA8VinG6CKjUiLZEerL30n2kBAQfhofvvHUnntSdta3BCsIOM00Dhj9jKLVyBSdC9w+N4225sKgWPR+K8ORZSN8Ud8lDMSODuEh3yBmkWOBkWr3QUmiVnS7kaq7iZmc+0rhQTgnANGRVTf6s71SRcQVnTF0wf34K9W9GcUYeMtMmyZf9Ts+yvJmTsvFx3OfZbokYTYReh3SZAvI5Ivf4hvOZG8RyCzRo548+T+KFIJRsenDHNkqfwDhVHZP9SWH
X-MS-Exchange-AntiSpam-MessageData: SAlj1djwUuuizOgnTDhih5RT980mIADZ+WDPmM5D0nZBlUDcwcc/nEzcChbWLmPqKzIswjl3fN3Q/0uU1bIfJ4Jin4eaK819XpBaepHCR6j3ilHTYBzsEbP7UQqMQmz76MVfmEfAbmCaCyIduQxGZg==
X-OriginatorOrg: rbbn.com
X-MS-Exchange-CrossTenant-Network-Message-Id: c4732808-fb89-443d-52a5-08d7e0c88e07
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2020 23:07:07.9079 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 29a671dc-ed7e-4a54-b1e5-8da1eb495dc3
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: dy4ME+Bti99j/kkjKJ0nx/U0jjqJ2q4wbTAEEz1VU8hGPx9GDf2d1zcEiwSRNazO
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4171
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: rbbn.com
Content-Type: text/plain; charset=WINDOWS-1252
Content-Transfer-Encoding: quoted-printable
Subject: [dpdk-dev] [PATCH] net/i40e: issue with ADD VLAN from Guest
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

In case of i40evf pmd, when ADD_VLAN is sent down the linux i40e driver,
along with add the vlan the kernel driver also enables the vlan stripping
by default.
This might have issues if the app configured DEV_RX_OFFLOAD_VLAN_STRIP
as off at the port configuration. The app after adding the VLAN will
expect the VLAN to be coming in the received packets but, due to
VLAN_STRIP enabled at the PF, it will get stripped.
This behavior of the Linux driver causes confussion with the DPDK app
using i40e_pmd. So it is better to check the state of the
DEV_RX_OFFLOAD_VLAN_STRIP flag in the dev_conf and disable the vlan strip
after sending add_vlan if app configured the VLAN_STRIP as disabled.


Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethd=
ev_vf.c
index 244397e..d9c30be 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1044,6 +1044,7 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vla=
nid)
 {
 =09struct i40e_vf *vf =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private)=
;
 =09struct virtchnl_vlan_filter_list *vlan_list;
+=09struct rte_eth_conf *dev_conf =3D &dev->data->dev_conf;
 =09uint8_t cmd_buffer[sizeof(struct virtchnl_vlan_filter_list) +
 =09=09=09=09=09=09=09sizeof(uint16_t)];
 =09int err;
@@ -1060,8 +1061,21 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vl=
anid)
 =09args.out_buffer =3D vf->aq_resp;
 =09args.out_size =3D I40E_AQ_BUF_SZ;
 =09err =3D i40evf_execute_vf_cmd(dev, &args);
-=09if (err)
+=09if (err) {
 =09=09PMD_DRV_LOG(ERR, "fail to execute command OP_ADD_VLAN");
+=09=09return err;
+=09}
+=09/*
+=09 * In linux kernel driver on receiving ADD_VLAN it enables
+=09 * VLAN_STRIP by default. So disable it if app confifured
+=09 * it that way.
+=09 */
+=09if (!(dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)) {
+=09=09err =3D i40evf_disable_vlan_strip(dev);
+=09=09if (err)
+=09=09=09PMD_DRV_LOG(ERR, "fail to execute command disable_vlan_strip "
+=09=09=09=09"as a part of OP_ADD_VLAN");
+=09}
=20
 =09return err;
 }
--=20
2.9.3.windows.1