[dpdk-dev,v3] doc: update flow filtering document

Message ID 20180131021227.129117-1-wei.zhao1@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Helin Zhang
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Zhao1, Wei Jan. 31, 2018, 2:12 a.m. UTC
  This patch will update example application of flow_filtering document.
It add Tx queues configuration related comment.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Reviewed-by: Ori Kam <orika@mellanox.com>

---

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(-)
  

Comments

Zhang, Helin Jan. 31, 2018, 6:50 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao
> Sent: Wednesday, January 31, 2018 10:12 AM
> To: dev@dpdk.org
> Cc: Mcnamara, John; stable@dpdk.org; orika@mellanox.com; Zhao1, Wei
> Subject: [dpdk-dev] [PATCH v3] doc: update flow filtering document
> 
> This patch will update example application of flow_filtering document.
> It add Tx queues configuration related comment.
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> Reviewed-by: Ori Kam <orika@mellanox.com>
Applied to dpdk-next-net-intel, thanks!

/Helin
  
Ferruh Yigit Jan. 31, 2018, 5:24 p.m. UTC | #2
On 1/31/2018 2:12 AM, Wei Zhao wrote:
> This patch will update example application of flow_filtering document.
> It add Tx queues configuration related comment.
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> Reviewed-by: Ori Kam <orika@mellanox.com>

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.
  
John McNamara Feb. 5, 2018, 3:31 p.m. UTC | #3
> -----Original Message-----

> From: Yigit, Ferruh

> Sent: Wednesday, January 31, 2018 5:24 PM

> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org

> Cc: Mcnamara, John <john.mcnamara@intel.com>; stable@dpdk.org;

> orika@mellanox.com

> Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering document

> 

> On 1/31/2018 2:12 AM, Wei Zhao wrote:

> > This patch will update example application of flow_filtering document.

> > It add Tx queues configuration related comment.

> >

> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

> > Reviewed-by: Ori Kam <orika@mellanox.com>

> 

> 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
  
Ferruh Yigit Feb. 6, 2018, 2:18 p.m. UTC | #4
On 2/5/2018 3:31 PM, Mcnamara, John wrote:
> 
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Wednesday, January 31, 2018 5:24 PM
>> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
>> Cc: Mcnamara, John <john.mcnamara@intel.com>; stable@dpdk.org;
>> orika@mellanox.com
>> Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering document
>>
>> On 1/31/2018 2:12 AM, Wei Zhao wrote:
>>> This patch will update example application of flow_filtering document.
>>> It add Tx queues configuration related comment.
>>>
>>> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
>>> Reviewed-by: Ori Kam <orika@mellanox.com>
>>
>> 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);

Thanks for clarifying this John.

Patch pulled from next-net-intel to next-net and suggested fix applied on next-net.
  
Zhao1, Wei Feb. 7, 2018, 7:37 a.m. UTC | #5
Ok, I will check that.

Thanks.

> -----Original Message-----

> From: Mcnamara, John

> Sent: Monday, February 5, 2018 11:31 PM

> To: Yigit, Ferruh <ferruh.yigit@intel.com>; Zhao1, Wei

> <wei.zhao1@intel.com>; dev@dpdk.org

> Cc: stable@dpdk.org; orika@mellanox.com

> Subject: RE: [dpdk-dev] [PATCH v3] doc: update flow filtering document

> 

> 

> > -----Original Message-----

> > From: Yigit, Ferruh

> > Sent: Wednesday, January 31, 2018 5:24 PM

> > To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org

> > Cc: Mcnamara, John <john.mcnamara@intel.com>; stable@dpdk.org;

> > orika@mellanox.com

> > Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering document

> >

> > On 1/31/2018 2:12 AM, Wei Zhao wrote:

> > > This patch will update example application of flow_filtering document.

> > > It add Tx queues configuration related comment.

> > >

> > > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

> > > Reviewed-by: Ori Kam <orika@mellanox.com>

> >

> > 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
  
Zhao1, Wei Feb. 7, 2018, 8:07 a.m. UTC | #6
Hi, Ferruh

> -----Original Message-----

> From: Yigit, Ferruh

> Sent: Tuesday, February 6, 2018 10:19 PM

> To: Mcnamara, John <john.mcnamara@intel.com>; Zhao1, Wei

> <wei.zhao1@intel.com>; dev@dpdk.org

> Cc: stable@dpdk.org; orika@mellanox.com

> Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering document

> 

> On 2/5/2018 3:31 PM, Mcnamara, John wrote:

> >

> >> -----Original Message-----

> >> From: Yigit, Ferruh

> >> Sent: Wednesday, January 31, 2018 5:24 PM

> >> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org

> >> Cc: Mcnamara, John <john.mcnamara@intel.com>; stable@dpdk.org;

> >> orika@mellanox.com

> >> Subject: Re: [dpdk-dev] [PATCH v3] doc: update flow filtering

> >> document

> >>

> >> On 1/31/2018 2:12 AM, Wei Zhao wrote:

> >>> This patch will update example application of flow_filtering document.

> >>> It add Tx queues configuration related comment.

> >>>

> >>> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

> >>> Reviewed-by: Ori Kam <orika@mellanox.com>

> >>

> >> 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);

> 

> 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.
  

Patch

diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst
index 725dcb4..b4a1dd7 100644
--- a/doc/guides/sample_app_ug/flow_filtering.rst
+++ b/doc/guides/sample_app_ug/flow_filtering.rst
@@ -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