From patchwork Sat Apr 27 17:00:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 1092071 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lunn.ch Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=lunn.ch header.i=@lunn.ch header.b="Xfdu5HV6"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44ry7q10Zgz9sCF for ; Sun, 28 Apr 2019 03:09:11 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726247AbfD0RJJ (ORCPT ); Sat, 27 Apr 2019 13:09:09 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:46776 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbfD0RJJ (ORCPT ); Sat, 27 Apr 2019 13:09:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uEMUEouKRghoSoVzJycJ90cq31RXjfRHzwB5+tb5VBY=; b=Xfdu5HV6Ul2P6/2wjNz2yF/Rvr c3zxBIjAETsP0/XZozx28ydQAU4J98oO3XGEw0WDInvz1eyYZ70MTl9PIQIQUMcTfNF2w/UA33Y8l BcV1CPQMdMYFReUDlf9q32PkRBivt7xYdr/KqKAfpNuvCbkcMjOmRYa+g/blDX7890Og=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1hKQgr-00030B-Q4; Sat, 27 Apr 2019 19:00:41 +0200 From: Andrew Lunn To: David Miller Cc: netdev , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v3 net-next 05/14] dsa: Add TAG protocol to tag ops Date: Sat, 27 Apr 2019 19:00:26 +0200 Message-Id: <20190427170035.11479-6-andrew@lunn.ch> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190427170035.11479-1-andrew@lunn.ch> References: <20190427170035.11479-1-andrew@lunn.ch> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In order that we can match the tagging protocol a switch driver request to the tagger, we need to know what protocol the tagger supports. Add this information to the ops structure. Signed-off-by: Andrew Lunn Reviewed-by: Florian Fainelli v2 More tag protocol to end of structure to keep hot members at the beginning. --- include/net/dsa.h | 1 + net/dsa/dsa.c | 1 + net/dsa/tag_brcm.c | 2 ++ net/dsa/tag_dsa.c | 1 + net/dsa/tag_edsa.c | 1 + net/dsa/tag_gswip.c | 1 + net/dsa/tag_ksz.c | 2 ++ net/dsa/tag_lan9303.c | 1 + net/dsa/tag_mtk.c | 1 + net/dsa/tag_qca.c | 1 + net/dsa/tag_trailer.c | 1 + 11 files changed, 13 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 8f3d5e0825a2..720036f48fb3 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -70,6 +70,7 @@ struct dsa_device_ops { int *offset); unsigned int overhead; const char *name; + enum dsa_tag_protocol proto; }; #define DSA_TAG_DRIVER_ALIAS "dsa_tag-" diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 92b3cd129eb7..2da733dff86b 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -36,6 +36,7 @@ static struct sk_buff *dsa_slave_notag_xmit(struct sk_buff *skb, static const struct dsa_device_ops none_ops = { .name = "none", + .proto = DSA_TAG_PROTO_NONE, .xmit = dsa_slave_notag_xmit, .rcv = NULL, }; diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c index 59421f9e96de..39b380485e5a 100644 --- a/net/dsa/tag_brcm.c +++ b/net/dsa/tag_brcm.c @@ -169,6 +169,7 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev, const struct dsa_device_ops brcm_netdev_ops = { .name = "brcm", + .proto = DSA_TAG_PROTO_BRCM, .xmit = brcm_tag_xmit, .rcv = brcm_tag_rcv, .overhead = BRCM_TAG_LEN, @@ -195,6 +196,7 @@ static struct sk_buff *brcm_tag_rcv_prepend(struct sk_buff *skb, const struct dsa_device_ops brcm_prepend_netdev_ops = { .name = "brcm-prepend", + .proto = DSA_TAG_PROTO_BRCM_PREPEND, .xmit = brcm_tag_xmit_prepend, .rcv = brcm_tag_rcv_prepend, .overhead = BRCM_TAG_LEN, diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index b8f3236db877..ec9b66c11219 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c @@ -152,6 +152,7 @@ static int dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, const struct dsa_device_ops dsa_netdev_ops = { .name = "dsa", + .proto = DSA_TAG_PROTO_DSA, .xmit = dsa_xmit, .rcv = dsa_rcv, .flow_dissect = dsa_tag_flow_dissect, diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c index c4fddf7292cf..866d4e684511 100644 --- a/net/dsa/tag_edsa.c +++ b/net/dsa/tag_edsa.c @@ -171,6 +171,7 @@ static int edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, const struct dsa_device_ops edsa_netdev_ops = { .name = "edsa", + .proto = DSA_TAG_PROTO_EDSA, .xmit = edsa_xmit, .rcv = edsa_rcv, .flow_dissect = edsa_tag_flow_dissect, diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c index 6a7ff063b6e0..192156373108 100644 --- a/net/dsa/tag_gswip.c +++ b/net/dsa/tag_gswip.c @@ -105,6 +105,7 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb, const struct dsa_device_ops gswip_netdev_ops = { .name = "gwsip", + .proto = DSA_TAG_PROTO_GSWIP, .xmit = gswip_tag_xmit, .rcv = gswip_tag_rcv, .overhead = GSWIP_RX_HEADER_LEN, diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index 6d78d88270fc..5f5c8f9a6141 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -135,6 +135,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev, const struct dsa_device_ops ksz9477_netdev_ops = { .name = "ksz9477", + .proto = DSA_TAG_PROTO_KSZ9477, .xmit = ksz9477_xmit, .rcv = ksz9477_rcv, .overhead = KSZ9477_INGRESS_TAG_LEN, @@ -171,6 +172,7 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb, const struct dsa_device_ops ksz9893_netdev_ops = { .name = "ksz9893", + .proto = DSA_TAG_PROTO_KSZ9893, .xmit = ksz9893_xmit, .rcv = ksz9477_rcv, .overhead = KSZ_INGRESS_TAG_LEN, diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c index 1f5819e4e687..b6ef1e1a6673 100644 --- a/net/dsa/tag_lan9303.c +++ b/net/dsa/tag_lan9303.c @@ -130,6 +130,7 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, const struct dsa_device_ops lan9303_netdev_ops = { .name = "lan9303", + .proto = DSA_TAG_PROTO_LAN9303, .xmit = lan9303_xmit, .rcv = lan9303_rcv, .overhead = LAN9303_TAG_LEN, diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c index 7ecafb569f74..ca02ab3dcd80 100644 --- a/net/dsa/tag_mtk.c +++ b/net/dsa/tag_mtk.c @@ -100,6 +100,7 @@ static int mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, const struct dsa_device_ops mtk_netdev_ops = { .name = "mtk", + .proto = DSA_TAG_PROTO_MTK, .xmit = mtk_tag_xmit, .rcv = mtk_tag_rcv, .flow_dissect = mtk_tag_flow_dissect, diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c index f3fdeafef1fe..1ff65c2e0cb4 100644 --- a/net/dsa/tag_qca.c +++ b/net/dsa/tag_qca.c @@ -101,6 +101,7 @@ static int qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, const struct dsa_device_ops qca_netdev_ops = { .name = "qca", + .proto = DSA_TAG_PROTO_QCA, .xmit = qca_tag_xmit, .rcv = qca_tag_rcv, .flow_dissect = qca_tag_flow_dissect, diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c index 9ec6aa7938cc..628ab1a44ed7 100644 --- a/net/dsa/tag_trailer.c +++ b/net/dsa/tag_trailer.c @@ -79,6 +79,7 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev, const struct dsa_device_ops trailer_netdev_ops = { .name = "trailer", + .proto = DSA_TAG_PROTO_TRAILER, .xmit = trailer_xmit, .rcv = trailer_rcv, .overhead = 4,