Skip to contentSkip to conversation

doc: update flow filting document

PATCH Superseded Wei Zhao 5 participants 11 messages Jan 30, 2018 – Feb 7, 2018

lore
Share & tools
lore

Wei Zhao

author
#0 lore raw

PATCH 1/1 doc: update flow filting document

This patch will update example application of flow_filting document. It add Tx queues configuration related comment.

---
 doc/guides/sample_app_ug/flow_filtering.rst | 112 ++++++++++++++++++----------
 1 file changed, 74 insertions(+), 38 deletions(-)
doc/guides/sample_app_ug/flow_filtering.rst +74 -38
index 725dcb4..76a04b4 100644
@@ -167,44 +167,65 @@ application is shown below:
            struct rte_eth_conf port_conf = {
                    .rxmode = {
                            .split_hdr_size = 0,
-                           /**< Header Split disabled */
-                           .header_split   = 0,
-                           /**< IP checksum offload disabled */
-                           .hw_ip_checksum = 0,
-                           /**< VLAN filtering disabled */
-                           .hw_vlan_filter = 0,
-                           /**< Jumbo Frame Support disabled */
-                           .jumbo_frame    = 0,
-                           /**< CRC stripped by hardware */
-                           .hw_strip_crc   = 1,
+                           .ignore_offload_bitfield = 1,
+                           .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                           },
+                   .txmode = {
+                           .offloads =
+                                   DEV_TX_OFFLOAD_VLAN_INSERT |
+                                   DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                                   DEV_TX_OFFLOAD_UDP_CKSUM   |
+                                   DEV_TX_OFFLOAD_TCP_CKSUM   |
+                                   DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                                   DEV_TX_OFFLOAD_TCP_TSO,
                    },
            };
+           struct rte_eth_txconf txq_conf;
+           struct rte_eth_rxconf rxq_conf;
+           struct rte_eth_dev_info dev_info;
 
            printf(":: initializing port: %d\n", port_id);
            ret = rte_eth_dev_configure(port_id,
-                                   nr_queues, nr_queues, &port_conf);
+                   nr_queues, nr_queues, &port_conf);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
                            ":: cannot configure device: err=%d, port=%u\n",
                            ret, port_id);
            }
 
+           rte_eth_dev_info_get(port_id, &dev_info);
+           rxq_conf = dev_info.default_rxconf;
+           rxq_conf.offloads = port_conf.rxmode.offloads;
            /* only set Rx queues: something we care only so far */
            for (i = 0; i < nr_queues; i++) {
                    ret = rte_eth_rx_queue_setup(port_id, i, 512,
-                                        rte_eth_dev_socket_id(port_id),
-                                        NULL,
-                                        mbuf_pool);
+                           rte_eth_dev_socket_id(port_id),
+                           &rxq_conf,
+                           mbuf_pool);
                    if (ret < 0) {
-                           rte_exit(EXIT_FAILURE,
-                              ":: Rx queue setup failed: err=%d, port=%u\n",
-                              ret, port_id);
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d,
+                                    port=%u\n",
+                                    ret, port_id);
                    }
            }
 
+           txq_conf = dev_info.default_txconf;
+           txq_conf.offloads = port_conf.txmode.offloads;
 
-           rte_eth_promiscuous_enable(port_id);
+           for (i = 0; i < nr_queues; i++) {
+                   ret = rte_eth_tx_queue_setup(port_id, i, 512,
+                           rte_eth_dev_socket_id(port_id),
+                           &txq_conf);
+                   if (ret < 0) {
+                           rte_exit(EXIT_FAILURE,
+                                   ":: Tx queue setup failed: err=%d,
+                                   port=%u\n",
+                                   ret, port_id);
+                   }
+          }
 
+           rte_eth_promiscuous_enable(port_id);
            ret = rte_eth_dev_start(port_id);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
@@ -223,20 +244,21 @@ The Ethernet port is configured with default settings using the
 .. code-block:: c
 
    struct rte_eth_conf port_conf = {
-                .rxmode = {
-                        .split_hdr_size = 0,
-                        /**< Header Split disabled */
-                        .header_split   = 0,
-                        /**< IP checksum offload disabled */
-                        .hw_ip_checksum = 0,
-                        /**< VLAN filtering disabled */
-                        .hw_vlan_filter = 0,
-                        /**< Jumbo Frame Support disabled */
-                        .jumbo_frame    = 0,
-                        /**< CRC stripped by hardware */
-                        .hw_strip_crc   = 1,
-                },
-   };
+           .rxmode = {
+                   .split_hdr_size = 0,
+                   .ignore_offload_bitfield = 1,
+                   .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                   },
+           .txmode = {
+                   .offloads =
+                           DEV_TX_OFFLOAD_VLAN_INSERT |
+                           DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                           DEV_TX_OFFLOAD_UDP_CKSUM   |
+                           DEV_TX_OFFLOAD_TCP_CKSUM   |
+                           DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                           DEV_TX_OFFLOAD_TCP_TSO,
+                   },
+           };
 
    ret = rte_eth_dev_configure(port_id, nr_queues, nr_queues, &port_conf);
    if (ret < 0) {
@@ -244,23 +266,37 @@ The Ethernet port is configured with default settings using the
                  ":: cannot configure device: err=%d, port=%u\n",
                  ret, port_id);
    }
+   rte_eth_dev_info_get(port_id, &dev_info);
+   rxq_conf = dev_info.default_rxconf;
+   rxq_conf.offloads = port_conf.rxmode.offloads;
 
-For this example we are configuring number of rx queues that are connected to
-a single port.
+For this example we are configuring number of rx and tx queues that are connected
+to a single port.
 
 .. code-block:: c
 
    for (i = 0; i < nr_queues; i++) {
           ret = rte_eth_rx_queue_setup(port_id, i, 512,
                                        rte_eth_dev_socket_id(port_id),
-                                       NULL,
+                                       &rxq_conf,
                                        mbuf_pool);
           if (ret < 0) {
                   rte_exit(EXIT_FAILURE,
-                          ":: Rx queue setup failed: err=%d, port=%u\n",
-                          ret, port_id);
+                           ":: Rx queue setup failed: err=%d, port=%u\n",
+                           ret, port_id);
+          }
+   }
+
+   for (i = 0; i < nr_queues; i++) {
+          ret = rte_eth_tx_queue_setup(port_id, i, 512,
+                                       rte_eth_dev_socket_id(port_id),
+                                       &txq_conf);
+          if (ret < 0) {
+                  rte_exit(EXIT_FAILURE,
+                           ":: Tx queue setup failed: err=%d, port=%u\n",
+                           ret, port_id);
           }
-  }
+   }
 
 In the next step we create and apply the flow rule. which is to send packets
 with destination ip equals to 192.168.1.1 to queue number 1. The detail
Signature · 1 line
2.9.3
author
#1 lore raw

PATCH v2 1/1 doc: update flow filting document

This patch will update example application of flow_filting document. It add Tx queues configuration related comment.

---

v2:
-change code indentation style.

---
 doc/guides/sample_app_ug/flow_filtering.rst | 108 ++++++++++++++++++----------
 1 file changed, 72 insertions(+), 36 deletions(-)
doc/guides/sample_app_ug/flow_filtering.rst +72 -36
index 725dcb4..b4a1dd7 100644
@@ -167,44 +167,65 @@ application is shown below:
            struct rte_eth_conf port_conf = {
                    .rxmode = {
                            .split_hdr_size = 0,
-                           /**< Header Split disabled */
-                           .header_split   = 0,
-                           /**< IP checksum offload disabled */
-                           .hw_ip_checksum = 0,
-                           /**< VLAN filtering disabled */
-                           .hw_vlan_filter = 0,
-                           /**< Jumbo Frame Support disabled */
-                           .jumbo_frame    = 0,
-                           /**< CRC stripped by hardware */
-                           .hw_strip_crc   = 1,
+                           .ignore_offload_bitfield = 1,
+                           .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                           },
+                   .txmode = {
+                           .offloads =
+                                   DEV_TX_OFFLOAD_VLAN_INSERT |
+                                   DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                                   DEV_TX_OFFLOAD_UDP_CKSUM   |
+                                   DEV_TX_OFFLOAD_TCP_CKSUM   |
+                                   DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                                   DEV_TX_OFFLOAD_TCP_TSO,
                    },
            };
+           struct rte_eth_txconf txq_conf;
+           struct rte_eth_rxconf rxq_conf;
+           struct rte_eth_dev_info dev_info;
 
            printf(":: initializing port: %d\n", port_id);
            ret = rte_eth_dev_configure(port_id,
-                                   nr_queues, nr_queues, &port_conf);
+                   nr_queues, nr_queues, &port_conf);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
                            ":: cannot configure device: err=%d, port=%u\n",
                            ret, port_id);
            }
 
+           rte_eth_dev_info_get(port_id, &dev_info);
+           rxq_conf = dev_info.default_rxconf;
+           rxq_conf.offloads = port_conf.rxmode.offloads;
            /* only set Rx queues: something we care only so far */
            for (i = 0; i < nr_queues; i++) {
                    ret = rte_eth_rx_queue_setup(port_id, i, 512,
-                                        rte_eth_dev_socket_id(port_id),
-                                        NULL,
-                                        mbuf_pool);
+                           rte_eth_dev_socket_id(port_id),
+                           &rxq_conf,
+                           mbuf_pool);
                    if (ret < 0) {
-                           rte_exit(EXIT_FAILURE,
-                              ":: Rx queue setup failed: err=%d, port=%u\n",
-                              ret, port_id);
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d,
+                                    port=%u\n",
+                                    ret, port_id);
                    }
            }
 
+           txq_conf = dev_info.default_txconf;
+           txq_conf.offloads = port_conf.txmode.offloads;
 
-           rte_eth_promiscuous_enable(port_id);
+           for (i = 0; i < nr_queues; i++) {
+                   ret = rte_eth_tx_queue_setup(port_id, i, 512,
+                           rte_eth_dev_socket_id(port_id),
+                           &txq_conf);
+                   if (ret < 0) {
+                           rte_exit(EXIT_FAILURE,
+                                   ":: Tx queue setup failed: err=%d,
+                                   port=%u\n",
+                                   ret, port_id);
+                   }
+          }
 
+           rte_eth_promiscuous_enable(port_id);
            ret = rte_eth_dev_start(port_id);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
@@ -223,20 +244,21 @@ The Ethernet port is configured with default settings using the
 .. code-block:: c
 
    struct rte_eth_conf port_conf = {
-                .rxmode = {
-                        .split_hdr_size = 0,
-                        /**< Header Split disabled */
-                        .header_split   = 0,
-                        /**< IP checksum offload disabled */
-                        .hw_ip_checksum = 0,
-                        /**< VLAN filtering disabled */
-                        .hw_vlan_filter = 0,
-                        /**< Jumbo Frame Support disabled */
-                        .jumbo_frame    = 0,
-                        /**< CRC stripped by hardware */
-                        .hw_strip_crc   = 1,
-                },
-   };
+           .rxmode = {
+                   .split_hdr_size = 0,
+                   .ignore_offload_bitfield = 1,
+                   .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                   },
+           .txmode = {
+                   .offloads =
+                           DEV_TX_OFFLOAD_VLAN_INSERT |
+                           DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                           DEV_TX_OFFLOAD_UDP_CKSUM   |
+                           DEV_TX_OFFLOAD_TCP_CKSUM   |
+                           DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                           DEV_TX_OFFLOAD_TCP_TSO,
+                   },
+           };
 
    ret = rte_eth_dev_configure(port_id, nr_queues, nr_queues, &port_conf);
    if (ret < 0) {
@@ -244,23 +266,37 @@ The Ethernet port is configured with default settings using the
                  ":: cannot configure device: err=%d, port=%u\n",
                  ret, port_id);
    }
+   rte_eth_dev_info_get(port_id, &dev_info);
+   rxq_conf = dev_info.default_rxconf;
+   rxq_conf.offloads = port_conf.rxmode.offloads;
 
-For this example we are configuring number of rx queues that are connected to
-a single port.
+For this example we are configuring number of rx and tx queues that are connected
+to a single port.
 
 .. code-block:: c
 
    for (i = 0; i < nr_queues; i++) {
           ret = rte_eth_rx_queue_setup(port_id, i, 512,
                                        rte_eth_dev_socket_id(port_id),
-                                       NULL,
+                                       &rxq_conf,
                                        mbuf_pool);
           if (ret < 0) {
                   rte_exit(EXIT_FAILURE,
                           ":: Rx queue setup failed: err=%d, port=%u\n",
                           ret, port_id);
           }
-  }
+   }
+
+   for (i = 0; i < nr_queues; i++) {
+          ret = rte_eth_tx_queue_setup(port_id, i, 512,
+                                       rte_eth_dev_socket_id(port_id),
+                                       &txq_conf);
+          if (ret < 0) {
+                  rte_exit(EXIT_FAILURE,
+                           ":: Tx queue setup failed: err=%d, port=%u\n",
+                           ret, port_id);
+          }
+   }
 
 In the next step we create and apply the flow rule. which is to send packets
 with destination ip equals to 192.168.1.1 to queue number 1. The detail
Signature · 1 line
2.9.3
#2 lore raw

Hi Wei,

You have a typo in the patch subject and comment,
It should be filtering

Ori

Quoted 192 lines

-----Original Message-----
From: Wei Zhao [mailto:[email protected]]
Sent: Tuesday, January 30, 2018 9:45 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; [email protected]; [email protected]; Wei Zhao <[email protected]>
Subject: [PATCH v2] doc: update flow filting document

This patch will update example application of flow_filting document. It add Tx queues configuration related comment.

---

v2:

(quoted diff) +0 -3
-change code indentation style.
---
 doc/guides/sample_app_ug/flow_filtering.rst | 108 ++++++++++++++++++-
---------
 1 file changed, 72 insertions(+), 36 deletions(-)
doc/guides/sample_app_ug/flow_filtering.rst +39 -18
index 725dcb4..b4a1dd7 100644
@@ -167,44 +167,65 @@ application is shown below:
            struct rte_eth_conf port_conf = {
                    .rxmode = {
                            .split_hdr_size = 0,
-                           /**< Header Split disabled */
-                           .header_split   = 0,
-                           /**< IP checksum offload disabled */
-                           .hw_ip_checksum = 0,
-                           /**< VLAN filtering disabled */
-                           .hw_vlan_filter = 0,
-                           /**< Jumbo Frame Support disabled */
-                           .jumbo_frame    = 0,
-                           /**< CRC stripped by hardware */
-                           .hw_strip_crc   = 1,
+                           .ignore_offload_bitfield = 1,
+                           .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                           },
+                   .txmode = {
+                           .offloads =
+                                   DEV_TX_OFFLOAD_VLAN_INSERT |
+                                   DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                                   DEV_TX_OFFLOAD_UDP_CKSUM   |
+                                   DEV_TX_OFFLOAD_TCP_CKSUM   |
+                                   DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                                   DEV_TX_OFFLOAD_TCP_TSO,
                    },
            };
+           struct rte_eth_txconf txq_conf;
+           struct rte_eth_rxconf rxq_conf;
+           struct rte_eth_dev_info dev_info;
 
            printf(":: initializing port: %d\n", port_id);
            ret = rte_eth_dev_configure(port_id,
-                                   nr_queues, nr_queues, &port_conf);
+                   nr_queues, nr_queues, &port_conf);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
                            ":: cannot configure device: err=%d, port=%u\n",
                            ret, port_id);
            }
 
+           rte_eth_dev_info_get(port_id, &dev_info);
+           rxq_conf = dev_info.default_rxconf;
+           rxq_conf.offloads = port_conf.rxmode.offloads;
            /* only set Rx queues: something we care only so far */
            for (i = 0; i < nr_queues; i++) {
                    ret = rte_eth_rx_queue_setup(port_id, i, 512,
-                                        rte_eth_dev_socket_id(port_id),
-                                        NULL,
-                                        mbuf_pool);
+                           rte_eth_dev_socket_id(port_id),
+                           &rxq_conf,
+                           mbuf_pool);
                    if (ret < 0) {
-                           rte_exit(EXIT_FAILURE,
-                              ":: Rx queue setup failed: err=%d, port=%u\n",
-                              ret, port_id);
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d,
+                                    port=%u\n",
+                                    ret, port_id);
                    }
            }
 
+           txq_conf = dev_info.default_txconf;
+           txq_conf.offloads = port_conf.txmode.offloads;
 
-           rte_eth_promiscuous_enable(port_id);
+           for (i = 0; i < nr_queues; i++) {
+                   ret = rte_eth_tx_queue_setup(port_id, i, 512,
+                           rte_eth_dev_socket_id(port_id),
+                           &txq_conf);
+                   if (ret < 0) {
+                           rte_exit(EXIT_FAILURE,
+                                   ":: Tx queue setup failed: err=%d,
+                                   port=%u\n",
+                                   ret, port_id);
+                   }
+          }
 
+           rte_eth_promiscuous_enable(port_id);
            ret = rte_eth_dev_start(port_id);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE, @@ -223,20 +244,21 @@ The Ethernet port

is configured with default settings using the .. code-block:: c

    struct rte_eth_conf port_conf = {
doc/guides/sample_app_ug/flow_filtering.rst +15 -14
-                .rxmode = {
-                        .split_hdr_size = 0,
-                        /**< Header Split disabled */
-                        .header_split   = 0,
-                        /**< IP checksum offload disabled */
-                        .hw_ip_checksum = 0,
-                        /**< VLAN filtering disabled */
-                        .hw_vlan_filter = 0,
-                        /**< Jumbo Frame Support disabled */
-                        .jumbo_frame    = 0,
-                        /**< CRC stripped by hardware */
-                        .hw_strip_crc   = 1,
-                },
-   };
+           .rxmode = {
+                   .split_hdr_size = 0,
+                   .ignore_offload_bitfield = 1,
+                   .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                   },
+           .txmode = {
+                   .offloads =
+                           DEV_TX_OFFLOAD_VLAN_INSERT |
+                           DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                           DEV_TX_OFFLOAD_UDP_CKSUM   |
+                           DEV_TX_OFFLOAD_TCP_CKSUM   |
+                           DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                           DEV_TX_OFFLOAD_TCP_TSO,
+                   },
+           };
 
    ret = rte_eth_dev_configure(port_id, nr_queues, nr_queues,
&port_conf);
    if (ret < 0) {
doc/guides/sample_app_ug/flow_filtering.rst +0 -0
@@ -244,23 +266,37 @@ The Ethernet port is configured with default

settings using the

                  ":: cannot configure device: err=%d, port=%u\n",
                  ret, port_id);
    }
doc/guides/sample_app_ug/flow_filtering.rst +3 -1
+   rte_eth_dev_info_get(port_id, &dev_info);
+   rxq_conf = dev_info.default_rxconf;
+   rxq_conf.offloads = port_conf.rxmode.offloads;
 
-For this example we are configuring number of rx queues that are

connected to -a single port.

doc/guides/sample_app_ug/flow_filtering.rst +15 -2
+For this example we are configuring number of rx and tx queues that are
+connected to a single port.
 
 .. code-block:: c
 
    for (i = 0; i < nr_queues; i++) {
           ret = rte_eth_rx_queue_setup(port_id, i, 512,
                                        rte_eth_dev_socket_id(port_id),
-                                       NULL,
+                                       &rxq_conf,
                                        mbuf_pool);
           if (ret < 0) {
                   rte_exit(EXIT_FAILURE,
                           ":: Rx queue setup failed: err=%d, port=%u\n",
                           ret, port_id);
           }
-  }
+   }
+
+   for (i = 0; i < nr_queues; i++) {
+          ret = rte_eth_tx_queue_setup(port_id, i, 512,
+                                       rte_eth_dev_socket_id(port_id),
+                                       &txq_conf);
+          if (ret < 0) {
+                  rte_exit(EXIT_FAILURE,
+                           ":: Tx queue setup failed: err=%d, port=%u\n",
+                           ret, port_id);
+          }
+   }
 
 In the next step we create and apply the flow rule. which is to send packets

with destination ip equals to 192.168.1.1 to queue number 1. The detail --
2.9.3

author
#3 lore raw

Hi, Ori Kam
A new v3 has been committed just now, thank you for your review work.

https://dpdk.org/dev/patchwork/patch/34742/

Quoted 208 lines

-----Original Message-----
From: Ori Kam [mailto:[email protected]]
Sent: Tuesday, January 30, 2018 5:22 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Mcnamara, John <[email protected]>
Subject: RE: [PATCH v2] doc: update flow filting document

Hi Wei,

You have a typo in the patch subject and comment, It should be filtering

Ori

Quoted 11 lines

-----Original Message-----
From: Wei Zhao [mailto:[email protected]]
Sent: Tuesday, January 30, 2018 9:45 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; [email protected]; [email protected]; Wei Zhao <[email protected]>
Subject: [PATCH v2] doc: update flow filting document

This patch will update example application of flow_filting document. It add Tx queues configuration related comment.

Quoted 8 lines

---

v2:
-change code indentation style.

---
 doc/guides/sample_app_ug/flow_filtering.rst | 108

++++++++++++++++++-

Quoted 82 lines

---------

 1 file changed, 72 insertions(+), 36 deletions(-)
doc/guides/sample_app_ug/flow_filtering.rst +33 -18
index 725dcb4..b4a1dd7 100644
@@ -167,44 +167,65 @@ application is shown below:
            struct rte_eth_conf port_conf = {
                    .rxmode = {
                            .split_hdr_size = 0,
-                           /**< Header Split disabled */
-                           .header_split   = 0,
-                           /**< IP checksum offload disabled */
-                           .hw_ip_checksum = 0,
-                           /**< VLAN filtering disabled */
-                           .hw_vlan_filter = 0,
-                           /**< Jumbo Frame Support disabled */
-                           .jumbo_frame    = 0,
-                           /**< CRC stripped by hardware */
-                           .hw_strip_crc   = 1,
+                           .ignore_offload_bitfield = 1,
+                           .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                           },
+                   .txmode = {
+                           .offloads =
+                                   DEV_TX_OFFLOAD_VLAN_INSERT |
+                                   DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                                   DEV_TX_OFFLOAD_UDP_CKSUM   |
+                                   DEV_TX_OFFLOAD_TCP_CKSUM   |
+                                   DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                                   DEV_TX_OFFLOAD_TCP_TSO,
                    },
            };
+           struct rte_eth_txconf txq_conf;
+           struct rte_eth_rxconf rxq_conf;
+           struct rte_eth_dev_info dev_info;
 
            printf(":: initializing port: %d\n", port_id);
            ret = rte_eth_dev_configure(port_id,
-                                   nr_queues, nr_queues, &port_conf);
+                   nr_queues, nr_queues, &port_conf);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
                            ":: cannot configure device: err=%d, port=%u\n",
                            ret, port_id);
            }
 
+           rte_eth_dev_info_get(port_id, &dev_info);
+           rxq_conf = dev_info.default_rxconf;
+           rxq_conf.offloads = port_conf.rxmode.offloads;
            /* only set Rx queues: something we care only so far */
            for (i = 0; i < nr_queues; i++) {
                    ret = rte_eth_rx_queue_setup(port_id, i, 512,
-                                        rte_eth_dev_socket_id(port_id),
-                                        NULL,
-                                        mbuf_pool);
+                           rte_eth_dev_socket_id(port_id),
+                           &rxq_conf,
+                           mbuf_pool);
                    if (ret < 0) {
-                           rte_exit(EXIT_FAILURE,
-                              ":: Rx queue setup failed: err=%d, port=%u\n",
-                              ret, port_id);
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d,
+                                    port=%u\n",
+                                    ret, port_id);
                    }
            }
 
+           txq_conf = dev_info.default_txconf;
+           txq_conf.offloads = port_conf.txmode.offloads;
 
-           rte_eth_promiscuous_enable(port_id);
+           for (i = 0; i < nr_queues; i++) {
+                   ret = rte_eth_tx_queue_setup(port_id, i, 512,
+                           rte_eth_dev_socket_id(port_id),
+                           &txq_conf);
+                   if (ret < 0) {
+                           rte_exit(EXIT_FAILURE,

doc/guides/sample_app_ug/flow_filtering.rst application is shown below: · line 231

Quoted 10 lines
doc/guides/sample_app_ug/flow_filtering.rst +6 -0
+                                   ":: Tx queue setup failed: err=%d,
+                                   port=%u\n",
+                                   ret, port_id);
+                   }
+          }
 
+           rte_eth_promiscuous_enable(port_id);
            ret = rte_eth_dev_start(port_id);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE, @@ -223,20 +244,21 @@ The Ethernet

port

Quoted 68 lines

is configured with default settings using the .. code-block:: c

    struct rte_eth_conf port_conf = {
doc/guides/sample_app_ug/flow_filtering.rst +15 -14
-                .rxmode = {
-                        .split_hdr_size = 0,
-                        /**< Header Split disabled */
-                        .header_split   = 0,
-                        /**< IP checksum offload disabled */
-                        .hw_ip_checksum = 0,
-                        /**< VLAN filtering disabled */
-                        .hw_vlan_filter = 0,
-                        /**< Jumbo Frame Support disabled */
-                        .jumbo_frame    = 0,
-                        /**< CRC stripped by hardware */
-                        .hw_strip_crc   = 1,
-                },
-   };
+           .rxmode = {
+                   .split_hdr_size = 0,
+                   .ignore_offload_bitfield = 1,
+                   .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                   },
+           .txmode = {
+                   .offloads =
+                           DEV_TX_OFFLOAD_VLAN_INSERT |
+                           DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                           DEV_TX_OFFLOAD_UDP_CKSUM   |
+                           DEV_TX_OFFLOAD_TCP_CKSUM   |
+                           DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                           DEV_TX_OFFLOAD_TCP_TSO,
+                   },
+           };
 
    ret = rte_eth_dev_configure(port_id, nr_queues, nr_queues,
&port_conf);
    if (ret < 0) {
doc/guides/sample_app_ug/flow_filtering.rst +0 -0
@@ -244,23 +266,37 @@ The Ethernet port is configured with default

settings using the

                  ":: cannot configure device: err=%d, port=%u\n",
                  ret, port_id);
    }
doc/guides/sample_app_ug/flow_filtering.rst +3 -1
+   rte_eth_dev_info_get(port_id, &dev_info);
+   rxq_conf = dev_info.default_rxconf;
+   rxq_conf.offloads = port_conf.rxmode.offloads;
 
-For this example we are configuring number of rx queues that are

connected to -a single port.

doc/guides/sample_app_ug/flow_filtering.rst +7 -2
+For this example we are configuring number of rx and tx queues that are
+connected to a single port.
 
 .. code-block:: c
 
    for (i = 0; i < nr_queues; i++) {
           ret = rte_eth_rx_queue_setup(port_id, i, 512,
                                        rte_eth_dev_socket_id(port_id),
-                                       NULL,
+                                       &rxq_conf,
                                        mbuf_pool);
           if (ret < 0) {
                   rte_exit(EXIT_FAILURE,
                           ":: Rx queue setup failed: err=%d, port=%u\n",
                           ret, port_id);
           }
-  }
+   }
+
+   for (i = 0; i < nr_queues; i++) {
+          ret = rte_eth_tx_queue_setup(port_id, i, 512,

doc/guides/sample_app_ug/flow_filtering.rst The Ethernet port is configured with default settings using the

Quoted 10 lines
doc/guides/sample_app_ug/flow_filtering.rst +8 -0
+                                       rte_eth_dev_socket_id(port_id),
+                                       &txq_conf);
+          if (ret < 0) {
+                  rte_exit(EXIT_FAILURE,
+                           ":: Tx queue setup failed: err=%d, port=%u\n",
+                           ret, port_id);
+          }
+   }
 
 In the next step we create and apply the flow rule. which is to send

packets

Quoted 3 lines

with destination ip equals to 192.168.1.1 to queue number 1. The detail --
2.9.3

author
#4 lore raw

PATCH v3 1/1 doc: update flow filtering document

In reply to Wei Zhao

This patch will update example application of flow_filtering document. It add Tx queues configuration related comment.

---

v2:
-change code indentation style.

v3:
-fix a typo in the patch subject and comment.

---
 doc/guides/sample_app_ug/flow_filtering.rst | 108 ++++++++++++++++++----------
 1 file changed, 72 insertions(+), 36 deletions(-)
doc/guides/sample_app_ug/flow_filtering.rst +72 -36
index 725dcb4..b4a1dd7 100644
@@ -167,44 +167,65 @@ application is shown below:
            struct rte_eth_conf port_conf = {
                    .rxmode = {
                            .split_hdr_size = 0,
-                           /**< Header Split disabled */
-                           .header_split   = 0,
-                           /**< IP checksum offload disabled */
-                           .hw_ip_checksum = 0,
-                           /**< VLAN filtering disabled */
-                           .hw_vlan_filter = 0,
-                           /**< Jumbo Frame Support disabled */
-                           .jumbo_frame    = 0,
-                           /**< CRC stripped by hardware */
-                           .hw_strip_crc   = 1,
+                           .ignore_offload_bitfield = 1,
+                           .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                           },
+                   .txmode = {
+                           .offloads =
+                                   DEV_TX_OFFLOAD_VLAN_INSERT |
+                                   DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                                   DEV_TX_OFFLOAD_UDP_CKSUM   |
+                                   DEV_TX_OFFLOAD_TCP_CKSUM   |
+                                   DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                                   DEV_TX_OFFLOAD_TCP_TSO,
                    },
            };
+           struct rte_eth_txconf txq_conf;
+           struct rte_eth_rxconf rxq_conf;
+           struct rte_eth_dev_info dev_info;
 
            printf(":: initializing port: %d\n", port_id);
            ret = rte_eth_dev_configure(port_id,
-                                   nr_queues, nr_queues, &port_conf);
+                   nr_queues, nr_queues, &port_conf);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
                            ":: cannot configure device: err=%d, port=%u\n",
                            ret, port_id);
            }
 
+           rte_eth_dev_info_get(port_id, &dev_info);
+           rxq_conf = dev_info.default_rxconf;
+           rxq_conf.offloads = port_conf.rxmode.offloads;
            /* only set Rx queues: something we care only so far */
            for (i = 0; i < nr_queues; i++) {
                    ret = rte_eth_rx_queue_setup(port_id, i, 512,
-                                        rte_eth_dev_socket_id(port_id),
-                                        NULL,
-                                        mbuf_pool);
+                           rte_eth_dev_socket_id(port_id),
+                           &rxq_conf,
+                           mbuf_pool);
                    if (ret < 0) {
-                           rte_exit(EXIT_FAILURE,
-                              ":: Rx queue setup failed: err=%d, port=%u\n",
-                              ret, port_id);
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d,
+                                    port=%u\n",
+                                    ret, port_id);
                    }
            }
 
+           txq_conf = dev_info.default_txconf;
+           txq_conf.offloads = port_conf.txmode.offloads;
 
-           rte_eth_promiscuous_enable(port_id);
+           for (i = 0; i < nr_queues; i++) {
+                   ret = rte_eth_tx_queue_setup(port_id, i, 512,
+                           rte_eth_dev_socket_id(port_id),
+                           &txq_conf);
+                   if (ret < 0) {
+                           rte_exit(EXIT_FAILURE,
+                                   ":: Tx queue setup failed: err=%d,
+                                   port=%u\n",
+                                   ret, port_id);
+                   }
+          }
 
+           rte_eth_promiscuous_enable(port_id);
            ret = rte_eth_dev_start(port_id);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
@@ -223,20 +244,21 @@ The Ethernet port is configured with default settings using the
 .. code-block:: c
 
    struct rte_eth_conf port_conf = {
-                .rxmode = {
-                        .split_hdr_size = 0,
-                        /**< Header Split disabled */
-                        .header_split   = 0,
-                        /**< IP checksum offload disabled */
-                        .hw_ip_checksum = 0,
-                        /**< VLAN filtering disabled */
-                        .hw_vlan_filter = 0,
-                        /**< Jumbo Frame Support disabled */
-                        .jumbo_frame    = 0,
-                        /**< CRC stripped by hardware */
-                        .hw_strip_crc   = 1,
-                },
-   };
+           .rxmode = {
+                   .split_hdr_size = 0,
+                   .ignore_offload_bitfield = 1,
+                   .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
+                   },
+           .txmode = {
+                   .offloads =
+                           DEV_TX_OFFLOAD_VLAN_INSERT |
+                           DEV_TX_OFFLOAD_IPV4_CKSUM  |
+                           DEV_TX_OFFLOAD_UDP_CKSUM   |
+                           DEV_TX_OFFLOAD_TCP_CKSUM   |
+                           DEV_TX_OFFLOAD_SCTP_CKSUM  |
+                           DEV_TX_OFFLOAD_TCP_TSO,
+                   },
+           };
 
    ret = rte_eth_dev_configure(port_id, nr_queues, nr_queues, &port_conf);
    if (ret < 0) {
@@ -244,23 +266,37 @@ The Ethernet port is configured with default settings using the
                  ":: cannot configure device: err=%d, port=%u\n",
                  ret, port_id);
    }
+   rte_eth_dev_info_get(port_id, &dev_info);
+   rxq_conf = dev_info.default_rxconf;
+   rxq_conf.offloads = port_conf.rxmode.offloads;
 
-For this example we are configuring number of rx queues that are connected to
-a single port.
+For this example we are configuring number of rx and tx queues that are connected
+to a single port.
 
 .. code-block:: c
 
    for (i = 0; i < nr_queues; i++) {
           ret = rte_eth_rx_queue_setup(port_id, i, 512,
                                        rte_eth_dev_socket_id(port_id),
-                                       NULL,
+                                       &rxq_conf,
                                        mbuf_pool);
           if (ret < 0) {
                   rte_exit(EXIT_FAILURE,
                           ":: Rx queue setup failed: err=%d, port=%u\n",
                           ret, port_id);
           }
-  }
+   }
+
+   for (i = 0; i < nr_queues; i++) {
+          ret = rte_eth_tx_queue_setup(port_id, i, 512,
+                                       rte_eth_dev_socket_id(port_id),
+                                       &txq_conf);
+          if (ret < 0) {
+                  rte_exit(EXIT_FAILURE,
+                           ":: Tx queue setup failed: err=%d, port=%u\n",
+                           ret, port_id);
+          }
+   }
 
 In the next step we create and apply the flow rule. which is to send packets
 with destination ip equals to 192.168.1.1 to queue number 1. The detail
Signature · 1 line
2.9.3
Applied
#5 lore raw

Re: [PATCH v3] doc: update flow filtering document

Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, January 31, 2018 10:12 AM
To: [email protected]
Cc: Mcnamara, John; [email protected]; [email protected]; Zhao1, Wei
Subject: [dpdk-dev] [PATCH v3] doc: update flow filtering document

Quoted 5 lines

This patch will update example application of flow_filtering document. It add Tx queues configuration related comment.

Applied to dpdk-next-net-intel, thanks!

/Helin

#6 lore raw

Re: [PATCH v3] doc: update flow filtering document

In reply to Wei Zhao
Quoted 5 lines · Wei Zhao

This patch will update example application of flow_filtering document. It add Tx queues configuration related comment.

Hi Wei,

This patch is causing documentation warning:
...dpdk/doc/guides/sample_app_ug/flow_filtering.rst:161: WARNING: Could not lex literal_block as "c". Highlighting skipped.

#7 lore raw

Re: [PATCH v3] doc: update flow filtering document

Quoted 13 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, January 31, 2018 5:24 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Mcnamara, John <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering document

Quoted 3 lines · Wei Zhao

This patch will update example application of flow_filtering document. It add Tx queues configuration related comment.

Quoted 8 lines
Quoted 2 lines

Hi Wei,

This patch is causing documentation warning:
...dpdk/doc/guides/sample_app_ug/flow_filtering.rst:161: WARNING: Could not lex literal_block as "c". Highlighting skipped.

Hi,

The reason for the warning was due to 2 instances like the following:

+ rte_exit(EXIT_FAILURE,

+                                    ":: Rx queue setup failed: err=%d,
+                                    port=%u\n",
+                                    ret, port_id);

Here the error string extends over 2 lines so the error message will print out a newline and a lot of whitespace in the middle of the string. It should probably be something like the following:

+ rte_exit(EXIT_FAILURE,

+                                    ":: Rx queue setup failed: err=%d, "
+                                    "port=%u\n",
+                                    ret, port_id);

or just:

+ rte_exit(EXIT_FAILURE,
+ ":: Rx queue setup failed: err=%d, port=%u\n",
+ ret, port_id);

We can fix the code in the doc but you should probably fix this in the code as well.

John

#8 lore raw

Re: [PATCH v3] doc: update flow filtering document

Quoted 42 lines · John
Quoted 13 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, January 31, 2018 5:24 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Mcnamara, John <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering document

Quoted 3 lines · Wei Zhao

This patch will update example application of flow_filtering document. It add Tx queues configuration related comment.

Quoted 8 lines
Quoted 2 lines

Hi Wei,

This patch is causing documentation warning:
...dpdk/doc/guides/sample_app_ug/flow_filtering.rst:161: WARNING: Could not lex literal_block as "c". Highlighting skipped.

Hi,

The reason for the warning was due to 2 instances like the following:

doc/guides/sample_app_ug/flow_filtering.rst +4 -0
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d,
+                                    port=%u\n",
+                                    ret, port_id);

Here the error string extends over 2 lines so the error message will print out a newline and a lot of whitespace in the middle of the string. It should probably be something like the following:

doc/guides/sample_app_ug/flow_filtering.rst +4 -0
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d, "
+                                    "port=%u\n",
+                                    ret, port_id);

or just:

doc/guides/sample_app_ug/flow_filtering.rst application is shown below: · line 209

Quoted 3 lines
doc/guides/sample_app_ug/flow_filtering.rst +3 -0
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d, port=%u\n",
+                                    ret, port_id);

Thanks for clarifying this John.

Patch pulled from next-net-intel to next-net and suggested fix applied on next-net.

author
#9 lore raw

Re: [PATCH v3] doc: update flow filtering document

Hi, Ferruh

Quoted 53 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, February 6, 2018 10:19 PM
To: Mcnamara, John <[email protected]>; Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering document

Quoted 33 lines · John
Quoted 14 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, January 31, 2018 5:24 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Mcnamara, John <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering document

Quoted 3 lines · Wei Zhao

This patch will update example application of flow_filtering document. It add Tx queues configuration related comment.

Quoted 8 lines
Quoted 2 lines

Hi Wei,

This patch is causing documentation warning:
...dpdk/doc/guides/sample_app_ug/flow_filtering.rst:161: WARNING:
Could not lex literal_block as "c". Highlighting skipped.

Hi,

The reason for the warning was due to 2 instances like the following:

doc/guides/sample_app_ug/flow_filtering.rst +4 -0
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d,
+                                    port=%u\n",
+                                    ret, port_id);
Quoted 2 lines

Here the error string extends over 2 lines so the error message will print out a newline and a lot of whitespace in the middle of the string. It

should probably be something like the following:

Quoted 8 lines
doc/guides/sample_app_ug/flow_filtering.rst +4 -0
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d, "
+                                    "port=%u\n",
+                                    ret, port_id);

or just:

Quoted 8 lines

doc/guides/sample_app_ug/flow_filtering.rst application is shown below: · line 209

Quoted 3 lines
doc/guides/sample_app_ug/flow_filtering.rst +3 -0
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d, port=%u\n",
+                                    ret, port_id);

Thanks for clarifying this John.

Patch pulled from next-net-intel to next-net and suggested fix applied on next-net.

Code in next-net-intel has been fixed for this issue, but code in v3 has not. So, the code you pull from next-net-intel has been changed to

	rte_exit(EXIT_FAILURE,
		":: Rx queue setup failed: err=%d, port=%u\n",
		ret, port_id);

you can have a double check, maybe it do not need fix patch.

author
#10 lore raw

Re: [PATCH v3] doc: update flow filtering document

In reply to Mcnamara, John

Ok, I will check that.

Thanks.

Quoted 59 lines

-----Original Message-----
From: Mcnamara, John
Sent: Monday, February 5, 2018 11:31 PM
To: Yigit, Ferruh <[email protected]>; Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: RE: [dpdk-dev] [PATCH v3] doc: update flow filtering document

Quoted 12 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, January 31, 2018 5:24 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Mcnamara, John <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering document

Quoted 3 lines · Wei Zhao

This patch will update example application of flow_filtering document. It add Tx queues configuration related comment.

Quoted 8 lines
Quoted 2 lines

Hi Wei,

This patch is causing documentation warning:
...dpdk/doc/guides/sample_app_ug/flow_filtering.rst:161: WARNING:
Could not lex literal_block as "c". Highlighting skipped.

Hi,

The reason for the warning was due to 2 instances like the following:

doc/guides/sample_app_ug/flow_filtering.rst +4 -0
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d,
+                                    port=%u\n",
+                                    ret, port_id);

Here the error string extends over 2 lines so the error message will print out a newline and a lot of whitespace in the middle of the string. It should probably be something like the following:

doc/guides/sample_app_ug/flow_filtering.rst +4 -0
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d, "
+                                    "port=%u\n",
+                                    ret, port_id);

or just:

doc/guides/sample_app_ug/flow_filtering.rst +3 -0
+                            rte_exit(EXIT_FAILURE,
+                                    ":: Rx queue setup failed: err=%d, port=%u\n",
+                                    ret, port_id);

We can fix the code in the doc but you should probably fix this in the code as well.

John