net: move TCP flags from ethdev header
authorMorten Brørup <mb@smartsharesystems.com>
Fri, 21 Jun 2019 10:55:06 +0000 (12:55 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 3 Jul 2019 10:57:30 +0000 (12:57 +0200)
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 <mb@smartsharesystems.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
app/test-pmd/cmdline.c
drivers/net/e1000/igb_ethdev.c
drivers/net/e1000/igb_flow.c
drivers/net/ixgbe/ixgbe_flow.c
lib/librte_ethdev/rte_eth_ctrl.h
lib/librte_gro/gro_tcp4.c
lib/librte_gro/gro_vxlan_tcp4.c
lib/librte_net/rte_tcp.h

index d1e0d44..cbde5d2 100644 (file)
@@ -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;
        }
index 4436f9d..3ee28cf 100644 (file)
@@ -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;
index 9f002de..4e0b38f 100644 (file)
@@ -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) {
index 2b8529f..92377b8 100644 (file)
@@ -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) {
index 85c1e37..be4b4af 100644 (file)
@@ -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
index 70d8c5d..feb5855 100644 (file)
@@ -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
index 5fa8807..f3b6e60 100644 (file)
@@ -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 +
index 4bcda55..7d649a2 100644 (file)
@@ -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