From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id C42C41B5EF for ; Fri, 14 Dec 2018 02:26:26 +0100 (CET) Received: by mail-pg1-f194.google.com with SMTP id z10so1889952pgp.7 for ; Thu, 13 Dec 2018 17:26:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dbuCE0Kt+GIqtvQH+YGxpAhxNVD8MDmPhvpZIQ6xXcc=; b=wAp1Tn/1pOFVC1vhpigWuVphtNGndOdDKr6lMav6JprjkZPYS+C8nW/X7tcbZY2O/v kwa2an2AurFOmEbURoRSodWBp0xCiPl3UcSJGKq1dCJPCNLh6vNT3m4/OSG8EWh35oL3 WjxJLJt3uvRjHDiQPbHbzNz/W5XPD7nhGeqa3zHgbkaxgNFMG22bbhVCL3ccchmX+Gx9 JwA3glu+CuFDLMRtOU4+Ex2wuYB4xQxIBdEAFYQqTgTGFImzKiGt7LiSoIr9Sh4a2ed/ qMM4AcVqR+IRnwUk9TSdGzpEnZimV1o8WAE694nOfwwGpKmmO0tJ+ImtMhI8Eg3IDoal fwdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dbuCE0Kt+GIqtvQH+YGxpAhxNVD8MDmPhvpZIQ6xXcc=; b=MPdixC5X9cF4hPV37SaraRDAJJ1p9jOrLdjipTt6mc2HJvH769hCSTH3S6LcCWnIz1 WuMgQUiXvbxEEuXVpaA0HQUiSlN15+UQZ53cMZhuoh2skgSnP4e1bSEZRtzt1Ol3dTRk j5dbH/wSXnuyeqGAZ6MASFByJYrqlsoR5G6xvfeLv/72POYzd0JyecVzuTfFZRiXvg1f 1S619D6/zvpazhg5m9FMlpOvixKXeJhIg1lWFUmnOfUsmQh5NS4ENypBHF4tK28dTXTK 2uFofwhDrM0cfnN/hPrEvgCaoL+uyRdCoAoXBJRlyw7HbFqDWMjm3Pa7MMPct3HGGOD7 W72g== X-Gm-Message-State: AA+aEWb/sNs4jvTBQQR4zcG9CL56K+pwUeuMskkBwK+17lc3nfERgS7K AxPKaFSH6N3KDgNFOry9zubiNHSJjaM= X-Google-Smtp-Source: AFSGD/VpTL4PtBsR66QiirYYlVZFmah1bRarZTpVdYalXyBP30f46EO6lAx6Npx3gsbpKCTrlKix8Q== X-Received: by 2002:a63:e348:: with SMTP id o8mr965004pgj.158.1544750785565; Thu, 13 Dec 2018 17:26:25 -0800 (PST) Received: from xeon-e3.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id i21sm3379085pgm.17.2018.12.13.17.26.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 17:26:24 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Thu, 13 Dec 2018 17:26:19 -0800 Message-Id: <20181214012621.15213-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181214012621.15213-1-stephen@networkplumber.org> References: <20181214012621.15213-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/3] net/netvsc: support receive without vlan strip 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: , X-List-Received-Date: Fri, 14 Dec 2018 01:26:27 -0000 In some cases, VLAN stripping is not desireable. If necessary re-insert stripped vlan tag. Signed-off-by: Stephen Hemminger --- drivers/net/netvsc/hn_ethdev.c | 2 ++ drivers/net/netvsc/hn_rxtx.c | 8 ++++++++ drivers/net/netvsc/hn_var.h | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index b330bf3d7255..d7ac0c7320b0 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -378,6 +378,8 @@ static int hn_dev_configure(struct rte_eth_dev *dev) return -EINVAL; } + hv->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP); + err = hn_rndis_conf_offload(hv, txmode->offloads, rxmode->offloads); if (err) { diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index f4a36641b6c3..622a83983e10 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -501,6 +501,14 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb, if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) { m->vlan_tci = info->vlan_info; m->ol_flags |= PKT_RX_VLAN_STRIPPED | PKT_RX_VLAN; + + /* NDIS always strips tag, put it back if necessary */ + if (!hv->vlan_strip && rte_vlan_insert(&m)) { + PMD_DRV_LOG(DEBUG, "vlan insert failed"); + ++rxq->stats.errors; + rte_pktmbuf_free(m); + return; + } } if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) { diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index e1072c7cfa55..cd173f6af942 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -97,8 +97,9 @@ struct hn_data { struct rte_eth_dev *vf_dev; /* Subordinate device */ rte_spinlock_t vf_lock; uint16_t port_id; - bool closed; - bool vf_present; + uint8_t closed; + uint8_t vf_present; + uint8_t vlan_strip; uint32_t link_status; uint32_t link_speed; -- 2.19.2