* [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
@ 2019-05-10 14:10 Morten Brørup
2019-05-10 14:10 ` Morten Brørup
0 siblings, 1 reply; 18+ messages in thread
From: Morten Brørup @ 2019-05-10 14:10 UTC (permalink / raw)
To: olivier.matz, thomas, ferruh.yigit, arybchenko; +Cc: dev, Morten Brørup
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
app/test-pmd/cmdline.c | 4 ++--
drivers/net/e1000/igb_ethdev.c | 8 ++++----
lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
lib/librte_net/rte_tcp.h | 13 +++++++++++++
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee50e45..59a45c1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
@@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b897e8a..c2fe19a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_port_mask) {
@@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
ttqf &= ~E1000_TTQF_MASK_ENABLE;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
@@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_ip_mask) {
@@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 5ea8ae2..f21e84b 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
RTE_NTUPLE_FLAGS_DST_PORT | \
RTE_NTUPLE_FLAGS_PROTO)
-#define TCP_URG_FLAG 0x20
-#define TCP_ACK_FLAG 0x10
-#define TCP_PSH_FLAG 0x08
-#define TCP_RST_FLAG 0x04
-#define TCP_SYN_FLAG 0x02
-#define TCP_FIN_FLAG 0x01
-#define TCP_FLAG_ALL 0x3F
+#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
/**
* A structure used to define the ntuple filter entry
diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
index 91f5898..2e89b5e 100644
--- a/lib/librte_net/rte_tcp.h
+++ b/lib/librte_net/rte_tcp.h
@@ -2,6 +2,7 @@
* Copyright(c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
* Copyright(c) 2010-2014 Intel Corporation.
+ * Copyright(c) 2019 SmartShare Systems.
* All rights reserved.
*/
@@ -35,6 +36,18 @@ struct tcp_hdr {
uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((__packed__));
+/**
+ * TCP Flags
+ */
+#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
+#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
+#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
+#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
+#define TCP_PSH_FLAG 0x08 /**< Push Function */
+#define TCP_RST_FLAG 0x04 /**< Reset the connection */
+#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
+#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
+
#ifdef __cplusplus
}
#endif
--
1.5.6
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-10 14:10 [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h Morten Brørup
@ 2019-05-10 14:10 ` Morten Brørup
0 siblings, 0 replies; 18+ messages in thread
From: Morten Brørup @ 2019-05-10 14:10 UTC (permalink / raw)
To: olivier.matz, thomas, ferruh.yigit, arybchenko; +Cc: dev, Morten Brørup
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
app/test-pmd/cmdline.c | 4 ++--
drivers/net/e1000/igb_ethdev.c | 8 ++++----
lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
lib/librte_net/rte_tcp.h | 13 +++++++++++++
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee50e45..59a45c1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
@@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b897e8a..c2fe19a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_port_mask) {
@@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
ttqf &= ~E1000_TTQF_MASK_ENABLE;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
@@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_ip_mask) {
@@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 5ea8ae2..f21e84b 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
RTE_NTUPLE_FLAGS_DST_PORT | \
RTE_NTUPLE_FLAGS_PROTO)
-#define TCP_URG_FLAG 0x20
-#define TCP_ACK_FLAG 0x10
-#define TCP_PSH_FLAG 0x08
-#define TCP_RST_FLAG 0x04
-#define TCP_SYN_FLAG 0x02
-#define TCP_FIN_FLAG 0x01
-#define TCP_FLAG_ALL 0x3F
+#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
/**
* A structure used to define the ntuple filter entry
diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
index 91f5898..2e89b5e 100644
--- a/lib/librte_net/rte_tcp.h
+++ b/lib/librte_net/rte_tcp.h
@@ -2,6 +2,7 @@
* Copyright(c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
* Copyright(c) 2010-2014 Intel Corporation.
+ * Copyright(c) 2019 SmartShare Systems.
* All rights reserved.
*/
@@ -35,6 +36,18 @@ struct tcp_hdr {
uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((__packed__));
+/**
+ * TCP Flags
+ */
+#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
+#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
+#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
+#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
+#define TCP_PSH_FLAG 0x08 /**< Push Function */
+#define TCP_RST_FLAG 0x04 /**< Reset the connection */
+#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
+#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
+
#ifdef __cplusplus
}
#endif
--
1.5.6
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-13 15:15 ` Morten Brørup
2019-05-13 15:15 ` Morten Brørup
@ 2019-05-13 17:00 ` Ferruh Yigit
2019-05-13 17:00 ` Ferruh Yigit
1 sibling, 1 reply; 18+ messages in thread
From: Ferruh Yigit @ 2019-05-13 17:00 UTC (permalink / raw)
To: Morten Brørup, Stephen Hemminger
Cc: Olivier Matz, thomas, arybchenko, dev
On 5/13/2019 4:15 PM, Morten Brørup wrote:
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
>> Sent: Monday, May 13, 2019 4:47 PM
>> To: Morten Brørup
>> Cc: Olivier Matz; thomas@monjalon.net; ferruh.yigit@intel.com;
>> arybchenko@solarflare.com; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h
>> instead of in rte_eth_ctrl.h
>>
>> On Mon, 13 May 2019 15:02:57 +0200
>> Morten Brørup <mb@smartsharesystems.com> wrote:
>>
>>>>
>>>> IMHO, adding the copyright for flags move is a bit overkill.
>>>
>>> I also added the two ECN flags and descriptions of all the flags. And
>> removed the misleading ALL flag.
>>>
>>> I don't know the formal or customary threshold criteria for adding a
>> copyright notice, so I just added it. It's our first direct contribution
>> where we didn't just send the corrections to another contributor, so I
>> thought it would be nice to have our name in here. You're the maintainer,
>> so I'll leave the final decision up to you.
>>
>> Most projects including DPDK do not add additional copyrights unless it
>> is a complete rewrite. Please don't clutter the code with this stuff.
>
> That's a quite clear threshold definition, and my modifications clearly don't fall into this category.
I think in the past threshold has been mentioned as "significant contribution",
although this is kind of vague, it sounds lighter than "complete rewrite",
anyway I agree for this patch it looks overkill to claim the copyright.
>
> Med venlig hilsen / kind regards
> - Morten Brørup
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-13 17:00 ` Ferruh Yigit
@ 2019-05-13 17:00 ` Ferruh Yigit
0 siblings, 0 replies; 18+ messages in thread
From: Ferruh Yigit @ 2019-05-13 17:00 UTC (permalink / raw)
To: Morten Brørup, Stephen Hemminger
Cc: Olivier Matz, thomas, arybchenko, dev
On 5/13/2019 4:15 PM, Morten Brørup wrote:
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
>> Sent: Monday, May 13, 2019 4:47 PM
>> To: Morten Brørup
>> Cc: Olivier Matz; thomas@monjalon.net; ferruh.yigit@intel.com;
>> arybchenko@solarflare.com; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h
>> instead of in rte_eth_ctrl.h
>>
>> On Mon, 13 May 2019 15:02:57 +0200
>> Morten Brørup <mb@smartsharesystems.com> wrote:
>>
>>>>
>>>> IMHO, adding the copyright for flags move is a bit overkill.
>>>
>>> I also added the two ECN flags and descriptions of all the flags. And
>> removed the misleading ALL flag.
>>>
>>> I don't know the formal or customary threshold criteria for adding a
>> copyright notice, so I just added it. It's our first direct contribution
>> where we didn't just send the corrections to another contributor, so I
>> thought it would be nice to have our name in here. You're the maintainer,
>> so I'll leave the final decision up to you.
>>
>> Most projects including DPDK do not add additional copyrights unless it
>> is a complete rewrite. Please don't clutter the code with this stuff.
>
> That's a quite clear threshold definition, and my modifications clearly don't fall into this category.
I think in the past threshold has been mentioned as "significant contribution",
although this is kind of vague, it sounds lighter than "complete rewrite",
anyway I agree for this patch it looks overkill to claim the copyright.
>
> Med venlig hilsen / kind regards
> - Morten Brørup
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-13 14:47 ` Stephen Hemminger
2019-05-13 14:47 ` Stephen Hemminger
@ 2019-05-13 15:15 ` Morten Brørup
2019-05-13 15:15 ` Morten Brørup
2019-05-13 17:00 ` Ferruh Yigit
1 sibling, 2 replies; 18+ messages in thread
From: Morten Brørup @ 2019-05-13 15:15 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Olivier Matz, thomas, ferruh.yigit, arybchenko, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Monday, May 13, 2019 4:47 PM
> To: Morten Brørup
> Cc: Olivier Matz; thomas@monjalon.net; ferruh.yigit@intel.com;
> arybchenko@solarflare.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h
> instead of in rte_eth_ctrl.h
>
> On Mon, 13 May 2019 15:02:57 +0200
> Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > >
> > > IMHO, adding the copyright for flags move is a bit overkill.
> >
> > I also added the two ECN flags and descriptions of all the flags. And
> removed the misleading ALL flag.
> >
> > I don't know the formal or customary threshold criteria for adding a
> copyright notice, so I just added it. It's our first direct contribution
> where we didn't just send the corrections to another contributor, so I
> thought it would be nice to have our name in here. You're the maintainer,
> so I'll leave the final decision up to you.
>
> Most projects including DPDK do not add additional copyrights unless it
> is a complete rewrite. Please don't clutter the code with this stuff.
That's a quite clear threshold definition, and my modifications clearly don't fall into this category.
Med venlig hilsen / kind regards
- Morten Brørup
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-13 15:15 ` Morten Brørup
@ 2019-05-13 15:15 ` Morten Brørup
2019-05-13 17:00 ` Ferruh Yigit
1 sibling, 0 replies; 18+ messages in thread
From: Morten Brørup @ 2019-05-13 15:15 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Olivier Matz, thomas, ferruh.yigit, arybchenko, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Monday, May 13, 2019 4:47 PM
> To: Morten Brørup
> Cc: Olivier Matz; thomas@monjalon.net; ferruh.yigit@intel.com;
> arybchenko@solarflare.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h
> instead of in rte_eth_ctrl.h
>
> On Mon, 13 May 2019 15:02:57 +0200
> Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > >
> > > IMHO, adding the copyright for flags move is a bit overkill.
> >
> > I also added the two ECN flags and descriptions of all the flags. And
> removed the misleading ALL flag.
> >
> > I don't know the formal or customary threshold criteria for adding a
> copyright notice, so I just added it. It's our first direct contribution
> where we didn't just send the corrections to another contributor, so I
> thought it would be nice to have our name in here. You're the maintainer,
> so I'll leave the final decision up to you.
>
> Most projects including DPDK do not add additional copyrights unless it
> is a complete rewrite. Please don't clutter the code with this stuff.
That's a quite clear threshold definition, and my modifications clearly don't fall into this category.
Med venlig hilsen / kind regards
- Morten Brørup
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-13 13:02 ` Morten Brørup
2019-05-13 13:02 ` Morten Brørup
@ 2019-05-13 14:47 ` Stephen Hemminger
2019-05-13 14:47 ` Stephen Hemminger
2019-05-13 15:15 ` Morten Brørup
1 sibling, 2 replies; 18+ messages in thread
From: Stephen Hemminger @ 2019-05-13 14:47 UTC (permalink / raw)
To: Morten Brørup; +Cc: Olivier Matz, thomas, ferruh.yigit, arybchenko, dev
On Mon, 13 May 2019 15:02:57 +0200
Morten Brørup <mb@smartsharesystems.com> wrote:
> >
> > IMHO, adding the copyright for flags move is a bit overkill.
>
> I also added the two ECN flags and descriptions of all the flags. And removed the misleading ALL flag.
>
> I don't know the formal or customary threshold criteria for adding a copyright notice, so I just added it. It's our first direct contribution where we didn't just send the corrections to another contributor, so I thought it would be nice to have our name in here. You're the maintainer, so I'll leave the final decision up to you.
Most projects including DPDK do not add additional copyrights unless it
is a complete rewrite. Please don't clutter the code with this stuff.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-13 14:47 ` Stephen Hemminger
@ 2019-05-13 14:47 ` Stephen Hemminger
2019-05-13 15:15 ` Morten Brørup
1 sibling, 0 replies; 18+ messages in thread
From: Stephen Hemminger @ 2019-05-13 14:47 UTC (permalink / raw)
To: Morten Brørup; +Cc: Olivier Matz, thomas, ferruh.yigit, arybchenko, dev
On Mon, 13 May 2019 15:02:57 +0200
Morten Brørup <mb@smartsharesystems.com> wrote:
> >
> > IMHO, adding the copyright for flags move is a bit overkill.
>
> I also added the two ECN flags and descriptions of all the flags. And removed the misleading ALL flag.
>
> I don't know the formal or customary threshold criteria for adding a copyright notice, so I just added it. It's our first direct contribution where we didn't just send the corrections to another contributor, so I thought it would be nice to have our name in here. You're the maintainer, so I'll leave the final decision up to you.
Most projects including DPDK do not add additional copyrights unless it
is a complete rewrite. Please don't clutter the code with this stuff.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-13 11:54 ` Olivier Matz
2019-05-13 11:54 ` Olivier Matz
@ 2019-05-13 13:02 ` Morten Brørup
2019-05-13 13:02 ` Morten Brørup
2019-05-13 14:47 ` Stephen Hemminger
1 sibling, 2 replies; 18+ messages in thread
From: Morten Brørup @ 2019-05-13 13:02 UTC (permalink / raw)
To: Olivier Matz; +Cc: thomas, ferruh.yigit, arybchenko, dev
Hi Olivier,
Thank you for responding to this, and sorry about the noise with my initial failed commit attempts.
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier Matz
> Sent: Monday, May 13, 2019 1:55 PM
> To: Morten Brørup
> Cc: thomas@monjalon.net; ferruh.yigit@intel.com;
> arybchenko@solarflare.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in
> rte_tcp.h instead of in rte_eth_ctrl.h
>
> Hi Morten,
>
> On Fri, May 10, 2019 at 07:34:14PM +0200, Morten Brørup wrote:
> > TCP flags were moved to the TCP header file from the Ethernet control
> > header file, keeping their names intact.
> >
> > Missing TCP ECN flags were added.
> >
> > The ALL mask did not include TCP ECN flags, so it was renamed to
> reflect
> > that it applies to N-tuple filtering only.
> > A driver using the ALL mask was updated accordingly.
> >
> > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> > ---
> > app/test-pmd/cmdline.c | 4 ++--
> > drivers/net/e1000/igb_ethdev.c | 8 ++++----
> > lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
> > lib/librte_net/rte_tcp.h | 13 +++++++++++++
> > 4 files changed, 20 insertions(+), 13 deletions(-)
> >
> b/lib/librte_ethdev/rte_eth_ctrl.h
> > index 5ea8ae2..f21e84b 100644
> > --- a/lib/librte_ethdev/rte_eth_ctrl.h
> > +++ b/lib/librte_ethdev/rte_eth_ctrl.h
> > @@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
> > RTE_NTUPLE_FLAGS_DST_PORT | \
> > RTE_NTUPLE_FLAGS_PROTO)
> >
> > -#define TCP_URG_FLAG 0x20
> > -#define TCP_ACK_FLAG 0x10
> > -#define TCP_PSH_FLAG 0x08
> > -#define TCP_RST_FLAG 0x04
> > -#define TCP_SYN_FLAG 0x02
> > -#define TCP_FIN_FLAG 0x01
> > -#define TCP_FLAG_ALL 0x3F
> > +#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can
> match. */
> >
> > /**
> > * A structure used to define the ntuple filter entry
> > diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
> > index 91f5898..2e89b5e 100644
> > --- a/lib/librte_net/rte_tcp.h
> > +++ b/lib/librte_net/rte_tcp.h
> > @@ -2,6 +2,7 @@
> > * Copyright(c) 1982, 1986, 1990, 1993
> > * The Regents of the University of California.
> > * Copyright(c) 2010-2014 Intel Corporation.
> > + * Copyright(c) 2019 SmartShare Systems.
> > * All rights reserved.
> > */
> >
>
> IMHO, adding the copyright for flags move is a bit overkill.
I also added the two ECN flags and descriptions of all the flags. And removed the misleading ALL flag.
I don't know the formal or customary threshold criteria for adding a copyright notice, so I just added it. It's our first direct contribution where we didn't just send the corrections to another contributor, so I thought it would be nice to have our name in here. You're the maintainer, so I'll leave the final decision up to you.
>
> > @@ -35,6 +36,18 @@ struct tcp_hdr {
> > uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
> > } __attribute__((__packed__));
> >
> > +/**
> > + * TCP Flags
> > + */
> > +#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
> > +#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
> > +#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
> > +#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
> > +#define TCP_PSH_FLAG 0x08 /**< Push Function */
> > +#define TCP_RST_FLAG 0x04 /**< Reset the connection */
> > +#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
> > +#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
> > +
> > #ifdef __cplusplus
> > }
> > #endif
>
> Moving these flags in rte_tcp.h makes sense.
>
> But I think they will need to be renamed with a RTE_ prefix inside this
> patchset: https://patches.dpdk.org/patch/52556/
> So we need to take care to the dependency between these 2 patchsets.
Agreed. I assume someone more git-experienced than myself can take care of this.
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Med venlig hilsen / kind regards
- Morten Brørup
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-13 13:02 ` Morten Brørup
@ 2019-05-13 13:02 ` Morten Brørup
2019-05-13 14:47 ` Stephen Hemminger
1 sibling, 0 replies; 18+ messages in thread
From: Morten Brørup @ 2019-05-13 13:02 UTC (permalink / raw)
To: Olivier Matz; +Cc: thomas, ferruh.yigit, arybchenko, dev
Hi Olivier,
Thank you for responding to this, and sorry about the noise with my initial failed commit attempts.
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier Matz
> Sent: Monday, May 13, 2019 1:55 PM
> To: Morten Brørup
> Cc: thomas@monjalon.net; ferruh.yigit@intel.com;
> arybchenko@solarflare.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in
> rte_tcp.h instead of in rte_eth_ctrl.h
>
> Hi Morten,
>
> On Fri, May 10, 2019 at 07:34:14PM +0200, Morten Brørup wrote:
> > TCP flags were moved to the TCP header file from the Ethernet control
> > header file, keeping their names intact.
> >
> > Missing TCP ECN flags were added.
> >
> > The ALL mask did not include TCP ECN flags, so it was renamed to
> reflect
> > that it applies to N-tuple filtering only.
> > A driver using the ALL mask was updated accordingly.
> >
> > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> > ---
> > app/test-pmd/cmdline.c | 4 ++--
> > drivers/net/e1000/igb_ethdev.c | 8 ++++----
> > lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
> > lib/librte_net/rte_tcp.h | 13 +++++++++++++
> > 4 files changed, 20 insertions(+), 13 deletions(-)
> >
> b/lib/librte_ethdev/rte_eth_ctrl.h
> > index 5ea8ae2..f21e84b 100644
> > --- a/lib/librte_ethdev/rte_eth_ctrl.h
> > +++ b/lib/librte_ethdev/rte_eth_ctrl.h
> > @@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
> > RTE_NTUPLE_FLAGS_DST_PORT | \
> > RTE_NTUPLE_FLAGS_PROTO)
> >
> > -#define TCP_URG_FLAG 0x20
> > -#define TCP_ACK_FLAG 0x10
> > -#define TCP_PSH_FLAG 0x08
> > -#define TCP_RST_FLAG 0x04
> > -#define TCP_SYN_FLAG 0x02
> > -#define TCP_FIN_FLAG 0x01
> > -#define TCP_FLAG_ALL 0x3F
> > +#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can
> match. */
> >
> > /**
> > * A structure used to define the ntuple filter entry
> > diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
> > index 91f5898..2e89b5e 100644
> > --- a/lib/librte_net/rte_tcp.h
> > +++ b/lib/librte_net/rte_tcp.h
> > @@ -2,6 +2,7 @@
> > * Copyright(c) 1982, 1986, 1990, 1993
> > * The Regents of the University of California.
> > * Copyright(c) 2010-2014 Intel Corporation.
> > + * Copyright(c) 2019 SmartShare Systems.
> > * All rights reserved.
> > */
> >
>
> IMHO, adding the copyright for flags move is a bit overkill.
I also added the two ECN flags and descriptions of all the flags. And removed the misleading ALL flag.
I don't know the formal or customary threshold criteria for adding a copyright notice, so I just added it. It's our first direct contribution where we didn't just send the corrections to another contributor, so I thought it would be nice to have our name in here. You're the maintainer, so I'll leave the final decision up to you.
>
> > @@ -35,6 +36,18 @@ struct tcp_hdr {
> > uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
> > } __attribute__((__packed__));
> >
> > +/**
> > + * TCP Flags
> > + */
> > +#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
> > +#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
> > +#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
> > +#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
> > +#define TCP_PSH_FLAG 0x08 /**< Push Function */
> > +#define TCP_RST_FLAG 0x04 /**< Reset the connection */
> > +#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
> > +#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
> > +
> > #ifdef __cplusplus
> > }
> > #endif
>
> Moving these flags in rte_tcp.h makes sense.
>
> But I think they will need to be renamed with a RTE_ prefix inside this
> patchset: https://patches.dpdk.org/patch/52556/
> So we need to take care to the dependency between these 2 patchsets.
Agreed. I assume someone more git-experienced than myself can take care of this.
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Med venlig hilsen / kind regards
- Morten Brørup
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-10 17:34 Morten Brørup
2019-05-10 17:34 ` Morten Brørup
@ 2019-05-13 11:54 ` Olivier Matz
2019-05-13 11:54 ` Olivier Matz
2019-05-13 13:02 ` Morten Brørup
1 sibling, 2 replies; 18+ messages in thread
From: Olivier Matz @ 2019-05-13 11:54 UTC (permalink / raw)
To: Morten Brørup; +Cc: thomas, ferruh.yigit, arybchenko, dev
Hi Morten,
On Fri, May 10, 2019 at 07:34:14PM +0200, Morten Brørup wrote:
> TCP flags were moved to the TCP header file from the Ethernet control
> header file, keeping their names intact.
>
> Missing TCP ECN flags were added.
>
> The ALL mask did not include TCP ECN flags, so it was renamed to reflect
> that it applies to N-tuple filtering only.
> A driver using the ALL mask was updated accordingly.
>
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> ---
> app/test-pmd/cmdline.c | 4 ++--
> drivers/net/e1000/igb_ethdev.c | 8 ++++----
> lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
> lib/librte_net/rte_tcp.h | 13 +++++++++++++
> 4 files changed, 20 insertions(+), 13 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index ee50e45..59a45c1 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
> " when protocol is TCP.\n");
> return;
> }
> - if (res->tcp_flags_value > TCP_FLAG_ALL) {
> + if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
> printf("invalid TCP flags.\n");
> return;
> }
> @@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
> " when protocol is TCP.\n");
> return;
> }
> - if (res->tcp_flags_value > TCP_FLAG_ALL) {
> + if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
> printf("invalid TCP flags.\n");
> return;
> }
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index b897e8a..c2fe19a 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
> return -EINVAL;
> if (filter->priority > E1000_2TUPLE_MAX_PRI)
> return -EINVAL; /* filter index is out of range. */
> - if (filter->tcp_flags > TCP_FLAG_ALL)
> + if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
> return -EINVAL; /* flags is invalid. */
>
> switch (filter->dst_port_mask) {
> @@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
> ttqf &= ~E1000_TTQF_MASK_ENABLE;
>
> /* tcp flags bits setting. */
> - if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
> + if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
> if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
> imir_ext |= E1000_IMIREXT_CTRL_URG;
> if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
> @@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
> return -EINVAL;
> if (filter->priority > E1000_2TUPLE_MAX_PRI)
> return -EINVAL; /* filter index is out of range. */
> - if (filter->tcp_flags > TCP_FLAG_ALL)
> + if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
> return -EINVAL; /* flags is invalid. */
>
> switch (filter->dst_ip_mask) {
> @@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
> imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
>
> /* tcp flags bits setting. */
> - if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
> + if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
> if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
> imir_ext |= E1000_IMIREXT_CTRL_URG;
> if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
> diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
> index 5ea8ae2..f21e84b 100644
> --- a/lib/librte_ethdev/rte_eth_ctrl.h
> +++ b/lib/librte_ethdev/rte_eth_ctrl.h
> @@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
> RTE_NTUPLE_FLAGS_DST_PORT | \
> RTE_NTUPLE_FLAGS_PROTO)
>
> -#define TCP_URG_FLAG 0x20
> -#define TCP_ACK_FLAG 0x10
> -#define TCP_PSH_FLAG 0x08
> -#define TCP_RST_FLAG 0x04
> -#define TCP_SYN_FLAG 0x02
> -#define TCP_FIN_FLAG 0x01
> -#define TCP_FLAG_ALL 0x3F
> +#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
>
> /**
> * A structure used to define the ntuple filter entry
> diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
> index 91f5898..2e89b5e 100644
> --- a/lib/librte_net/rte_tcp.h
> +++ b/lib/librte_net/rte_tcp.h
> @@ -2,6 +2,7 @@
> * Copyright(c) 1982, 1986, 1990, 1993
> * The Regents of the University of California.
> * Copyright(c) 2010-2014 Intel Corporation.
> + * Copyright(c) 2019 SmartShare Systems.
> * All rights reserved.
> */
>
IMHO, adding the copyright for flags move is a bit overkill.
> @@ -35,6 +36,18 @@ struct tcp_hdr {
> uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
> } __attribute__((__packed__));
>
> +/**
> + * TCP Flags
> + */
> +#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
> +#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
> +#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
> +#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
> +#define TCP_PSH_FLAG 0x08 /**< Push Function */
> +#define TCP_RST_FLAG 0x04 /**< Reset the connection */
> +#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
> +#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
> +
> #ifdef __cplusplus
> }
> #endif
Moving these flags in rte_tcp.h makes sense.
But I think they will need to be renamed with a RTE_ prefix inside this
patchset: https://patches.dpdk.org/patch/52556/
So we need to take care to the dependency between these 2 patchsets.
Acked-by: Olivier Matz <olivier.matz@6wind.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-13 11:54 ` Olivier Matz
@ 2019-05-13 11:54 ` Olivier Matz
2019-05-13 13:02 ` Morten Brørup
1 sibling, 0 replies; 18+ messages in thread
From: Olivier Matz @ 2019-05-13 11:54 UTC (permalink / raw)
To: Morten Brørup; +Cc: thomas, ferruh.yigit, arybchenko, dev
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5471 bytes --]
Hi Morten,
On Fri, May 10, 2019 at 07:34:14PM +0200, Morten Brørup wrote:
> TCP flags were moved to the TCP header file from the Ethernet control
> header file, keeping their names intact.
>
> Missing TCP ECN flags were added.
>
> The ALL mask did not include TCP ECN flags, so it was renamed to reflect
> that it applies to N-tuple filtering only.
> A driver using the ALL mask was updated accordingly.
>
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> ---
> app/test-pmd/cmdline.c | 4 ++--
> drivers/net/e1000/igb_ethdev.c | 8 ++++----
> lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
> lib/librte_net/rte_tcp.h | 13 +++++++++++++
> 4 files changed, 20 insertions(+), 13 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index ee50e45..59a45c1 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
> " when protocol is TCP.\n");
> return;
> }
> - if (res->tcp_flags_value > TCP_FLAG_ALL) {
> + if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
> printf("invalid TCP flags.\n");
> return;
> }
> @@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
> " when protocol is TCP.\n");
> return;
> }
> - if (res->tcp_flags_value > TCP_FLAG_ALL) {
> + if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
> printf("invalid TCP flags.\n");
> return;
> }
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index b897e8a..c2fe19a 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
> return -EINVAL;
> if (filter->priority > E1000_2TUPLE_MAX_PRI)
> return -EINVAL; /* filter index is out of range. */
> - if (filter->tcp_flags > TCP_FLAG_ALL)
> + if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
> return -EINVAL; /* flags is invalid. */
>
> switch (filter->dst_port_mask) {
> @@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
> ttqf &= ~E1000_TTQF_MASK_ENABLE;
>
> /* tcp flags bits setting. */
> - if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
> + if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
> if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
> imir_ext |= E1000_IMIREXT_CTRL_URG;
> if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
> @@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
> return -EINVAL;
> if (filter->priority > E1000_2TUPLE_MAX_PRI)
> return -EINVAL; /* filter index is out of range. */
> - if (filter->tcp_flags > TCP_FLAG_ALL)
> + if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
> return -EINVAL; /* flags is invalid. */
>
> switch (filter->dst_ip_mask) {
> @@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
> imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
>
> /* tcp flags bits setting. */
> - if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
> + if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
> if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
> imir_ext |= E1000_IMIREXT_CTRL_URG;
> if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
> diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
> index 5ea8ae2..f21e84b 100644
> --- a/lib/librte_ethdev/rte_eth_ctrl.h
> +++ b/lib/librte_ethdev/rte_eth_ctrl.h
> @@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
> RTE_NTUPLE_FLAGS_DST_PORT | \
> RTE_NTUPLE_FLAGS_PROTO)
>
> -#define TCP_URG_FLAG 0x20
> -#define TCP_ACK_FLAG 0x10
> -#define TCP_PSH_FLAG 0x08
> -#define TCP_RST_FLAG 0x04
> -#define TCP_SYN_FLAG 0x02
> -#define TCP_FIN_FLAG 0x01
> -#define TCP_FLAG_ALL 0x3F
> +#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
>
> /**
> * A structure used to define the ntuple filter entry
> diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
> index 91f5898..2e89b5e 100644
> --- a/lib/librte_net/rte_tcp.h
> +++ b/lib/librte_net/rte_tcp.h
> @@ -2,6 +2,7 @@
> * Copyright(c) 1982, 1986, 1990, 1993
> * The Regents of the University of California.
> * Copyright(c) 2010-2014 Intel Corporation.
> + * Copyright(c) 2019 SmartShare Systems.
> * All rights reserved.
> */
>
IMHO, adding the copyright for flags move is a bit overkill.
> @@ -35,6 +36,18 @@ struct tcp_hdr {
> uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
> } __attribute__((__packed__));
>
> +/**
> + * TCP Flags
> + */
> +#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
> +#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
> +#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
> +#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
> +#define TCP_PSH_FLAG 0x08 /**< Push Function */
> +#define TCP_RST_FLAG 0x04 /**< Reset the connection */
> +#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
> +#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
> +
> #ifdef __cplusplus
> }
> #endif
Moving these flags in rte_tcp.h makes sense.
But I think they will need to be renamed with a RTE_ prefix inside this
patchset: https://patches.dpdk.org/patch/52556/
So we need to take care to the dependency between these 2 patchsets.
Acked-by: Olivier Matz <olivier.matz@6wind.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
@ 2019-05-10 17:34 Morten Brørup
2019-05-10 17:34 ` Morten Brørup
2019-05-13 11:54 ` Olivier Matz
0 siblings, 2 replies; 18+ messages in thread
From: Morten Brørup @ 2019-05-10 17:34 UTC (permalink / raw)
To: olivier.matz, thomas, ferruh.yigit, arybchenko; +Cc: dev, Morten Brørup
TCP flags were moved to the TCP header file from the Ethernet control
header file, keeping their names intact.
Missing TCP ECN flags were added.
The ALL mask did not include TCP ECN flags, so it was renamed to reflect
that it applies to N-tuple filtering only.
A driver using the ALL mask was updated accordingly.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
app/test-pmd/cmdline.c | 4 ++--
drivers/net/e1000/igb_ethdev.c | 8 ++++----
lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
lib/librte_net/rte_tcp.h | 13 +++++++++++++
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee50e45..59a45c1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
@@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b897e8a..c2fe19a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_port_mask) {
@@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
ttqf &= ~E1000_TTQF_MASK_ENABLE;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
@@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_ip_mask) {
@@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 5ea8ae2..f21e84b 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
RTE_NTUPLE_FLAGS_DST_PORT | \
RTE_NTUPLE_FLAGS_PROTO)
-#define TCP_URG_FLAG 0x20
-#define TCP_ACK_FLAG 0x10
-#define TCP_PSH_FLAG 0x08
-#define TCP_RST_FLAG 0x04
-#define TCP_SYN_FLAG 0x02
-#define TCP_FIN_FLAG 0x01
-#define TCP_FLAG_ALL 0x3F
+#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
/**
* A structure used to define the ntuple filter entry
diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
index 91f5898..2e89b5e 100644
--- a/lib/librte_net/rte_tcp.h
+++ b/lib/librte_net/rte_tcp.h
@@ -2,6 +2,7 @@
* Copyright(c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
* Copyright(c) 2010-2014 Intel Corporation.
+ * Copyright(c) 2019 SmartShare Systems.
* All rights reserved.
*/
@@ -35,6 +36,18 @@ struct tcp_hdr {
uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((__packed__));
+/**
+ * TCP Flags
+ */
+#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
+#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
+#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
+#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
+#define TCP_PSH_FLAG 0x08 /**< Push Function */
+#define TCP_RST_FLAG 0x04 /**< Reset the connection */
+#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
+#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
+
#ifdef __cplusplus
}
#endif
--
1.5.6
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-10 17:34 Morten Brørup
@ 2019-05-10 17:34 ` Morten Brørup
2019-05-13 11:54 ` Olivier Matz
1 sibling, 0 replies; 18+ messages in thread
From: Morten Brørup @ 2019-05-10 17:34 UTC (permalink / raw)
To: olivier.matz, thomas, ferruh.yigit, arybchenko; +Cc: dev, Morten Brørup
TCP flags were moved to the TCP header file from the Ethernet control
header file, keeping their names intact.
Missing TCP ECN flags were added.
The ALL mask did not include TCP ECN flags, so it was renamed to reflect
that it applies to N-tuple filtering only.
A driver using the ALL mask was updated accordingly.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
app/test-pmd/cmdline.c | 4 ++--
drivers/net/e1000/igb_ethdev.c | 8 ++++----
lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
lib/librte_net/rte_tcp.h | 13 +++++++++++++
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee50e45..59a45c1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
@@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b897e8a..c2fe19a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_port_mask) {
@@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
ttqf &= ~E1000_TTQF_MASK_ENABLE;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
@@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_ip_mask) {
@@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 5ea8ae2..f21e84b 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
RTE_NTUPLE_FLAGS_DST_PORT | \
RTE_NTUPLE_FLAGS_PROTO)
-#define TCP_URG_FLAG 0x20
-#define TCP_ACK_FLAG 0x10
-#define TCP_PSH_FLAG 0x08
-#define TCP_RST_FLAG 0x04
-#define TCP_SYN_FLAG 0x02
-#define TCP_FIN_FLAG 0x01
-#define TCP_FLAG_ALL 0x3F
+#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
/**
* A structure used to define the ntuple filter entry
diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
index 91f5898..2e89b5e 100644
--- a/lib/librte_net/rte_tcp.h
+++ b/lib/librte_net/rte_tcp.h
@@ -2,6 +2,7 @@
* Copyright(c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
* Copyright(c) 2010-2014 Intel Corporation.
+ * Copyright(c) 2019 SmartShare Systems.
* All rights reserved.
*/
@@ -35,6 +36,18 @@ struct tcp_hdr {
uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((__packed__));
+/**
+ * TCP Flags
+ */
+#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
+#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
+#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
+#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
+#define TCP_PSH_FLAG 0x08 /**< Push Function */
+#define TCP_RST_FLAG 0x04 /**< Reset the connection */
+#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
+#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
+
#ifdef __cplusplus
}
#endif
--
1.5.6
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
@ 2019-05-10 17:10 Morten Brørup
2019-05-10 17:10 ` Morten Brørup
0 siblings, 1 reply; 18+ messages in thread
From: Morten Brørup @ 2019-05-10 17:10 UTC (permalink / raw)
To: olivier.matz, thomas, ferruh.yigit, arybchenko; +Cc: dev, Morten Brørup
TCP flags were moved to the TCP header file from the Ethernet control header file, keeping their names intact.
Missing TCP ECN flags were added.
The ALL mask did not include TCP ECN flags, so it was renamed to reflect that it applies to N-tuple filtering only.
A driver using the ALL mask was updated accordingly.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
app/test-pmd/cmdline.c | 4 ++--
drivers/net/e1000/igb_ethdev.c | 8 ++++----
lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
lib/librte_net/rte_tcp.h | 13 +++++++++++++
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee50e45..59a45c1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
@@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b897e8a..c2fe19a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_port_mask) {
@@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
ttqf &= ~E1000_TTQF_MASK_ENABLE;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
@@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_ip_mask) {
@@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 5ea8ae2..f21e84b 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
RTE_NTUPLE_FLAGS_DST_PORT | \
RTE_NTUPLE_FLAGS_PROTO)
-#define TCP_URG_FLAG 0x20
-#define TCP_ACK_FLAG 0x10
-#define TCP_PSH_FLAG 0x08
-#define TCP_RST_FLAG 0x04
-#define TCP_SYN_FLAG 0x02
-#define TCP_FIN_FLAG 0x01
-#define TCP_FLAG_ALL 0x3F
+#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
/**
* A structure used to define the ntuple filter entry
diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
index 91f5898..2e89b5e 100644
--- a/lib/librte_net/rte_tcp.h
+++ b/lib/librte_net/rte_tcp.h
@@ -2,6 +2,7 @@
* Copyright(c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
* Copyright(c) 2010-2014 Intel Corporation.
+ * Copyright(c) 2019 SmartShare Systems.
* All rights reserved.
*/
@@ -35,6 +36,18 @@ struct tcp_hdr {
uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((__packed__));
+/**
+ * TCP Flags
+ */
+#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
+#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
+#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
+#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
+#define TCP_PSH_FLAG 0x08 /**< Push Function */
+#define TCP_RST_FLAG 0x04 /**< Reset the connection */
+#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
+#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
+
#ifdef __cplusplus
}
#endif
--
1.5.6
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-10 17:10 Morten Brørup
@ 2019-05-10 17:10 ` Morten Brørup
0 siblings, 0 replies; 18+ messages in thread
From: Morten Brørup @ 2019-05-10 17:10 UTC (permalink / raw)
To: olivier.matz, thomas, ferruh.yigit, arybchenko; +Cc: dev, Morten Brørup
TCP flags were moved to the TCP header file from the Ethernet control header file, keeping their names intact.
Missing TCP ECN flags were added.
The ALL mask did not include TCP ECN flags, so it was renamed to reflect that it applies to N-tuple filtering only.
A driver using the ALL mask was updated accordingly.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
app/test-pmd/cmdline.c | 4 ++--
drivers/net/e1000/igb_ethdev.c | 8 ++++----
lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
lib/librte_net/rte_tcp.h | 13 +++++++++++++
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee50e45..59a45c1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
@@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b897e8a..c2fe19a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_port_mask) {
@@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
ttqf &= ~E1000_TTQF_MASK_ENABLE;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
@@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_ip_mask) {
@@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 5ea8ae2..f21e84b 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
RTE_NTUPLE_FLAGS_DST_PORT | \
RTE_NTUPLE_FLAGS_PROTO)
-#define TCP_URG_FLAG 0x20
-#define TCP_ACK_FLAG 0x10
-#define TCP_PSH_FLAG 0x08
-#define TCP_RST_FLAG 0x04
-#define TCP_SYN_FLAG 0x02
-#define TCP_FIN_FLAG 0x01
-#define TCP_FLAG_ALL 0x3F
+#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
/**
* A structure used to define the ntuple filter entry
diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
index 91f5898..2e89b5e 100644
--- a/lib/librte_net/rte_tcp.h
+++ b/lib/librte_net/rte_tcp.h
@@ -2,6 +2,7 @@
* Copyright(c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
* Copyright(c) 2010-2014 Intel Corporation.
+ * Copyright(c) 2019 SmartShare Systems.
* All rights reserved.
*/
@@ -35,6 +36,18 @@ struct tcp_hdr {
uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((__packed__));
+/**
+ * TCP Flags
+ */
+#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
+#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
+#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
+#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
+#define TCP_PSH_FLAG 0x08 /**< Push Function */
+#define TCP_RST_FLAG 0x04 /**< Reset the connection */
+#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
+#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
+
#ifdef __cplusplus
}
#endif
--
1.5.6
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
@ 2019-05-10 16:10 Morten Brørup
2019-05-10 16:10 ` Morten Brørup
0 siblings, 1 reply; 18+ messages in thread
From: Morten Brørup @ 2019-05-10 16:10 UTC (permalink / raw)
To: Olivier Matz, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: dev, Morten Brørup
TCP flags were moved to the TCP header file from the Ethernet control
header file, keeping their names intact.
Missing TCP ECN flags were added.
The ALL mask did not include TCP ECN flags, so it was renamed to
reflect that it applies to N-tuple filtering only.
A driver using the ALL mask was updated accordingly.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
app/test-pmd/cmdline.c | 4 ++--
drivers/net/e1000/igb_ethdev.c | 8 ++++----
lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
lib/librte_net/rte_tcp.h | 13 +++++++++++++
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee50e45..59a45c1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
@@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b897e8a..c2fe19a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_port_mask) {
@@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
ttqf &= ~E1000_TTQF_MASK_ENABLE;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
@@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_ip_mask) {
@@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 5ea8ae2..f21e84b 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
RTE_NTUPLE_FLAGS_DST_PORT | \
RTE_NTUPLE_FLAGS_PROTO)
-#define TCP_URG_FLAG 0x20
-#define TCP_ACK_FLAG 0x10
-#define TCP_PSH_FLAG 0x08
-#define TCP_RST_FLAG 0x04
-#define TCP_SYN_FLAG 0x02
-#define TCP_FIN_FLAG 0x01
-#define TCP_FLAG_ALL 0x3F
+#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
/**
* A structure used to define the ntuple filter entry
diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
index 91f5898..2e89b5e 100644
--- a/lib/librte_net/rte_tcp.h
+++ b/lib/librte_net/rte_tcp.h
@@ -2,6 +2,7 @@
* Copyright(c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
* Copyright(c) 2010-2014 Intel Corporation.
+ * Copyright(c) 2019 SmartShare Systems.
* All rights reserved.
*/
@@ -35,6 +36,18 @@ struct tcp_hdr {
uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((__packed__));
+/**
+ * TCP Flags
+ */
+#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
+#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
+#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
+#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
+#define TCP_PSH_FLAG 0x08 /**< Push Function */
+#define TCP_RST_FLAG 0x04 /**< Reset the connection */
+#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
+#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
+
#ifdef __cplusplus
}
#endif
--
1.5.6
^ permalink raw reply [flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
2019-05-10 16:10 Morten Brørup
@ 2019-05-10 16:10 ` Morten Brørup
0 siblings, 0 replies; 18+ messages in thread
From: Morten Brørup @ 2019-05-10 16:10 UTC (permalink / raw)
To: Olivier Matz, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
Cc: dev, Morten Brørup
TCP flags were moved to the TCP header file from the Ethernet control
header file, keeping their names intact.
Missing TCP ECN flags were added.
The ALL mask did not include TCP ECN flags, so it was renamed to
reflect that it applies to N-tuple filtering only.
A driver using the ALL mask was updated accordingly.
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
app/test-pmd/cmdline.c | 4 ++--
drivers/net/e1000/igb_ethdev.c | 8 ++++----
lib/librte_ethdev/rte_eth_ctrl.h | 8 +-------
lib/librte_net/rte_tcp.h | 13 +++++++++++++
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ee50e45..59a45c1 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9983,7 +9983,7 @@ cmd_2tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
@@ -10141,7 +10141,7 @@ cmd_5tuple_filter_parsed(void *parsed_result,
" when protocol is TCP.\n");
return;
}
- if (res->tcp_flags_value > TCP_FLAG_ALL) {
+ if (res->tcp_flags_value > RTE_NTUPLE_TCP_FLAGS_MASK) {
printf("invalid TCP flags.\n");
return;
}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b897e8a..c2fe19a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3702,7 +3702,7 @@ ntuple_filter_to_2tuple(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_port_mask) {
@@ -3782,7 +3782,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev,
ttqf &= ~E1000_TTQF_MASK_ENABLE;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
@@ -4188,7 +4188,7 @@ ntuple_filter_to_5tuple_82576(struct rte_eth_ntuple_filter *filter,
return -EINVAL;
if (filter->priority > E1000_2TUPLE_MAX_PRI)
return -EINVAL; /* filter index is out of range. */
- if (filter->tcp_flags > TCP_FLAG_ALL)
+ if (filter->tcp_flags > RTE_NTUPLE_TCP_FLAGS_MASK)
return -EINVAL; /* flags is invalid. */
switch (filter->dst_ip_mask) {
@@ -4318,7 +4318,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
/* tcp flags bits setting. */
- if (filter->filter_info.tcp_flags & TCP_FLAG_ALL) {
+ if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
if (filter->filter_info.tcp_flags & TCP_URG_FLAG)
imir_ext |= E1000_IMIREXT_CTRL_URG;
if (filter->filter_info.tcp_flags & TCP_ACK_FLAG)
diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 5ea8ae2..f21e84b 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -184,13 +184,7 @@ struct rte_eth_syn_filter {
RTE_NTUPLE_FLAGS_DST_PORT | \
RTE_NTUPLE_FLAGS_PROTO)
-#define TCP_URG_FLAG 0x20
-#define TCP_ACK_FLAG 0x10
-#define TCP_PSH_FLAG 0x08
-#define TCP_RST_FLAG 0x04
-#define TCP_SYN_FLAG 0x02
-#define TCP_FIN_FLAG 0x01
-#define TCP_FLAG_ALL 0x3F
+#define RTE_NTUPLE_TCP_FLAGS_MASK 0x3F /**< TCP flags filter can match. */
/**
* A structure used to define the ntuple filter entry
diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h
index 91f5898..2e89b5e 100644
--- a/lib/librte_net/rte_tcp.h
+++ b/lib/librte_net/rte_tcp.h
@@ -2,6 +2,7 @@
* Copyright(c) 1982, 1986, 1990, 1993
* The Regents of the University of California.
* Copyright(c) 2010-2014 Intel Corporation.
+ * Copyright(c) 2019 SmartShare Systems.
* All rights reserved.
*/
@@ -35,6 +36,18 @@ struct tcp_hdr {
uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((__packed__));
+/**
+ * TCP Flags
+ */
+#define TCP_CWR_FLAG 0x80 /**< Congestion Window Reduced */
+#define TCP_ECE_FLAG 0x40 /**< ECN-Echo */
+#define TCP_URG_FLAG 0x20 /**< Urgent Pointer field significant */
+#define TCP_ACK_FLAG 0x10 /**< Acknowledgment field significant */
+#define TCP_PSH_FLAG 0x08 /**< Push Function */
+#define TCP_RST_FLAG 0x04 /**< Reset the connection */
+#define TCP_SYN_FLAG 0x02 /**< Synchronize sequence numbers */
+#define TCP_FIN_FLAG 0x01 /**< No more data from sender */
+
#ifdef __cplusplus
}
#endif
--
1.5.6
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2019-05-13 17:00 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-10 14:10 [dpdk-dev] [PATCH] librte_net: define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h Morten Brørup
2019-05-10 14:10 ` Morten Brørup
2019-05-10 16:10 Morten Brørup
2019-05-10 16:10 ` Morten Brørup
2019-05-10 17:10 Morten Brørup
2019-05-10 17:10 ` Morten Brørup
2019-05-10 17:34 Morten Brørup
2019-05-10 17:34 ` Morten Brørup
2019-05-13 11:54 ` Olivier Matz
2019-05-13 11:54 ` Olivier Matz
2019-05-13 13:02 ` Morten Brørup
2019-05-13 13:02 ` Morten Brørup
2019-05-13 14:47 ` Stephen Hemminger
2019-05-13 14:47 ` Stephen Hemminger
2019-05-13 15:15 ` Morten Brørup
2019-05-13 15:15 ` Morten Brørup
2019-05-13 17:00 ` Ferruh Yigit
2019-05-13 17:00 ` Ferruh Yigit
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).