@@ -712,23 +712,43 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
static void
-dpdk_eth_checksum_offload_configure(struct netdev_dpdk *dev)
+dpdk_eth_hwol_offload_configure(struct netdev_dpdk *dev,
+ const struct smap *args)
OVS_REQUIRES(dev->mutex)
{
struct rte_eth_dev_info info;
- bool rx_csum_ol_flag = false;
- uint32_t rx_chksm_offload_capa = DEV_RX_OFFLOAD_UDP_CKSUM |
- DEV_RX_OFFLOAD_TCP_CKSUM |
- DEV_RX_OFFLOAD_IPV4_CKSUM;
+ bool rx_csum_ol_req;
+ uint32_t rx_csum_ol_mask = DEV_RX_OFFLOAD_UDP_CKSUM |
+ DEV_RX_OFFLOAD_TCP_CKSUM |
+ DEV_RX_OFFLOAD_IPV4_CKSUM;
+
+ /* Check if requested rx-checksum is same as current rx-checksum config. */
+ rx_csum_ol_req = smap_get_bool(args, "rx-checksum-offload", true);
+ if (rx_csum_ol_req !=
+ ((dev->hw_ol_features & NETDEV_RX_CHECKSUM_OFFLOAD) != 0)) {
+
+ dev->requested_hwol ^= NETDEV_RX_CHECKSUM_OFFLOAD;
+ }
+
+ /* Check if there is a requested change in hwol features. */
+ if (dev->requested_hwol == dev->hw_ol_features) {
+ return;
+ }
+
+ /* Change the requested hwol features to only allow supported features. */
rte_eth_dev_info_get(dev->port_id, &info);
- rx_csum_ol_flag = (dev->requested_hwol & NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
-
- if (rx_csum_ol_flag &&
- (info.rx_offload_capa & rx_chksm_offload_capa) !=
- rx_chksm_offload_capa) {
+ /* rx-checksum offload. */
+ if (rx_csum_ol_req &&
+ (info.rx_offload_capa & rx_csum_ol_mask) !=
+ rx_csum_ol_mask) {
VLOG_WARN_ONCE("Rx checksum offload is not supported on device %d",
dev->port_id);
dev->requested_hwol &= ~NETDEV_RX_CHECKSUM_OFFLOAD;
+ }
+
+ /* Check if differences between requested and current hwol features. */
+ if (dev->requested_hwol == dev->hw_ol_features) {
return;
}
+
netdev_request_reconfigure(&dev->up);
}
@@ -1180,6 +1200,4 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args,
{RTE_FC_RX_PAUSE, RTE_FC_FULL }
};
- bool rx_chksm_ofld;
- bool temp_flag;
const char *new_devargs;
int err = 0;
@@ -1259,13 +1277,6 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args,
}
- /* Rx checksum offload configuration */
- /* By default the Rx checksum offload is ON */
- rx_chksm_ofld = smap_get_bool(args, "rx-checksum-offload", true);
- temp_flag = (dev->hw_ol_features & NETDEV_RX_CHECKSUM_OFFLOAD)
- != 0;
- if (temp_flag != rx_chksm_ofld) {
- dev->requested_hwol ^= NETDEV_RX_CHECKSUM_OFFLOAD;
- dpdk_eth_checksum_offload_configure(dev);
- }
+ /* Process any eth dev hwol configuration. */
+ dpdk_eth_hwol_offload_configure(dev, args);
out:
Checking requested Rx checksum config and whether it should be applied to the eth device was split partially between the higher level set config function and a dedicated Rx checksum function. Refactor that by moving all Rx checksum related config into one function and make it generic so that it could easily be extended for other Hw offloads that can be set during DPDK eth dev configure. Cc: Sugesh Chandran <sugesh.chandran@intel.com> Signed-off-by: Kevin Traynor <ktraynor@redhat.com> --- lib/netdev-dpdk.c | 53 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 21 deletions(-)