diff mbox

[ovs-dev,v2,1/3] netdev-dpdk: Fix Rx checksum reconfigure.

Message ID 1494609740-15104-2-git-send-email-ktraynor@redhat.com
State Changes Requested
Headers show

Commit Message

Kevin Traynor May 12, 2017, 5:22 p.m. UTC
Rx checksum offload is enabled by default where available, with
reconfiguration through OVSDB options:rx-checksum-offload.
However, setting rx-checksum-offload does not result in a
reconfiguration of the NIC.

Fix that by checking if the requested port config features
(e.g. rx checksum offload) are currently applied on the NIC and if
not, perform a reconfiguration.

Fixes: 1a2bb11817a4 ("netdev-dpdk: Enable Rx checksum offloading feature on DPDK physical ports.")
Cc: Sugesh Chandran <sugesh.chandran@intel.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 lib/netdev-dpdk.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 609b8da..d1688ce 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -374,4 +374,5 @@  struct netdev_dpdk {
     int requested_rxq_size;
     int requested_txq_size;
+    uint32_t requested_hwol;
 
     /* Number of rx/tx descriptors for physical devices */
@@ -648,5 +649,5 @@  dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
         conf.rxmode.max_rx_pkt_len = 0;
     }
-    conf.rxmode.hw_ip_checksum = (dev->hw_ol_features &
+    conf.rxmode.hw_ip_checksum = (dev->requested_hwol &
                                   NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
     /* A device may report more queues than it makes available (this has
@@ -702,4 +703,5 @@  dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
         dev->up.n_rxq = n_rxq;
         dev->up.n_txq = n_txq;
+        dev->hw_ol_features = dev->requested_hwol;
 
         return 0;
@@ -719,5 +721,5 @@  dpdk_eth_checksum_offload_configure(struct netdev_dpdk *dev)
                                      DEV_RX_OFFLOAD_IPV4_CKSUM;
     rte_eth_dev_info_get(dev->port_id, &info);
-    rx_csum_ol_flag = (dev->hw_ol_features & NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
+    rx_csum_ol_flag = (dev->requested_hwol & NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
 
     if (rx_csum_ol_flag &&
@@ -726,5 +728,5 @@  dpdk_eth_checksum_offload_configure(struct netdev_dpdk *dev)
         VLOG_WARN_ONCE("Rx checksum offload is not supported on device %d",
                    dev->port_id);
-        dev->hw_ol_features &= ~NETDEV_RX_CHECKSUM_OFFLOAD;
+        dev->requested_hwol &= ~NETDEV_RX_CHECKSUM_OFFLOAD;
         return;
     }
@@ -872,4 +874,5 @@  common_construct(struct netdev *netdev, unsigned int port_no,
     /* Initilize the hardware offload flags to 0 */
     dev->hw_ol_features = 0;
+    dev->requested_hwol = 0;
 
     dev->flags = NETDEV_UP | NETDEV_PROMISC;
@@ -1260,5 +1263,5 @@  netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args,
                         != 0;
     if (temp_flag != rx_chksm_ofld) {
-        dev->hw_ol_features ^= NETDEV_RX_CHECKSUM_OFFLOAD;
+        dev->requested_hwol ^= NETDEV_RX_CHECKSUM_OFFLOAD;
         dpdk_eth_checksum_offload_configure(dev);
     }
@@ -3124,5 +3127,6 @@  netdev_dpdk_reconfigure(struct netdev *netdev)
         && dev->rxq_size == dev->requested_rxq_size
         && dev->txq_size == dev->requested_txq_size
-        && dev->socket_id == dev->requested_socket_id) {
+        && dev->socket_id == dev->requested_socket_id
+        && dev->hw_ol_features == dev->requested_hwol) {
         /* Reconfiguration is unnecessary */