Define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
PATCH 1/1 Define TCP flags in rte_tcp.h instead of in rte_eth_ctrl.h
TCP flags were moved to the TCP header file from the Ethernet control header file, and the RTE prefix was added to their names.
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.
Updated other files affected by the renaming accordingly.
--- app/test-pmd/cmdline.c | 4 ++-- drivers/net/e1000/igb_ethdev.c | 32 ++++++++++++++++---------------- drivers/net/e1000/igb_flow.c | 4 ++-- drivers/net/ixgbe/ixgbe_flow.c | 4 ++-- lib/librte_ethdev/rte_eth_ctrl.h | 8 +------- lib/librte_gro/gro_tcp4.c | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 2 +- lib/librte_net/rte_tcp.h | 12 ++++++++++++ 8 files changed, 37 insertions(+), 31 deletions(-)
app/test-pmd/cmdline.c +2 -2
@@ -10080,7 +10080,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 ; }
@@ -10238,7 +10238,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 ; }
drivers/net/e1000/igb_ethdev.c +16 -16
@@ -3707,7 +3707,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) {
@@ -3787,18 +3787,18 @@ 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 &TCP_URG_FLAG ) +if (filter->filter_info.tcp_flags &RTE_NTUPLE_TCP_FLAGS_MASK ) { +if (filter->filter_info.tcp_flags &RTE_TCP_URG_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_URG ; -if (filter->filter_info.tcp_flags &TCP_ACK_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_ACK_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_ACK ; -if (filter->filter_info.tcp_flags &TCP_PSH_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_PSH_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_PSH ; -if (filter->filter_info.tcp_flags &TCP_RST_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_RST_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_RST ; -if (filter->filter_info.tcp_flags &TCP_SYN_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_SYN_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_SYN ; -if (filter->filter_info.tcp_flags &TCP_FIN_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_FIN_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_FIN ; }else { imir_ext |=E1000_IMIREXT_CTRL_BP ;
@@ -4193,7 +4193,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) {
@@ -4323,18 +4323,18 @@ 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 &TCP_URG_FLAG ) +if (filter->filter_info.tcp_flags &RTE_NTUPLE_TCP_FLAGS_MASK ) { +if (filter->filter_info.tcp_flags &RTE_TCP_URG_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_URG ; -if (filter->filter_info.tcp_flags &TCP_ACK_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_ACK_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_ACK ; -if (filter->filter_info.tcp_flags &TCP_PSH_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_PSH_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_PSH ; -if (filter->filter_info.tcp_flags &TCP_RST_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_RST_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_RST ; -if (filter->filter_info.tcp_flags &TCP_SYN_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_SYN_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_SYN ; -if (filter->filter_info.tcp_flags &TCP_FIN_FLAG ) +if (filter->filter_info.tcp_flags &RTE_TCP_FIN_FLAG ) imir_ext |=E1000_IMIREXT_CTRL_FIN ; }else { imir_ext |=E1000_IMIREXT_CTRL_BP ;
drivers/net/e1000/igb_flow.c +2 -2
@@ -866,13 +866,13 @@ cons_parse_syn_filter(const struct rte_flow_attr *attr, tcp_spec = item->spec; tcp_mask = item->mask; -if (!(tcp_spec->hdr.tcp_flags &TCP_SYN_FLAG ) || +if (!(tcp_spec->hdr.tcp_flags &RTE_TCP_SYN_FLAG ) || tcp_mask->hdr.src_port || tcp_mask->hdr.dst_port || tcp_mask->hdr.sent_seq || tcp_mask->hdr.recv_ack || tcp_mask->hdr.data_off || - tcp_mask->hdr.tcp_flags !=TCP_SYN_FLAG || + tcp_mask->hdr.tcp_flags !=RTE_TCP_SYN_FLAG || tcp_mask->hdr.rx_win || tcp_mask->hdr.cksum || tcp_mask->hdr.tcp_urp) {
drivers/net/ixgbe/ixgbe_flow.c +2 -2
@@ -1048,13 +1048,13 @@ cons_parse_syn_filter(const struct rte_flow_attr *attr, tcp_spec = item->spec; tcp_mask = item->mask; -if (!(tcp_spec->hdr.tcp_flags &TCP_SYN_FLAG ) || +if (!(tcp_spec->hdr.tcp_flags &RTE_TCP_SYN_FLAG ) || tcp_mask->hdr.src_port || tcp_mask->hdr.dst_port || tcp_mask->hdr.sent_seq || tcp_mask->hdr.recv_ack || tcp_mask->hdr.data_off || - tcp_mask->hdr.tcp_flags !=TCP_SYN_FLAG || + tcp_mask->hdr.tcp_flags !=RTE_TCP_SYN_FLAG || tcp_mask->hdr.rx_win || tcp_mask->hdr.cksum || tcp_mask->hdr.tcp_urp) {
lib/librte_ethdev/rte_eth_ctrl.h +1 -7
@@ -149,13 +149,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
lib/librte_gro/gro_tcp4.c +1 -1
@@ -224,7 +224,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,* Don't process the packet which has FIN, SYN, RST, PSH, URG, ECE * or CWR set. */ -if (tcp_hdr->tcp_flags !=TCP_ACK_FLAG ) +if (tcp_hdr->tcp_flags !=RTE_TCP_ACK_FLAG )return -1 ;/* * Don't process the packet whose payload length is less than or
lib/librte_gro/gro_vxlan_tcp4.c +1 -1
@@ -330,7 +330,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt,* Don't process the packet which has FIN, SYN, RST, PSH, URG, * ECE or CWR set. */ -if (tcp_hdr->tcp_flags !=TCP_ACK_FLAG ) +if (tcp_hdr->tcp_flags !=RTE_TCP_ACK_FLAG )return -1 ; hdr_len = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len +
lib/librte_net/rte_tcp.h +12 -0
@@ -35,6 +35,18 @@ struct rte_tcp_hdr {uint16_t tcp_urp;/**< TCP urgent pointer, if any. */ } __attribute__((__packed__)); +/** +* TCP Flags +*/ +#define RTE_TCP_CWR_FLAG 0x80/**< Congestion Window Reduced */ +#define RTE_TCP_ECE_FLAG 0x40/**< ECN-Echo */ +#define RTE_TCP_URG_FLAG 0x20/**< Urgent Pointer field significant */ +#define RTE_TCP_ACK_FLAG 0x10/**< Acknowledgment field significant */ +#define RTE_TCP_PSH_FLAG 0x08/**< Push Function */ +#define RTE_TCP_RST_FLAG 0x04/**< Reset the connection */ +#define RTE_TCP_SYN_FLAG 0x02/**< Synchronize sequence numbers */ +#define RTE_TCP_FIN_FLAG 0x01/**< No more data from sender */ + #ifdef __cplusplus }#endif
Signature · 1 line
1.5.6
Quoted 11 lines · Morten Brørup
TCP flags were moved to the TCP header file from the Ethernet control header file, and the RTE prefix was added to their names.
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.
Updated other files affected by the renaming accordingly.
Signed-off-by Morten Brørup <[email protected]>
Ferruh Yigit
AppliedQuoted 6 lines · Olivier Matz
Quoted 5 lines · Morten Brørup
TCP flags were moved to the TCP header file from the Ethernet control header file, and the RTE prefix was added to their names.
Missing TCP ECN flags were added.
Quoted 9 lines
Quoted 6 lines
The ALL mask did not include TCP ECN flags, so it was renamed to reflect that it applies to N-tuple filtering only.
Updated other files affected by the renaming accordingly.
Signed-off-by Morten Brørup <[email protected]>Acked-by Olivier Matz <[email protected]>
Applied to dpdk-next-net/master, thanks.