ice: PPPoE offload support
Subsystems (4)
v6 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.
v6:
* make check for ppp proto more generic
* fix remaining byte order issues
v5: fix endianness when processing compressed protocols
v4:
* PPPoE header validation
* added MPLS support
* added support for compressed PPP protocol field
* flow_dissector_key_pppoe::session_id stored in __be16
* new field: flow_dissector_key_pppoe::type
* always add an ethtype lookup if PPP/PPPoE options are provided (to prevent setting incorrect ethtype)
* rebase
v3:
* revert byte order changes in is_ppp_proto_supported from previous version
* add kernel-doc for is_ppp_proto_supported
* add more CC
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 | 71 +++++++- drivers/net/ethernet/intel/ice/ice_tc_lib.h | 8 + include/linux/ppp_defs.h | 14 ++ include/net/flow_dissector.h | 13 ++ include/net/flow_offload.h | 6 + include/uapi/linux/pkt_cls.h | 3 + net/core/flow_dissector.c | 53 +++++- net/core/flow_offload.c | 7 + net/sched/cls_flower.c | 64 +++++++ 13 files changed, 412 insertions(+), 9 deletions(-)
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
RFC PATCH v6 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)
- type (16 bits) - this is PPPoE ethertype, for now only ETH_P_PPP_SES is supported, possible ETH_P_PPP_DISC in the future
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.
---
v6:
* make check for ppp proto more generic
* fix remaining byte order issues
v5: fix endianness when processing compressed protocols v4:
* pppoe header validation
* added MPLS dissection
* added support for compressed ppp protocol field
* flow_dissector_key_pppoe::session_id stored in __be16
* new field: flow_dissector_key_pppoe::type
v3: revert byte order changes in is_ppp_proto_supported from
previous version
v2: ntohs instead of htons in is_ppp_proto_supported
include/linux/ppp_defs.h | 14 ++++++++++ include/net/flow_dissector.h | 13 +++++++++ net/core/flow_dissector.c | 53 +++++++++++++++++++++++++++++++----- 3 files changed, 73 insertions(+), 7 deletions(-)
include/linux/ppp_defs.h +14 -0
@@ -11,4 +11,18 @@#include <uapi/linux/ppp_defs.h> #define PPP_FCS (fcs, c) crc_ccitt_byte(fcs, c) + +/** +* ppp_proto_is_valid - checks if PPP protocol is valid +* @proto: PPP protocol +* +* Assumes proto is not compressed. +* Protocol is valid if the value is odd and the least significant bit of the +* most significant octet is 0 (see RFC 1661, section 2). +*/ +static inline bool ppp_proto_is_valid (u16 proto) +{ +return !!((proto &0x0101 ) ==0x0001 ); +} +#endif /* _PPP_DEFS_H_ */
include/net/flow_dissector.h +13 -0
@@ -277,6 +277,18 @@ 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 +* @type: pppoe eth type +*/ +struct flow_dissector_key_pppoe { +__be16 session_id; +__be16 ppp_proto; +__be16 type; +}; +enum flow_dissector_key_id {FLOW_DISSECTOR_KEY_CONTROL ,/* struct flow_dissector_key_control */ FLOW_DISSECTOR_KEY_BASIC ,/* struct flow_dissector_key_basic */
@@ -307,6 +319,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 +46 -7
78 lines not on this page · raw message
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [RFC PATCH net-next v6 1/4] flow_dissector: Add PPPoE dissectors
Quoted 11 lines · Marcin Szycik
From: Wojciech Drewek <[email protected]>
Allow to dissect PPPoE specific fields which are:
- session ID (16 bits)
- ppp protocol (16 bits)
- type (16 bits) - this is PPPoE ethertype, for now onlyETH_P_PPP_SESis supported, possibleETH_P_PPP_DISCin the futureThe goal is to make the following TC command possible:
Quoted 7 lines
# 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.
RFC PATCH v6 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.
---
v4:
* support of MPLS inner fields
* session_id stored in __be16
include/uapi/linux/pkt_cls.h | 3 ++ net/sched/cls_flower.c | 64 ++++++++++++++++++++++++++++++++++++ 2 files changed, 67 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 ,/* be16 */ +TCA_FLOWER_KEY_PPP_PROTO ,/* be16 */ + __TCA_FLOWER_MAX, };
net/sched/cls_flower.c +64 -0
106 lines not on this page · raw message
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [RFC PATCH net-next v6 2/4] net/sched: flower: Add PPPoE filter
Quoted 8 lines · Marcin Szycik
From: 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_IPandPPP_IPV6, otherwise leave it asETH_P_PPP_SES.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
RFC PATCH v6 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
@@ -76,6 +76,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,
@@ -122,6 +126,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
@@ -230,6 +230,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 · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
RFC PATCH v6 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.
---
v4:
* adapted code to the redefined ice_tc_pppoe_hdr (session_id is now
stored in __be16)
* removed note about missing support for vlan fields:
263957263a00 ("ice: switch: dynamically add VLAN headers to dummy packets") is already accepted
* always add an ethtype lookup if PPP/PPPoE options are provided (to prevent setting incorrect ethtype)
* rebase
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 | 71 +++++++- drivers/net/ethernet/intel/ice/ice_tc_lib.h | 8 + 6 files changed, 259 insertions(+), 2 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_VLAN_EX ,ICE_VLAN_IN , ICE_VXLAN_GPE,
@@ -109,6 +110,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 and VLAN type */
@@ -207,6 +209,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;
@@ -224,6 +234,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 +70 -1
101 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_tc_lib.h +8 -0
@@ -24,6 +24,8 @@#define ICE_TC_FLWR_FIELD_ETH_TYPE_ID BIT(17)#define ICE_TC_FLWR_FIELD_ENC_OPTS BIT(18)#define ICE_TC_FLWR_FIELD_CVLAN BIT(19) +#define ICE_TC_FLWR_FIELD_PPPOE_SESSID BIT(20) +#define ICE_TC_FLWR_FIELD_PPP_PROTO BIT(21)#define ICE_TC_FLOWER_MASK_32 0xFFFFFFFF
@@ -44,6 +46,11 @@ struct ice_tc_vlan_hdr {__be16 vlan_tpid; }; +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 ];
@@ -84,6 +91,7 @@ struct ice_tc_flower_lyr_2_4_hdrs {struct ice_tc_l2_hdr l2_mask;struct ice_tc_vlan_hdr vlan_hdr;struct ice_tc_vlan_hdr cvlan_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