diff mbox series

[ovs-dev] netdev-dpdk: New option 'hw_strip_crc' fields for DPDK interfaces

Message ID 1507540142-9313-1-git-send-email-wenxu@ucloud.cn
State Changes Requested
Delegated to: Ian Stokes
Headers show
Series [ovs-dev] netdev-dpdk: New option 'hw_strip_crc' fields for DPDK interfaces | expand

Commit Message

wenxu Oct. 9, 2017, 9:09 a.m. UTC
From: wenxu <wenxu@ucloud.cn>

Some vf driver like i40evf can't disable the hw_strip_crc, with err
'dpdk|ERR|i40evf_dev_configure(): VF can't disable HW CRC Strip'
so hw_strip_crc feature should can be configurable

Signed-off-by: wenxu <wenxu@ucloud.cn>
---
 NEWS                 |  2 ++
 lib/netdev-dpdk.c    | 30 ++++++++++++++++++++++++++++++
 vswitchd/vswitch.xml |  9 +++++++++
 3 files changed, 41 insertions(+)

Comments

Gao Zhenyu Oct. 9, 2017, 1:13 p.m. UTC | #1
Thanks for working on it.

I want to know if we can have a patch to try one more time if we hit the
hw_strip_crc error since we had introduce many options in ovs-dpdk now.
(Just like function dpdk_eth_dev_queue_setup, it figures out queue number
by retrying)

Thanks
Zhenyu Gao

2017-10-09 17:09 GMT+08:00 <wenxu@ucloud.cn>:

> From: wenxu <wenxu@ucloud.cn>
>
> Some vf driver like i40evf can't disable the hw_strip_crc, with err
> 'dpdk|ERR|i40evf_dev_configure(): VF can't disable HW CRC Strip'
> so hw_strip_crc feature should can be configurable
>
> Signed-off-by: wenxu <wenxu@ucloud.cn>
> ---
>  NEWS                 |  2 ++
>  lib/netdev-dpdk.c    | 30 ++++++++++++++++++++++++++++++
>  vswitchd/vswitch.xml |  9 +++++++++
>  3 files changed, 41 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index a3c1a02..d913847 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -5,6 +5,8 @@ Post-v2.8.0
>         chassis "hostname" in addition to a chassis "name".
>     - Linux kernel 4.13
>       * Add support for compiling OVS with the latest Linux 4.13 kernel
> +   - DPDK:
> +     * New option 'hw_strip_crc' fields for DPDK interfaces
>
>  v2.8.0 - xx xxx xxxx
>  ---------------------
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index c60f46f..23c2a72 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -402,11 +402,15 @@ struct netdev_dpdk {
>      int requested_n_rxq;
>      int requested_rxq_size;
>      int requested_txq_size;
> +    bool requested_hw_strip_crc;
>
>      /* Number of rx/tx descriptors for physical devices */
>      int rxq_size;
>      int txq_size;
>
> +    /*crc strip feature config*/
> +    bool hw_strip_crc;
> +
>      /* Socket ID detected when vHost device is brought up */
>      int requested_socket_id;
>
> @@ -700,6 +704,7 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int
> n_rxq, int n_txq)
>
>      conf.rxmode.hw_ip_checksum = (dev->hw_ol_features &
>                                    NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
> +    conf.rxmode.hw_strip_crc = dev->hw_strip_crc;
>      /* A device may report more queues than it makes available (this has
>       * been observed for Intel xl710, which reserves some of them for
>       * SRIOV):  rte_eth_*_queue_setup will fail if a queue is not
> @@ -914,6 +919,8 @@ common_construct(struct netdev *netdev, dpdk_port_t
> port_no,
>      dev->requested_n_txq = NR_QUEUE;
>      dev->requested_rxq_size = NIC_PORT_DEFAULT_RXQ_SIZE;
>      dev->requested_txq_size = NIC_PORT_DEFAULT_TXQ_SIZE;
> +    dev->requested_hw_strip_crc = false;
> +    dev->hw_strip_crc = false;
>
>      /* Initialize the flow control to NULL */
>      memset(&dev->fc_conf, 0, sizeof dev->fc_conf);
> @@ -1192,6 +1199,11 @@ netdev_dpdk_get_config(const struct netdev *netdev,
> struct smap *args)
>          } else {
>              smap_add(args, "rx_csum_offload", "false");
>          }
> +        if (dev->hw_strip_crc) {
> +            smap_add(args, "hw_strip_crc", "true");
> +        } else {
> +            smap_add(args, "hw_strip_crc", "false");
> +        }
>      }
>      ovs_mutex_unlock(&dev->mutex);
>
> @@ -1255,6 +1267,19 @@ dpdk_set_rxq_config(struct netdev_dpdk *dev, const
> struct smap *args)
>  }
>
>  static void
> +dpdk_set_hw_strip_crc_config(struct netdev_dpdk *dev, const struct smap
> *args)
> +     OVS_REQUIRES(dev->mutex)
> +{
> +    int new_hw_strip_crc;
> +
> +    new_hw_strip_crc = smap_get_bool(args, "hw_strip_crc", false);
> +    if (new_hw_strip_crc != dev->requested_hw_strip_crc) {
> +        dev->requested_hw_strip_crc = new_hw_strip_crc;
> +        netdev_request_reconfigure(&dev->up);
> +    }
> +}
> +
> +static void
>  dpdk_process_queue_size(struct netdev *netdev, const struct smap *args,
>                          const char *flag, int default_size, int *new_size)
>  {
> @@ -1290,6 +1315,8 @@ netdev_dpdk_set_config(struct netdev *netdev, const
> struct smap *args,
>
>      dpdk_set_rxq_config(dev, args);
>
> +    dpdk_set_hw_strip_crc_config(dev, args);
> +
>      dpdk_process_queue_size(netdev, args, "n_rxq_desc",
>                              NIC_PORT_DEFAULT_RXQ_SIZE,
>                              &dev->requested_rxq_size);
> @@ -3196,6 +3223,7 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
>      if (netdev->n_txq == dev->requested_n_txq
>          && netdev->n_rxq == dev->requested_n_rxq
>          && dev->mtu == dev->requested_mtu
> +        && dev->hw_strip_crc == dev->requested_hw_strip_crc
>          && dev->rxq_size == dev->requested_rxq_size
>          && dev->txq_size == dev->requested_txq_size
>          && dev->socket_id == dev->requested_socket_id) {
> @@ -3217,6 +3245,8 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
>      dev->rxq_size = dev->requested_rxq_size;
>      dev->txq_size = dev->requested_txq_size;
>
> +    dev->hw_strip_crc = dev->requested_hw_strip_crc;
> +
>      rte_free(dev->tx_q);
>      err = dpdk_eth_dev_init(dev);
>      dev->tx_q = netdev_dpdk_alloc_txq(netdev->n_txq);
> diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
> index 074535b..d1e7a6b 100644
> --- a/vswitchd/vswitch.xml
> +++ b/vswitchd/vswitch.xml
> @@ -2589,6 +2589,15 @@
>          </p>
>        </column>
>
> +      <column name="options" key="hw_strip_crc"
> +              type='{"type": "bool"}'>
> +        <p>
> +          Specifies DPDK interfaces whether enable hw_strip_crc feature
> or not.
> +          If not specified, the default is false.
> +          Not supported by DPDK vHost interfaces.
> +        </p>
> +      </column>
> +
>        <column name="other_config" key="pmd-rxq-affinity">
>          <p>Specifies mapping of RX queues of this interface to CPU
> cores.</p>
>          <p>Value should be set in the following form:</p>
> --
> 1.8.3.1
>
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
wenxu Oct. 10, 2017, 2:33 a.m. UTC | #2
Hi Zhenyu,


I think add a option maybe better.


1. It keep unchange the action with default value is false
2. It can be try one more time but if there some other different config, there should be more times to try
3. For some user who want to enable this feature, it can be configurable




在 2017-10-09 21:13:12,"Gao Zhenyu" <sysugaozhenyu@gmail.com> 写道:

Thanks for working on it.


I want to know if we can have a patch to try one more time if we hit the hw_strip_crc error since we had introduce many options in ovs-dpdk now. (Just like function dpdk_eth_dev_queue_setup, it figures out queue number by retrying)


Thanks
Zhenyu Gao


2017-10-09 17:09 GMT+08:00 <wenxu@ucloud.cn>:
From: wenxu <wenxu@ucloud.cn>

Some vf driver like i40evf can't disable the hw_strip_crc, with err
'dpdk|ERR|i40evf_dev_configure(): VF can't disable HW CRC Strip'
so hw_strip_crc feature should can be configurable

Signed-off-by: wenxu <wenxu@ucloud.cn>
---
 NEWS                 |  2 ++
 lib/netdev-dpdk.c    | 30 ++++++++++++++++++++++++++++++
 vswitchd/vswitch.xml |  9 +++++++++
 3 files changed, 41 insertions(+)

diff --git a/NEWS b/NEWS
index a3c1a02..d913847 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Post-v2.8.0
        chassis "hostname" in addition to a chassis "name".
    - Linux kernel 4.13
      * Add support for compiling OVS with the latest Linux 4.13 kernel
+   - DPDK:
+     * New option 'hw_strip_crc' fields for DPDK interfaces

 v2.8.0 - xx xxx xxxx
 ---------------------
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index c60f46f..23c2a72 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -402,11 +402,15 @@ struct netdev_dpdk {
     int requested_n_rxq;
     int requested_rxq_size;
     int requested_txq_size;
+    bool requested_hw_strip_crc;

     /* Number of rx/tx descriptors for physical devices */
     int rxq_size;
     int txq_size;

+    /*crc strip feature config*/
+    bool hw_strip_crc;
+
     /* Socket ID detected when vHost device is brought up */
     int requested_socket_id;

@@ -700,6 +704,7 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)

     conf.rxmode.hw_ip_checksum = (dev->hw_ol_features &
                                   NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
+    conf.rxmode.hw_strip_crc = dev->hw_strip_crc;
     /* A device may report more queues than it makes available (this has
      * been observed for Intel xl710, which reserves some of them for
      * SRIOV):  rte_eth_*_queue_setup will fail if a queue is not
@@ -914,6 +919,8 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no,
     dev->requested_n_txq = NR_QUEUE;
     dev->requested_rxq_size = NIC_PORT_DEFAULT_RXQ_SIZE;
     dev->requested_txq_size = NIC_PORT_DEFAULT_TXQ_SIZE;
+    dev->requested_hw_strip_crc = false;
+    dev->hw_strip_crc = false;

     /* Initialize the flow control to NULL */
     memset(&dev->fc_conf, 0, sizeof dev->fc_conf);
@@ -1192,6 +1199,11 @@ netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args)
         } else {
             smap_add(args, "rx_csum_offload", "false");
         }
+        if (dev->hw_strip_crc) {
+            smap_add(args, "hw_strip_crc", "true");
+        } else {
+            smap_add(args, "hw_strip_crc", "false");
+        }
     }
     ovs_mutex_unlock(&dev->mutex);

@@ -1255,6 +1267,19 @@ dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args)
 }

 static void
+dpdk_set_hw_strip_crc_config(struct netdev_dpdk *dev, const struct smap *args)
+     OVS_REQUIRES(dev->mutex)
+{
+    int new_hw_strip_crc;
+
+    new_hw_strip_crc = smap_get_bool(args, "hw_strip_crc", false);
+    if (new_hw_strip_crc != dev->requested_hw_strip_crc) {
+        dev->requested_hw_strip_crc = new_hw_strip_crc;
+        netdev_request_reconfigure(&dev->up);
+    }
+}
+
+static void
 dpdk_process_queue_size(struct netdev *netdev, const struct smap *args,
                         const char *flag, int default_size, int *new_size)
 {
@@ -1290,6 +1315,8 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args,

     dpdk_set_rxq_config(dev, args);

+    dpdk_set_hw_strip_crc_config(dev, args);
+
     dpdk_process_queue_size(netdev, args, "n_rxq_desc",
                             NIC_PORT_DEFAULT_RXQ_SIZE,
                             &dev->requested_rxq_size);
@@ -3196,6 +3223,7 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
     if (netdev->n_txq == dev->requested_n_txq
         && netdev->n_rxq == dev->requested_n_rxq
         && dev->mtu == dev->requested_mtu
+        && dev->hw_strip_crc == dev->requested_hw_strip_crc
         && dev->rxq_size == dev->requested_rxq_size
         && dev->txq_size == dev->requested_txq_size
         && dev->socket_id == dev->requested_socket_id) {
@@ -3217,6 +3245,8 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
     dev->rxq_size = dev->requested_rxq_size;
     dev->txq_size = dev->requested_txq_size;

+    dev->hw_strip_crc = dev->requested_hw_strip_crc;
+
     rte_free(dev->tx_q);
     err = dpdk_eth_dev_init(dev);
     dev->tx_q = netdev_dpdk_alloc_txq(netdev->n_txq);
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 074535b..d1e7a6b 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -2589,6 +2589,15 @@
         </p>
       </column>

+      <column name="options" key="hw_strip_crc"
+              type='{"type": "bool"}'>
+        <p>
+          Specifies DPDK interfaces whether enable hw_strip_crc feature or not.
+          If not specified, the default is false.
+          Not supported by DPDK vHost interfaces.
+        </p>
+      </column>
+
       <column name="other_config" key="pmd-rxq-affinity">
         <p>Specifies mapping of RX queues of this interface to CPU cores.</p>
         <p>Value should be set in the following form:</p>
--
1.8.3.1
Chandran, Sugesh Oct. 13, 2017, 10:28 a.m. UTC | #3
Hi Wenxu,
Thank you for the patch.
I had reviewed the patch and I have same comment as Zhenyu.

As you said there are so many other configs. Its not a good practice to offer configuration choices for some of them.
I don’t think user see any difference in performance/functionality either its enabled/disabled.
My understanding is, this will let user to reconfigure the port again with hw_strip_crc when they see a failure.
Instead of having an option for user. How about check the support first and enable/disable accordingly. I think DPDK doesn’t provide this information in its rte_eth_dev_info now. However its worth to check the possibility in DPDK to report hw_crc_strip feature support  with other flags.
It looks similar to how rx checksum offload is being handled in OVS-DPDK.

Also if all the DPDK NICs can support the hw_crc_strip, it make sense to keep it enable as a default choice.
What do you think?





Regards
_Sugesh

> -----Original Message-----
> From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-
> bounces@openvswitch.org] On Behalf Of wenxu
> Sent: Tuesday, October 10, 2017 3:33 AM
> To: Gao Zhenyu <sysugaozhenyu@gmail.com>
> Cc: ovs dev <dev@openvswitch.org>
> Subject: Re: [ovs-dev] [PATCH] netdev-dpdk: New option 'hw_strip_crc' fields
> for DPDK interfaces
> 
> Hi Zhenyu,
> 
> 
> I think add a option maybe better.
> 
> 
> 1. It keep unchange the action with default value is false 2. It can be try one
> more time but if there some other different config, there should be more times
> to try 3. For some user who want to enable this feature, it can be configurable
> 
> 
> 
> 
> 在 2017-10-09 21:13:12,"Gao Zhenyu" <sysugaozhenyu@gmail.com> 写道:
> 
> Thanks for working on it.
> 
> 
> I want to know if we can have a patch to try one more time if we hit the
> hw_strip_crc error since we had introduce many options in ovs-dpdk now. (Just
> like function dpdk_eth_dev_queue_setup, it figures out queue number by
> retrying)
> 
> 
> Thanks
> Zhenyu Gao
> 
> 
> 2017-10-09 17:09 GMT+08:00 <wenxu@ucloud.cn>:
> From: wenxu <wenxu@ucloud.cn>
> 
> Some vf driver like i40evf can't disable the hw_strip_crc, with err
> 'dpdk|ERR|i40evf_dev_configure(): VF can't disable HW CRC Strip'
> so hw_strip_crc feature should can be configurable
> 
> Signed-off-by: wenxu <wenxu@ucloud.cn>
> ---
>  NEWS                 |  2 ++
>  lib/netdev-dpdk.c    | 30 ++++++++++++++++++++++++++++++
>  vswitchd/vswitch.xml |  9 +++++++++
>  3 files changed, 41 insertions(+)
> 
> diff --git a/NEWS b/NEWS
> index a3c1a02..d913847 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -5,6 +5,8 @@ Post-v2.8.0
>         chassis "hostname" in addition to a chassis "name".
>     - Linux kernel 4.13
>       * Add support for compiling OVS with the latest Linux 4.13 kernel
> +   - DPDK:
> +     * New option 'hw_strip_crc' fields for DPDK interfaces
> 
>  v2.8.0 - xx xxx xxxx
>  ---------------------
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index c60f46f..23c2a72
> 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -402,11 +402,15 @@ struct netdev_dpdk {
>      int requested_n_rxq;
>      int requested_rxq_size;
>      int requested_txq_size;
> +    bool requested_hw_strip_crc;
> 
>      /* Number of rx/tx descriptors for physical devices */
>      int rxq_size;
>      int txq_size;
> 
> +    /*crc strip feature config*/
> +    bool hw_strip_crc;
> +
>      /* Socket ID detected when vHost device is brought up */
>      int requested_socket_id;
> 
> @@ -700,6 +704,7 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev,
> int n_rxq, int n_txq)
> 
>      conf.rxmode.hw_ip_checksum = (dev->hw_ol_features &
>                                    NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
> +    conf.rxmode.hw_strip_crc = dev->hw_strip_crc;
>      /* A device may report more queues than it makes available (this has
>       * been observed for Intel xl710, which reserves some of them for
>       * SRIOV):  rte_eth_*_queue_setup will fail if a queue is not @@ -914,6
> +919,8 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no,
>      dev->requested_n_txq = NR_QUEUE;
>      dev->requested_rxq_size = NIC_PORT_DEFAULT_RXQ_SIZE;
>      dev->requested_txq_size = NIC_PORT_DEFAULT_TXQ_SIZE;
> +    dev->requested_hw_strip_crc = false;
> +    dev->hw_strip_crc = false;
> 
>      /* Initialize the flow control to NULL */
>      memset(&dev->fc_conf, 0, sizeof dev->fc_conf); @@ -1192,6 +1199,11 @@
> netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args)
>          } else {
>              smap_add(args, "rx_csum_offload", "false");
>          }
> +        if (dev->hw_strip_crc) {
> +            smap_add(args, "hw_strip_crc", "true");
> +        } else {
> +            smap_add(args, "hw_strip_crc", "false");
> +        }
>      }
>      ovs_mutex_unlock(&dev->mutex);
> 
> @@ -1255,6 +1267,19 @@ dpdk_set_rxq_config(struct netdev_dpdk *dev,
> const struct smap *args)  }
> 
>  static void
> +dpdk_set_hw_strip_crc_config(struct netdev_dpdk *dev, const struct smap
> *args)
> +     OVS_REQUIRES(dev->mutex)
> +{
> +    int new_hw_strip_crc;
> +
> +    new_hw_strip_crc = smap_get_bool(args, "hw_strip_crc", false);
> +    if (new_hw_strip_crc != dev->requested_hw_strip_crc) {
> +        dev->requested_hw_strip_crc = new_hw_strip_crc;
> +        netdev_request_reconfigure(&dev->up);
> +    }
> +}
> +
> +static void
>  dpdk_process_queue_size(struct netdev *netdev, const struct smap *args,
>                          const char *flag, int default_size, int *new_size)  { @@ -1290,6
> +1315,8 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap
> *args,
> 
>      dpdk_set_rxq_config(dev, args);
> 
> +    dpdk_set_hw_strip_crc_config(dev, args);
> +
>      dpdk_process_queue_size(netdev, args, "n_rxq_desc",
>                              NIC_PORT_DEFAULT_RXQ_SIZE,
>                              &dev->requested_rxq_size); @@ -3196,6 +3223,7 @@
> netdev_dpdk_reconfigure(struct netdev *netdev)
>      if (netdev->n_txq == dev->requested_n_txq
>          && netdev->n_rxq == dev->requested_n_rxq
>          && dev->mtu == dev->requested_mtu
> +        && dev->hw_strip_crc == dev->requested_hw_strip_crc
>          && dev->rxq_size == dev->requested_rxq_size
>          && dev->txq_size == dev->requested_txq_size
>          && dev->socket_id == dev->requested_socket_id) { @@ -3217,6 +3245,8
> @@ netdev_dpdk_reconfigure(struct netdev *netdev)
>      dev->rxq_size = dev->requested_rxq_size;
>      dev->txq_size = dev->requested_txq_size;
> 
> +    dev->hw_strip_crc = dev->requested_hw_strip_crc;
> +
>      rte_free(dev->tx_q);
>      err = dpdk_eth_dev_init(dev);
>      dev->tx_q = netdev_dpdk_alloc_txq(netdev->n_txq);
> diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index
> 074535b..d1e7a6b 100644
> --- a/vswitchd/vswitch.xml
> +++ b/vswitchd/vswitch.xml
> @@ -2589,6 +2589,15 @@
>          </p>
>        </column>
> 
> +      <column name="options" key="hw_strip_crc"
> +              type='{"type": "bool"}'>
> +        <p>
> +          Specifies DPDK interfaces whether enable hw_strip_crc feature or not.
> +          If not specified, the default is false.
> +          Not supported by DPDK vHost interfaces.
> +        </p>
> +      </column>
> +
>        <column name="other_config" key="pmd-rxq-affinity">
>          <p>Specifies mapping of RX queues of this interface to CPU cores.</p>
>          <p>Value should be set in the following form:</p>
> --
> 1.8.3.1
> 
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
wenxu Oct. 14, 2017, 2:33 a.m. UTC | #4
Hi Sugesh, 


I agree with you !  If there is hw_strip_crc info in the rte_eth_dev_info, it can be configured dynamic. If all the DPDK NICs can support the hw_crc_strip, it can be enable default. Maybe this can be check by DPDK guys?







At 2017-10-13 18:28:46, "Chandran, Sugesh" <sugesh.chandran@intel.com> wrote:
>Hi Wenxu,
>Thank you for the patch.
>I had reviewed the patch and I have same comment as Zhenyu.
>
>As you said there are so many other configs. Its not a good practice to offer configuration choices for some of them.
>I don’t think user see any difference in performance/functionality either its enabled/disabled.
>My understanding is, this will let user to reconfigure the port again with hw_strip_crc when they see a failure.
>Instead of having an option for user. How about check the support first and enable/disable accordingly. I think DPDK doesn’t provide this information in its rte_eth_dev_info now. However its worth to check the possibility in DPDK to report hw_crc_strip feature support  with other flags.
>It looks similar to how rx checksum offload is being handled in OVS-DPDK.
>
>Also if all the DPDK NICs can support the hw_crc_strip, it make sense to keep it enable as a default choice.
>What do you think?
>
>
>
>
>
>Regards
>_Sugesh
>
>> -----Original Message-----
>> From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-
>> bounces@openvswitch.org] On Behalf Of wenxu
>> Sent: Tuesday, October 10, 2017 3:33 AM
>> To: Gao Zhenyu <sysugaozhenyu@gmail.com>
>> Cc: ovs dev <dev@openvswitch.org>
>> Subject: Re: [ovs-dev] [PATCH] netdev-dpdk: New option 'hw_strip_crc' fields
>> for DPDK interfaces
>> 
>> Hi Zhenyu,
>> 
>> 
>> I think add a option maybe better.
>> 
>> 
>> 1. It keep unchange the action with default value is false 2. It can be try one
>> more time but if there some other different config, there should be more times
>> to try 3. For some user who want to enable this feature, it can be configurable
>> 
>> 
>> 
>> 
>> 在 2017-10-09 21:13:12,"Gao Zhenyu" <sysugaozhenyu@gmail.com> 写道:
>> 
>> Thanks for working on it.
>> 
>> 
>> I want to know if we can have a patch to try one more time if we hit the
>> hw_strip_crc error since we had introduce many options in ovs-dpdk now. (Just
>> like function dpdk_eth_dev_queue_setup, it figures out queue number by
>> retrying)
>> 
>> 
>> Thanks
>> Zhenyu Gao
>> 
>> 
>> 2017-10-09 17:09 GMT+08:00 <wenxu@ucloud.cn>:
>> From: wenxu <wenxu@ucloud.cn>
>> 
>> Some vf driver like i40evf can't disable the hw_strip_crc, with err
>> 'dpdk|ERR|i40evf_dev_configure(): VF can't disable HW CRC Strip'
>> so hw_strip_crc feature should can be configurable
>> 
>> Signed-off-by: wenxu <wenxu@ucloud.cn>
>> ---
>>  NEWS                 |  2 ++
>>  lib/netdev-dpdk.c    | 30 ++++++++++++++++++++++++++++++
>>  vswitchd/vswitch.xml |  9 +++++++++
>>  3 files changed, 41 insertions(+)
>> 
>> diff --git a/NEWS b/NEWS
>> index a3c1a02..d913847 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -5,6 +5,8 @@ Post-v2.8.0
>>         chassis "hostname" in addition to a chassis "name".
>>     - Linux kernel 4.13
>>       * Add support for compiling OVS with the latest Linux 4.13 kernel
>> +   - DPDK:
>> +     * New option 'hw_strip_crc' fields for DPDK interfaces
>> 
>>  v2.8.0 - xx xxx xxxx
>>  ---------------------
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index c60f46f..23c2a72
>> 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -402,11 +402,15 @@ struct netdev_dpdk {
>>      int requested_n_rxq;
>>      int requested_rxq_size;
>>      int requested_txq_size;
>> +    bool requested_hw_strip_crc;
>> 
>>      /* Number of rx/tx descriptors for physical devices */
>>      int rxq_size;
>>      int txq_size;
>> 
>> +    /*crc strip feature config*/
>> +    bool hw_strip_crc;
>> +
>>      /* Socket ID detected when vHost device is brought up */
>>      int requested_socket_id;
>> 
>> @@ -700,6 +704,7 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev,
>> int n_rxq, int n_txq)
>> 
>>      conf.rxmode.hw_ip_checksum = (dev->hw_ol_features &
>>                                    NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
>> +    conf.rxmode.hw_strip_crc = dev->hw_strip_crc;
>>      /* A device may report more queues than it makes available (this has
>>       * been observed for Intel xl710, which reserves some of them for
>>       * SRIOV):  rte_eth_*_queue_setup will fail if a queue is not @@ -914,6
>> +919,8 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no,
>>      dev->requested_n_txq = NR_QUEUE;
>>      dev->requested_rxq_size = NIC_PORT_DEFAULT_RXQ_SIZE;
>>      dev->requested_txq_size = NIC_PORT_DEFAULT_TXQ_SIZE;
>> +    dev->requested_hw_strip_crc = false;
>> +    dev->hw_strip_crc = false;
>> 
>>      /* Initialize the flow control to NULL */
>>      memset(&dev->fc_conf, 0, sizeof dev->fc_conf); @@ -1192,6 +1199,11 @@
>> netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args)
>>          } else {
>>              smap_add(args, "rx_csum_offload", "false");
>>          }
>> +        if (dev->hw_strip_crc) {
>> +            smap_add(args, "hw_strip_crc", "true");
>> +        } else {
>> +            smap_add(args, "hw_strip_crc", "false");
>> +        }
>>      }
>>      ovs_mutex_unlock(&dev->mutex);
>> 
>> @@ -1255,6 +1267,19 @@ dpdk_set_rxq_config(struct netdev_dpdk *dev,
>> const struct smap *args)  }
>> 
>>  static void
>> +dpdk_set_hw_strip_crc_config(struct netdev_dpdk *dev, const struct smap
>> *args)
>> +     OVS_REQUIRES(dev->mutex)
>> +{
>> +    int new_hw_strip_crc;
>> +
>> +    new_hw_strip_crc = smap_get_bool(args, "hw_strip_crc", false);
>> +    if (new_hw_strip_crc != dev->requested_hw_strip_crc) {
>> +        dev->requested_hw_strip_crc = new_hw_strip_crc;
>> +        netdev_request_reconfigure(&dev->up);
>> +    }
>> +}
>> +
>> +static void
>>  dpdk_process_queue_size(struct netdev *netdev, const struct smap *args,
>>                          const char *flag, int default_size, int *new_size)  { @@ -1290,6
>> +1315,8 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap
>> *args,
>> 
>>      dpdk_set_rxq_config(dev, args);
>> 
>> +    dpdk_set_hw_strip_crc_config(dev, args);
>> +
>>      dpdk_process_queue_size(netdev, args, "n_rxq_desc",
>>                              NIC_PORT_DEFAULT_RXQ_SIZE,
>>                              &dev->requested_rxq_size); @@ -3196,6 +3223,7 @@
>> netdev_dpdk_reconfigure(struct netdev *netdev)
>>      if (netdev->n_txq == dev->requested_n_txq
>>          && netdev->n_rxq == dev->requested_n_rxq
>>          && dev->mtu == dev->requested_mtu
>> +        && dev->hw_strip_crc == dev->requested_hw_strip_crc
>>          && dev->rxq_size == dev->requested_rxq_size
>>          && dev->txq_size == dev->requested_txq_size
>>          && dev->socket_id == dev->requested_socket_id) { @@ -3217,6 +3245,8
>> @@ netdev_dpdk_reconfigure(struct netdev *netdev)
>>      dev->rxq_size = dev->requested_rxq_size;
>>      dev->txq_size = dev->requested_txq_size;
>> 
>> +    dev->hw_strip_crc = dev->requested_hw_strip_crc;
>> +
>>      rte_free(dev->tx_q);
>>      err = dpdk_eth_dev_init(dev);
>>      dev->tx_q = netdev_dpdk_alloc_txq(netdev->n_txq);
>> diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index
>> 074535b..d1e7a6b 100644
>> --- a/vswitchd/vswitch.xml
>> +++ b/vswitchd/vswitch.xml
>> @@ -2589,6 +2589,15 @@
>>          </p>
>>        </column>
>> 
>> +      <column name="options" key="hw_strip_crc"
>> +              type='{"type": "bool"}'>
>> +        <p>
>> +          Specifies DPDK interfaces whether enable hw_strip_crc feature or not.
>> +          If not specified, the default is false.
>> +          Not supported by DPDK vHost interfaces.
>> +        </p>
>> +      </column>
>> +
>>        <column name="other_config" key="pmd-rxq-affinity">
>>          <p>Specifies mapping of RX queues of this interface to CPU cores.</p>
>>          <p>Value should be set in the following form:</p>
>> --
>> 1.8.3.1
>> 
>> 
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>> 
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>_______________________________________________
>dev mailing list
>dev@openvswitch.org
>https://mail.openvswitch.org/mailman/listinfo/ovs-dev
wenxu Oct. 14, 2017, 2:45 a.m. UTC | #5
I just check it from DPDK http://dpdk.org/doc/guides/nics/overview.html#id1
Not all the DPDK NIC support hw_strip_crc






At 2017-10-14 10:33:21, "wenxu" <wenx05124561@163.com> wrote:



Hi Sugesh, 


I agree with you !  If there is hw_strip_crc info in the rte_eth_dev_info, it can be configured dynamic. If all the DPDK NICs can support the hw_crc_strip, it can be enable default. Maybe this can be check by DPDK guys?







At 2017-10-13 18:28:46, "Chandran, Sugesh" <sugesh.chandran@intel.com> wrote:
>Hi Wenxu,
>Thank you for the patch.
>I had reviewed the patch and I have same comment as Zhenyu.
>
>As you said there are so many other configs. Its not a good practice to offer configuration choices for some of them.
>I don’t think user see any difference in performance/functionality either its enabled/disabled.
>My understanding is, this will let user to reconfigure the port again with hw_strip_crc when they see a failure.
>Instead of having an option for user. How about check the support first and enable/disable accordingly. I think DPDK doesn’t provide this information in its rte_eth_dev_info now. However its worth to check the possibility in DPDK to report hw_crc_strip feature support  with other flags.
>It looks similar to how rx checksum offload is being handled in OVS-DPDK.
>
>Also if all the DPDK NICs can support the hw_crc_strip, it make sense to keep it enable as a default choice.
>What do you think?
>
>
>
>
>
>Regards
>_Sugesh
>
>> -----Original Message-----
>> From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-
>> bounces@openvswitch.org] On Behalf Of wenxu
>> Sent: Tuesday, October 10, 2017 3:33 AM
>> To: Gao Zhenyu <sysugaozhenyu@gmail.com>
>> Cc: ovs dev <dev@openvswitch.org>
>> Subject: Re: [ovs-dev] [PATCH] netdev-dpdk: New option 'hw_strip_crc' fields
>> for DPDK interfaces
>> 
>> Hi Zhenyu,
>> 
>> 
>> I think add a option maybe better.
>> 
>> 
>> 1. It keep unchange the action with default value is false 2. It can be try one
>> more time but if there some other different config, there should be more times
>> to try 3. For some user who want to enable this feature, it can be configurable
>> 
>> 
>> 
>> 
>> 在 2017-10-09 21:13:12,"Gao Zhenyu" <sysugaozhenyu@gmail.com> 写道:
>> 
>> Thanks for working on it.
>> 
>> 
>> I want to know if we can have a patch to try one more time if we hit the
>> hw_strip_crc error since we had introduce many options in ovs-dpdk now. (Just
>> like function dpdk_eth_dev_queue_setup, it figures out queue number by
>> retrying)
>> 
>> 
>> Thanks
>> Zhenyu Gao
>> 
>> 
>> 2017-10-09 17:09 GMT+08:00 <wenxu@ucloud.cn>:
>> From: wenxu <wenxu@ucloud.cn>
>> 
>> Some vf driver like i40evf can't disable the hw_strip_crc, with err
>> 'dpdk|ERR|i40evf_dev_configure(): VF can't disable HW CRC Strip'
>> so hw_strip_crc feature should can be configurable
>> 
>> Signed-off-by: wenxu <wenxu@ucloud.cn>
>> ---
>>  NEWS                 |  2 ++
>>  lib/netdev-dpdk.c    | 30 ++++++++++++++++++++++++++++++
>>  vswitchd/vswitch.xml |  9 +++++++++
>>  3 files changed, 41 insertions(+)
>> 
>> diff --git a/NEWS b/NEWS
>> index a3c1a02..d913847 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -5,6 +5,8 @@ Post-v2.8.0
>>         chassis "hostname" in addition to a chassis "name".
>>     - Linux kernel 4.13
>>       * Add support for compiling OVS with the latest Linux 4.13 kernel
>> +   - DPDK:
>> +     * New option 'hw_strip_crc' fields for DPDK interfaces
>> 
>>  v2.8.0 - xx xxx xxxx
>>  ---------------------
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index c60f46f..23c2a72
>> 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -402,11 +402,15 @@ struct netdev_dpdk {
>>      int requested_n_rxq;
>>      int requested_rxq_size;
>>      int requested_txq_size;
>> +    bool requested_hw_strip_crc;
>> 
>>      /* Number of rx/tx descriptors for physical devices */
>>      int rxq_size;
>>      int txq_size;
>> 
>> +    /*crc strip feature config*/
>> +    bool hw_strip_crc;
>> +
>>      /* Socket ID detected when vHost device is brought up */
>>      int requested_socket_id;
>> 
>> @@ -700,6 +704,7 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev,
>> int n_rxq, int n_txq)
>> 
>>      conf.rxmode.hw_ip_checksum = (dev->hw_ol_features &
>>                                    NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
>> +    conf.rxmode.hw_strip_crc = dev->hw_strip_crc;
>>      /* A device may report more queues than it makes available (this has
>>       * been observed for Intel xl710, which reserves some of them for
>>       * SRIOV):  rte_eth_*_queue_setup will fail if a queue is not @@ -914,6
>> +919,8 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no,
>>      dev->requested_n_txq = NR_QUEUE;
>>      dev->requested_rxq_size = NIC_PORT_DEFAULT_RXQ_SIZE;
>>      dev->requested_txq_size = NIC_PORT_DEFAULT_TXQ_SIZE;
>> +    dev->requested_hw_strip_crc = false;
>> +    dev->hw_strip_crc = false;
>> 
>>      /* Initialize the flow control to NULL */
>>      memset(&dev->fc_conf, 0, sizeof dev->fc_conf); @@ -1192,6 +1199,11 @@
>> netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args)
>>          } else {
>>              smap_add(args, "rx_csum_offload", "false");
>>          }
>> +        if (dev->hw_strip_crc) {
>> +            smap_add(args, "hw_strip_crc", "true");
>> +        } else {
>> +            smap_add(args, "hw_strip_crc", "false");
>> +        }
>>      }
>>      ovs_mutex_unlock(&dev->mutex);
>> 
>> @@ -1255,6 +1267,19 @@ dpdk_set_rxq_config(struct netdev_dpdk *dev,
>> const struct smap *args)  }
>> 
>>  static void
>> +dpdk_set_hw_strip_crc_config(struct netdev_dpdk *dev, const struct smap
>> *args)
>> +     OVS_REQUIRES(dev->mutex)
>> +{
>> +    int new_hw_strip_crc;
>> +
>> +    new_hw_strip_crc = smap_get_bool(args, "hw_strip_crc", false);
>> +    if (new_hw_strip_crc != dev->requested_hw_strip_crc) {
>> +        dev->requested_hw_strip_crc = new_hw_strip_crc;
>> +        netdev_request_reconfigure(&dev->up);
>> +    }
>> +}
>> +
>> +static void
>>  dpdk_process_queue_size(struct netdev *netdev, const struct smap *args,
>>                          const char *flag, int default_size, int *new_size)  { @@ -1290,6
>> +1315,8 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap
>> *args,
>> 
>>      dpdk_set_rxq_config(dev, args);
>> 
>> +    dpdk_set_hw_strip_crc_config(dev, args);
>> +
>>      dpdk_process_queue_size(netdev, args, "n_rxq_desc",
>>                              NIC_PORT_DEFAULT_RXQ_SIZE,
>>                              &dev->requested_rxq_size); @@ -3196,6 +3223,7 @@
>> netdev_dpdk_reconfigure(struct netdev *netdev)
>>      if (netdev->n_txq == dev->requested_n_txq
>>          && netdev->n_rxq == dev->requested_n_rxq
>>          && dev->mtu == dev->requested_mtu
>> +        && dev->hw_strip_crc == dev->requested_hw_strip_crc
>>          && dev->rxq_size == dev->requested_rxq_size
>>          && dev->txq_size == dev->requested_txq_size
>>          && dev->socket_id == dev->requested_socket_id) { @@ -3217,6 +3245,8
>> @@ netdev_dpdk_reconfigure(struct netdev *netdev)
>>      dev->rxq_size = dev->requested_rxq_size;
>>      dev->txq_size = dev->requested_txq_size;
>> 
>> +    dev->hw_strip_crc = dev->requested_hw_strip_crc;
>> +
>>      rte_free(dev->tx_q);
>>      err = dpdk_eth_dev_init(dev);
>>      dev->tx_q = netdev_dpdk_alloc_txq(netdev->n_txq);
>> diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index
>> 074535b..d1e7a6b 100644
>> --- a/vswitchd/vswitch.xml
>> +++ b/vswitchd/vswitch.xml
>> @@ -2589,6 +2589,15 @@
>>          </p>
>>        </column>
>> 
>> +      <column name="options" key="hw_strip_crc"
>> +              type='{"type": "bool"}'>
>> +        <p>
>> +          Specifies DPDK interfaces whether enable hw_strip_crc feature or not.
>> +          If not specified, the default is false.
>> +          Not supported by DPDK vHost interfaces.
>> +        </p>
>> +      </column>
>> +
>>        <column name="other_config" key="pmd-rxq-affinity">
>>          <p>Specifies mapping of RX queues of this interface to CPU cores.</p>
>>          <p>Value should be set in the following form:</p>
>> --
>> 1.8.3.1
>> 
>> 
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>> 
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>_______________________________________________
>dev mailing list
>dev@openvswitch.org
>https://mail.openvswitch.org/mailman/listinfo/ovs-dev




【网易自营】好吃到爆!鲜香弹滑加热即食,经典13香/麻辣小龙虾仅75元3斤>>
Chandran, Sugesh Oct. 15, 2017, 2:53 p.m. UTC | #6
Thank you for the link.

Looking at the table, i40e vf ..vec doesn’t support the crc offload at all.
So when vectorization is ON, its possible to disable the hw_strip_crc(By default its disabled according to the table) and start the port normally without any issue. This means the  port init error is happening only when using i40e-vf driver instead of i40e-vf ..vec? correct me if my understanding is wrong?

I feel, this offload feature should be discoverable from port and do a dynamic init based on it,  instead of making user to do it as a configuration.





Regards
_Sugesh

From: wenxu [mailto:wenx05124561@163.com]

Sent: Saturday, October 14, 2017 3:46 AM
To: Chandran, Sugesh <sugesh.chandran@intel.com>
Cc: Gao Zhenyu <sysugaozhenyu@gmail.com>; ovs dev <dev@openvswitch.org>
Subject: Re:[ovs-dev] [PATCH] netdev-dpdk: New option 'hw_strip_crc' fields for DPDK interfaces

I just check it from DPDK http://dpdk.org/doc/guides/nics/overview.html#id1
Not all the DPDK NIC support hw_strip_crc




At 2017-10-14 10:33:21, "wenxu" <wenx05124561@163.com<mailto:wenx05124561@163.com>> wrote:


Hi Sugesh,

I agree with you !  If there is hw_strip_crc info in the rte_eth_dev_info, it can be configured dynamic. If all the DPDK NICs can support the hw_crc_strip, it can be enable default. Maybe this can be check by DPDK guys?




At 2017-10-13 18:28:46, "Chandran, Sugesh" <sugesh.chandran@intel.com<mailto:sugesh.chandran@intel.com>> wrote:

>Hi Wenxu,


>Thank you for the patch.


>I had reviewed the patch and I have same comment as Zhenyu.


>


>As you said there are so many other configs. Its not a good practice to offer configuration choices for some of them.


>I don’t think user see any difference in performance/functionality either its enabled/disabled.


>My understanding is, this will let user to reconfigure the port again with hw_strip_crc when they see a failure.


>Instead of having an option for user. How about check the support first and enable/disable accordingly. I think DPDK doesn’t provide this information in its rte_eth_dev_info now. However its worth to check the possibility in DPDK to report hw_crc_strip feature support  with other flags.


>It looks similar to how rx checksum offload is being handled in OVS-DPDK.


>


>Also if all the DPDK NICs can support the hw_crc_strip, it make sense to keep it enable as a default choice.


>What do you think?


>


>


>


>


>


>Regards


>_Sugesh


>


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


>> From: ovs-dev-bounces@openvswitch.org<mailto:ovs-dev-bounces@openvswitch.org> [mailto:ovs-dev-


>> bounces@openvswitch.org<mailto:bounces@openvswitch.org>] On Behalf Of wenxu


>> Sent: Tuesday, October 10, 2017 3:33 AM


>> To: Gao Zhenyu <sysugaozhenyu@gmail.com<mailto:sysugaozhenyu@gmail.com>>


>> Cc: ovs dev <dev@openvswitch.org<mailto:dev@openvswitch.org>>


>> Subject: Re: [ovs-dev] [PATCH] netdev-dpdk: New option 'hw_strip_crc' fields


>> for DPDK interfaces


>>


>> Hi Zhenyu,


>>


>>


>> I think add a option maybe better.


>>


>>


>> 1. It keep unchange the action with default value is false 2. It can be try one


>> more time but if there some other different config, there should be more times


>> to try 3. For some user who want to enable this feature, it can be configurable


>>


>>


>>


>>


>> 在 2017-10-09 21:13:12,"Gao Zhenyu" <sysugaozhenyu@gmail.com<mailto:sysugaozhenyu@gmail.com>> 写道:


>>


>> Thanks for working on it.


>>


>>


>> I want to know if we can have a patch to try one more time if we hit the


>> hw_strip_crc error since we had introduce many options in ovs-dpdk now. (Just


>> like function dpdk_eth_dev_queue_setup, it figures out queue number by


>> retrying)


>>


>>


>> Thanks


>> Zhenyu Gao


>>


>>


>> 2017-10-09 17:09 GMT+08:00 <wenxu@ucloud.cn<mailto:wenxu@ucloud.cn>>:


>> From: wenxu <wenxu@ucloud.cn<mailto:wenxu@ucloud.cn>>


>>


>> Some vf driver like i40evf can't disable the hw_strip_crc, with err


>> 'dpdk|ERR|i40evf_dev_configure(): VF can't disable HW CRC Strip'


>> so hw_strip_crc feature should can be configurable


>>


>> Signed-off-by: wenxu <wenxu@ucloud.cn<mailto:wenxu@ucloud.cn>>


>> ---


>>  NEWS                 |  2 ++


>>  lib/netdev-dpdk.c    | 30 ++++++++++++++++++++++++++++++


>>  vswitchd/vswitch.xml |  9 +++++++++


>>  3 files changed, 41 insertions(+)


>>


>> diff --git a/NEWS b/NEWS


>> index a3c1a02..d913847 100644


>> --- a/NEWS


>> +++ b/NEWS


>> @@ -5,6 +5,8 @@ Post-v2.8.0


>>         chassis "hostname" in addition to a chassis "name".


>>     - Linux kernel 4.13


>>       * Add support for compiling OVS with the latest Linux 4.13 kernel


>> +   - DPDK:


>> +     * New option 'hw_strip_crc' fields for DPDK interfaces


>>


>>  v2.8.0 - xx xxx xxxx


>>  ---------------------


>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index c60f46f..23c2a72


>> 100644


>> --- a/lib/netdev-dpdk.c


>> +++ b/lib/netdev-dpdk.c


>> @@ -402,11 +402,15 @@ struct netdev_dpdk {


>>      int requested_n_rxq;


>>      int requested_rxq_size;


>>      int requested_txq_size;


>> +    bool requested_hw_strip_crc;


>>


>>      /* Number of rx/tx descriptors for physical devices */


>>      int rxq_size;


>>      int txq_size;


>>


>> +    /*crc strip feature config*/


>> +    bool hw_strip_crc;


>> +


>>      /* Socket ID detected when vHost device is brought up */


>>      int requested_socket_id;


>>


>> @@ -700,6 +704,7 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev,


>> int n_rxq, int n_txq)


>>


>>      conf.rxmode.hw_ip_checksum = (dev->hw_ol_features &


>>                                    NETDEV_RX_CHECKSUM_OFFLOAD) != 0;


>> +    conf.rxmode.hw_strip_crc = dev->hw_strip_crc;


>>      /* A device may report more queues than it makes available (this has


>>       * been observed for Intel xl710, which reserves some of them for


>>       * SRIOV):  rte_eth_*_queue_setup will fail if a queue is not @@ -914,6


>> +919,8 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no,


>>      dev->requested_n_txq = NR_QUEUE;


>>      dev->requested_rxq_size = NIC_PORT_DEFAULT_RXQ_SIZE;


>>      dev->requested_txq_size = NIC_PORT_DEFAULT_TXQ_SIZE;


>> +    dev->requested_hw_strip_crc = false;


>> +    dev->hw_strip_crc = false;


>>


>>      /* Initialize the flow control to NULL */


>>      memset(&dev->fc_conf, 0, sizeof dev->fc_conf); @@ -1192,6 +1199,11 @@


>> netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args)


>>          } else {


>>              smap_add(args, "rx_csum_offload", "false");


>>          }


>> +        if (dev->hw_strip_crc) {


>> +            smap_add(args, "hw_strip_crc", "true");


>> +        } else {


>> +            smap_add(args, "hw_strip_crc", "false");


>> +        }


>>      }


>>      ovs_mutex_unlock(&dev->mutex);


>>


>> @@ -1255,6 +1267,19 @@ dpdk_set_rxq_config(struct netdev_dpdk *dev,


>> const struct smap *args)  }


>>


>>  static void


>> +dpdk_set_hw_strip_crc_config(struct netdev_dpdk *dev, const struct smap


>> *args)


>> +     OVS_REQUIRES(dev->mutex)


>> +{


>> +    int new_hw_strip_crc;


>> +


>> +    new_hw_strip_crc = smap_get_bool(args, "hw_strip_crc", false);


>> +    if (new_hw_strip_crc != dev->requested_hw_strip_crc) {


>> +        dev->requested_hw_strip_crc = new_hw_strip_crc;


>> +        netdev_request_reconfigure(&dev->up);


>> +    }


>> +}


>> +


>> +static void


>>  dpdk_process_queue_size(struct netdev *netdev, const struct smap *args,


>>                          const char *flag, int default_size, int *new_size)  { @@ -1290,6


>> +1315,8 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap


>> *args,


>>


>>      dpdk_set_rxq_config(dev, args);


>>


>> +    dpdk_set_hw_strip_crc_config(dev, args);


>> +


>>      dpdk_process_queue_size(netdev, args, "n_rxq_desc",


>>                              NIC_PORT_DEFAULT_RXQ_SIZE,


>>                              &dev->requested_rxq_size); @@ -3196,6 +3223,7 @@


>> netdev_dpdk_reconfigure(struct netdev *netdev)


>>      if (netdev->n_txq == dev->requested_n_txq


>>          && netdev->n_rxq == dev->requested_n_rxq


>>          && dev->mtu == dev->requested_mtu


>> +        && dev->hw_strip_crc == dev->requested_hw_strip_crc


>>          && dev->rxq_size == dev->requested_rxq_size


>>          && dev->txq_size == dev->requested_txq_size


>>          && dev->socket_id == dev->requested_socket_id) { @@ -3217,6 +3245,8


>> @@ netdev_dpdk_reconfigure(struct netdev *netdev)


>>      dev->rxq_size = dev->requested_rxq_size;


>>      dev->txq_size = dev->requested_txq_size;


>>


>> +    dev->hw_strip_crc = dev->requested_hw_strip_crc;


>> +


>>      rte_free(dev->tx_q);


>>      err = dpdk_eth_dev_init(dev);


>>      dev->tx_q = netdev_dpdk_alloc_txq(netdev->n_txq);


>> diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index


>> 074535b..d1e7a6b 100644


>> --- a/vswitchd/vswitch.xml


>> +++ b/vswitchd/vswitch.xml


>> @@ -2589,6 +2589,15 @@


>>          </p>


>>        </column>


>>


>> +      <column name="options" key="hw_strip_crc"


>> +              type='{"type": "bool"}'>


>> +        <p>


>> +          Specifies DPDK interfaces whether enable hw_strip_crc feature or not.


>> +          If not specified, the default is false.


>> +          Not supported by DPDK vHost interfaces.


>> +        </p>


>> +      </column>


>> +


>>        <column name="other_config" key="pmd-rxq-affinity">


>>          <p>Specifies mapping of RX queues of this interface to CPU cores.</p>


>>          <p>Value should be set in the following form:</p>


>> --


>> 1.8.3.1


>>


>>


>> _______________________________________________


>> dev mailing list


>> dev@openvswitch.org<mailto:dev@openvswitch.org>


>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev


>>


>> _______________________________________________


>> dev mailing list


>> dev@openvswitch.org<mailto:dev@openvswitch.org>


>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev


>_______________________________________________


>dev mailing list


>dev@openvswitch.org<mailto:dev@openvswitch.org>


>https://mail.openvswitch.org/mailman/listinfo/ovs-dev


【网易自营】好吃到爆!鲜香弹滑加热即食,经典13香/麻辣小龙虾仅75元3斤>>   <http://you.163.com/item/detail?id=1183001&from=web_gg_mail_jiaobiao_7>

【网易自营|30天无忧退货】仅售同款价1/4!MUJI制造商“2017秋冬舒适家居拖鞋系列”限时仅34.9元>>  <http://you.163.com/item/detail?id=1165011&from=web_gg_mail_jiaobiao_9>
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index a3c1a02..d913847 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@  Post-v2.8.0
        chassis "hostname" in addition to a chassis "name".
    - Linux kernel 4.13
      * Add support for compiling OVS with the latest Linux 4.13 kernel
+   - DPDK:
+     * New option 'hw_strip_crc' fields for DPDK interfaces
 
 v2.8.0 - xx xxx xxxx
 ---------------------
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index c60f46f..23c2a72 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -402,11 +402,15 @@  struct netdev_dpdk {
     int requested_n_rxq;
     int requested_rxq_size;
     int requested_txq_size;
+    bool requested_hw_strip_crc;
 
     /* Number of rx/tx descriptors for physical devices */
     int rxq_size;
     int txq_size;
 
+    /*crc strip feature config*/
+    bool hw_strip_crc;
+
     /* Socket ID detected when vHost device is brought up */
     int requested_socket_id;
 
@@ -700,6 +704,7 @@  dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
 
     conf.rxmode.hw_ip_checksum = (dev->hw_ol_features &
                                   NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
+    conf.rxmode.hw_strip_crc = dev->hw_strip_crc;
     /* A device may report more queues than it makes available (this has
      * been observed for Intel xl710, which reserves some of them for
      * SRIOV):  rte_eth_*_queue_setup will fail if a queue is not
@@ -914,6 +919,8 @@  common_construct(struct netdev *netdev, dpdk_port_t port_no,
     dev->requested_n_txq = NR_QUEUE;
     dev->requested_rxq_size = NIC_PORT_DEFAULT_RXQ_SIZE;
     dev->requested_txq_size = NIC_PORT_DEFAULT_TXQ_SIZE;
+    dev->requested_hw_strip_crc = false;
+    dev->hw_strip_crc = false;
 
     /* Initialize the flow control to NULL */
     memset(&dev->fc_conf, 0, sizeof dev->fc_conf);
@@ -1192,6 +1199,11 @@  netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args)
         } else {
             smap_add(args, "rx_csum_offload", "false");
         }
+        if (dev->hw_strip_crc) {
+            smap_add(args, "hw_strip_crc", "true");
+        } else {
+            smap_add(args, "hw_strip_crc", "false");
+        }
     }
     ovs_mutex_unlock(&dev->mutex);
 
@@ -1255,6 +1267,19 @@  dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args)
 }
 
 static void
+dpdk_set_hw_strip_crc_config(struct netdev_dpdk *dev, const struct smap *args)
+     OVS_REQUIRES(dev->mutex)
+{
+    int new_hw_strip_crc;
+
+    new_hw_strip_crc = smap_get_bool(args, "hw_strip_crc", false);
+    if (new_hw_strip_crc != dev->requested_hw_strip_crc) {
+        dev->requested_hw_strip_crc = new_hw_strip_crc;
+        netdev_request_reconfigure(&dev->up);
+    }
+}
+
+static void
 dpdk_process_queue_size(struct netdev *netdev, const struct smap *args,
                         const char *flag, int default_size, int *new_size)
 {
@@ -1290,6 +1315,8 @@  netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args,
 
     dpdk_set_rxq_config(dev, args);
 
+    dpdk_set_hw_strip_crc_config(dev, args);
+
     dpdk_process_queue_size(netdev, args, "n_rxq_desc",
                             NIC_PORT_DEFAULT_RXQ_SIZE,
                             &dev->requested_rxq_size);
@@ -3196,6 +3223,7 @@  netdev_dpdk_reconfigure(struct netdev *netdev)
     if (netdev->n_txq == dev->requested_n_txq
         && netdev->n_rxq == dev->requested_n_rxq
         && dev->mtu == dev->requested_mtu
+        && dev->hw_strip_crc == dev->requested_hw_strip_crc
         && dev->rxq_size == dev->requested_rxq_size
         && dev->txq_size == dev->requested_txq_size
         && dev->socket_id == dev->requested_socket_id) {
@@ -3217,6 +3245,8 @@  netdev_dpdk_reconfigure(struct netdev *netdev)
     dev->rxq_size = dev->requested_rxq_size;
     dev->txq_size = dev->requested_txq_size;
 
+    dev->hw_strip_crc = dev->requested_hw_strip_crc;
+
     rte_free(dev->tx_q);
     err = dpdk_eth_dev_init(dev);
     dev->tx_q = netdev_dpdk_alloc_txq(netdev->n_txq);
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 074535b..d1e7a6b 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -2589,6 +2589,15 @@ 
         </p>
       </column>
 
+      <column name="options" key="hw_strip_crc"
+              type='{"type": "bool"}'>
+        <p>
+          Specifies DPDK interfaces whether enable hw_strip_crc feature or not. 
+          If not specified, the default is false.
+          Not supported by DPDK vHost interfaces.
+        </p>
+      </column>
+
       <column name="other_config" key="pmd-rxq-affinity">
         <p>Specifies mapping of RX queues of this interface to CPU cores.</p>
         <p>Value should be set in the following form:</p>