* [RFC PATCH net-next v2 0/5] ice: L2TPv3 offload support
@ 2022-08-29 9:44 ` Wojciech Drewek
0 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen, davem,
edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri, marcin.szycik,
michal.swiatkowski, kurt, boris.sukholitko, vladbu,
komachi.yoshiki, paulb, baowen.zheng, louis.peens, simon.horman,
pablo, maksym.glubokiy, intel-wired-lan, jchapman, gnault
Add support for dissecting L2TPv3 session id in flow dissector. Add support
for this field in tc-flower and support offloading L2TPv3. Finally, add
support for hardware offload of L2TPv3 packets based on session id in
switchdev mode in ice driver.
Example filter:
# tc filter add dev $PF1 ingress prio 1 protocol ip \
flower \
ip_proto l2tp \
l2tpv3_sid 1234 \
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 in ice.
COMMS DDP package contains profiles of more advanced protocols.
Without COMMS DDP package hw offload will not work, however
sw offload will still work.
Marcin Szycik (1):
ice: Add L2TPv3 hardware offload support
Wojciech Drewek (4):
uapi: move IPPROTO_L2TP to in.h
flow_dissector: Add L2TPv3 dissectors
net/sched: flower: Add L2TPv3 filter
flow_offload: Introduce flow_match_l2tpv3
.../ethernet/intel/ice/ice_protocol_type.h | 8 +++
drivers/net/ethernet/intel/ice/ice_switch.c | 70 ++++++++++++++++++-
drivers/net/ethernet/intel/ice/ice_tc_lib.c | 27 ++++++-
drivers/net/ethernet/intel/ice/ice_tc_lib.h | 6 ++
include/net/flow_dissector.h | 9 +++
include/net/flow_offload.h | 6 ++
include/uapi/linux/in.h | 2 +
include/uapi/linux/l2tp.h | 2 -
include/uapi/linux/pkt_cls.h | 2 +
net/core/flow_dissector.c | 28 ++++++++
net/core/flow_offload.c | 7 ++
net/sched/cls_flower.c | 16 +++++
12 files changed, 179 insertions(+), 4 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Intel-wired-lan] [RFC PATCH net-next v2 0/5] ice: L2TPv3 offload support
@ 2022-08-29 9:44 ` Wojciech Drewek
0 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, gnault, intel-wired-lan, vladbu,
kuba, pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb,
jhs, xiyou.wangcong, davem
Add support for dissecting L2TPv3 session id in flow dissector. Add support
for this field in tc-flower and support offloading L2TPv3. Finally, add
support for hardware offload of L2TPv3 packets based on session id in
switchdev mode in ice driver.
Example filter:
# tc filter add dev $PF1 ingress prio 1 protocol ip \
flower \
ip_proto l2tp \
l2tpv3_sid 1234 \
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 in ice.
COMMS DDP package contains profiles of more advanced protocols.
Without COMMS DDP package hw offload will not work, however
sw offload will still work.
Marcin Szycik (1):
ice: Add L2TPv3 hardware offload support
Wojciech Drewek (4):
uapi: move IPPROTO_L2TP to in.h
flow_dissector: Add L2TPv3 dissectors
net/sched: flower: Add L2TPv3 filter
flow_offload: Introduce flow_match_l2tpv3
.../ethernet/intel/ice/ice_protocol_type.h | 8 +++
drivers/net/ethernet/intel/ice/ice_switch.c | 70 ++++++++++++++++++-
drivers/net/ethernet/intel/ice/ice_tc_lib.c | 27 ++++++-
drivers/net/ethernet/intel/ice/ice_tc_lib.h | 6 ++
include/net/flow_dissector.h | 9 +++
include/net/flow_offload.h | 6 ++
include/uapi/linux/in.h | 2 +
include/uapi/linux/l2tp.h | 2 -
include/uapi/linux/pkt_cls.h | 2 +
net/core/flow_dissector.c | 28 ++++++++
net/core/flow_offload.c | 7 ++
net/sched/cls_flower.c | 16 +++++
12 files changed, 179 insertions(+), 4 deletions(-)
--
2.31.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 22+ messages in thread
* [RFC PATCH net-next v2 1/5] uapi: move IPPROTO_L2TP to in.h
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
@ 2022-08-29 9:44 ` Wojciech Drewek
-1 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen, davem,
edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri, marcin.szycik,
michal.swiatkowski, kurt, boris.sukholitko, vladbu,
komachi.yoshiki, paulb, baowen.zheng, louis.peens, simon.horman,
pablo, maksym.glubokiy, intel-wired-lan, jchapman, gnault
IPPROTO_L2TP is currently defined in l2tp.h, but most of
ip protocols is defined in in.h file. Move it there in order
to keep code clean.
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
include/uapi/linux/in.h | 2 ++
include/uapi/linux/l2tp.h | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index 14168225cecd..5a9454c886b3 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -68,6 +68,8 @@ enum {
#define IPPROTO_PIM IPPROTO_PIM
IPPROTO_COMP = 108, /* Compression Header Protocol */
#define IPPROTO_COMP IPPROTO_COMP
+ IPPROTO_L2TP = 115, /* Layer 2 Tunnelling Protocol */
+#define IPPROTO_L2TP IPPROTO_L2TP
IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
#define IPPROTO_SCTP IPPROTO_SCTP
IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */
diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h
index bab8c9708611..7d81c3e1ec29 100644
--- a/include/uapi/linux/l2tp.h
+++ b/include/uapi/linux/l2tp.h
@@ -13,8 +13,6 @@
#include <linux/in.h>
#include <linux/in6.h>
-#define IPPROTO_L2TP 115
-
/**
* struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets
* @l2tp_family: address family number AF_L2TPIP.
--
2.31.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Intel-wired-lan] [RFC PATCH net-next v2 1/5] uapi: move IPPROTO_L2TP to in.h
@ 2022-08-29 9:44 ` Wojciech Drewek
0 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, gnault, intel-wired-lan, vladbu,
kuba, pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb,
jhs, xiyou.wangcong, davem
IPPROTO_L2TP is currently defined in l2tp.h, but most of
ip protocols is defined in in.h file. Move it there in order
to keep code clean.
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
include/uapi/linux/in.h | 2 ++
include/uapi/linux/l2tp.h | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index 14168225cecd..5a9454c886b3 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -68,6 +68,8 @@ enum {
#define IPPROTO_PIM IPPROTO_PIM
IPPROTO_COMP = 108, /* Compression Header Protocol */
#define IPPROTO_COMP IPPROTO_COMP
+ IPPROTO_L2TP = 115, /* Layer 2 Tunnelling Protocol */
+#define IPPROTO_L2TP IPPROTO_L2TP
IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
#define IPPROTO_SCTP IPPROTO_SCTP
IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */
diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h
index bab8c9708611..7d81c3e1ec29 100644
--- a/include/uapi/linux/l2tp.h
+++ b/include/uapi/linux/l2tp.h
@@ -13,8 +13,6 @@
#include <linux/in.h>
#include <linux/in6.h>
-#define IPPROTO_L2TP 115
-
/**
* struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets
* @l2tp_family: address family number AF_L2TPIP.
--
2.31.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
@ 2022-08-29 9:44 ` Wojciech Drewek
-1 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen, davem,
edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri, marcin.szycik,
michal.swiatkowski, kurt, boris.sukholitko, vladbu,
komachi.yoshiki, paulb, baowen.zheng, louis.peens, simon.horman,
pablo, maksym.glubokiy, intel-wired-lan, jchapman, gnault
Allow to dissect L2TPv3 specific field which is:
- session ID (32 bits)
L2TPv3 might be transported over IP or over UDP,
this ipmplementation is only about L2TPv3 over IP.
IP protocold carries L2TPv3 when ip_proto is
IPPROTO_L2TP (115).
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
include/net/flow_dissector.h | 9 +++++++++
net/core/flow_dissector.c | 28 ++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index 6c74812d64b2..5ccf52ef8809 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -289,6 +289,14 @@ struct flow_dissector_key_pppoe {
__be16 type;
};
+/**
+ * struct flow_dissector_key_l2tpv3:
+ * @session_id: identifier for a l2tp session
+ */
+struct flow_dissector_key_l2tpv3 {
+ __be32 session_id;
+};
+
enum flow_dissector_key_id {
FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */
FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */
@@ -320,6 +328,7 @@ enum flow_dissector_key_id {
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_L2TPV3, /* struct flow_dissector_key_l2tpv3 */
FLOW_DISSECTOR_KEY_MAX,
};
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 764c4cb3fe8f..dbd944de4129 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -204,6 +204,30 @@ static void __skb_flow_dissect_icmp(const struct sk_buff *skb,
skb_flow_get_icmp_tci(skb, key_icmp, data, thoff, hlen);
}
+static void __skb_flow_dissect_l2tpv3(const struct sk_buff *skb,
+ struct flow_dissector *flow_dissector,
+ void *target_container, const void *data,
+ int nhoff, int hlen)
+{
+ struct flow_dissector_key_l2tpv3 *key_l2tpv3;
+ struct {
+ __be32 session_id;
+ } *hdr, _hdr;
+
+ hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen, &_hdr);
+ if (!hdr)
+ return;
+
+ if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_L2TPV3))
+ return;
+
+ key_l2tpv3 = skb_flow_dissector_target(flow_dissector,
+ FLOW_DISSECTOR_KEY_L2TPV3,
+ target_container);
+
+ key_l2tpv3->session_id = hdr->session_id;
+}
+
void skb_flow_dissect_meta(const struct sk_buff *skb,
struct flow_dissector *flow_dissector,
void *target_container)
@@ -1497,6 +1521,10 @@ bool __skb_flow_dissect(const struct net *net,
__skb_flow_dissect_icmp(skb, flow_dissector, target_container,
data, nhoff, hlen);
break;
+ case IPPROTO_L2TP:
+ __skb_flow_dissect_l2tpv3(skb, flow_dissector, target_container,
+ data, nhoff, hlen);
+ break;
default:
break;
--
2.31.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Intel-wired-lan] [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
@ 2022-08-29 9:44 ` Wojciech Drewek
0 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, gnault, intel-wired-lan, vladbu,
kuba, pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb,
jhs, xiyou.wangcong, davem
Allow to dissect L2TPv3 specific field which is:
- session ID (32 bits)
L2TPv3 might be transported over IP or over UDP,
this ipmplementation is only about L2TPv3 over IP.
IP protocold carries L2TPv3 when ip_proto is
IPPROTO_L2TP (115).
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
include/net/flow_dissector.h | 9 +++++++++
net/core/flow_dissector.c | 28 ++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index 6c74812d64b2..5ccf52ef8809 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -289,6 +289,14 @@ struct flow_dissector_key_pppoe {
__be16 type;
};
+/**
+ * struct flow_dissector_key_l2tpv3:
+ * @session_id: identifier for a l2tp session
+ */
+struct flow_dissector_key_l2tpv3 {
+ __be32 session_id;
+};
+
enum flow_dissector_key_id {
FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */
FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */
@@ -320,6 +328,7 @@ enum flow_dissector_key_id {
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_L2TPV3, /* struct flow_dissector_key_l2tpv3 */
FLOW_DISSECTOR_KEY_MAX,
};
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 764c4cb3fe8f..dbd944de4129 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -204,6 +204,30 @@ static void __skb_flow_dissect_icmp(const struct sk_buff *skb,
skb_flow_get_icmp_tci(skb, key_icmp, data, thoff, hlen);
}
+static void __skb_flow_dissect_l2tpv3(const struct sk_buff *skb,
+ struct flow_dissector *flow_dissector,
+ void *target_container, const void *data,
+ int nhoff, int hlen)
+{
+ struct flow_dissector_key_l2tpv3 *key_l2tpv3;
+ struct {
+ __be32 session_id;
+ } *hdr, _hdr;
+
+ hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen, &_hdr);
+ if (!hdr)
+ return;
+
+ if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_L2TPV3))
+ return;
+
+ key_l2tpv3 = skb_flow_dissector_target(flow_dissector,
+ FLOW_DISSECTOR_KEY_L2TPV3,
+ target_container);
+
+ key_l2tpv3->session_id = hdr->session_id;
+}
+
void skb_flow_dissect_meta(const struct sk_buff *skb,
struct flow_dissector *flow_dissector,
void *target_container)
@@ -1497,6 +1521,10 @@ bool __skb_flow_dissect(const struct net *net,
__skb_flow_dissect_icmp(skb, flow_dissector, target_container,
data, nhoff, hlen);
break;
+ case IPPROTO_L2TP:
+ __skb_flow_dissect_l2tpv3(skb, flow_dissector, target_container,
+ data, nhoff, hlen);
+ break;
default:
break;
--
2.31.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH net-next v2 3/5] net/sched: flower: Add L2TPv3 filter
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
@ 2022-08-29 9:44 ` Wojciech Drewek
-1 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen, davem,
edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri, marcin.szycik,
michal.swiatkowski, kurt, boris.sukholitko, vladbu,
komachi.yoshiki, paulb, baowen.zheng, louis.peens, simon.horman,
pablo, maksym.glubokiy, intel-wired-lan, jchapman, gnault
Add support for matching on L2TPv3 session ID.
Session ID can be specified only when ip proto was
set to IPPROTO_L2TP.
Example filter:
# tc filter add dev $PF1 ingress prio 1 protocol ip \
flower \
ip_proto l2tp \
l2tpv3_sid 1234 \
skip_sw \
action mirred egress redirect dev $VF1_PR
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
include/uapi/linux/pkt_cls.h | 2 ++
net/sched/cls_flower.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 877309d6ca3c..648a82f32666 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -592,6 +592,8 @@ enum {
TCA_FLOWER_KEY_PPPOE_SID, /* be16 */
TCA_FLOWER_KEY_PPP_PROTO, /* be16 */
+ TCA_FLOWER_KEY_L2TPV3_SID, /* be32 */
+
__TCA_FLOWER_MAX,
};
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 041d63ff809a..22d32b82bc09 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -69,6 +69,7 @@ struct fl_flow_key {
struct flow_dissector_key_hash hash;
struct flow_dissector_key_num_of_vlans num_of_vlans;
struct flow_dissector_key_pppoe pppoe;
+ struct flow_dissector_key_l2tpv3 l2tpv3;
} __aligned(BITS_PER_LONG / 8); /* Ensure that we can do comparisons as longs. */
struct fl_flow_mask_range {
@@ -712,6 +713,7 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
[TCA_FLOWER_KEY_NUM_OF_VLANS] = { .type = NLA_U8 },
[TCA_FLOWER_KEY_PPPOE_SID] = { .type = NLA_U16 },
[TCA_FLOWER_KEY_PPP_PROTO] = { .type = NLA_U16 },
+ [TCA_FLOWER_KEY_L2TPV3_SID] = { .type = NLA_U32 },
};
@@ -1790,6 +1792,11 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
fl_set_key_val(tb, key->arp.tha, TCA_FLOWER_KEY_ARP_THA,
mask->arp.tha, TCA_FLOWER_KEY_ARP_THA_MASK,
sizeof(key->arp.tha));
+ } else if (key->basic.ip_proto == IPPROTO_L2TP) {
+ fl_set_key_val(tb, &key->l2tpv3.session_id,
+ TCA_FLOWER_KEY_L2TPV3_SID,
+ &mask->l2tpv3.session_id, TCA_FLOWER_UNSPEC,
+ sizeof(key->l2tpv3.session_id));
}
if (key->basic.ip_proto == IPPROTO_TCP ||
@@ -1970,6 +1977,8 @@ static void fl_init_dissector(struct flow_dissector *dissector,
FLOW_DISSECTOR_KEY_NUM_OF_VLANS, num_of_vlans);
FL_KEY_SET_IF_MASKED(mask, keys, cnt,
FLOW_DISSECTOR_KEY_PPPOE, pppoe);
+ FL_KEY_SET_IF_MASKED(mask, keys, cnt,
+ FLOW_DISSECTOR_KEY_L2TPV3, l2tpv3);
skb_flow_dissector_init(dissector, keys, cnt);
}
@@ -3196,6 +3205,13 @@ static int fl_dump_key(struct sk_buff *skb, struct net *net,
mask->arp.tha, TCA_FLOWER_KEY_ARP_THA_MASK,
sizeof(key->arp.tha))))
goto nla_put_failure;
+ else if (key->basic.ip_proto == IPPROTO_L2TP &&
+ fl_dump_key_val(skb, &key->l2tpv3.session_id,
+ TCA_FLOWER_KEY_L2TPV3_SID,
+ &mask->l2tpv3.session_id,
+ TCA_FLOWER_UNSPEC,
+ sizeof(key->l2tpv3.session_id)))
+ goto nla_put_failure;
if ((key->basic.ip_proto == IPPROTO_TCP ||
key->basic.ip_proto == IPPROTO_UDP ||
--
2.31.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Intel-wired-lan] [RFC PATCH net-next v2 3/5] net/sched: flower: Add L2TPv3 filter
@ 2022-08-29 9:44 ` Wojciech Drewek
0 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, gnault, intel-wired-lan, vladbu,
kuba, pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb,
jhs, xiyou.wangcong, davem
Add support for matching on L2TPv3 session ID.
Session ID can be specified only when ip proto was
set to IPPROTO_L2TP.
Example filter:
# tc filter add dev $PF1 ingress prio 1 protocol ip \
flower \
ip_proto l2tp \
l2tpv3_sid 1234 \
skip_sw \
action mirred egress redirect dev $VF1_PR
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
include/uapi/linux/pkt_cls.h | 2 ++
net/sched/cls_flower.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 877309d6ca3c..648a82f32666 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -592,6 +592,8 @@ enum {
TCA_FLOWER_KEY_PPPOE_SID, /* be16 */
TCA_FLOWER_KEY_PPP_PROTO, /* be16 */
+ TCA_FLOWER_KEY_L2TPV3_SID, /* be32 */
+
__TCA_FLOWER_MAX,
};
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 041d63ff809a..22d32b82bc09 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -69,6 +69,7 @@ struct fl_flow_key {
struct flow_dissector_key_hash hash;
struct flow_dissector_key_num_of_vlans num_of_vlans;
struct flow_dissector_key_pppoe pppoe;
+ struct flow_dissector_key_l2tpv3 l2tpv3;
} __aligned(BITS_PER_LONG / 8); /* Ensure that we can do comparisons as longs. */
struct fl_flow_mask_range {
@@ -712,6 +713,7 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
[TCA_FLOWER_KEY_NUM_OF_VLANS] = { .type = NLA_U8 },
[TCA_FLOWER_KEY_PPPOE_SID] = { .type = NLA_U16 },
[TCA_FLOWER_KEY_PPP_PROTO] = { .type = NLA_U16 },
+ [TCA_FLOWER_KEY_L2TPV3_SID] = { .type = NLA_U32 },
};
@@ -1790,6 +1792,11 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
fl_set_key_val(tb, key->arp.tha, TCA_FLOWER_KEY_ARP_THA,
mask->arp.tha, TCA_FLOWER_KEY_ARP_THA_MASK,
sizeof(key->arp.tha));
+ } else if (key->basic.ip_proto == IPPROTO_L2TP) {
+ fl_set_key_val(tb, &key->l2tpv3.session_id,
+ TCA_FLOWER_KEY_L2TPV3_SID,
+ &mask->l2tpv3.session_id, TCA_FLOWER_UNSPEC,
+ sizeof(key->l2tpv3.session_id));
}
if (key->basic.ip_proto == IPPROTO_TCP ||
@@ -1970,6 +1977,8 @@ static void fl_init_dissector(struct flow_dissector *dissector,
FLOW_DISSECTOR_KEY_NUM_OF_VLANS, num_of_vlans);
FL_KEY_SET_IF_MASKED(mask, keys, cnt,
FLOW_DISSECTOR_KEY_PPPOE, pppoe);
+ FL_KEY_SET_IF_MASKED(mask, keys, cnt,
+ FLOW_DISSECTOR_KEY_L2TPV3, l2tpv3);
skb_flow_dissector_init(dissector, keys, cnt);
}
@@ -3196,6 +3205,13 @@ static int fl_dump_key(struct sk_buff *skb, struct net *net,
mask->arp.tha, TCA_FLOWER_KEY_ARP_THA_MASK,
sizeof(key->arp.tha))))
goto nla_put_failure;
+ else if (key->basic.ip_proto == IPPROTO_L2TP &&
+ fl_dump_key_val(skb, &key->l2tpv3.session_id,
+ TCA_FLOWER_KEY_L2TPV3_SID,
+ &mask->l2tpv3.session_id,
+ TCA_FLOWER_UNSPEC,
+ sizeof(key->l2tpv3.session_id)))
+ goto nla_put_failure;
if ((key->basic.ip_proto == IPPROTO_TCP ||
key->basic.ip_proto == IPPROTO_UDP ||
--
2.31.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH net-next v2 4/5] flow_offload: Introduce flow_match_l2tpv3
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
@ 2022-08-29 9:44 ` Wojciech Drewek
-1 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen, davem,
edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri, marcin.szycik,
michal.swiatkowski, kurt, boris.sukholitko, vladbu,
komachi.yoshiki, paulb, baowen.zheng, louis.peens, simon.horman,
pablo, maksym.glubokiy, intel-wired-lan, jchapman, gnault
Allow to offload L2TPv3 filters by adding flow_rule_match_l2tpv3.
Drivers can extract L2TPv3 specific fields from now on.
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
include/net/flow_offload.h | 6 ++++++
net/core/flow_offload.c | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index 2a9a9e42e7fd..e343f9f8363e 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -80,6 +80,10 @@ struct flow_match_pppoe {
struct flow_dissector_key_pppoe *key, *mask;
};
+struct flow_match_l2tpv3 {
+ struct flow_dissector_key_l2tpv3 *key, *mask;
+};
+
struct flow_rule;
void flow_rule_match_meta(const struct flow_rule *rule,
@@ -128,6 +132,8 @@ 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);
+void flow_rule_match_l2tpv3(const struct flow_rule *rule,
+ struct flow_match_l2tpv3 *out);
enum flow_action_id {
FLOW_ACTION_ACCEPT = 0,
diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c
index 8cfb63528d18..abe423fd5736 100644
--- a/net/core/flow_offload.c
+++ b/net/core/flow_offload.c
@@ -237,6 +237,13 @@ void flow_rule_match_pppoe(const struct flow_rule *rule,
}
EXPORT_SYMBOL(flow_rule_match_pppoe);
+void flow_rule_match_l2tpv3(const struct flow_rule *rule,
+ struct flow_match_l2tpv3 *out)
+{
+ FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_L2TPV3, out);
+}
+EXPORT_SYMBOL(flow_rule_match_l2tpv3);
+
struct flow_block_cb *flow_block_cb_alloc(flow_setup_cb_t *cb,
void *cb_ident, void *cb_priv,
void (*release)(void *cb_priv))
--
2.31.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Intel-wired-lan] [RFC PATCH net-next v2 4/5] flow_offload: Introduce flow_match_l2tpv3
@ 2022-08-29 9:44 ` Wojciech Drewek
0 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, gnault, intel-wired-lan, vladbu,
kuba, pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb,
jhs, xiyou.wangcong, davem
Allow to offload L2TPv3 filters by adding flow_rule_match_l2tpv3.
Drivers can extract L2TPv3 specific fields from now on.
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
include/net/flow_offload.h | 6 ++++++
net/core/flow_offload.c | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index 2a9a9e42e7fd..e343f9f8363e 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -80,6 +80,10 @@ struct flow_match_pppoe {
struct flow_dissector_key_pppoe *key, *mask;
};
+struct flow_match_l2tpv3 {
+ struct flow_dissector_key_l2tpv3 *key, *mask;
+};
+
struct flow_rule;
void flow_rule_match_meta(const struct flow_rule *rule,
@@ -128,6 +132,8 @@ 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);
+void flow_rule_match_l2tpv3(const struct flow_rule *rule,
+ struct flow_match_l2tpv3 *out);
enum flow_action_id {
FLOW_ACTION_ACCEPT = 0,
diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c
index 8cfb63528d18..abe423fd5736 100644
--- a/net/core/flow_offload.c
+++ b/net/core/flow_offload.c
@@ -237,6 +237,13 @@ void flow_rule_match_pppoe(const struct flow_rule *rule,
}
EXPORT_SYMBOL(flow_rule_match_pppoe);
+void flow_rule_match_l2tpv3(const struct flow_rule *rule,
+ struct flow_match_l2tpv3 *out)
+{
+ FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_L2TPV3, out);
+}
+EXPORT_SYMBOL(flow_rule_match_l2tpv3);
+
struct flow_block_cb *flow_block_cb_alloc(flow_setup_cb_t *cb,
void *cb_ident, void *cb_priv,
void (*release)(void *cb_priv))
--
2.31.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [RFC PATCH net-next v2 5/5] ice: Add L2TPv3 hardware offload support
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
@ 2022-08-29 9:44 ` Wojciech Drewek
-1 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen, davem,
edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri, marcin.szycik,
michal.swiatkowski, kurt, boris.sukholitko, vladbu,
komachi.yoshiki, paulb, baowen.zheng, louis.peens, simon.horman,
pablo, maksym.glubokiy, intel-wired-lan, jchapman, gnault
From: Marcin Szycik <marcin.szycik@linux.intel.com>
Add support for offloading packets based on L2TPv3 session id in switchdev
mode.
Example filter:
tc filter add dev $PF1 ingress prio 1 protocol ip flower ip_proto l2tp \
l2tpv3_sid 1234 skip_sw action mirred egress redirect dev $VF1_PR
Changes in iproute2 are required to be able to specify l2tpv3_sid.
ICE COMMS DDP package is required to create a filter as it contains L2TPv3
profiles.
Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
---
.../ethernet/intel/ice/ice_protocol_type.h | 8 +++
drivers/net/ethernet/intel/ice/ice_switch.c | 70 ++++++++++++++++++-
drivers/net/ethernet/intel/ice/ice_tc_lib.c | 27 ++++++-
drivers/net/ethernet/intel/ice/ice_tc_lib.h | 6 ++
4 files changed, 109 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_protocol_type.h b/drivers/net/ethernet/intel/ice/ice_protocol_type.h
index 560efc7654c7..02a4e1cf624e 100644
--- a/drivers/net/ethernet/intel/ice/ice_protocol_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_protocol_type.h
@@ -44,6 +44,7 @@ enum ice_protocol_type {
ICE_GTP,
ICE_GTP_NO_PAY,
ICE_PPPOE,
+ ICE_L2TPV3,
ICE_VLAN_EX,
ICE_VLAN_IN,
ICE_VXLAN_GPE,
@@ -111,6 +112,7 @@ enum ice_prot_id {
#define ICE_UDP_ILOS_HW 53
#define ICE_GRE_OF_HW 64
#define ICE_PPPOE_HW 103
+#define ICE_L2TPV3_HW 104
#define ICE_UDP_OF_HW 52 /* UDP Tunnels */
#define ICE_META_DATA_ID_HW 255 /* this is used for tunnel and VLAN type */
@@ -217,6 +219,11 @@ struct ice_pppoe_hdr {
__be16 ppp_prot_id; /* control and data only */
};
+struct ice_l2tpv3_sess_hdr {
+ __be32 session_id;
+ __be64 cookie;
+};
+
struct ice_nvgre_hdr {
__be16 flags;
__be16 protocol;
@@ -235,6 +242,7 @@ union ice_prot_hdr {
struct ice_nvgre_hdr nvgre_hdr;
struct ice_udp_gtp_hdr gtp_hdr;
struct ice_pppoe_hdr pppoe_hdr;
+ struct ice_l2tpv3_sess_hdr l2tpv3_sess_hdr;
};
/* This is mapping table entry that maps every word within a given protocol
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 697feb89188c..075703f513ed 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -42,6 +42,7 @@ enum {
ICE_PKT_GTP_NOPAY = BIT(8),
ICE_PKT_KMALLOC = BIT(9),
ICE_PKT_PPPOE = BIT(10),
+ ICE_PKT_L2TPV3 = BIT(11),
};
struct ice_dummy_pkt_offsets {
@@ -1258,6 +1259,65 @@ ICE_DECLARE_PKT_TEMPLATE(pppoe_ipv6_udp) = {
0x00, 0x00, /* 2 bytes for 4 bytes alignment */
};
+ICE_DECLARE_PKT_OFFSETS(ipv4_l2tpv3) = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_ETYPE_OL, 12 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_L2TPV3, 34 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+ICE_DECLARE_PKT_TEMPLATE(ipv4_l2tpv3) = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x08, 0x00, /* ICE_ETYPE_OL 12 */
+
+ 0x45, 0x00, 0x00, 0x20, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x73, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 34 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+ICE_DECLARE_PKT_OFFSETS(ipv6_l2tpv3) = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_ETYPE_OL, 12 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_L2TPV3, 54 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+ICE_DECLARE_PKT_TEMPLATE(ipv6_l2tpv3) = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x86, 0xDD, /* ICE_ETYPE_OL 12 */
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_IL 14 */
+ 0x00, 0x0c, 0x73, 0x40,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 54 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
static const struct ice_dummy_pkt_profile ice_dummy_pkt_profiles[] = {
ICE_PKT_PROFILE(ipv6_gtp, ICE_PKT_TUN_GTPU | ICE_PKT_OUTER_IPV6 |
ICE_PKT_GTP_NOPAY),
@@ -1297,6 +1357,8 @@ static const struct ice_dummy_pkt_profile ice_dummy_pkt_profiles[] = {
ICE_PKT_PROFILE(udp_tun_ipv6_tcp, ICE_PKT_TUN_UDP |
ICE_PKT_INNER_IPV6 |
ICE_PKT_INNER_TCP),
+ ICE_PKT_PROFILE(ipv6_l2tpv3, ICE_PKT_L2TPV3 | ICE_PKT_OUTER_IPV6),
+ ICE_PKT_PROFILE(ipv4_l2tpv3, ICE_PKT_L2TPV3),
ICE_PKT_PROFILE(udp_tun_tcp, ICE_PKT_TUN_UDP | ICE_PKT_INNER_TCP),
ICE_PKT_PROFILE(udp_tun_ipv6_udp, ICE_PKT_TUN_UDP |
ICE_PKT_INNER_IPV6),
@@ -4492,6 +4554,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
{ ICE_GTP, { 8, 10, 12, 14, 16, 18, 20, 22 } },
{ ICE_GTP_NO_PAY, { 8, 10, 12, 14 } },
{ ICE_PPPOE, { 0, 2, 4, 6 } },
+ { ICE_L2TPV3, { 0, 2, 4, 6, 8, 10 } },
{ ICE_VLAN_EX, { 2, 0 } },
{ ICE_VLAN_IN, { 2, 0 } },
};
@@ -4515,6 +4578,7 @@ static struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
{ ICE_GTP, ICE_UDP_OF_HW },
{ ICE_GTP_NO_PAY, ICE_UDP_ILOS_HW },
{ ICE_PPPOE, ICE_PPPOE_HW },
+ { ICE_L2TPV3, ICE_L2TPV3_HW },
{ ICE_VLAN_EX, ICE_VLAN_OF_HW },
{ ICE_VLAN_IN, ICE_VLAN_OL_HW },
};
@@ -5598,7 +5662,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
if (lkups[i].h_u.pppoe_hdr.ppp_prot_id ==
htons(PPP_IPV6))
match |= ICE_PKT_OUTER_IPV6;
- }
+ } else if (lkups[i].type == ICE_L2TPV3)
+ match |= ICE_PKT_L2TPV3;
}
while (ret->match && (match & ret->match) != ret->match)
@@ -5699,6 +5764,9 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
case ICE_PPPOE:
len = sizeof(struct ice_pppoe_hdr);
break;
+ case ICE_L2TPV3:
+ len = sizeof(struct ice_l2tpv3_sess_hdr);
+ break;
default:
return -EINVAL;
}
diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
index 42df686e0215..170e04eaad18 100644
--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
@@ -71,6 +71,10 @@ ice_tc_count_lkups(u32 flags, struct ice_tc_flower_lyr_2_4_hdrs *headers,
if (flags & (ICE_TC_FLWR_FIELD_IP_TOS | ICE_TC_FLWR_FIELD_IP_TTL))
lkups_cnt++;
+ /* are L2TPv3 options specified? */
+ if (flags & ICE_TC_FLWR_FIELD_L2TPV3_SESSID)
+ lkups_cnt++;
+
/* is L4 (TCP/UDP/any other L4 protocol fields) specified? */
if (flags & (ICE_TC_FLWR_FIELD_DEST_L4_PORT |
ICE_TC_FLWR_FIELD_SRC_L4_PORT))
@@ -515,6 +519,17 @@ ice_tc_fill_rules(struct ice_hw *hw, u32 flags,
i++;
}
+ if (flags & ICE_TC_FLWR_FIELD_L2TPV3_SESSID) {
+ list[i].type = ICE_L2TPV3;
+
+ list[i].h_u.l2tpv3_sess_hdr.session_id =
+ headers->l2tpv3_hdr.session_id;
+ list[i].m_u.l2tpv3_sess_hdr.session_id =
+ cpu_to_be32(0xFFFFFFFF);
+
+ i++;
+ }
+
/* copy L4 (src, dest) port */
if (flags & (ICE_TC_FLWR_FIELD_DEST_L4_PORT |
ICE_TC_FLWR_FIELD_SRC_L4_PORT)) {
@@ -1168,7 +1183,8 @@ ice_parse_cls_flower(struct net_device *filter_dev, struct ice_vsi *vsi,
BIT(FLOW_DISSECTOR_KEY_IP) |
BIT(FLOW_DISSECTOR_KEY_ENC_IP) |
BIT(FLOW_DISSECTOR_KEY_PORTS) |
- BIT(FLOW_DISSECTOR_KEY_PPPOE))) {
+ BIT(FLOW_DISSECTOR_KEY_PPPOE) |
+ BIT(FLOW_DISSECTOR_KEY_L2TPV3))) {
NL_SET_ERR_MSG_MOD(fltr->extack, "Unsupported key used");
return -EOPNOTSUPP;
}
@@ -1351,6 +1367,15 @@ ice_parse_cls_flower(struct net_device *filter_dev, struct ice_vsi *vsi,
ice_tc_set_tos_ttl(&match, fltr, headers, false);
}
+ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_L2TPV3)) {
+ struct flow_match_l2tpv3 match;
+
+ flow_rule_match_l2tpv3(rule, &match);
+
+ fltr->flags |= ICE_TC_FLWR_FIELD_L2TPV3_SESSID;
+ headers->l2tpv3_hdr.session_id = match.key->session_id;
+ }
+
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_PORTS)) {
struct flow_match_ports match;
diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.h b/drivers/net/ethernet/intel/ice/ice_tc_lib.h
index f397ed02606d..ebef34385a4f 100644
--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.h
@@ -30,6 +30,7 @@
#define ICE_TC_FLWR_FIELD_IP_TTL BIT(23)
#define ICE_TC_FLWR_FIELD_ENC_IP_TOS BIT(24)
#define ICE_TC_FLWR_FIELD_ENC_IP_TTL BIT(25)
+#define ICE_TC_FLWR_FIELD_L2TPV3_SESSID BIT(26)
#define ICE_TC_FLOWER_MASK_32 0xFFFFFFFF
@@ -86,6 +87,10 @@ struct ice_tc_l3_hdr {
u8 ttl;
};
+struct ice_tc_l2tpv3_hdr {
+ __be32 session_id;
+};
+
struct ice_tc_l4_hdr {
__be16 dst_port;
__be16 src_port;
@@ -98,6 +103,7 @@ struct ice_tc_flower_lyr_2_4_hdrs {
struct ice_tc_vlan_hdr vlan_hdr;
struct ice_tc_vlan_hdr cvlan_hdr;
struct ice_tc_pppoe_hdr pppoe_hdr;
+ struct ice_tc_l2tpv3_hdr l2tpv3_hdr;
/* L3 (IPv4[6]) layer fields with their mask */
struct ice_tc_l3_hdr l3_key;
struct ice_tc_l3_hdr l3_mask;
--
2.31.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Intel-wired-lan] [RFC PATCH net-next v2 5/5] ice: Add L2TPv3 hardware offload support
@ 2022-08-29 9:44 ` Wojciech Drewek
0 siblings, 0 replies; 22+ messages in thread
From: Wojciech Drewek @ 2022-08-29 9:44 UTC (permalink / raw)
To: netdev
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, gnault, intel-wired-lan, vladbu,
kuba, pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb,
jhs, xiyou.wangcong, davem
From: Marcin Szycik <marcin.szycik@linux.intel.com>
Add support for offloading packets based on L2TPv3 session id in switchdev
mode.
Example filter:
tc filter add dev $PF1 ingress prio 1 protocol ip flower ip_proto l2tp \
l2tpv3_sid 1234 skip_sw action mirred egress redirect dev $VF1_PR
Changes in iproute2 are required to be able to specify l2tpv3_sid.
ICE COMMS DDP package is required to create a filter as it contains L2TPv3
profiles.
Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
---
.../ethernet/intel/ice/ice_protocol_type.h | 8 +++
drivers/net/ethernet/intel/ice/ice_switch.c | 70 ++++++++++++++++++-
drivers/net/ethernet/intel/ice/ice_tc_lib.c | 27 ++++++-
drivers/net/ethernet/intel/ice/ice_tc_lib.h | 6 ++
4 files changed, 109 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_protocol_type.h b/drivers/net/ethernet/intel/ice/ice_protocol_type.h
index 560efc7654c7..02a4e1cf624e 100644
--- a/drivers/net/ethernet/intel/ice/ice_protocol_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_protocol_type.h
@@ -44,6 +44,7 @@ enum ice_protocol_type {
ICE_GTP,
ICE_GTP_NO_PAY,
ICE_PPPOE,
+ ICE_L2TPV3,
ICE_VLAN_EX,
ICE_VLAN_IN,
ICE_VXLAN_GPE,
@@ -111,6 +112,7 @@ enum ice_prot_id {
#define ICE_UDP_ILOS_HW 53
#define ICE_GRE_OF_HW 64
#define ICE_PPPOE_HW 103
+#define ICE_L2TPV3_HW 104
#define ICE_UDP_OF_HW 52 /* UDP Tunnels */
#define ICE_META_DATA_ID_HW 255 /* this is used for tunnel and VLAN type */
@@ -217,6 +219,11 @@ struct ice_pppoe_hdr {
__be16 ppp_prot_id; /* control and data only */
};
+struct ice_l2tpv3_sess_hdr {
+ __be32 session_id;
+ __be64 cookie;
+};
+
struct ice_nvgre_hdr {
__be16 flags;
__be16 protocol;
@@ -235,6 +242,7 @@ union ice_prot_hdr {
struct ice_nvgre_hdr nvgre_hdr;
struct ice_udp_gtp_hdr gtp_hdr;
struct ice_pppoe_hdr pppoe_hdr;
+ struct ice_l2tpv3_sess_hdr l2tpv3_sess_hdr;
};
/* This is mapping table entry that maps every word within a given protocol
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 697feb89188c..075703f513ed 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -42,6 +42,7 @@ enum {
ICE_PKT_GTP_NOPAY = BIT(8),
ICE_PKT_KMALLOC = BIT(9),
ICE_PKT_PPPOE = BIT(10),
+ ICE_PKT_L2TPV3 = BIT(11),
};
struct ice_dummy_pkt_offsets {
@@ -1258,6 +1259,65 @@ ICE_DECLARE_PKT_TEMPLATE(pppoe_ipv6_udp) = {
0x00, 0x00, /* 2 bytes for 4 bytes alignment */
};
+ICE_DECLARE_PKT_OFFSETS(ipv4_l2tpv3) = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_ETYPE_OL, 12 },
+ { ICE_IPV4_OFOS, 14 },
+ { ICE_L2TPV3, 34 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+ICE_DECLARE_PKT_TEMPLATE(ipv4_l2tpv3) = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x08, 0x00, /* ICE_ETYPE_OL 12 */
+
+ 0x45, 0x00, 0x00, 0x20, /* ICE_IPV4_IL 14 */
+ 0x00, 0x00, 0x40, 0x00,
+ 0x40, 0x73, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 34 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
+ICE_DECLARE_PKT_OFFSETS(ipv6_l2tpv3) = {
+ { ICE_MAC_OFOS, 0 },
+ { ICE_ETYPE_OL, 12 },
+ { ICE_IPV6_OFOS, 14 },
+ { ICE_L2TPV3, 54 },
+ { ICE_PROTOCOL_LAST, 0 },
+};
+
+ICE_DECLARE_PKT_TEMPLATE(ipv6_l2tpv3) = {
+ 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x86, 0xDD, /* ICE_ETYPE_OL 12 */
+
+ 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_IL 14 */
+ 0x00, 0x0c, 0x73, 0x40,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 54 */
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, /* 2 bytes for 4 bytes alignment */
+};
+
static const struct ice_dummy_pkt_profile ice_dummy_pkt_profiles[] = {
ICE_PKT_PROFILE(ipv6_gtp, ICE_PKT_TUN_GTPU | ICE_PKT_OUTER_IPV6 |
ICE_PKT_GTP_NOPAY),
@@ -1297,6 +1357,8 @@ static const struct ice_dummy_pkt_profile ice_dummy_pkt_profiles[] = {
ICE_PKT_PROFILE(udp_tun_ipv6_tcp, ICE_PKT_TUN_UDP |
ICE_PKT_INNER_IPV6 |
ICE_PKT_INNER_TCP),
+ ICE_PKT_PROFILE(ipv6_l2tpv3, ICE_PKT_L2TPV3 | ICE_PKT_OUTER_IPV6),
+ ICE_PKT_PROFILE(ipv4_l2tpv3, ICE_PKT_L2TPV3),
ICE_PKT_PROFILE(udp_tun_tcp, ICE_PKT_TUN_UDP | ICE_PKT_INNER_TCP),
ICE_PKT_PROFILE(udp_tun_ipv6_udp, ICE_PKT_TUN_UDP |
ICE_PKT_INNER_IPV6),
@@ -4492,6 +4554,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
{ ICE_GTP, { 8, 10, 12, 14, 16, 18, 20, 22 } },
{ ICE_GTP_NO_PAY, { 8, 10, 12, 14 } },
{ ICE_PPPOE, { 0, 2, 4, 6 } },
+ { ICE_L2TPV3, { 0, 2, 4, 6, 8, 10 } },
{ ICE_VLAN_EX, { 2, 0 } },
{ ICE_VLAN_IN, { 2, 0 } },
};
@@ -4515,6 +4578,7 @@ static struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
{ ICE_GTP, ICE_UDP_OF_HW },
{ ICE_GTP_NO_PAY, ICE_UDP_ILOS_HW },
{ ICE_PPPOE, ICE_PPPOE_HW },
+ { ICE_L2TPV3, ICE_L2TPV3_HW },
{ ICE_VLAN_EX, ICE_VLAN_OF_HW },
{ ICE_VLAN_IN, ICE_VLAN_OL_HW },
};
@@ -5598,7 +5662,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
if (lkups[i].h_u.pppoe_hdr.ppp_prot_id ==
htons(PPP_IPV6))
match |= ICE_PKT_OUTER_IPV6;
- }
+ } else if (lkups[i].type == ICE_L2TPV3)
+ match |= ICE_PKT_L2TPV3;
}
while (ret->match && (match & ret->match) != ret->match)
@@ -5699,6 +5764,9 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
case ICE_PPPOE:
len = sizeof(struct ice_pppoe_hdr);
break;
+ case ICE_L2TPV3:
+ len = sizeof(struct ice_l2tpv3_sess_hdr);
+ break;
default:
return -EINVAL;
}
diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
index 42df686e0215..170e04eaad18 100644
--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
@@ -71,6 +71,10 @@ ice_tc_count_lkups(u32 flags, struct ice_tc_flower_lyr_2_4_hdrs *headers,
if (flags & (ICE_TC_FLWR_FIELD_IP_TOS | ICE_TC_FLWR_FIELD_IP_TTL))
lkups_cnt++;
+ /* are L2TPv3 options specified? */
+ if (flags & ICE_TC_FLWR_FIELD_L2TPV3_SESSID)
+ lkups_cnt++;
+
/* is L4 (TCP/UDP/any other L4 protocol fields) specified? */
if (flags & (ICE_TC_FLWR_FIELD_DEST_L4_PORT |
ICE_TC_FLWR_FIELD_SRC_L4_PORT))
@@ -515,6 +519,17 @@ ice_tc_fill_rules(struct ice_hw *hw, u32 flags,
i++;
}
+ if (flags & ICE_TC_FLWR_FIELD_L2TPV3_SESSID) {
+ list[i].type = ICE_L2TPV3;
+
+ list[i].h_u.l2tpv3_sess_hdr.session_id =
+ headers->l2tpv3_hdr.session_id;
+ list[i].m_u.l2tpv3_sess_hdr.session_id =
+ cpu_to_be32(0xFFFFFFFF);
+
+ i++;
+ }
+
/* copy L4 (src, dest) port */
if (flags & (ICE_TC_FLWR_FIELD_DEST_L4_PORT |
ICE_TC_FLWR_FIELD_SRC_L4_PORT)) {
@@ -1168,7 +1183,8 @@ ice_parse_cls_flower(struct net_device *filter_dev, struct ice_vsi *vsi,
BIT(FLOW_DISSECTOR_KEY_IP) |
BIT(FLOW_DISSECTOR_KEY_ENC_IP) |
BIT(FLOW_DISSECTOR_KEY_PORTS) |
- BIT(FLOW_DISSECTOR_KEY_PPPOE))) {
+ BIT(FLOW_DISSECTOR_KEY_PPPOE) |
+ BIT(FLOW_DISSECTOR_KEY_L2TPV3))) {
NL_SET_ERR_MSG_MOD(fltr->extack, "Unsupported key used");
return -EOPNOTSUPP;
}
@@ -1351,6 +1367,15 @@ ice_parse_cls_flower(struct net_device *filter_dev, struct ice_vsi *vsi,
ice_tc_set_tos_ttl(&match, fltr, headers, false);
}
+ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_L2TPV3)) {
+ struct flow_match_l2tpv3 match;
+
+ flow_rule_match_l2tpv3(rule, &match);
+
+ fltr->flags |= ICE_TC_FLWR_FIELD_L2TPV3_SESSID;
+ headers->l2tpv3_hdr.session_id = match.key->session_id;
+ }
+
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_PORTS)) {
struct flow_match_ports match;
diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.h b/drivers/net/ethernet/intel/ice/ice_tc_lib.h
index f397ed02606d..ebef34385a4f 100644
--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.h
@@ -30,6 +30,7 @@
#define ICE_TC_FLWR_FIELD_IP_TTL BIT(23)
#define ICE_TC_FLWR_FIELD_ENC_IP_TOS BIT(24)
#define ICE_TC_FLWR_FIELD_ENC_IP_TTL BIT(25)
+#define ICE_TC_FLWR_FIELD_L2TPV3_SESSID BIT(26)
#define ICE_TC_FLOWER_MASK_32 0xFFFFFFFF
@@ -86,6 +87,10 @@ struct ice_tc_l3_hdr {
u8 ttl;
};
+struct ice_tc_l2tpv3_hdr {
+ __be32 session_id;
+};
+
struct ice_tc_l4_hdr {
__be16 dst_port;
__be16 src_port;
@@ -98,6 +103,7 @@ struct ice_tc_flower_lyr_2_4_hdrs {
struct ice_tc_vlan_hdr vlan_hdr;
struct ice_tc_vlan_hdr cvlan_hdr;
struct ice_tc_pppoe_hdr pppoe_hdr;
+ struct ice_tc_l2tpv3_hdr l2tpv3_hdr;
/* L3 (IPv4[6]) layer fields with their mask */
struct ice_tc_l3_hdr l3_key;
struct ice_tc_l3_hdr l3_mask;
--
2.31.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [RFC PATCH net-next v2 5/5] ice: Add L2TPv3 hardware offload support
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
@ 2022-08-31 9:16 ` Michal Swiatkowski
-1 siblings, 0 replies; 22+ messages in thread
From: Michal Swiatkowski @ 2022-08-31 9:16 UTC (permalink / raw)
To: Wojciech Drewek
Cc: netdev, alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen,
davem, edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri,
marcin.szycik, kurt, boris.sukholitko, vladbu, komachi.yoshiki,
paulb, baowen.zheng, louis.peens, simon.horman, pablo,
maksym.glubokiy, intel-wired-lan, jchapman, gnault
On Mon, Aug 29, 2022 at 11:44:12AM +0200, Wojciech Drewek wrote:
> From: Marcin Szycik <marcin.szycik@linux.intel.com>
>
> Add support for offloading packets based on L2TPv3 session id in switchdev
> mode.
>
> Example filter:
> tc filter add dev $PF1 ingress prio 1 protocol ip flower ip_proto l2tp \
> l2tpv3_sid 1234 skip_sw action mirred egress redirect dev $VF1_PR
>
> Changes in iproute2 are required to be able to specify l2tpv3_sid.
>
> ICE COMMS DDP package is required to create a filter as it contains L2TPv3
> profiles.
>
<snip>
ice part looks fine, thanks.
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Intel-wired-lan] [RFC PATCH net-next v2 5/5] ice: Add L2TPv3 hardware offload support
@ 2022-08-31 9:16 ` Michal Swiatkowski
0 siblings, 0 replies; 22+ messages in thread
From: Michal Swiatkowski @ 2022-08-31 9:16 UTC (permalink / raw)
To: Wojciech Drewek
Cc: simon.horman, maksym.glubokiy, komachi.yoshiki, jchapman,
edumazet, boris.sukholitko, louis.peens, gnault, intel-wired-lan,
vladbu, kuba, pabeni, pablo, baowen.zheng, kurt, jiri, paulb,
jhs, xiyou.wangcong, netdev, davem
On Mon, Aug 29, 2022 at 11:44:12AM +0200, Wojciech Drewek wrote:
> From: Marcin Szycik <marcin.szycik@linux.intel.com>
>
> Add support for offloading packets based on L2TPv3 session id in switchdev
> mode.
>
> Example filter:
> tc filter add dev $PF1 ingress prio 1 protocol ip flower ip_proto l2tp \
> l2tpv3_sid 1234 skip_sw action mirred egress redirect dev $VF1_PR
>
> Changes in iproute2 are required to be able to specify l2tpv3_sid.
>
> ICE COMMS DDP package is required to create a filter as it contains L2TPv3
> profiles.
>
<snip>
ice part looks fine, thanks.
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH net-next v2 1/5] uapi: move IPPROTO_L2TP to in.h
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
@ 2022-08-31 10:02 ` Guillaume Nault
-1 siblings, 0 replies; 22+ messages in thread
From: Guillaume Nault @ 2022-08-31 10:02 UTC (permalink / raw)
To: Wojciech Drewek
Cc: netdev, alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen,
davem, edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri,
marcin.szycik, michal.swiatkowski, kurt, boris.sukholitko,
vladbu, komachi.yoshiki, paulb, baowen.zheng, louis.peens,
simon.horman, pablo, maksym.glubokiy, intel-wired-lan, jchapman
On Mon, Aug 29, 2022 at 11:44:08AM +0200, Wojciech Drewek wrote:
> IPPROTO_L2TP is currently defined in l2tp.h, but most of
> ip protocols is defined in in.h file. Move it there in order
> to keep code clean.
Acked-by: Guillaume Nault <gnault@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Intel-wired-lan] [RFC PATCH net-next v2 1/5] uapi: move IPPROTO_L2TP to in.h
@ 2022-08-31 10:02 ` Guillaume Nault
0 siblings, 0 replies; 22+ messages in thread
From: Guillaume Nault @ 2022-08-31 10:02 UTC (permalink / raw)
To: Wojciech Drewek
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, intel-wired-lan, vladbu, kuba,
pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb, jhs,
xiyou.wangcong, netdev, davem
On Mon, Aug 29, 2022 at 11:44:08AM +0200, Wojciech Drewek wrote:
> IPPROTO_L2TP is currently defined in l2tp.h, but most of
> ip protocols is defined in in.h file. Move it there in order
> to keep code clean.
Acked-by: Guillaume Nault <gnault@redhat.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
@ 2022-08-31 10:07 ` Guillaume Nault
-1 siblings, 0 replies; 22+ messages in thread
From: Guillaume Nault @ 2022-08-31 10:07 UTC (permalink / raw)
To: Wojciech Drewek
Cc: netdev, alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen,
davem, edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri,
marcin.szycik, michal.swiatkowski, kurt, boris.sukholitko,
vladbu, komachi.yoshiki, paulb, baowen.zheng, louis.peens,
simon.horman, pablo, maksym.glubokiy, intel-wired-lan, jchapman
On Mon, Aug 29, 2022 at 11:44:09AM +0200, Wojciech Drewek wrote:
> Allow to dissect L2TPv3 specific field which is:
> - session ID (32 bits)
>
> L2TPv3 might be transported over IP or over UDP,
> this ipmplementation is only about L2TPv3 over IP.
> IP protocold carries L2TPv3 when ip_proto is
s/protocold/protocol/
> +static void __skb_flow_dissect_l2tpv3(const struct sk_buff *skb,
> + struct flow_dissector *flow_dissector,
> + void *target_container, const void *data,
> + int nhoff, int hlen)
> +{
> + struct flow_dissector_key_l2tpv3 *key_l2tpv3;
> + struct {
> + __be32 session_id;
> + } *hdr, _hdr;
> +
> + hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen, &_hdr);
> + if (!hdr)
> + return;
> +
> + if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_L2TPV3))
> + return;
I'd find it more logical to test !dissector_uses_key() first, then call
__skb_header_pointer(). But that probably just a personnal preference.
In any case the code looks good to me.
Acked-by: Guillaume Nault <gnault@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Intel-wired-lan] [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
@ 2022-08-31 10:07 ` Guillaume Nault
0 siblings, 0 replies; 22+ messages in thread
From: Guillaume Nault @ 2022-08-31 10:07 UTC (permalink / raw)
To: Wojciech Drewek
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, intel-wired-lan, vladbu, kuba,
pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb, jhs,
xiyou.wangcong, netdev, davem
On Mon, Aug 29, 2022 at 11:44:09AM +0200, Wojciech Drewek wrote:
> Allow to dissect L2TPv3 specific field which is:
> - session ID (32 bits)
>
> L2TPv3 might be transported over IP or over UDP,
> this ipmplementation is only about L2TPv3 over IP.
> IP protocold carries L2TPv3 when ip_proto is
s/protocold/protocol/
> +static void __skb_flow_dissect_l2tpv3(const struct sk_buff *skb,
> + struct flow_dissector *flow_dissector,
> + void *target_container, const void *data,
> + int nhoff, int hlen)
> +{
> + struct flow_dissector_key_l2tpv3 *key_l2tpv3;
> + struct {
> + __be32 session_id;
> + } *hdr, _hdr;
> +
> + hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen, &_hdr);
> + if (!hdr)
> + return;
> +
> + if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_L2TPV3))
> + return;
I'd find it more logical to test !dissector_uses_key() first, then call
__skb_header_pointer(). But that probably just a personnal preference.
In any case the code looks good to me.
Acked-by: Guillaume Nault <gnault@redhat.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC PATCH net-next v2 3/5] net/sched: flower: Add L2TPv3 filter
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
@ 2022-08-31 10:23 ` Guillaume Nault
-1 siblings, 0 replies; 22+ messages in thread
From: Guillaume Nault @ 2022-08-31 10:23 UTC (permalink / raw)
To: Wojciech Drewek
Cc: netdev, alexandr.lobakin, jesse.brandeburg, anthony.l.nguyen,
davem, edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri,
marcin.szycik, michal.swiatkowski, kurt, boris.sukholitko,
vladbu, komachi.yoshiki, paulb, baowen.zheng, louis.peens,
simon.horman, pablo, maksym.glubokiy, intel-wired-lan, jchapman
On Mon, Aug 29, 2022 at 11:44:10AM +0200, Wojciech Drewek wrote:
> Add support for matching on L2TPv3 session ID.
> Session ID can be specified only when ip proto was
> set to IPPROTO_L2TP.
Acked-by: Guillaume Nault <gnault@redhat.com>
(I'll stop reviewing here since I have no expertise in ice driver
offload).
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Intel-wired-lan] [RFC PATCH net-next v2 3/5] net/sched: flower: Add L2TPv3 filter
@ 2022-08-31 10:23 ` Guillaume Nault
0 siblings, 0 replies; 22+ messages in thread
From: Guillaume Nault @ 2022-08-31 10:23 UTC (permalink / raw)
To: Wojciech Drewek
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, intel-wired-lan, vladbu, kuba,
pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb, jhs,
xiyou.wangcong, netdev, davem
On Mon, Aug 29, 2022 at 11:44:10AM +0200, Wojciech Drewek wrote:
> Add support for matching on L2TPv3 session ID.
> Session ID can be specified only when ip proto was
> set to IPPROTO_L2TP.
Acked-by: Guillaume Nault <gnault@redhat.com>
(I'll stop reviewing here since I have no expertise in ice driver
offload).
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 22+ messages in thread
* RE: [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
2022-08-31 10:07 ` [Intel-wired-lan] " Guillaume Nault
@ 2022-08-31 10:24 ` Drewek, Wojciech
-1 siblings, 0 replies; 22+ messages in thread
From: Drewek, Wojciech @ 2022-08-31 10:24 UTC (permalink / raw)
To: Guillaume Nault
Cc: netdev, Lobakin, Alexandr, Brandeburg, Jesse, Nguyen, Anthony L,
davem, edumazet, kuba, pabeni, jhs, xiyou.wangcong, jiri,
marcin.szycik, michal.swiatkowski, kurt, boris.sukholitko,
vladbu, komachi.yoshiki, paulb, baowen.zheng, louis.peens,
simon.horman, pablo, maksym.glubokiy, intel-wired-lan, jchapman
Hi Guillaume,
Thanks for the review!
> -----Original Message-----
> From: Guillaume Nault <gnault@redhat.com>
> Sent: środa, 31 sierpnia 2022 12:07
> To: Drewek, Wojciech <wojciech.drewek@intel.com>
> Cc: netdev@vger.kernel.org; Lobakin, Alexandr <alexandr.lobakin@intel.com>; Brandeburg, Jesse <jesse.brandeburg@intel.com>;
> Nguyen, Anthony L <anthony.l.nguyen@intel.com>; davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; jhs@mojatatu.com; xiyou.wangcong@gmail.com; jiri@resnulli.us; marcin.szycik@linux.intel.com;
> michal.swiatkowski@linux.intel.com; kurt@linutronix.de; boris.sukholitko@broadcom.com; vladbu@nvidia.com;
> komachi.yoshiki@gmail.com; paulb@nvidia.com; baowen.zheng@corigine.com; louis.peens@corigine.com;
> simon.horman@corigine.com; pablo@netfilter.org; maksym.glubokiy@plvision.eu; intel-wired-lan@lists.osuosl.org;
> jchapman@katalix.com
> Subject: Re: [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
>
> On Mon, Aug 29, 2022 at 11:44:09AM +0200, Wojciech Drewek wrote:
> > Allow to dissect L2TPv3 specific field which is:
> > - session ID (32 bits)
> >
> > L2TPv3 might be transported over IP or over UDP,
> > this ipmplementation is only about L2TPv3 over IP.
> > IP protocold carries L2TPv3 when ip_proto is
>
> s/protocold/protocol/
>
> > +static void __skb_flow_dissect_l2tpv3(const struct sk_buff *skb,
> > + struct flow_dissector *flow_dissector,
> > + void *target_container, const void *data,
> > + int nhoff, int hlen)
> > +{
> > + struct flow_dissector_key_l2tpv3 *key_l2tpv3;
> > + struct {
> > + __be32 session_id;
> > + } *hdr, _hdr;
> > +
> > + hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen, &_hdr);
> > + if (!hdr)
> > + return;
> > +
> > + if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_L2TPV3))
> > + return;
>
> I'd find it more logical to test !dissector_uses_key() first, then call
> __skb_header_pointer(). But that probably just a personnal preference.
Makes sense to me, I'll change that in the next version.
>
> In any case the code looks good to me.
>
> Acked-by: Guillaume Nault <gnault@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Intel-wired-lan] [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
@ 2022-08-31 10:24 ` Drewek, Wojciech
0 siblings, 0 replies; 22+ messages in thread
From: Drewek, Wojciech @ 2022-08-31 10:24 UTC (permalink / raw)
To: Guillaume Nault
Cc: simon.horman, kurt, komachi.yoshiki, jchapman, edumazet,
boris.sukholitko, louis.peens, intel-wired-lan, vladbu, kuba,
pabeni, pablo, baowen.zheng, maksym.glubokiy, jiri, paulb, jhs,
xiyou.wangcong, netdev, davem
Hi Guillaume,
Thanks for the review!
> -----Original Message-----
> From: Guillaume Nault <gnault@redhat.com>
> Sent: środa, 31 sierpnia 2022 12:07
> To: Drewek, Wojciech <wojciech.drewek@intel.com>
> Cc: netdev@vger.kernel.org; Lobakin, Alexandr <alexandr.lobakin@intel.com>; Brandeburg, Jesse <jesse.brandeburg@intel.com>;
> Nguyen, Anthony L <anthony.l.nguyen@intel.com>; davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; jhs@mojatatu.com; xiyou.wangcong@gmail.com; jiri@resnulli.us; marcin.szycik@linux.intel.com;
> michal.swiatkowski@linux.intel.com; kurt@linutronix.de; boris.sukholitko@broadcom.com; vladbu@nvidia.com;
> komachi.yoshiki@gmail.com; paulb@nvidia.com; baowen.zheng@corigine.com; louis.peens@corigine.com;
> simon.horman@corigine.com; pablo@netfilter.org; maksym.glubokiy@plvision.eu; intel-wired-lan@lists.osuosl.org;
> jchapman@katalix.com
> Subject: Re: [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors
>
> On Mon, Aug 29, 2022 at 11:44:09AM +0200, Wojciech Drewek wrote:
> > Allow to dissect L2TPv3 specific field which is:
> > - session ID (32 bits)
> >
> > L2TPv3 might be transported over IP or over UDP,
> > this ipmplementation is only about L2TPv3 over IP.
> > IP protocold carries L2TPv3 when ip_proto is
>
> s/protocold/protocol/
>
> > +static void __skb_flow_dissect_l2tpv3(const struct sk_buff *skb,
> > + struct flow_dissector *flow_dissector,
> > + void *target_container, const void *data,
> > + int nhoff, int hlen)
> > +{
> > + struct flow_dissector_key_l2tpv3 *key_l2tpv3;
> > + struct {
> > + __be32 session_id;
> > + } *hdr, _hdr;
> > +
> > + hdr = __skb_header_pointer(skb, nhoff, sizeof(_hdr), data, hlen, &_hdr);
> > + if (!hdr)
> > + return;
> > +
> > + if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_L2TPV3))
> > + return;
>
> I'd find it more logical to test !dissector_uses_key() first, then call
> __skb_header_pointer(). But that probably just a personnal preference.
Makes sense to me, I'll change that in the next version.
>
> In any case the code looks good to me.
>
> Acked-by: Guillaume Nault <gnault@redhat.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2022-08-31 12:13 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 9:44 [RFC PATCH net-next v2 0/5] ice: L2TPv3 offload support Wojciech Drewek
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
2022-08-29 9:44 ` [RFC PATCH net-next v2 1/5] uapi: move IPPROTO_L2TP to in.h Wojciech Drewek
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
2022-08-31 10:02 ` Guillaume Nault
2022-08-31 10:02 ` [Intel-wired-lan] " Guillaume Nault
2022-08-29 9:44 ` [RFC PATCH net-next v2 2/5] flow_dissector: Add L2TPv3 dissectors Wojciech Drewek
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
2022-08-31 10:07 ` Guillaume Nault
2022-08-31 10:07 ` [Intel-wired-lan] " Guillaume Nault
2022-08-31 10:24 ` Drewek, Wojciech
2022-08-31 10:24 ` [Intel-wired-lan] " Drewek, Wojciech
2022-08-29 9:44 ` [RFC PATCH net-next v2 3/5] net/sched: flower: Add L2TPv3 filter Wojciech Drewek
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
2022-08-31 10:23 ` Guillaume Nault
2022-08-31 10:23 ` [Intel-wired-lan] " Guillaume Nault
2022-08-29 9:44 ` [RFC PATCH net-next v2 4/5] flow_offload: Introduce flow_match_l2tpv3 Wojciech Drewek
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
2022-08-29 9:44 ` [RFC PATCH net-next v2 5/5] ice: Add L2TPv3 hardware offload support Wojciech Drewek
2022-08-29 9:44 ` [Intel-wired-lan] " Wojciech Drewek
2022-08-31 9:16 ` Michal Swiatkowski
2022-08-31 9:16 ` [Intel-wired-lan] " Michal Swiatkowski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.