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 216EFA0577; Mon, 6 Apr 2020 18:57:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 352ED2BE9; Mon, 6 Apr 2020 18:57:40 +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 85AAE2B96 for ; Mon, 6 Apr 2020 18:57:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rbbn.com; s=mimecast20180816; t=1586192257; 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: in-reply-to:in-reply-to:references:references; bh=R5c2tMeQ2zvXtmmptTk7Vji7w7fd4d2FqodWKQ+US+I=; b=jAOi7EbsX67G59aCkbJAelt4yWceNop4m6oHqoeAKEpDjsaQoP/mBnD3bThOXS7953LUBh rwV8EAo2x+KupnidyXAXYDBFyEcHgl8LnTh5mXXf4VVJOcPh1MlWqsCMO9tWgJK4TMyBLn dImWDwChe4S6lj/yKeWVuNowrCNHcAE= Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-495-hWESEIYWPSakB04-yQ2R0w-1; Mon, 06 Apr 2020 12:57:36 -0400 X-MC-Unique: hWESEIYWPSakB04-yQ2R0w-1 Received: from DM6PR03MB4777.namprd03.prod.outlook.com (2603:10b6:5:18b::26) by DM6PR03MB4297.namprd03.prod.outlook.com (2603:10b6:5:9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.20; Mon, 6 Apr 2020 16:57:35 +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.2878.018; Mon, 6 Apr 2020 16:57:35 +0000 From: "Dey, Souvik" To: dev@dpdk.org Cc: Souvik Dey Date: Mon, 6 Apr 2020 12:57:14 -0400 Message-Id: <20200406165714.18036-1-sodey@rbbn.com> X-Mailer: git-send-email 2.9.3.windows.1 In-Reply-To: <20200303012913.13664-1-sodey@rbbn.com> References: <20200303012913.13664-1-sodey@rbbn.com> X-ClientProxiedBy: MN2PR05CA0047.namprd05.prod.outlook.com (2603:10b6:208:236::16) 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 MN2PR05CA0047.namprd05.prod.outlook.com (2603:10b6:208:236::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2900.6 via Frontend Transport; Mon, 6 Apr 2020 16:57:35 +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: 018c77a7-db6f-4d5c-6dc2-08d7da4b9ae0 X-MS-TrafficTypeDiagnostic: DM6PR03MB4297: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0365C0E14B 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)(39850400004)(396003)(136003)(366004)(346002)(376002)(316002)(6506007)(6916009)(5660300002)(81156014)(36756003)(478600001)(81166006)(2906002)(8676002)(52116002)(4326008)(8936002)(107886003)(6486002)(6512007)(66946007)(16526019)(186003)(26005)(2616005)(956004)(66476007)(66556008)(1076003)(86362001)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eCjH+xcolhHK+VBsQhq6inqk2EIxGGUJEA6QyCK9xwOyfWmenQ1ywDXkjBzNZx+B1yUt4RYAq5cZNqTVSu5UQGHzz3xZNyuOaVwWcHzc+15soHtiXOjcSS8qbI6+butPplRVXbOKYLgiRbFANJyRL+6dLFfWY87qiFlSAdvYxadtmCYLrreRj/DV/+/OFp43YCDaES/7nqjork+iT9V39gUiavvPoYkDyJUZOs1VxXtATy6OJrz1eyYQNghiMoWyRemtAj9HbvRfLF+cvkZc8KuoCMbCV5ZkQfolGCariLhu8B1PLQiInUNEym1XC1fRaf4SDp6ZQ3whmoVpof9r4fm6WIV3R65Txz46D0xY5Uv+m49H26U91qnUvIT1dy2mcR28yAefvsPJLiFk/4KtwW8koN/W7o4inVHbN9H2tstle0oBb5Wwwwbhtz4n6683 X-MS-Exchange-AntiSpam-MessageData: 9dJmelzz47MSeA5E7YtMYialTzfW8NigrcZ2M2Hn87zaPqckY4YE/DASQe9BFdC1OK2h1T3ueep/JKkvH4+BBLjInSm16PpxWP5eRUK/HGwuGUBHgNONixaIUwLo1Nzv8H/WRYTfyUEU9pU6kaKxGQ== X-OriginatorOrg: rbbn.com X-MS-Exchange-CrossTenant-Network-Message-Id: 018c77a7-db6f-4d5c-6dc2-08d7da4b9ae0 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2020 16:57:35.3765 (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: Us7bjB+Ht22tRDr9rfMW5PJkwjGoxc3NuCJhVK8idSokz03CBrsemsQxG4l5AN4B X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4297 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: rbbn.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH v3] net/bnx2x: handle guest VLAN for SR-IOV case 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: Souvik Dey In case of bnx2xvf pmd, tx packets can support vland id in 2 ways: 1. setting the mbuf ol_flags=3DPKT_TX_VLAN_PKT and passing the vlanid in mbuf->vlan_tci. 2. the tx packet itself has the vlan id included in the packet. The first case is working as expected but the second case where the vlan id is included in thetx packets itself was found not working as expected. To handle that we need to properly set the start_bd bitfield and the vlan_or_ethertype instead of setting it to just the ethertype in case of VF. Signed-off-by: Souvik Dey <"sodey@rbbn.com> --- v3: * Fixed the checkpatch issue. * Changed vlan to VLAN in the headline. =20 v2: * Fix compilation issues. * Changed the Subject Line as recommended. =20 drivers/net/bnx2x/bnx2x.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 0b4030e..ff7646b 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2216,11 +2216,27 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, stru= ct rte_mbuf *m0) =09=09=09tx_start_bd->vlan_or_ethertype =3D =09=09=09 rte_cpu_to_le_16(pkt_prod); =09=09else { +=09=09=09/* when transmitting in a vf, start bd +=09=09=09 * must hold the ethertype for fw to enforce it +=09=09=09 */ =09=09=09struct rte_ether_hdr *eh =3D =09=09=09 rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); =20 -=09=09=09tx_start_bd->vlan_or_ethertype =3D -=09=09=09 rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type)); +=09=09=09/* Still need to consider inband vlan for enforced */ +=09=09=09if (eh->ether_type =3D=3D +=09=09=09=09=09rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) { +=09=09=09=09struct rte_vlan_hdr *vh =3D +=09=09=09=09=09(struct rte_vlan_hdr *)(eh + 1); +=09=09=09=09tx_start_bd->bd_flags.as_bitfield |=3D +=09=09=09=09=09(X_ETH_INBAND_VLAN << +=09=09=09=09=09ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT); +=09=09=09=09tx_start_bd->vlan_or_ethertype =3D +=09=09=09=09=09rte_cpu_to_le_16(ntohs(vh->vlan_tci)); +=09=09=09} else { +=09=09=09=09tx_start_bd->vlan_or_ethertype =3D +=09=09=09=09=09(rte_cpu_to_le_16 +=09=09=09=09=09(rte_be_to_cpu_16(eh->ether_type))); +=09=09=09} =09=09} =09} =20 --=20 2.9.3.windows.1