Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp940707ybh; Wed, 22 Jul 2020 17:59:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUcT1yOhtKp7AjA3Jw3suepF1IiZMXbVSYf/3FP3NI2WQnpRZFSMZDYzpH1pl3U/tWk6d0 X-Received: by 2002:a17:906:3a0d:: with SMTP id z13mr2013851eje.109.1595465957882; Wed, 22 Jul 2020 17:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595465957; cv=none; d=google.com; s=arc-20160816; b=VmXVBOtnQpT4CKLmtpVnSeAUOVlLaouA17XxA5wPusqnnBmpWSji45RXm7tpr93RMU tjxtZ1v7ZYohL0XWt3xszUHR884Rnqmx9rWz3AJzapTHwB9T0FHy0UGrvX47eHKUgKXp KR3asz5JYdoTqkH+Ne/iMVqgAMineIhR2eQb/5mcCslzP7Y0zyO68hDZWMm79UhNL8cG LpqfnenltCVlJjPo+1npG25VNkWVwBdJmSXgSWj+CECluGnAgfUuNIde/GKmk1WoIwca GlmPO6dWdrOO3Miyao4JR1wByTjajZYucvoSdBv2Iont8oF5pX7xYJuhqXfLTUKr6ped wErQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=ekRwxgmmfEjVJs0nSw/ng2a067arZjWK7wEF2pZDjT0=; b=tfJ9ukFGkNLbTs7keVEsDpmvHCNq277joJSEULDcOYQAcZx4iHi9Kd/RbIsFzwxXgK RK6EWZvXjOOhb3KVhGE3+hhdSaCqNmerkmUBwTaTV+VETJ/KLByO7X3p2SqMwnnSAJg4 f0Tpu2JwzkKGweKtERM5Xt17zu/zUG/VoZJx0EcBVOFrSrbcxSPc+5jD8anFe2GWm6HS 1CEYhtZjCug007y+x7GyFIOWLn/ObmsnX2StUmA9iibqiIfvNKZtYUbZxeKZ/CS8taYn S6u+W9+vXqEhqZr/neSGl7mV+d4GuMPdItnUfdMabkw177uIM1wYgO0Jueed5rE0BNxH t5uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si1012068ejb.404.2020.07.22.17.58.55; Wed, 22 Jul 2020 17:59:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387439AbgGWA6b (ORCPT + 99 others); Wed, 22 Jul 2020 20:58:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728607AbgGWA6b (ORCPT ); Wed, 22 Jul 2020 20:58:31 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CAC0C0619DC; Wed, 22 Jul 2020 17:58:31 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id EF40B126ABECD; Wed, 22 Jul 2020 17:41:45 -0700 (PDT) Date: Wed, 22 Jul 2020 17:58:30 -0700 (PDT) Message-Id: <20200722.175830.616952267325554952.davem@davemloft.net> To: srirakr2@cisco.com Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, mbumgard@cisco.com, ugm@cisco.com, nimm@cisco.com, xe-linux-external@cisco.com, kuba@kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6] hv_netvsc: add support for vlans in AF_PACKET mode From: David Miller In-Reply-To: <20200722153845.79946-1-srirakr2@cisco.com> References: <20200722153845.79946-1-srirakr2@cisco.com> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 22 Jul 2020 17:41:46 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sriram Krishnan Date: Wed, 22 Jul 2020 21:08:44 +0530 > Vlan tagged packets are getting dropped when used with DPDK that uses > the AF_PACKET interface on a hyperV guest. > > The packet layer uses the tpacket interface to communicate the vlans > information to the upper layers. On Rx path, these drivers can read the > vlan info from the tpacket header but on the Tx path, this information > is still within the packet frame and requires the paravirtual drivers to > push this back into the NDIS header which is then used by the host OS to > form the packet. > > This transition from the packet frame to NDIS header is currently missing > hence causing the host OS to drop the all vlan tagged packets sent by > the drivers that use AF_PACKET (ETH_P_ALL) such as DPDK. > > Here is an overview of the changes in the vlan header in the packet path: > > The RX path (userspace handles everything): > 1. RX VLAN packet is stripped by HOST OS and placed in NDIS header > 2. Guest Kernel RX hv_netvsc packets and moves VLAN info from NDIS > header into kernel SKB > 3. Kernel shares packets with user space application with PACKET_MMAP. > The SKB VLAN info is copied to tpacket layer and indication set > TP_STATUS_VLAN_VALID. > 4. The user space application will re-insert the VLAN info into the frame > > The TX path: > 1. The user space application has the VLAN info in the frame. > 2. Guest kernel gets packets from the application with PACKET_MMAP. > 3. The kernel later sends the frame to the hv_netvsc driver. The only way > to send VLANs is when the SKB is setup & the VLAN is stripped from the > frame. > 4. TX VLAN is re-inserted by HOST OS based on the NDIS header. If it sees > a VLAN in the frame the packet is dropped. > > Cc: xe-linux-external@cisco.com > Cc: Sriram Krishnan > Signed-off-by: Sriram Krishnan Applied to net-next, thank you.