ice: PPPoE offload support
Subsystems (4)
v2 cover ice: PPPoE offload support
Add support for dissecting PPPoE and PPP-specific fields in flow dissector:
PPPoE session id and PPP protocol type. Add support for those fields in tc-flower and support offloading PPPoE. Finally, add support for hardware offload of PPPoE packets in switchdev mode in ice driver.
Example filter:
tc filter add dev $PF1 ingress protocol ppp_ses prio 1 flower pppoe_sid \
1234 ppp_proto ip skip_sw action mirred egress redirect dev $VF1_PR
Changes in iproute2 are required to use the new fields (will be submitted soon).
ICE COMMS DDP package is required to create a filter in ice.
Note: currently matching on vlan + PPPoE fields is not supported. Patch [0] will add this feature.
[0] https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]
v2: cosmetic changes
Marcin Szycik (1):
ice: Add support for PPPoE hardware offload
Wojciech Drewek (3):
flow_dissector: Add PPPoE dissectors
net/sched: flower: Add PPPoE filter
flow_offload: Introduce flow_match_pppoe
drivers/net/ethernet/intel/ice/ice.h | 1 + .../net/ethernet/intel/ice/ice_flex_pipe.c | 5 +- .../ethernet/intel/ice/ice_protocol_type.h | 11 ++ drivers/net/ethernet/intel/ice/ice_switch.c | 165 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_tc_lib.c | 95 ++++++++-- drivers/net/ethernet/intel/ice/ice_tc_lib.h | 8 + include/net/flow_dissector.h | 11 ++ include/net/flow_offload.h | 6 + include/uapi/linux/pkt_cls.h | 3 + net/core/flow_dissector.c | 51 +++++- net/core/flow_offload.c | 7 + net/sched/cls_flower.c | 46 +++++ 12 files changed, 392 insertions(+), 17 deletions(-)
Signature · 1 line
2.35.1
RFC PATCH v2 1/4 flow_dissector: Add PPPoE dissectors
From: Wojciech Drewek <[email protected]>
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 dropNote that only PPPoE Session is supported.
---
v2: use ntohs instead of htons in is_ppp_proto_supported
include/net/flow_dissector.h | 11 ++++++++ net/core/flow_dissector.c | 51 +++++++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 6 deletions(-)
include/net/flow_dissector.h +11 -0
@@ -261,6 +261,16 @@ struct flow_dissector_key_num_of_vlans {u8 num_of_vlans; }; +/** +* struct flow_dissector_key_pppoe: +* @session_id: pppoe session id +* @ppp_proto: ppp protocol +*/ +struct flow_dissector_key_pppoe { +u16 session_id; +__be16 ppp_proto; +}; +enum flow_dissector_key_id {FLOW_DISSECTOR_KEY_CONTROL ,/* struct flow_dissector_key_control */ FLOW_DISSECTOR_KEY_BASIC ,/* struct flow_dissector_key_basic */
@@ -291,6 +301,7 @@ enum flow_dissector_key_id {FLOW_DISSECTOR_KEY_CT ,/* struct flow_dissector_key_ct */ FLOW_DISSECTOR_KEY_HASH ,/* struct flow_dissector_key_hash */ FLOW_DISSECTOR_KEY_NUM_OF_VLANS ,/* struct flow_dissector_key_num_of_vlans */ +FLOW_DISSECTOR_KEY_PPPOE ,/* struct flow_dissector_key_pppoe */ FLOW_DISSECTOR_KEY_MAX, };
net/core/flow_dissector.c +45 -6
70 lines not on this page · raw message
Signature · 1 line
2.35.1
Jakub Kicinski
maintainerRe: [RFC PATCH net-next v2 1/4] flow_dissector: Add PPPoE dissectors
Quoted 1 line · On Tue, 28 Jun 2022 13:29:15 +0200 Marcin Szycik wrote:
+static bool
is_ppp_proto_supported(__be16 proto)
What does supported mean in this context?
net/core/flow_dissector.c bool bpf_flow_dissect(struct bpf_prog *prog, struct bpf_flow_dissector *ctx, · line 901
Quoted 3 lines
net/core/flow_dissector.c +3
-0+{ +switch (ntohs (proto)) { +case PPP_AT :
Byte swap on the constant.
Quoted 14 lines
net/core/flow_dissector.c +14
-0+case PPP_IPX : +case PPP_VJC_COMP : +case PPP_VJC_UNCOMP : +case PPP_MP : +case PPP_COMPFRAG : +case PPP_COMP : +case PPP_MPLS_UC : +case PPP_MPLS_MC : +case PPP_IPCP : +case PPP_ATCP : +case PPP_IPXCP : +case PPP_IPV6CP : +case PPP_CCPFRAG : +case PPP_MPLSCP :
net/core/flow_dissector.c bool bpf_flow_dissect(struct bpf_prog *prog, struct bpf_flow_dissector *ctx, · line 925
Quoted 10 lines
net/core/flow_dissector.c +10
-0+case PPP_LCP : +case PPP_PAP : +case PPP_LQR : +case PPP_CHAP : +case PPP_CBCP : +return true; +default : +return false; + } +}
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
RE: [RFC PATCH net-next v2 1/4] flow_dissector: Add PPPoE dissectors
Quoted 14 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: środa, 29 czerwca 2022 06:40
To: Marcin Szycik <[email protected]>
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; Brandeburg, Jesse <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Drewek, Wojciech <[email protected]>; Lobakin, Alexandr <[email protected]>
Subject: Re: [RFC PATCH net-next v2 1/4]flow_dissector: Add PPPoE dissectors
Quoted 4 lines
Quoted 1 line · On Tue, 28 Jun 2022 13:29:15 +0200 Marcin Szycik wrote:
+static bool
is_ppp_proto_supported(__be16 proto)What does supported mean in this context?
It means that only those protocols are going to be dissected.
Quoted 6 lines
net/core/flow_dissector.c bool bpf_flow_dissect(struct bpf_prog *prog, struct bpf_flow_dissector *ctx, · line 901
Quoted 4 lines
net/core/flow_dissector.c +3
-0+{ +switch (ntohs (proto)) { +case PPP_AT :Byte swap on the constant.
Sure, it will be included in v3
Quoted 17 lines
Quoted 17 lines
net/core/flow_dissector.c +16
-0+case PPP_IPX : +case PPP_VJC_COMP : +case PPP_VJC_UNCOMP : +case PPP_MP : +case PPP_COMPFRAG : +case PPP_COMP : +case PPP_MPLS_UC : +case PPP_MPLS_MC : +case PPP_IPCP : +case PPP_ATCP : +case PPP_IPXCP : +case PPP_IPV6CP : +case PPP_CCPFRAG : +case PPP_MPLSCP : +case PPP_LCP : +case PPP_PAP :
Quoted 8 lines
net/core/flow_dissector.c bool bpf_flow_dissect(struct bpf_prog *prog, struct bpf_flow_dissector *ctx, · line 925
Quoted 8 lines
net/core/flow_dissector.c +8
-0+case PPP_LQR : +case PPP_CHAP : +case PPP_CBCP : +return true; +default : +return false; + } +}
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Jakub Kicinski
maintainerRe: [RFC PATCH net-next v2 1/4] flow_dissector: Add PPPoE dissectors
Quoted 5 lines · Wojciech
Quoted 3 lines
Quoted 1 line
+static bool
is_ppp_proto_supported(__be16 proto)What does supported mean in this context?
It means that only those protocols are going to be dissected.
We only dissect PPP_IP and PPP_IPV6. This looks more like a list of all known protocols.
RE: [RFC PATCH net-next v2 1/4] flow_dissector: Add PPPoE dissectors
Quoted 15 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: środa, 29 czerwca 2022 17:20
To: Drewek, Wojciech <[email protected]>
Cc: Marcin Szycik <[email protected]>; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; Brandeburg, Jesse <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Lobakin, Alexandr <[email protected]>
Subject: Re: [RFC PATCH net-next v2 1/4]flow_dissector: Add PPPoE dissectorsOn Wed, 29 Jun 2022 07:44:50 +0000 Drewek, Wojciech wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+static bool
is_ppp_proto_supported(__be16 proto)What does supported mean in this context?
It means that only those protocols are going to be dissected.
We only dissect
PPP_IPandPPP_IPV6. This looks more like a list of all known protocols.
Sorry, maybe I wasn't precise enough. It is a list of protocols that user can match on. In case of PPP_IP and PPP_IPV6 user can also match on inner fields specific for ipv4 and ipv6.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
RFC PATCH v2 2/4 net/sched: flower: Add PPPoE filter
In reply to Marcin SzycikFrom: Wojciech Drewek <[email protected]>
Add support for PPPoE specific fields for tc-flower. Those fields can be provided only when protocol was set to ETH_P_PPP_SES. Defines, dump, load and set are being done here.
Overwrite basic.n_proto only in case of PPP_IP and PPP_IPV6, otherwise leave it as ETH_P_PPP_SES.
--- include/uapi/linux/pkt_cls.h | 3 +++ net/sched/cls_flower.c | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)
include/uapi/linux/pkt_cls.h +3 -0
@@ -589,6 +589,9 @@ enum {TCA_FLOWER_KEY_NUM_OF_VLANS ,/* u8 */ +TCA_FLOWER_KEY_PPPOE_SID ,/* u16 */ +TCA_FLOWER_KEY_PPP_PROTO ,/* be16 */ + __TCA_FLOWER_MAX, };
net/sched/cls_flower.c +46 -0
88 lines not on this page · raw message
Signature · 1 line
2.35.1
RFC PATCH v2 3/4 flow_offload: Introduce flow_match_pppoe
In reply to Marcin SzycikFrom: Wojciech Drewek <[email protected]>
Allow to offload PPPoE filters by adding flow_rule_match_pppoe. Drivers can extract PPPoE specific fields from now on.
--- include/net/flow_offload.h | 6 ++++++ net/core/flow_offload.c | 7 +++++++ 2 files changed, 13 insertions(+)
include/net/flow_offload.h +6 -0
@@ -72,6 +72,10 @@ struct flow_match_ct {struct flow_dissector_key_ct *key, *mask; }; +struct flow_match_pppoe { +struct flow_dissector_key_pppoe *key, *mask; +}; +struct flow_rule ; void flow_rule_match_meta(const struct flow_rule *rule,
@@ -116,6 +120,8 @@ void flow_rule_match_enc_opts(const struct flow_rule *rule, struct flow_match_enc_opts *out);void flow_rule_match_ct (const struct flow_rule *rule,struct flow_match_ct *out); +void flow_rule_match_pppoe (const struct flow_rule *rule, +struct flow_match_pppoe *out);enum flow_action_id {FLOW_ACTION_ACCEPT =0 ,
net/core/flow_offload.c +7 -0
@@ -223,6 +223,13 @@ void flow_rule_match_ct(const struct flow_rule *rule, }EXPORT_SYMBOL (flow_rule_match_ct); +void flow_rule_match_pppoe (const struct flow_rule *rule, +struct flow_match_pppoe *out) +{ +FLOW_DISSECTOR_MATCH (rule,FLOW_DISSECTOR_KEY_PPPOE , out); +} +EXPORT_SYMBOL (flow_rule_match_pppoe); +struct flow_block_cb *flow_block_cb_alloc (flow_setup_cb_t *cb,void *cb_ident,void *cb_priv,void (*release)(void *cb_priv))
Signature · 1 line
2.35.1
RFC PATCH v2 4/4 ice: Add support for PPPoE hardware offload
In reply to Marcin SzycikAdd support for creating PPPoE filters in switchdev mode. Add support for parsing PPPoE and PPP-specific tc options: pppoe_sid and ppp_proto.
Example filter:
tc filter add dev $PF1 ingress protocol ppp_ses prio 1 flower pppoe_sid \
1234 ppp_proto ip skip_sw action mirred egress redirect dev $VF1_PR
Changes in iproute2 are required to use the new fields.
ICE COMMS DDP package is required to create a filter as it contains PPPoE profiles. Added a warning message when loaded DDP package does not contain required profiles.
Note: currently matching on vlan + PPPoE fields is not supported. Patch [0] will add this feature.
[0] https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]
---
v2: wrap one long line
drivers/net/ethernet/intel/ice/ice.h | 1 + .../net/ethernet/intel/ice/ice_flex_pipe.c | 5 +- .../ethernet/intel/ice/ice_protocol_type.h | 11 ++ drivers/net/ethernet/intel/ice/ice_switch.c | 165 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_tc_lib.c | 95 ++++++++-- drivers/net/ethernet/intel/ice/ice_tc_lib.h | 8 + 6 files changed, 274 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -52,6 +52,7 @@#include <net/udp_tunnel.h> #include <net/vxlan.h> #include <net/gtp.h> +#include <linux/ppp_defs.h> #include "ice_devids.h" #include "ice_type.h" #include "ice_txrx.h"
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +4 -1
@@ -1964,8 +1964,11 @@ ice_get_sw_fv_list(struct ice_hw *hw, struct ice_prot_lkup_ext *lkups, } } }while (fv); -if (list_empty (fv_list)) +if (list_empty (fv_list)) { +dev_warn (ice_hw_to_dev (hw),"Required profiles not found in currently loaded DDP package" );return -EIO ; + } +return 0 ; err:
drivers/net/ethernet/intel/ice/ice_protocol_type.h +11 -0
@@ -43,6 +43,7 @@ enum ice_protocol_type {ICE_NVGRE ,ICE_GTP ,ICE_GTP_NO_PAY , +ICE_PPPOE ,ICE_VXLAN_GPE ,ICE_SCTP_IL ,ICE_PROTOCOL_LAST
@@ -107,6 +108,7 @@ enum ice_prot_id {#define ICE_TCP_IL_HW 49#define ICE_UDP_ILOS_HW 53#define ICE_GRE_OF_HW 64 +#define ICE_PPPOE_HW 103#define ICE_UDP_OF_HW 52/* UDP Tunnels */ #define ICE_META_DATA_ID_HW 255/* this is used for tunnel type */
@@ -200,6 +202,14 @@ struct ice_udp_gtp_hdr {u8 rsvrd; }; +struct ice_pppoe_hdr { +u8 rsrvd_ver_type; +u8 rsrvd_code; +__be16 session_id; +__be16 length; +__be16 ppp_prot_id;/* control and data only */ +}; +struct ice_nvgre_hdr {__be16 flags;__be16 protocol;
@@ -217,6 +227,7 @@ union ice_prot_hdr {struct ice_udp_tnl_hdr tnl_hdr;struct ice_nvgre_hdr nvgre_hdr;struct ice_udp_gtp_hdr gtp_hdr; +struct ice_pppoe_hdr pppoe_hdr; };/* This is mapping table entry that maps every word within a given protocol
drivers/net/ethernet/intel/ice/ice_switch.c +165 -0
207 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_tc_lib.c +85 -10
137 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_tc_lib.h +8 -0
@@ -23,6 +23,8 @@#define ICE_TC_FLWR_FIELD_ENC_DST_MAC BIT(16)#define ICE_TC_FLWR_FIELD_ETH_TYPE_ID BIT(17)#define ICE_TC_FLWR_FIELD_ENC_OPTS BIT(18) +#define ICE_TC_FLWR_FIELD_PPPOE_SESSID BIT(19) +#define ICE_TC_FLWR_FIELD_PPP_PROTO BIT(20)#define ICE_TC_FLOWER_MASK_32 0xFFFFFFFF
@@ -42,6 +44,11 @@ struct ice_tc_vlan_hdr {u16 vlan_prio;/* Only last 3 bits valid (valid values: 0..7) */ }; +struct ice_tc_pppoe_hdr { +__be16 session_id; +__be16 ppp_proto; +}; +struct ice_tc_l2_hdr {u8 dst_mac[ETH_ALEN ];u8 src_mac[ETH_ALEN ];
@@ -81,6 +88,7 @@ struct ice_tc_flower_lyr_2_4_hdrs {struct ice_tc_l2_hdr l2_key;struct ice_tc_l2_hdr l2_mask;struct ice_tc_vlan_hdr vlan_hdr; +struct ice_tc_pppoe_hdr pppoe_hdr;/* L3 (IPv4[6]) layer fields with their mask */ struct ice_tc_l3_hdr l3_key;struct ice_tc_l3_hdr l3_mask;
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Jakub Kicinski
maintainerQuoted 9 lines · On Tue, 28 Jun 2022 13:29:14 +0200 Marcin Szycik wrote:
Add support for dissecting PPPoE and PPP-specific fields in flow dissector:
PPPoE session id and PPP protocol type. Add support for those fields in tc-flower and support offloading PPPoE. Finally, add support for hardware offload of PPPoE packets in switchdev mode in ice driver.Example filter:
tc filter add dev $PF1 ingress protocolppp_sesprio 1 flowerpppoe_sid\
1234ppp_protoipskip_swaction mirred egress redirect dev $VF1_PR
Quoted 7 lines
Changes in iproute2 are required to use the new fields (will be submitted soon).
ICE COMMS DDP package is required to create a filter in ice.
Note: currently matching on vlan + PPPoE fields is not supported. Patch [0] will add this feature.
Please make sure to CC Guillaume Nault <[email protected]> and PPP folks from MAINTAINERS.