From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9991BA0588; Wed, 15 Apr 2020 00:07:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CF0751C437; Wed, 15 Apr 2020 00:07:50 +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 BFC771C2F8 for ; Wed, 15 Apr 2020 00:07:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rbbn.com; s=mimecast20180816; t=1586902069; 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=FeZc2ADKuEnzzr4fcjsYzfJo5QJv/zB1pxa+XlhOC0U=; b=GrDqNCoWzO57MlRCWutV6IsU149W22XRoiBDhkeUAkKDfIPxnggurIOd34A2sMU+uKJht5 cemeF2NBae8x/1kHocBkKnWvltpKIJjRYe6YSoZEzTRLioEeP77nLjLPrhToX+ZvJh5hOX 6gn2DoMxOb2ycvITr0vfKEqzh7CfzI4= Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-BC9J7-OIM1ewwWEyGfTsrg-1; Tue, 14 Apr 2020 18:07:47 -0400 X-MC-Unique: BC9J7-OIM1ewwWEyGfTsrg-1 Received: from DM6PR03MB4777.namprd03.prod.outlook.com (20.179.106.218) by DM6PR03MB5034.namprd03.prod.outlook.com (10.141.162.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.26; Tue, 14 Apr 2020 22:07:45 +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 22:07:45 +0000 From: Souvik Dey To: beilei.xing@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, Souvik Dey Date: Tue, 14 Apr 2020 18:07:33 -0400 Message-Id: <20200414220733.7868-1-sodey@rbbn.com> X-Mailer: git-send-email 2.9.3.windows.1 X-ClientProxiedBy: MN2PR14CA0006.namprd14.prod.outlook.com (2603:10b6:208:23e::11) 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 MN2PR14CA0006.namprd14.prod.outlook.com (2603:10b6:208:23e::11) 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 22:07:44 +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: 41fbc243-8ca0-4606-7682-08d7e0c0427b X-MS-TrafficTypeDiagnostic: DM6PR03MB5034: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: 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)(366004)(136003)(376002)(346002)(39850400004)(396003)(2616005)(26005)(956004)(52116002)(4326008)(316002)(6506007)(186003)(66556008)(16526019)(66476007)(66946007)(5660300002)(2906002)(8936002)(81156014)(8676002)(107886003)(1076003)(478600001)(6512007)(36756003)(86362001)(6486002)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xyrVin8PFoPRygnBrBKQ0PhFBSUuRVWgu4SEFy1LQeSmqgECzHhMzylVPSvI1A02i32n+XtoxdesyCmJOQvqHHjEjoPxhl/aUirfZMBg/1Ri0K8LPfbhbL+hFjRmzvYUwSMvQQxxW4yhdp5pOPaaUnGrZAV2RLhnADYg4ujDzPcj22PDQMzqretnDqyomW3I9mQ6UEFMFUMuPliC3JcLgOki+utKedd4vjt9dfYQNlwQ5w0sfePLJZGdGYvvrbm9HD8lN1Cd2JvweuHQ1jTEVlzgF1VMNI71D0v/rHcowW1vIwaDlNo5IdqW6NYEmSuOHUTup8cIg1MKYBGN0TaWSnvDLai8HwlujfiC7z1luhflW5CZqrpjkEUDv+TuxLWL0j5XsIMI3210jb+UAOlPQvNF4FpozCH7c+V9yKPSC/PKbTqk7hKZukDwnDwE33Lr X-MS-Exchange-AntiSpam-MessageData: DbRuE17ir4eASx5OVzZEX0+EgWt4EbNSRS+3D9Tf+DaJ3Agf3Y7lAcdlrBJEXEpuKBavIAZolqX3w4g7KpGjEr+pfx5boT6riZfLxxmko+eDYVdbiA175B2nFl9Lgje28cDrFq37vzPHUcqzGvMM4Q== X-OriginatorOrg: rbbn.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41fbc243-8ca0-4606-7682-08d7e0c0427b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2020 22:07:45.1953 (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: JbblKPYMmO1+RDGH7nVEsYI+Yg0vm+bd5uquKq08wbBEsmN8k03TwX1xE9Oq7Eo0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB5034 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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..b8b6c57 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 ret; +=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