Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp840492pxb; Wed, 25 Aug 2021 17:05:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyML1aYGoAOpsQNx6dTfSSOCeEYWZWDsf9C3VszCJdRiXyJf2c2afSdU/Xs36qLGnH7vcWn X-Received: by 2002:a17:906:d045:: with SMTP id bo5mr1279317ejb.461.1629936353733; Wed, 25 Aug 2021 17:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629936353; cv=none; d=google.com; s=arc-20160816; b=T4uK3hGi5CccTFm5BTzW1HPeq7Rylj9+ZZAstZ8629xVIInW6gjy80eeG7mF6iVCC7 KRkfnzD954Tg7cVOMHyjQEF5/h0sBOwLMyu8PI062Tbet6kFnFSfwElEEADnVL5GAnD7 b0hvADByzSYfZzS3073W4v1k0yLXXskCHTVXR4ef2k4xp6XO3PvOukM6IIjuri7fsy0H Rp9A7I22hB1oZU8z4ya9e9vXhegchdWaJLnqGYeDubpuilLbMkqkqtieB5SxZkcKiuCW 6X+gcPq9w4++cU+QjlVZygNwn5EfkusNNiXtQDmOb7I0sXUK1GOLTEKHpBLSa0j+FR0I NLyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KlyUydUojzLZ6p39N0u7umX9ajU71wqXxuDHFIBSfEU=; b=R4M6eJ560JWeoVDvqhcJ5ot+1+ZLvgGWPx0ODNlXcFmc1yWcDzIwXgz4emFFOFOdzm UJuAU6cX9fJmqZwgzarWvSV81X7xKPPgO2/OfPumQLLTgEfaRRqY9fKZRNmcuD9v19fH do9YY0P7ljxPBuafqw1EjBBYUBMtIgm4Npq41oz71H98gIvNyJmit2ncPEUFVoeRh8k1 YEH1ZDyw13ctcGLCiaPE5ei61/HwKFQksVCeZ80hQVcp4jA2q7pn7ch8kwHyExyoR1qJ EbpkzAlHUJFEzlxd7ceLxU4QwlVLkDZCmCZO5sO/TCThhcwlSYgigoX9I2y7mKEG1yk1 9siA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dv6rvcAy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qf15si1541109ejc.431.2021.08.25.17.05.30; Wed, 25 Aug 2021 17:05:53 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dv6rvcAy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234533AbhHZAEj (ORCPT + 99 others); Wed, 25 Aug 2021 20:04:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231535AbhHZAEj (ORCPT ); Wed, 25 Aug 2021 20:04:39 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F4AAC061757; Wed, 25 Aug 2021 17:03:52 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id x12so1967656wrr.11; Wed, 25 Aug 2021 17:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KlyUydUojzLZ6p39N0u7umX9ajU71wqXxuDHFIBSfEU=; b=Dv6rvcAy935B8kJHZeiXg1EHaPpGS/ccJWcMk4XgNNtcK5Oeydjb2bNPjkQd1lXaIG 8o+CcNDSyvnJUyWJoGzXTKOa213z8OK3xJroNWMa+lyzzv0G5+ql26itr/qPKAh/ewMU wndNGicDyUXxzr10DqhQNJYmbQkzWvdTBVOYRxVc0c/cixHw8AMiC/KytLiuWuzzuJz0 qmjTm+1jk+qpoGEFqYso4XbtEeGp6TE+QmCUW8DDEvallXyAcVYZDkjfEAql8Kl6B1WV y4i6sdlbibCViJNqRMiV8M+lhWYKXg9oQqznY2t8Nti01xPQH3jkfSnO+mHMP2cTxDjq KAjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KlyUydUojzLZ6p39N0u7umX9ajU71wqXxuDHFIBSfEU=; b=SqSg9PlN5ilTySqtq7Pp5IBxrX8ub03QLNBKTKht8CdsJd2pW+LVoyTdgKKMwg+V+6 VCouCisG6qUcyCdfK8H0hOWZ3/AZ0dKY1EBTbo+ifOTtWcSYe7RwH165W/CU3QKsQ1RL EWriY6CObGT+fEAWkySHXXom7CvVDjriZ/u3QJzHd9P1zELfKIdFRIOZNIWZ6LdnWW// MvV+HBWNv3ZAxU35AOHyvUv+W4I6HkMZsE/UaIsXbFLhE+2SM6rDF4ZHTSdIAwf5iqy9 eFgDPh1HDHwURjbd6n8WD9vPAhi0W4XNQ8EmHanSpVK44rlM0MTmOwf57CyvXALQL7Jb MqEQ== X-Gm-Message-State: AOAM5320uQHZ95zPvs0zt4TMXFO4WTo8oWzmhxqKJGWJeQsuHetG/OAZ Z0mdpf2+oR++sloRv6eeTcLjRDc9eMU= X-Received: by 2002:adf:90d0:: with SMTP id i74mr637031wri.185.1629936230707; Wed, 25 Aug 2021 17:03:50 -0700 (PDT) Received: from skbuf ([82.78.148.104]) by smtp.gmail.com with ESMTPSA id r8sm1353839wrj.11.2021.08.25.17.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Aug 2021 17:03:50 -0700 (PDT) Date: Thu, 26 Aug 2021 03:03:49 +0300 From: Vladimir Oltean To: DENG Qingfang Cc: Sean Wang , Landen Chao , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [RFC net-next 2/2] net: dsa: tag_mtk: handle VLAN tag insertion on TX Message-ID: <20210826000349.q3s5gjuworxtbcna@skbuf> References: <20210825083832.2425886-1-dqfext@gmail.com> <20210825083832.2425886-3-dqfext@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210825083832.2425886-3-dqfext@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 25, 2021 at 04:38:31PM +0800, DENG Qingfang wrote: > Advertise TX VLAN offload features, and handle VLAN tag insertion in > the tag_xmit function. > > Signed-off-by: DENG Qingfang > --- > net/dsa/tag_mtk.c | 46 ++++++++++++++++++++++------------------------ > 1 file changed, 22 insertions(+), 24 deletions(-) > > diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c > index 415d8ece242a..e407abefa06c 100644 > --- a/net/dsa/tag_mtk.c > +++ b/net/dsa/tag_mtk.c > @@ -22,7 +22,6 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, > struct net_device *dev) > { > struct dsa_port *dp = dsa_slave_to_port(dev); > - u8 xmit_tpid; > u8 *mtk_tag; > > /* Build the special tag after the MAC Source Address. If VLAN header > @@ -31,33 +30,31 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, > * the both special and VLAN tag at the same time and then look up VLAN > * table with VID. > */ > - switch (skb->protocol) { > - case htons(ETH_P_8021Q): > - xmit_tpid = MTK_HDR_XMIT_TAGGED_TPID_8100; > - break; > - case htons(ETH_P_8021AD): > - xmit_tpid = MTK_HDR_XMIT_TAGGED_TPID_88A8; > - break; > - default: > - xmit_tpid = MTK_HDR_XMIT_UNTAGGED; > - skb_push(skb, MTK_HDR_LEN); > - dsa_alloc_etype_header(skb, MTK_HDR_LEN); > - } > - You cannot just remove the old code. Only things like 8021q uppers will send packets with the VLAN in the hwaccel area. If you have an application that puts the VLAN in the actual AF_PACKET payload, like: https://github.com/vladimiroltean/tsn-scripts/blob/master/isochron/send.c then you need to handle the VLAN being in the skb payload.