Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3151750ybb; Sun, 22 Mar 2020 16:58:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuODCLhmkhD8elYkHIra0PCqcm0C1bX19MPfav8Ye2SQO3Tk7qJfh2/ZHeaZRxdmVZxzfmX X-Received: by 2002:a9d:7c94:: with SMTP id q20mr4907351otn.150.1584921521009; Sun, 22 Mar 2020 16:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584921521; cv=none; d=google.com; s=arc-20160816; b=o8WZ0RVEKyQpTrvHebiqgxTsjx5K93IzO7Fqnvdli1Oo5d9SLfGpXU5yz82SK2XUuq bls18QK/pB2ensZzzprQ7mMkH0QejvVEbsZKgBNNxtcpru3TyH15553+koCm2QoIYLZW gioth4PAszg0xVX4EOuscSwxmWXoHNS/S1JVfFSY/20/tfUsQr+21ZEYwVRCbxgy04wp OXjf11osoFUq5ux0SN/ZIJnXMV9/1wK5vu5i1nxAwqRNWn6cU/rZngguMJy53rnktwZ1 yEjqblroxmrLVpMm/X0YsWKFX2MYHmkO9+1VAaH6vXAIroM4HZQmFh7wM3690WI4t/HH kzLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=16n5W71pgyT6GLbXOW01rJLBzPo7sl4nqjxN9D4dB2g=; b=ARyP+Mq2OnatJ9iqorpccmj65ll5Bn98mC+ZWo8689O3SY6uvDM6N82MpNepaw8SpM GzZP2zDHs9g0p7iBZu25h7bWBri75LbdrzN+afXTIcPDGeJpQDjGrEMIw2CAqQuX3yeo jd8/c55uVzt9QiPmgRNPA9O0vY8fNMUn+at9lEhOiP5gY9AvOh9pQ23zhEyLGykYWiQL YbX6mD/QXxMN1eEQ6g+HMTokPDkY77VYDo5L5DC1uc+dbczRyFq5ZPqLB86wpCFpWguj DXCl1vYU4PRt+rJSCqm7A3P8jUI1ex0/Y0b89nDg3cmX0CZeSTFUStC/2caMssZ9qB/H nWnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MUWX8hEI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id x1si2998628otq.201.2020.03.22.16.58.27; Sun, 22 Mar 2020 16:58:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MUWX8hEI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726944AbgCVX6L (ORCPT + 99 others); Sun, 22 Mar 2020 19:58:11 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:40826 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726880AbgCVX6L (ORCPT ); Sun, 22 Mar 2020 19:58:11 -0400 Received: by mail-ed1-f68.google.com with SMTP id w26so7994335edu.7; Sun, 22 Mar 2020 16:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=16n5W71pgyT6GLbXOW01rJLBzPo7sl4nqjxN9D4dB2g=; b=MUWX8hEIe2xtcWw5PGoYP41lapbLjFNAQ5MwKfKtOqvT8ALEsxnOJtpJkwHDCApYIR yIi0d7E0FFRCNJ70LAd49zcszL/tVjZkPP8HZSAwkD8sUzIUxsZGdvzh8PPocI/ihEC4 eDDudVlNJEJJTt9wWsez6yE2BM7W7ASQctkuhBTqAqhcdrWiUmfm0fPM5GlsMwjwh4Vp GCMKtMPAS6y7qGZaqqS3QWOpBnW3XmVqdgNc6lPV6M2dRjg1i+cwNpFfW/wbbl0FRFfq DkddZhhAzx6nWtdKVlBnKYIB3bIo9Rx2bfE6D7dTTQQXR4HT9WY5+1CNjS/t20LCvnkz ovlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=16n5W71pgyT6GLbXOW01rJLBzPo7sl4nqjxN9D4dB2g=; b=Vbq3Npqr/AbOlZJ7tteEUxrFJ2UUtxNN37nTKDzC6pqsMaqWWgCViiovJeEP7F8PQs qE+Do62ZlXDPiqr/dHWseFRW8RwvDC1HrM6JhTxEhxv4aMINJQSxXCtJG+FH3nYpbDGr pke7wXncPmAIqjZBIkraNrnNl4VtKCY4f7dYHxdVZPq72MZOFm8Kl3xBf99gPeqQAM8I bdK7t7Rco/1gcETyyNXIgkbB7FRvYm9LlbWXX1gMR4TJ9WtFPRw01DZ6lB1Jj9YQkpgq Z+pKo/8WlVTA378iMyqERGilFeXmDCA1C3nguMMgb7uIkWfuaFgu7AHjuFpXrd8r6J4Q Mf0A== X-Gm-Message-State: ANhLgQ2uGNOYP+3Wibr9dON5SQRBq3ptKA82N1w3KCXIujye6mRv9UY6 peztLYJq9ah5DTCayAv6dtizNav3alhn9rxHRLc= X-Received: by 2002:a50:aca3:: with SMTP id x32mr19159147edc.368.1584921488688; Sun, 22 Mar 2020 16:58:08 -0700 (PDT) MIME-Version: 1.0 References: <20200322210957.3940-1-f.fainelli@gmail.com> In-Reply-To: <20200322210957.3940-1-f.fainelli@gmail.com> From: Vladimir Oltean Date: Mon, 23 Mar 2020 01:57:57 +0200 Message-ID: Subject: Re: [PATCH net-next] net: dsa: Implement flow dissection for tag_brcm.c To: Florian Fainelli Cc: netdev , Alexander Lobakin , Andrew Lunn , Vivien Didelot , "David S. Miller" , Jakub Kicinski , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 22 Mar 2020 at 23:10, Florian Fainelli wrote: > > Provide a flow_dissect callback which returns the network offset and > where to find the skb protocol, given the tags structure a common > function works for both tagging formats that are supported. > > Signed-off-by: Florian Fainelli > --- Looks good to me. > net/dsa/tag_brcm.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c > index 9c3114179690..0d3f796d14a3 100644 > --- a/net/dsa/tag_brcm.c > +++ b/net/dsa/tag_brcm.c > @@ -142,6 +142,27 @@ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb, > > return skb; > } > + > +static int brcm_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, > + int *offset) > +{ > + /* We have been called on the DSA master network device after > + * eth_type_trans() which pulled the Ethernet header already. > + * Frames have one of these two layouts: > + * ----------------------------------- > + * | MAC DA | MAC SA | 4b tag | Type | DSA_TAG_PROTO_BRCM > + * ----------------------------------- > + * ----------------------------------- > + * | 4b tag | MAC DA | MAC SA | Type | DSA_TAG_PROTO_BRCM_PREPEND > + * ----------------------------------- > + * skb->data points 2 bytes before the actual Ethernet type field and > + * we have an offset of 4bytes between where skb->data and where the > + * payload starts. > + */ > + *offset = BRCM_TAG_LEN; > + *proto = ((__be16 *)skb->data)[1]; > + return 0; > +} > #endif > > #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM) > @@ -177,6 +198,7 @@ static const struct dsa_device_ops brcm_netdev_ops = { > .xmit = brcm_tag_xmit, > .rcv = brcm_tag_rcv, > .overhead = BRCM_TAG_LEN, > + .flow_dissect = brcm_tag_flow_dissect, > }; > > DSA_TAG_DRIVER(brcm_netdev_ops); > @@ -205,6 +227,7 @@ static const struct dsa_device_ops brcm_prepend_netdev_ops = { > .xmit = brcm_tag_xmit_prepend, > .rcv = brcm_tag_rcv_prepend, > .overhead = BRCM_TAG_LEN, > + .flow_dissect = brcm_tag_flow_dissect, > }; > > DSA_TAG_DRIVER(brcm_prepend_netdev_ops); > -- > 2.19.1 > Regards, -Vladimir