Skip to content

Commit

Permalink
netdev-dpdk: Handle ENOTSUP for rte_eth_dev_set_mtu.
Browse files Browse the repository at this point in the history
The function rte_eth_dev_set_mtu is not supported for all DPDK drivers.
Currently if it is not supported we return an error in
dpdk_eth_dev_queue_setup. There are two issues with this.

(i) A device can still function even if rte_eth_dev_set_mtu is not
supported albeit with the default max rx packet length.

(ii) When ENOTSUP is returned it will not be caught in port_reconfigure()
at the dpif-netdev layer. Port_reconfigure() checks if a netdev_reconfigure()
function is supported for a given netdev and ignores EOPNOTSUPP errors as it
assumes errors of this value mean there is no reconfiguration function.
In this case the reconfiguration function is supported for netdev dpdk but
a function called as part of the reconfigure (rte_eth_dev_set_mtu) may
not be supported.

As this is a corner case, this commit warns a user when
rte_eth_dev_set_mtu is not supported and informs them of the default
max rx packet length that will be used instead.

Signed-off-by: Ian Stokes <[email protected]>
Co-author: Michal Weglicki <[email protected]>
Tested-By: Ciara Loftus <[email protected]>
Acked-by: Cian Ferriter <[email protected]>
Tested-by: Cian Ferriter <[email protected]>
  • Loading branch information
istokes committed Jun 8, 2018
1 parent e10ca8b commit 4dd16ca
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq)
int i;
struct rte_eth_conf conf = port_conf;
struct rte_eth_dev_info info;
uint16_t conf_mtu;

/* As of DPDK 17.11.1 a few PMDs require to explicitly enable
* scatter to support jumbo RX. Checking the offload capabilities
Expand Down Expand Up @@ -821,9 +822,19 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq)

diag = rte_eth_dev_set_mtu(dev->port_id, dev->mtu);
if (diag) {
VLOG_ERR("Interface %s MTU (%d) setup error: %s",
dev->up.name, dev->mtu, rte_strerror(-diag));
break;
/* A device may not support rte_eth_dev_set_mtu, in this case
* flag a warning to the user and include the devices configured
* MTU value that will be used instead. */
if (-ENOTSUP == diag) {
rte_eth_dev_get_mtu(dev->port_id, &conf_mtu);
VLOG_WARN("Interface %s does not support MTU configuration, "
"max packet size supported is %"PRIu16".",
dev->up.name, conf_mtu);
} else {
VLOG_ERR("Interface %s MTU (%d) setup error: %s",
dev->up.name, dev->mtu, rte_strerror(-diag));
break;
}
}

for (i = 0; i < n_txq; i++) {
Expand Down

0 comments on commit 4dd16ca

Please sign in to comment.