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 8795CA0577; Tue, 14 Apr 2020 01:09:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 61E511C06B; Tue, 14 Apr 2020 01:09:40 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id A9CE71C036 for ; Tue, 14 Apr 2020 01:09:38 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03DN1KmV017464; Mon, 13 Apr 2020 16:09:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=3d468P1u9rM2d/OCi1cjscftZL5HBsYz7VaW4tYR5HA=; b=USdNzMBLXvMuxmECHU2DhtxXxMumKn3SdAJ0/PTX++LAbK11wxGzVxRm2QrNDsI7LaNK xdXLTvstFuNbD3ZRJTPZRc9pR7QuRHzDFsflI0ezTBsSF1q/5LSYHXBV3EHGDgWC8MUO uQsGGAvbTs786OyNc5YlLgdTnpzuOhCsuWNPd69B2FjSoTQ/BsOqJfBRDsM3fHl30ED7 DH4QWetvVzhwMTtS414zkzcXO6DxWJmmoaCKVl/xP3/Wj4gyL4tmut60ngUUjkdDDiu9 VBa/7skM1XVDHTOepOZcb2F3iTvVqecUVoaOHjH5XYPxvrwMSQ66D0CTm8nCwHRwBhpb bA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 30bddkqycm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 13 Apr 2020 16:09:38 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 13 Apr 2020 16:09:36 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 13 Apr 2020 16:09:36 -0700 Received: from irv1user08.caveonetworks.com (unknown [10.104.116.105]) by maili.marvell.com (Postfix) with ESMTP id 36A5C3F703F; Mon, 13 Apr 2020 16:09:36 -0700 (PDT) Received: (from rmody@localhost) by irv1user08.caveonetworks.com (8.14.4/8.14.4/Submit) id 03DN9aTu023572; Mon, 13 Apr 2020 16:09:36 -0700 X-Authentication-Warning: irv1user08.caveonetworks.com: rmody set sender to rmody@marvell.com using -f From: Rasesh Mody To: CC: Souvik Dey , , , Date: Mon, 13 Apr 2020 16:09:30 -0700 Message-ID: <20200413230930.23514-1-rmody@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200226163635.18252-1-sodey@rbbn.com> References: <20200226163635.18252-1-sodey@rbbn.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-13_11:2020-04-13, 2020-04-13 signatures=0 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=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. v3: * Fixed the checkpatch issue. * Changed vlan to VLAN in the headline. v2: * Fix compilation issues. * Changed the Subject Line as recommended. Signed-off-by: Souvik Dey Acked-by: Rasesh Mody --- 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 0b4030e2b9..ff7646b25d 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, 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))); + } } } -- 2.18.0