From patchwork Tue Mar 3 01:29:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dey, Souvik" X-Patchwork-Id: 66202 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 406D4A056F; Tue, 3 Mar 2020 02:29:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 00F391BFF6; Tue, 3 Mar 2020 02:29:31 +0100 (CET) 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 66A071BFF2 for ; Tue, 3 Mar 2020 02:29:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rbbn.com; s=mimecast20180816; t=1583198968; 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; bh=R5ogTMSDSmlvUkeoRslvtbVidA3TSUxu1p1ZxkNp0fY=; b=Dr2c+YNb5gVawd0alz+mIo12QBdKjbACFFzsl7UgWvAI+0DpfJLyjCWMT02YoXcTA/C6SH De5ZpadMWzQirj1OWoHpk9NYz6kRl06une3W9IzqMYvWbbRJjX0vHi/LJe+I16svDK1lru tAgcRR1MAnrnJ8BcJAB344EF46clC18= Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-bn3nam04lp2052.outbound.protection.outlook.com [104.47.46.52]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-252-tzzBy6_AMD-8u4Bi1GRNrg-1; Mon, 02 Mar 2020 20:29:26 -0500 X-MC-Unique: tzzBy6_AMD-8u4Bi1GRNrg-1 Received: from DM6PR03MB4777.namprd03.prod.outlook.com (2603:10b6:5:18b::26) by DM6PR03MB4396.namprd03.prod.outlook.com (2603:10b6:5:104::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.16; Tue, 3 Mar 2020 01:29:22 +0000 Received: from DM6PR03MB4777.namprd03.prod.outlook.com ([fe80::8a1:2fec:6da4:5789]) by DM6PR03MB4777.namprd03.prod.outlook.com ([fe80::8a1:2fec:6da4:5789%5]) with mapi id 15.20.2772.019; Tue, 3 Mar 2020 01:29:21 +0000 From: "Dey, Souvik" To: rmody@marvell.com, shshaikh@marvell.com, jerinj@marvell.com, ferruh.yigit@intel.com, thomas@monjalon.net Cc: dev@dpdk.org, stable@dpdk.org, "Dey, Souvik" Date: Mon, 2 Mar 2020 20:29:13 -0500 Message-Id: <20200303012913.13664-1-sodey@rbbn.com> X-Mailer: git-send-email 2.9.3.windows.1 X-ClientProxiedBy: MN2PR20CA0013.namprd20.prod.outlook.com (2603:10b6:208:e8::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 MN2PR20CA0013.namprd20.prod.outlook.com (2603:10b6:208:e8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2772.18 via Frontend Transport; Tue, 3 Mar 2020 01:29:21 +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: 2fa9b94f-f5d2-4f9d-ed94-08d7bf124cd6 X-MS-TrafficTypeDiagnostic: DM6PR03MB4396: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 03319F6FEF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(376002)(39860400002)(396003)(366004)(136003)(199004)(189003)(8936002)(1076003)(316002)(81166006)(81156014)(6486002)(66476007)(6666004)(6512007)(66946007)(66556008)(8676002)(4326008)(52116002)(107886003)(2616005)(5660300002)(36756003)(186003)(2906002)(86362001)(26005)(956004)(478600001)(16526019)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR03MB4396; H:DM6PR03MB4777.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C79N9O7rK8Za/yFSuyxq821Cvtd5vJqvpo/b+jvpbQ1fzzK7rg7siycTTVTAZ1043u6uaQYQ0t3CzJGh8rk2BzJtHWx6Xq3lxmK6XeFSyMFya60c2A4jNBn5dYMbIsFkmBbOB8SwxJvVIEDLWQxISB2e5LpOWENaZfi9sXJjH9+nbMpuNXqaK4jNZ/Gru6Elua6L8/pg3ftax6eI99nmLzwabWSXlCw3Ge4cA9GgI4SWAsgE1dTkaFQ1+LijsxHkoq6JVBDh4xqGMkoQ81zeokpcMROTfGwXzkOdPYBdwNLuJedjZ2oVOiaO71UxjDyojnQnpV/8YnW5GyEdyeqeuK+O4UAeexDrn10pgu2tKT72kSz4kkxF7UGqU63H6lKWcZDVNNHejpDaJfgpo/HWCxsSZxYWXvOP838DZaVBzjWFO9KMh6kbqnkxZzjtqnJr X-MS-Exchange-AntiSpam-MessageData: AdFLaeaF4mQU8rKrIHpwX1SZWPs1HMeL6JLxbjS2P6TJs4Ekfb0oS+1bI1irZTQ+DZ0t3Uga0Xxvh3m8X8nAYXLeUADkBPegGEvzCgGo9P3yT1Qu3j4MJGZ1ZySpxWFraqDjLvfBOfzvC78T1fHPTA== X-OriginatorOrg: rbbn.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fa9b94f-f5d2-4f9d-ed94-08d7bf124cd6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2020 01:29:21.8103 (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: RKogqSHpkTzifrXTS4zVZIUlmu0WYeHzQ90t2qhTeiH770jIZITgSPTmu2WUZRa0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4396 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: rbbn.com X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [PATCH v2] 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" In case of bnx2xvf pmd, tx packets can support vland id in 2 ways : 1. setting the mbuf ol_flags=PKT_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: "Dey, Souvik" Acked-by: Rasesh Mody Signed-off-by: "Dey Souvik" --- v2: * Fix compilation issues. * Changed the Subject Line as recommended. drivers/net/bnx2x/bnx2x.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 0b4030e..0afa602 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2216,11 +2216,25 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_start_bd->vlan_or_ethertype = rte_cpu_to_le_16(pkt_prod); else { + /* when transmitting in a vf, start bd must hold the ethertype + * for fw to enforce it + */ struct rte_ether_hdr *eh = rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); - - tx_start_bd->vlan_or_ethertype = - rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type)); + /* Still need to consider inband vlan for enforced */ + if (eh->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) { + struct rte_vlan_hdr *vh = + (struct rte_vlan_hdr *)(eh + 1); + tx_start_bd->bd_flags.as_bitfield |= + (X_ETH_INBAND_VLAN << + ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT); + tx_start_bd->vlan_or_ethertype = + rte_cpu_to_le_16(ntohs(vh->vlan_tci)); + } else { + tx_start_bd->vlan_or_ethertype = + (rte_cpu_to_le_16 + (rte_be_to_cpu_16(eh->ether_type))); + } } }