diff mbox series

[ovs-dev,v14,1/7] compat: Add psample and tc sample action defines for older kernels

Message ID 20210715060140.3866-2-cmi@nvidia.com
State Changes Requested
Headers show
Series Add offload support for sFlow | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot success github build: passed

Commit Message

Chris Mi July 15, 2021, 6:01 a.m. UTC
Update kernel UAPI to support psample and the tc sample action.

Signed-off-by: Chris Mi <cmi@nvidia.com>
Reviewed-by: Eli Britstein <elibr@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
---
 include/linux/automake.mk        |  4 ++-
 include/linux/psample.h          | 62 ++++++++++++++++++++++++++++++++
 include/linux/tc_act/tc_sample.h | 25 +++++++++++++
 3 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/psample.h
 create mode 100644 include/linux/tc_act/tc_sample.h

Comments

Eelco Chaudron Sept. 3, 2021, 9:15 a.m. UTC | #1
On 15 Jul 2021, at 8:01, Chris Mi wrote:

> Update kernel UAPI to support psample and the tc sample action.
>
> Signed-off-by: Chris Mi <cmi@nvidia.com>
> Reviewed-by: Eli Britstein <elibr@nvidia.com>
> Acked-by: Eelco Chaudron <echaudro@redhat.com>

Hi Chris,

I plan to review and test this patchset over the course of the next week or two. So feedback might come in chunks, but I’ll let you know once I’m done, so you can send a new revision after that, if necessary.

Also, I'll explicitly ACK this patch, as some changes were introduced since my original ACK.

Cheers,

Eelco

Acked-by: Eelco Chaudron <echaudro@redhat.com>

<SNIP>
Chris Mi Sept. 3, 2021, 10:01 a.m. UTC | #2
On 9/3/2021 5:15 PM, Eelco Chaudron wrote:
> On 15 Jul 2021, at 8:01, Chris Mi wrote:
>
>> Update kernel UAPI to support psample and the tc sample action.
>>
>> Signed-off-by: Chris Mi <cmi@nvidia.com>
>> Reviewed-by: Eli Britstein <elibr@nvidia.com>
>> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> Hi Chris,
>
> I plan to review and test this patchset over the course of the next week or two. So feedback might come in chunks, but I’ll let you know once I’m done, so you can send a new revision after that, if necessary.
>
> Also, I'll explicitly ACK this patch, as some changes were introduced since my original ACK.
>
> Cheers,
>
> Eelco
>
> Acked-by: Eelco Chaudron <echaudro@redhat.com>
>
> <SNIP>
>
Got it. Thanks, Eelco.

-Chris
diff mbox series

Patch

diff --git a/include/linux/automake.mk b/include/linux/automake.mk
index 8f063f482..c48d9699a 100644
--- a/include/linux/automake.mk
+++ b/include/linux/automake.mk
@@ -7,4 +7,6 @@  noinst_HEADERS += \
 	include/linux/tc_act/tc_skbedit.h \
 	include/linux/tc_act/tc_tunnel_key.h \
 	include/linux/tc_act/tc_vlan.h \
-	include/linux/tc_act/tc_ct.h
+	include/linux/tc_act/tc_ct.h \
+	include/linux/tc_act/tc_sample.h \
+	include/linux/psample.h
diff --git a/include/linux/psample.h b/include/linux/psample.h
new file mode 100644
index 000000000..e585db5bf
--- /dev/null
+++ b/include/linux/psample.h
@@ -0,0 +1,62 @@ 
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __UAPI_PSAMPLE_H
+#define __UAPI_PSAMPLE_H
+
+enum {
+	PSAMPLE_ATTR_IIFINDEX,
+	PSAMPLE_ATTR_OIFINDEX,
+	PSAMPLE_ATTR_ORIGSIZE,
+	PSAMPLE_ATTR_SAMPLE_GROUP,
+	PSAMPLE_ATTR_GROUP_SEQ,
+	PSAMPLE_ATTR_SAMPLE_RATE,
+	PSAMPLE_ATTR_DATA,
+	PSAMPLE_ATTR_GROUP_REFCOUNT,
+	PSAMPLE_ATTR_TUNNEL,
+
+	PSAMPLE_ATTR_PAD,
+	PSAMPLE_ATTR_OUT_TC,		/* u16 */
+	PSAMPLE_ATTR_OUT_TC_OCC,	/* u64, bytes */
+	PSAMPLE_ATTR_LATENCY,		/* u64, nanoseconds */
+	PSAMPLE_ATTR_TIMESTAMP,		/* u64, nanoseconds */
+	PSAMPLE_ATTR_PROTO,		/* u16 */
+
+	__PSAMPLE_ATTR_MAX
+};
+
+enum psample_command {
+	PSAMPLE_CMD_SAMPLE,
+	PSAMPLE_CMD_GET_GROUP,
+	PSAMPLE_CMD_NEW_GROUP,
+	PSAMPLE_CMD_DEL_GROUP,
+};
+
+enum psample_tunnel_key_attr {
+	PSAMPLE_TUNNEL_KEY_ATTR_ID,                 /* be64 Tunnel ID */
+	PSAMPLE_TUNNEL_KEY_ATTR_IPV4_SRC,           /* be32 src IP address. */
+	PSAMPLE_TUNNEL_KEY_ATTR_IPV4_DST,           /* be32 dst IP address. */
+	PSAMPLE_TUNNEL_KEY_ATTR_TOS,                /* u8 Tunnel IP ToS. */
+	PSAMPLE_TUNNEL_KEY_ATTR_TTL,                /* u8 Tunnel IP TTL. */
+	PSAMPLE_TUNNEL_KEY_ATTR_DONT_FRAGMENT,      /* No argument, set DF. */
+	PSAMPLE_TUNNEL_KEY_ATTR_CSUM,               /* No argument. CSUM packet. */
+	PSAMPLE_TUNNEL_KEY_ATTR_OAM,                /* No argument. OAM frame.  */
+	PSAMPLE_TUNNEL_KEY_ATTR_GENEVE_OPTS,        /* Array of Geneve options. */
+	PSAMPLE_TUNNEL_KEY_ATTR_TP_SRC,	            /* be16 src Transport Port. */
+	PSAMPLE_TUNNEL_KEY_ATTR_TP_DST,		    /* be16 dst Transport Port. */
+	PSAMPLE_TUNNEL_KEY_ATTR_VXLAN_OPTS,	    /* Nested VXLAN opts* */
+	PSAMPLE_TUNNEL_KEY_ATTR_IPV6_SRC,           /* struct in6_addr src IPv6 address. */
+	PSAMPLE_TUNNEL_KEY_ATTR_IPV6_DST,           /* struct in6_addr dst IPv6 address. */
+	PSAMPLE_TUNNEL_KEY_ATTR_PAD,
+	PSAMPLE_TUNNEL_KEY_ATTR_ERSPAN_OPTS,        /* struct erspan_metadata */
+	PSAMPLE_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE,   /* No argument. IPV4_INFO_BRIDGE mode.*/
+	__PSAMPLE_TUNNEL_KEY_ATTR_MAX
+};
+
+/* Can be overridden at runtime by module option */
+#define PSAMPLE_ATTR_MAX (__PSAMPLE_ATTR_MAX - 1)
+
+#define PSAMPLE_NL_MCGRP_CONFIG_NAME "config"
+#define PSAMPLE_NL_MCGRP_SAMPLE_NAME "packets"
+#define PSAMPLE_GENL_NAME "psample"
+#define PSAMPLE_GENL_VERSION 1
+
+#endif
diff --git a/include/linux/tc_act/tc_sample.h b/include/linux/tc_act/tc_sample.h
new file mode 100644
index 000000000..fee1bcc20
--- /dev/null
+++ b/include/linux/tc_act/tc_sample.h
@@ -0,0 +1,25 @@ 
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __LINUX_TC_SAMPLE_H
+#define __LINUX_TC_SAMPLE_H
+
+#include <linux/types.h>
+#include <linux/pkt_cls.h>
+#include <linux/if_ether.h>
+
+struct tc_sample {
+	tc_gen;
+};
+
+enum {
+	TCA_SAMPLE_UNSPEC,
+	TCA_SAMPLE_TM,
+	TCA_SAMPLE_PARMS,
+	TCA_SAMPLE_RATE,
+	TCA_SAMPLE_TRUNC_SIZE,
+	TCA_SAMPLE_PSAMPLE_GROUP,
+	TCA_SAMPLE_PAD,
+	__TCA_SAMPLE_MAX
+};
+#define TCA_SAMPLE_MAX (__TCA_SAMPLE_MAX - 1)
+
+#endif