From: "Drewek, Wojciech" <wojciech.drewek@intel.com>
To: Baowen Zheng <baowen.zheng@corigine.com>,
Marcin Szycik <marcin.szycik@linux.intel.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "zhangkaiheb@126.com" <zhangkaiheb@126.com>,
"jiri@resnulli.us" <jiri@resnulli.us>,
"jhs@mojatatu.com" <jhs@mojatatu.com>,
Simon Horman <simon.horman@corigine.com>,
"kurt@linutronix.de" <kurt@linutronix.de>,
"paulb@nvidia.com" <paulb@nvidia.com>,
"gustavoars@kernel.org" <gustavoars@kernel.org>,
"Brandeburg, Jesse" <jesse.brandeburg@intel.com>,
"edumazet@google.com" <edumazet@google.com>,
"boris.sukholitko@broadcom.com" <boris.sukholitko@broadcom.com>,
"komachi.yoshiki@gmail.com" <komachi.yoshiki@gmail.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"xiyou.wangcong@gmail.com" <xiyou.wangcong@gmail.com>,
"elic@nvidia.com" <elic@nvidia.com>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"pablo@netfilter.org" <pablo@netfilter.org>,
"intel-wired-lan@lists.osuosl.org"
<intel-wired-lan@lists.osuosl.org>
Subject: Re: [Intel-wired-lan] [RFC PATCH net-next 1/4] flow_dissector: Add PPPoE dissectors
Date: Mon, 27 Jun 2022 11:36:21 +0000 [thread overview]
Message-ID: <MW4PR11MB57765C5D5A1149515E3C6F97FDB99@MW4PR11MB5776.namprd11.prod.outlook.com> (raw)
In-Reply-To: <DM5PR1301MB21725B441E51642967C8BB4FE7B69@DM5PR1301MB2172.namprd13.prod.outlook.com>
Thanks for the review!
> -----Original Message-----
> From: Baowen Zheng <baowen.zheng@corigine.com>
> Sent: niedziela, 26 czerwca 2022 09:20
> To: Marcin Szycik <marcin.szycik@linux.intel.com>; netdev@vger.kernel.org
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; davem@davemloft.net; xiyou.wangcong@gmail.com; Brandeburg, Jesse
> <jesse.brandeburg@intel.com>; gustavoars@kernel.org; boris.sukholitko@broadcom.com; elic@nvidia.com; edumazet@google.com;
> kuba@kernel.org; jhs@mojatatu.com; jiri@resnulli.us; kurt@linutronix.de; pablo@netfilter.org; pabeni@redhat.com;
> paulb@nvidia.com; Simon Horman <simon.horman@corigine.com>; komachi.yoshiki@gmail.com; zhangkaiheb@126.com; intel-wired-
> lan@lists.osuosl.org; michal.swiatkowski@linux.intel.com; Drewek, Wojciech <wojciech.drewek@intel.com>
> Subject: RE: [RFC PATCH net-next 1/4] flow_dissector: Add PPPoE dissectors
>
> On Friday, June 24, 2022 9:42 PM, Marcin Szycik wrote:
>
> >Allow to dissect PPPoE specific fields which are:
> >- session ID (16 bits)
> >- ppp protocol (16 bits)
> >
> >The goal is to make the following TC command possible:
> >
> > # tc filter add dev ens6f0 ingress prio 1 protocol ppp_ses \
> > flower \
> > pppoe_sid 12 \
> > ppp_proto ip \
> > action drop
> >
> >Note that only PPPoE Session is supported.
> >
> >Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
> >---
> > include/net/flow_dissector.h | 11 ++++++++
> > net/core/flow_dissector.c | 51 +++++++++++++++++++++++++++++++-----
> > 2 files changed, 56 insertions(+), 6 deletions(-)
> >
> >diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index
> >a4c6057c7097..8ff40c7c3f1c 100644
> >--- a/include/net/flow_dissector.h
> >+++ b/include/net/flow_dissector.h
> >@@ -261,6 +261,16 @@ struct flow_dissector_key_num_of_vlans {
> > u8 num_of_vlans;
> > };
> >
> [..]
> >+static bool is_ppp_proto_supported(__be16 proto) {
> >+ switch (proto) {
> >+ case htons(PPP_AT):
> >+ case htons(PPP_IPX):
> >+ case htons(PPP_VJC_COMP):
> >+ case htons(PPP_VJC_UNCOMP):
> >+ case htons(PPP_MP):
> >+ case htons(PPP_COMPFRAG):
> >+ case htons(PPP_COMP):
> >+ case htons(PPP_MPLS_UC):
> >+ case htons(PPP_MPLS_MC):
> >+ case htons(PPP_IPCP):
> >+ case htons(PPP_ATCP):
> >+ case htons(PPP_IPXCP):
> >+ case htons(PPP_IPV6CP):
> >+ case htons(PPP_CCPFRAG):
> >+ case htons(PPP_MPLSCP):
> >+ case htons(PPP_LCP):
> >+ case htons(PPP_PAP):
> >+ case htons(PPP_LQR):
> >+ case htons(PPP_CHAP):
> >+ case htons(PPP_CBCP):
> >+ return true;
> >+ default:
> >+ return false;
> >+ }
> >+}
> >+
> Just a suggestion, for the above code segment, will it be more clean to change as the format:
> switch (ntohs(proto)) {
> case PPP_AT:
> case PPP_IPX:
> case PPP_VJC_COMP:
> then you will not need to call function of htons repeatedly.
Sure, will be included in second version.
> > /**
> > * __skb_flow_dissect - extract the flow_keys struct and return it
> > * @net: associated network namespace, derived from @skb if NULL @@ -
> >1221,19 +1250,29 @@ bool __skb_flow_dissect(const struct net *net,
> > }
> >
> > nhoff += PPPOE_SES_HLEN;
> >- switch (hdr->proto) {
> >- case htons(PPP_IP):
> >+ if (hdr->proto == htons(PPP_IP)) {
> > proto = htons(ETH_P_IP);
> > fdret = FLOW_DISSECT_RET_PROTO_AGAIN;
> >- break;
> >- case htons(PPP_IPV6):
> >+ } else if (hdr->proto == htons(PPP_IPV6)) {
> > proto = htons(ETH_P_IPV6);
> > fdret = FLOW_DISSECT_RET_PROTO_AGAIN;
> >- break;
> >- default:
> >+ } else if (is_ppp_proto_supported(hdr->proto)) {
> >+ fdret = FLOW_DISSECT_RET_OUT_GOOD;
> >+ } else {
> > fdret = FLOW_DISSECT_RET_OUT_BAD;
> > break;
> > }
> >+
> >+ if (dissector_uses_key(flow_dissector,
> >+ FLOW_DISSECTOR_KEY_PPPOE)) {
> >+ struct flow_dissector_key_pppoe *key_pppoe;
> >+
> >+ key_pppoe =
> >skb_flow_dissector_target(flow_dissector,
> >+
> >FLOW_DISSECTOR_KEY_PPPOE,
> >+ target_container);
> >+ key_pppoe->session_id = ntohs(hdr->hdr.sid);
> >+ key_pppoe->ppp_proto = hdr->proto;
> >+ }
> > break;
> > }
> > case htons(ETH_P_TIPC): {
> >--
> >2.35.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2022-06-27 11:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-24 13:41 [Intel-wired-lan] [RFC PATCH net-next 0/4] ice: PPPoE offload support Marcin Szycik
2022-06-24 13:41 ` [Intel-wired-lan] [RFC PATCH net-next 1/4] flow_dissector: Add PPPoE dissectors Marcin Szycik
2022-06-24 15:01 ` Alexander Lobakin
2022-06-27 11:33 ` Drewek, Wojciech
2022-06-26 7:20 ` Baowen Zheng
2022-06-27 11:36 ` Drewek, Wojciech [this message]
2022-06-24 13:41 ` [Intel-wired-lan] [RFC PATCH net-next 2/4] net/sched: flower: Add PPPoE filter Marcin Szycik
2022-06-24 13:41 ` [Intel-wired-lan] [RFC PATCH net-next 3/4] flow_offload: Introduce flow_match_pppoe Marcin Szycik
2022-06-24 13:41 ` [Intel-wired-lan] [RFC PATCH net-next 4/4] ice: Add support for PPPoE hardware offload Marcin Szycik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MW4PR11MB57765C5D5A1149515E3C6F97FDB99@MW4PR11MB5776.namprd11.prod.outlook.com \
--to=wojciech.drewek@intel.com \
--cc=baowen.zheng@corigine.com \
--cc=boris.sukholitko@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=elic@nvidia.com \
--cc=gustavoars@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=komachi.yoshiki@gmail.com \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=marcin.szycik@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=paulb@nvidia.com \
--cc=simon.horman@corigine.com \
--cc=xiyou.wangcong@gmail.com \
--cc=zhangkaiheb@126.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).