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 3076DA0577; Tue, 14 Apr 2020 23:59:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8599B1C2B9; Tue, 14 Apr 2020 23:59:30 +0200 (CEST) Received: from us-smtp-delivery-181.mimecast.com (us-smtp-delivery-181.mimecast.com [216.205.24.181]) by dpdk.org (Postfix) with ESMTP id 1B73F1C22A for ; Tue, 14 Apr 2020 23:59:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rbbn.com; s=mimecast20180816; t=1586901567; 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=uRdifae2KbHHtrR/maFZE03ZotL3ly93LyAKakXBPHc=; b=NlDYNGGg2vjIx203zgCIo5OD3xaT8Q+sqvmJee46IR/USHIG875ANzs8ItB0VQfo6DJ5iP NgDdPnBMuTlvg9q/4AxJxQCKVQzR5XF8h/L18naEIfbgKFLly5S0HPpSYCVpTSN1OfkfHq jXFf2zqdwAI7pZZXoGurb7HLyT7xvkI= Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-co1nam04lp2053.outbound.protection.outlook.com [104.47.45.53]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-139-nD1PEbd3OYmjqkbBzreWfQ-1; Tue, 14 Apr 2020 17:59:25 -0400 X-MC-Unique: nD1PEbd3OYmjqkbBzreWfQ-1 Received: from DM6PR03MB4777.namprd03.prod.outlook.com (2603:10b6:5:18b::26) by DM6PR03MB4426.namprd03.prod.outlook.com (2603:10b6:5:105::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.25; Tue, 14 Apr 2020 21:59:22 +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 21:59:22 +0000 From: Souvik Dey To: beilei.xing@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, "Dey, Souvik" Date: Tue, 14 Apr 2020 17:58:47 -0400 Message-Id: <20200414215847.3156-1-sodey@rbbn.com> X-Mailer: git-send-email 2.9.3.windows.1 X-ClientProxiedBy: MN2PR15CA0059.namprd15.prod.outlook.com (2603:10b6:208:237::28) 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 MN2PR15CA0059.namprd15.prod.outlook.com (2603:10b6:208:237::28) 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 21:59:22 +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: 861d1454-5f4e-46f9-b6dc-08d7e0bf16de X-MS-TrafficTypeDiagnostic: DM6PR03MB4426: 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)(136003)(346002)(376002)(396003)(39850400004)(366004)(4326008)(6506007)(66946007)(66476007)(6666004)(107886003)(8676002)(186003)(36756003)(2906002)(5660300002)(16526019)(1076003)(26005)(52116002)(66556008)(956004)(316002)(6486002)(478600001)(6512007)(86362001)(81156014)(8936002)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z6/HeJStzizg3Rap9LVSlAoYeRIG8pp4Zs+crt1QP7CcqgN72J3twK+nbPW3bJWH3WyVRzZqbObZQct3Zbru1AixKXoUPg+DPqDb7pOjx2nnKu3MJeHgohVUYQgBY9jWddUHZsCiUd2AK4d/B/J1m2ls97sTzgE9U26Hb9lf6lCGE8slYuuFUYrqw0jnPcmzRV0zaAGpwpFOXQWkaaJWNcuZs1aJzHIxzeeHwZdTAR0DRa7XOwgtt13JufSdA8PhM+lxBEkb/82up+nxSqHva0ORBj+cXVVbTTejrIc4Nw8xUOg3ZvQIvVFUIheQa9jZThNtx0ZMVxvmH2sQd2KvHzjAU5ToGavEiI05HPg4aob1g8jqki0G/or2fHU0jJGmsGTL5CHFzb+bdrewk1aBkoveqYHoy/TC/+/Dj2uYAMvF5fetdlPlNBtktHCYGng4 X-MS-Exchange-AntiSpam-MessageData: d9zboh74ZK2P/u/9vsPoYYXSOyofwbT5GYjsw56WJBM3YRd9Uvgf1IkcXLj14v2Oy+kMsxXqbFou1BEO5Meb2t829+dOgCY5AvWWrBwfilxA2Fen0AAmt8Xxtoxk2WMheRgkRcDbERvThsh5ATciHw== X-OriginatorOrg: rbbn.com X-MS-Exchange-CrossTenant-Network-Message-Id: 861d1454-5f4e-46f9-b6dc-08d7e0bf16de X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2020 21:59:22.5123 (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: jVyW+kdqb2QB1IjUpfikfCbZqGWN9BIrYZ2LunicVpmweURXBrTlIHTvk5pOChiv X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4426 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: rbbn.com Content-Type: text/plain 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" From: "Dey, Souvik" 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