* [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos
@ 2017-07-17 12:07 Jiri Pirko
2017-07-17 12:07 ` [patch net-next 1/6] mlxsw: acl: Add ip ttl acl element Jiri Pirko
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Jiri Pirko @ 2017-07-17 12:07 UTC (permalink / raw)
To: netdev; +Cc: davem, ogerlitz, idosch, mlxsw
From: Jiri Pirko <jiri@mellanox.com>
Or says:
Support offloading matches on ip ttl and tos
Or Gerlitz (6):
mlxsw: acl: Add ip ttl acl element
mlxsw: spectrum: Add ttl to the ipv4 acl block
mlxsw: spectrum_flower: Add support for ip ttl
mlxsw: acl: Add ip tos acl element
mlxsw: spectrum: Add tos to the ipv4 acl block
mlxsw: spectrum_flower: Add support for ip tos
.../ethernet/mellanox/mlxsw/core_acl_flex_keys.h | 6 +++
.../mellanox/mlxsw/spectrum_acl_flex_keys.h | 3 ++
.../ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | 3 ++
.../net/ethernet/mellanox/mlxsw/spectrum_flower.c | 44 +++++++++++++++++++++-
4 files changed, 54 insertions(+), 2 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [patch net-next 1/6] mlxsw: acl: Add ip ttl acl element
2017-07-17 12:07 [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos Jiri Pirko
@ 2017-07-17 12:07 ` Jiri Pirko
2017-07-17 12:07 ` [patch net-next 2/6] mlxsw: spectrum: Add ttl to the ipv4 acl block Jiri Pirko
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2017-07-17 12:07 UTC (permalink / raw)
To: netdev; +Cc: davem, ogerlitz, idosch, mlxsw
From: Or Gerlitz <ogerlitz@mellanox.com>
Define new element for ip ttl and place it into scratch area.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h
index 9807ef8..789ebb3 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h
@@ -57,6 +57,7 @@ enum mlxsw_afk_element {
MLXSW_AFK_ELEMENT_VID,
MLXSW_AFK_ELEMENT_PCP,
MLXSW_AFK_ELEMENT_TCP_FLAGS,
+ MLXSW_AFK_ELEMENT_IP_TTL_,
MLXSW_AFK_ELEMENT_MAX,
};
@@ -104,6 +105,7 @@ static const struct mlxsw_afk_element_info mlxsw_afk_element_infos[] = {
MLXSW_AFK_ELEMENT_INFO_U32(VID, 0x10, 8, 12),
MLXSW_AFK_ELEMENT_INFO_U32(PCP, 0x10, 20, 3),
MLXSW_AFK_ELEMENT_INFO_U32(TCP_FLAGS, 0x10, 23, 9),
+ MLXSW_AFK_ELEMENT_INFO_U32(IP_TTL_, 0x14, 0, 8),
MLXSW_AFK_ELEMENT_INFO_U32(SRC_IP4, 0x18, 0, 32),
MLXSW_AFK_ELEMENT_INFO_U32(DST_IP4, 0x1C, 0, 32),
MLXSW_AFK_ELEMENT_INFO_BUF(SRC_IP6_HI, 0x18, 8),
--
2.9.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [patch net-next 2/6] mlxsw: spectrum: Add ttl to the ipv4 acl block
2017-07-17 12:07 [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos Jiri Pirko
2017-07-17 12:07 ` [patch net-next 1/6] mlxsw: acl: Add ip ttl acl element Jiri Pirko
@ 2017-07-17 12:07 ` Jiri Pirko
2017-07-17 12:07 ` [patch net-next 3/6] mlxsw: spectrum_flower: Add support for ip ttl Jiri Pirko
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2017-07-17 12:07 UTC (permalink / raw)
To: netdev; +Cc: davem, ogerlitz, idosch, mlxsw
From: Or Gerlitz <ogerlitz@mellanox.com>
Add ttl field to the ipv4 acl block.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h | 1 +
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h
index 85d5001..8a4767c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h
@@ -70,6 +70,7 @@ static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_dip[] = {
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4[] = {
MLXSW_AFK_ELEMENT_INST_U32(SRC_IP4, 0x00, 0, 32),
+ MLXSW_AFK_ELEMENT_INST_U32(IP_TTL_, 0x04, 24, 8),
MLXSW_AFK_ELEMENT_INST_U32(TCP_FLAGS, 0x08, 8, 9), /* TCP_CONTROL+TCP_ECN */
};
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
index 61a10f1..2c57be7 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
@@ -984,6 +984,7 @@ static const enum mlxsw_afk_element mlxsw_sp_acl_tcam_pattern_ipv4[] = {
MLXSW_AFK_ELEMENT_VID,
MLXSW_AFK_ELEMENT_PCP,
MLXSW_AFK_ELEMENT_TCP_FLAGS,
+ MLXSW_AFK_ELEMENT_IP_TTL_,
};
static const enum mlxsw_afk_element mlxsw_sp_acl_tcam_pattern_ipv6[] = {
--
2.9.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [patch net-next 3/6] mlxsw: spectrum_flower: Add support for ip ttl
2017-07-17 12:07 [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos Jiri Pirko
2017-07-17 12:07 ` [patch net-next 1/6] mlxsw: acl: Add ip ttl acl element Jiri Pirko
2017-07-17 12:07 ` [patch net-next 2/6] mlxsw: spectrum: Add ttl to the ipv4 acl block Jiri Pirko
@ 2017-07-17 12:07 ` Jiri Pirko
2017-07-17 12:07 ` [patch net-next 4/6] mlxsw: acl: Add ip tos acl element Jiri Pirko
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2017-07-17 12:07 UTC (permalink / raw)
To: netdev; +Cc: davem, ogerlitz, idosch, mlxsw
From: Or Gerlitz <ogerlitz@mellanox.com>
Support offloading rules that match on ip ttl.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
.../net/ethernet/mellanox/mlxsw/spectrum_flower.c | 37 ++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
index 21bb2bf..84fe33c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
@@ -212,11 +212,39 @@ static int mlxsw_sp_flower_parse_tcp(struct mlxsw_sp *mlxsw_sp,
return 0;
}
+static int mlxsw_sp_flower_parse_ip(struct mlxsw_sp *mlxsw_sp,
+ struct mlxsw_sp_acl_rule_info *rulei,
+ struct tc_cls_flower_offload *f,
+ u16 n_proto)
+{
+ struct flow_dissector_key_ip *key, *mask;
+
+ if (!dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_IP))
+ return 0;
+
+ if (n_proto != ETH_P_IP && n_proto != ETH_P_IPV6) {
+ dev_err(mlxsw_sp->bus_info->dev, "IP keys supported only for IPv4/6\n");
+ return -EINVAL;
+ }
+
+ key = skb_flow_dissector_target(f->dissector,
+ FLOW_DISSECTOR_KEY_IP,
+ f->key);
+ mask = skb_flow_dissector_target(f->dissector,
+ FLOW_DISSECTOR_KEY_IP,
+ f->mask);
+ mlxsw_sp_acl_rulei_keymask_u32(rulei, MLXSW_AFK_ELEMENT_IP_TTL_,
+ key->ttl, mask->ttl);
+ return 0;
+}
+
static int mlxsw_sp_flower_parse(struct mlxsw_sp *mlxsw_sp,
struct net_device *dev,
struct mlxsw_sp_acl_rule_info *rulei,
struct tc_cls_flower_offload *f)
{
+ u16 n_proto_mask = 0;
+ u16 n_proto_key = 0;
u16 addr_type = 0;
u8 ip_proto = 0;
int err;
@@ -229,6 +257,7 @@ static int mlxsw_sp_flower_parse(struct mlxsw_sp *mlxsw_sp,
BIT(FLOW_DISSECTOR_KEY_IPV6_ADDRS) |
BIT(FLOW_DISSECTOR_KEY_PORTS) |
BIT(FLOW_DISSECTOR_KEY_TCP) |
+ BIT(FLOW_DISSECTOR_KEY_IP) |
BIT(FLOW_DISSECTOR_KEY_VLAN))) {
dev_err(mlxsw_sp->bus_info->dev, "Unsupported key\n");
return -EOPNOTSUPP;
@@ -253,8 +282,8 @@ static int mlxsw_sp_flower_parse(struct mlxsw_sp *mlxsw_sp,
skb_flow_dissector_target(f->dissector,
FLOW_DISSECTOR_KEY_BASIC,
f->mask);
- u16 n_proto_key = ntohs(key->n_proto);
- u16 n_proto_mask = ntohs(mask->n_proto);
+ n_proto_key = ntohs(key->n_proto);
+ n_proto_mask = ntohs(mask->n_proto);
if (n_proto_key == ETH_P_ALL) {
n_proto_key = 0;
@@ -324,6 +353,10 @@ static int mlxsw_sp_flower_parse(struct mlxsw_sp *mlxsw_sp,
if (err)
return err;
+ err = mlxsw_sp_flower_parse_ip(mlxsw_sp, rulei, f, n_proto_key & n_proto_mask);
+ if (err)
+ return err;
+
return mlxsw_sp_flower_parse_actions(mlxsw_sp, dev, rulei, f->exts);
}
--
2.9.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [patch net-next 4/6] mlxsw: acl: Add ip tos acl element
2017-07-17 12:07 [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos Jiri Pirko
` (2 preceding siblings ...)
2017-07-17 12:07 ` [patch net-next 3/6] mlxsw: spectrum_flower: Add support for ip ttl Jiri Pirko
@ 2017-07-17 12:07 ` Jiri Pirko
2017-07-17 12:07 ` [patch net-next 5/6] mlxsw: spectrum: Add tos to the ipv4 acl block Jiri Pirko
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2017-07-17 12:07 UTC (permalink / raw)
To: netdev; +Cc: davem, ogerlitz, idosch, mlxsw
From: Or Gerlitz <ogerlitz@mellanox.com>
Define new element for ip tos (ecn, dscp) and place it into scratch area.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h
index 789ebb3..f6963b0 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h
@@ -58,6 +58,8 @@ enum mlxsw_afk_element {
MLXSW_AFK_ELEMENT_PCP,
MLXSW_AFK_ELEMENT_TCP_FLAGS,
MLXSW_AFK_ELEMENT_IP_TTL_,
+ MLXSW_AFK_ELEMENT_IP_ECN,
+ MLXSW_AFK_ELEMENT_IP_DSCP,
MLXSW_AFK_ELEMENT_MAX,
};
@@ -106,6 +108,8 @@ static const struct mlxsw_afk_element_info mlxsw_afk_element_infos[] = {
MLXSW_AFK_ELEMENT_INFO_U32(PCP, 0x10, 20, 3),
MLXSW_AFK_ELEMENT_INFO_U32(TCP_FLAGS, 0x10, 23, 9),
MLXSW_AFK_ELEMENT_INFO_U32(IP_TTL_, 0x14, 0, 8),
+ MLXSW_AFK_ELEMENT_INFO_U32(IP_ECN, 0x14, 9, 2),
+ MLXSW_AFK_ELEMENT_INFO_U32(IP_DSCP, 0x14, 11, 6),
MLXSW_AFK_ELEMENT_INFO_U32(SRC_IP4, 0x18, 0, 32),
MLXSW_AFK_ELEMENT_INFO_U32(DST_IP4, 0x1C, 0, 32),
MLXSW_AFK_ELEMENT_INFO_BUF(SRC_IP6_HI, 0x18, 8),
--
2.9.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [patch net-next 5/6] mlxsw: spectrum: Add tos to the ipv4 acl block
2017-07-17 12:07 [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos Jiri Pirko
` (3 preceding siblings ...)
2017-07-17 12:07 ` [patch net-next 4/6] mlxsw: acl: Add ip tos acl element Jiri Pirko
@ 2017-07-17 12:07 ` Jiri Pirko
2017-07-17 12:07 ` [patch net-next 6/6] mlxsw: spectrum_flower: Add support for ip tos Jiri Pirko
2017-07-17 16:18 ` [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos David Miller
6 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2017-07-17 12:07 UTC (permalink / raw)
To: netdev; +Cc: davem, ogerlitz, idosch, mlxsw
From: Or Gerlitz <ogerlitz@mellanox.com>
Add ecn and dscp fields to the ipv4 acl block.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h | 2 ++
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h
index 8a4767c..fb80318 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h
@@ -70,7 +70,9 @@ static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_dip[] = {
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4[] = {
MLXSW_AFK_ELEMENT_INST_U32(SRC_IP4, 0x00, 0, 32),
+ MLXSW_AFK_ELEMENT_INST_U32(IP_ECN, 0x04, 4, 2),
MLXSW_AFK_ELEMENT_INST_U32(IP_TTL_, 0x04, 24, 8),
+ MLXSW_AFK_ELEMENT_INST_U32(IP_DSCP, 0x08, 0, 6),
MLXSW_AFK_ELEMENT_INST_U32(TCP_FLAGS, 0x08, 8, 9), /* TCP_CONTROL+TCP_ECN */
};
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
index 2c57be7..bc5173f 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
@@ -985,6 +985,8 @@ static const enum mlxsw_afk_element mlxsw_sp_acl_tcam_pattern_ipv4[] = {
MLXSW_AFK_ELEMENT_PCP,
MLXSW_AFK_ELEMENT_TCP_FLAGS,
MLXSW_AFK_ELEMENT_IP_TTL_,
+ MLXSW_AFK_ELEMENT_IP_ECN,
+ MLXSW_AFK_ELEMENT_IP_DSCP,
};
static const enum mlxsw_afk_element mlxsw_sp_acl_tcam_pattern_ipv6[] = {
--
2.9.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [patch net-next 6/6] mlxsw: spectrum_flower: Add support for ip tos
2017-07-17 12:07 [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos Jiri Pirko
` (4 preceding siblings ...)
2017-07-17 12:07 ` [patch net-next 5/6] mlxsw: spectrum: Add tos to the ipv4 acl block Jiri Pirko
@ 2017-07-17 12:07 ` Jiri Pirko
2017-07-17 16:18 ` [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos David Miller
6 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2017-07-17 12:07 UTC (permalink / raw)
To: netdev; +Cc: davem, ogerlitz, idosch, mlxsw
From: Or Gerlitz <ogerlitz@mellanox.com>
Support offloading rules that match on ip tos.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
index 84fe33c..400ad40 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
@@ -235,6 +235,13 @@ static int mlxsw_sp_flower_parse_ip(struct mlxsw_sp *mlxsw_sp,
f->mask);
mlxsw_sp_acl_rulei_keymask_u32(rulei, MLXSW_AFK_ELEMENT_IP_TTL_,
key->ttl, mask->ttl);
+
+ mlxsw_sp_acl_rulei_keymask_u32(rulei, MLXSW_AFK_ELEMENT_IP_ECN,
+ key->tos & 0x3, mask->tos & 0x3);
+
+ mlxsw_sp_acl_rulei_keymask_u32(rulei, MLXSW_AFK_ELEMENT_IP_DSCP,
+ key->tos >> 6, mask->tos >> 6);
+
return 0;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos
2017-07-17 12:07 [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos Jiri Pirko
` (5 preceding siblings ...)
2017-07-17 12:07 ` [patch net-next 6/6] mlxsw: spectrum_flower: Add support for ip tos Jiri Pirko
@ 2017-07-17 16:18 ` David Miller
6 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-07-17 16:18 UTC (permalink / raw)
To: jiri; +Cc: netdev, ogerlitz, idosch, mlxsw
From: Jiri Pirko <jiri@resnulli.us>
Date: Mon, 17 Jul 2017 14:07:25 +0200
> From: Jiri Pirko <jiri@mellanox.com>
>
> Or says:
>
> Support offloading matches on ip ttl and tos
Series applied, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-07-17 16:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-17 12:07 [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos Jiri Pirko
2017-07-17 12:07 ` [patch net-next 1/6] mlxsw: acl: Add ip ttl acl element Jiri Pirko
2017-07-17 12:07 ` [patch net-next 2/6] mlxsw: spectrum: Add ttl to the ipv4 acl block Jiri Pirko
2017-07-17 12:07 ` [patch net-next 3/6] mlxsw: spectrum_flower: Add support for ip ttl Jiri Pirko
2017-07-17 12:07 ` [patch net-next 4/6] mlxsw: acl: Add ip tos acl element Jiri Pirko
2017-07-17 12:07 ` [patch net-next 5/6] mlxsw: spectrum: Add tos to the ipv4 acl block Jiri Pirko
2017-07-17 12:07 ` [patch net-next 6/6] mlxsw: spectrum_flower: Add support for ip tos Jiri Pirko
2017-07-17 16:18 ` [patch net-next 0/6] mlxsw: offloading matches on ip ttl and tos David Miller
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).