Skip to content

Commit 6508505

Browse files
authored
Add drop monitor Kernel Patches for buffer support (#338)
* Add drop monitor Kernel Patches for buffer support ## Patch List * 0001-psample-Encapsulate-packet-metadata-in-a-struct.patch : torvalds/linux@a03e99d * 0002-psample-Add-additional-metadata-attributes.patch : torvalds/linux@07e1a58 * 0003-psample-define-the-macro-PSAMPLE_MD_EXTENDED_ATTR.patch : * 0004-drop_monitor-Extend-WJH-buffer-linux-channel.patch : * Add description to patches 0003 & 0004 * Remove redundant line Signed-off-by: Vivek Reddy <vkarri@nvidia.com> --------- Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
1 parent fee7d7e commit 6508505

5 files changed

+269
-45
lines changed

patch/0001-psample-Encapsulate-packet-metadata-in-a-struct.patch

+8-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
From ab65c38369aec72cbaac3e1c9d6731804edfc5b4 Mon Sep 17 00:00:00 2001
1+
From a03e99d39f1943ec88f6fd3b0b9f34c20663d401 Mon Sep 17 00:00:00 2001
22
From: Ido Schimmel <idosch@nvidia.com>
33
Date: Sun, 14 Mar 2021 14:19:30 +0200
4-
5-
[backport of upstream commit a03e99d39f1943ec88f6fd3b0b9f34c20663d401]
6-
7-
Subject: [PATCH 1/3] psample: Encapsulate packet metadata in a struct
4+
Subject: [PATCH] psample: Encapsulate packet metadata in a struct
85

96
Currently, callers of psample_sample_packet() pass three metadata
107
attributes: Ingress port, egress port and truncated size. Subsequent
@@ -25,10 +22,10 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
2522
4 files changed, 23 insertions(+), 21 deletions(-)
2623

2724
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
28-
index 1a9978f50..323857943 100644
25+
index 93b15b8c007e6d..3b15f8d728a37e 100644
2926
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
3027
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
31-
@@ -2167,7 +2167,7 @@ void mlxsw_sp_sample_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
28+
@@ -2217,7 +2217,7 @@ void mlxsw_sp_sample_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
3229
{
3330
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp->ports[local_port];
3431
struct mlxsw_sp_port_sample *sample;
@@ -37,7 +34,7 @@ index 1a9978f50..323857943 100644
3734

3835
if (unlikely(!mlxsw_sp_port)) {
3936
dev_warn_ratelimited(mlxsw_sp->bus_info->dev, "Port %d: sample skb received for non-existent port\n",
40-
@@ -2179,9 +2179,9 @@ void mlxsw_sp_sample_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
37+
@@ -2229,9 +2229,9 @@ void mlxsw_sp_sample_receive(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
4138
sample = rcu_dereference(mlxsw_sp_port->sample);
4239
if (!sample)
4340
goto out_unlock;
@@ -51,7 +48,7 @@ index 1a9978f50..323857943 100644
5148
rcu_read_unlock();
5249
out:
5350
diff --git a/include/net/psample.h b/include/net/psample.h
54-
index 68ae16bb0..ac6dbfb38 100644
51+
index 68ae16bb0a4a85..ac6dbfb3870d94 100644
5552
--- a/include/net/psample.h
5653
+++ b/include/net/psample.h
5754
@@ -14,6 +14,12 @@ struct psample_group {
@@ -87,7 +84,7 @@ index 68ae16bb0..ac6dbfb38 100644
8784
}
8885

8986
diff --git a/net/psample/psample.c b/net/psample/psample.c
90-
index 482c07f27..065bc887d 100644
87+
index 482c07f2766b18..065bc887d23936 100644
9188
--- a/net/psample/psample.c
9289
+++ b/net/psample/psample.c
9390
@@ -356,9 +356,11 @@ static int psample_tunnel_meta_len(struct ip_tunnel_info *tun_info)
@@ -105,7 +102,7 @@ index 482c07f27..065bc887d 100644
105102
struct ip_tunnel_info *tun_info;
106103
#endif
107104
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
108-
index 3ebf9ede3..2fece01f2 100644
105+
index db8ee9e5c8c229..6a0c16e4351d71 100644
109106
--- a/net/sched/act_sample.c
110107
+++ b/net/sched/act_sample.c
111108
@@ -158,10 +158,8 @@ static int tcf_sample_act(struct sk_buff *skb, const struct tc_action *a,
@@ -146,6 +143,3 @@ index 3ebf9ede3..2fece01f2 100644
146143

147144
if (skb_at_tc_ingress(skb) && tcf_sample_dev_ok_push(skb->dev))
148145
skb_pull(skb, skb->mac_len);
149-
--
150-
2.17.1
151-

patch/0002-psample-Add-additional-metadata-attributes.patch

+13-20
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
From d025a830ef465ea7b560742028b46dfc5c334cf1 Mon Sep 17 00:00:00 2001
1+
From 07e1a5809b595df6e125504dff6245cb2c8ed3de Mon Sep 17 00:00:00 2001
22
From: Ido Schimmel <idosch@nvidia.com>
33
Date: Sun, 14 Mar 2021 14:19:31 +0200
4-
5-
[backport of upstream commit 07e1a5809b595df6e125504dff6245cb2c8ed3de]
6-
7-
Subject: [PATCH 2/3] psample: Add additional metadata attributes
4+
Subject: [PATCH] psample: Add additional metadata attributes
85

96
Extend psample to report the following attributes when available:
107

@@ -25,7 +22,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
2522
3 files changed, 52 insertions(+), 1 deletion(-)
2623

2724
diff --git a/include/net/psample.h b/include/net/psample.h
28-
index ac6dbfb38..e328c5127 100644
25+
index ac6dbfb3870d94..e328c512775717 100644
2926
--- a/include/net/psample.h
3027
+++ b/include/net/psample.h
3128
@@ -18,6 +18,13 @@ struct psample_metadata {
@@ -43,25 +40,24 @@ index ac6dbfb38..e328c5127 100644
4340

4441
struct psample_group *psample_group_get(struct net *net, u32 group_num);
4542
diff --git a/include/uapi/linux/psample.h b/include/uapi/linux/psample.h
46-
index bff5032c9..0521691b6 100644
43+
index aea26ab1431c14..c6329f71b939fb 100644
4744
--- a/include/uapi/linux/psample.h
4845
+++ b/include/uapi/linux/psample.h
49-
@@ -13,6 +13,13 @@ enum {
46+
@@ -12,6 +12,12 @@ enum {
47+
PSAMPLE_ATTR_DATA,
5048
PSAMPLE_ATTR_GROUP_REFCOUNT,
5149
PSAMPLE_ATTR_TUNNEL,
50+
+ PSAMPLE_ATTR_PAD,
51+
+ PSAMPLE_ATTR_OUT_TC, /* u16 */
52+
+ PSAMPLE_ATTR_OUT_TC_OCC, /* u64, bytes */
53+
+ PSAMPLE_ATTR_LATENCY, /* u64, nanoseconds */
54+
+ PSAMPLE_ATTR_TIMESTAMP, /* u64, nanoseconds */
55+
+ PSAMPLE_ATTR_PROTO, /* u16 */
5256

53-
+ PSAMPLE_ATTR_PAD,
54-
+ PSAMPLE_ATTR_OUT_TC, /* u16 */
55-
+ PSAMPLE_ATTR_OUT_TC_OCC, /* u64, bytes */
56-
+ PSAMPLE_ATTR_LATENCY, /* u64, nanoseconds */
57-
+ PSAMPLE_ATTR_TIMESTAMP, /* u64, nanoseconds */
58-
+ PSAMPLE_ATTR_PROTO, /* u16 */
59-
+
6057
__PSAMPLE_ATTR_MAX
6158
};
62-
6359
diff --git a/net/psample/psample.c b/net/psample/psample.c
64-
index 065bc887d..118d5d2a8 100644
60+
index 065bc887d23936..118d5d2a81a023 100644
6561
--- a/net/psample/psample.c
6662
+++ b/net/psample/psample.c
6763
@@ -8,6 +8,7 @@
@@ -134,6 +130,3 @@ index 065bc887d..118d5d2a8 100644
134130
if (data_len) {
135131
int nla_len = nla_total_size(data_len);
136132
struct nlattr *nla;
137-
--
138-
2.17.1
139-
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 7dbf2689eb841c51dca4dad51b0941c06aa09e26 Mon Sep 17 00:00:00 2001
22
From: Vadym Hlushko <vadymh@nvidia.com>
33
Date: Mon, 11 Apr 2022 15:41:46 +0000
4-
Subject: [PATCH 3/3] psample: Add Nvidia-specific wrapper function for the psample driver
4+
Subject: psample: Add Nvidia-specific wrapper function for the psample driver
55

66
Add a variable to notify the psample driver to use a wrapper function,
77
which does preprocess before sending the sample packet to the userspace application.
@@ -12,17 +12,15 @@ Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
1212
1 file changed, 2 insertions(+)
1313

1414
diff --git a/include/net/psample.h b/include/net/psample.h
15-
index e328c5127..b7c79f634 100644
15+
index e328c51..1c4d70c 100644
1616
--- a/include/net/psample.h
1717
+++ b/include/net/psample.h
1818
@@ -14,6 +14,8 @@ struct psample_group {
1919
struct rcu_head rcu;
2020
};
21-
22-
+#define PSAMPLE_MD_EXTENDED_ATTR 1
21+
22+
+#define PSAMPLE_MD_EXTENDED_ATTR 1
2323
+
2424
struct psample_metadata {
2525
u32 trunc_size;
2626
int in_ifindex;
27-
--
28-
2.17.1

0 commit comments

Comments
 (0)