Skip to content

Commit

Permalink
netdev-dpdk: Set scatter based on capabilities
Browse files Browse the repository at this point in the history
Before this commit setting scatter offload was based on checking
net_nfp device.
Since DPDK 17.11 more PMD drivers are reporting offload
capabilities. Therefore this commit removes the specific check
against net_nfp device and replaces it with a generic check of
device capabilities before setting the scatter offload.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
  • Loading branch information
OphirMunk authored and istokes committed Nov 7, 2018
1 parent 7f021f9 commit 270d921
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/netdev-dpdk.c
Expand Up @@ -363,6 +363,7 @@ struct ingress_policer {
enum dpdk_hw_ol_features {
NETDEV_RX_CHECKSUM_OFFLOAD = 1 << 0,
NETDEV_RX_HW_CRC_STRIP = 1 << 1,
NETDEV_RX_HW_SCATTER = 1 << 2
};

/*
Expand Down Expand Up @@ -913,13 +914,11 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq)
rte_eth_dev_info_get(dev->port_id, &info);

/* As of DPDK 17.11.1 a few PMDs require to explicitly enable
* scatter to support jumbo RX. Checking the offload capabilities
* is not an option as PMDs are not required yet to report
* them. The only reliable info is the driver name and knowledge
* (testing or code review). Listing all such PMDs feels harder
* than highlighting the one known not to need scatter */
* scatter to support jumbo RX.
* Setting scatter for the device is done after checking for
* scatter support in the device capabilites. */
if (dev->mtu > ETHER_MTU) {
if (strncmp(info.driver_name, "net_nfp", 7)) {
if (dev->hw_ol_features & NETDEV_RX_HW_SCATTER) {
conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER;
}
}
Expand Down Expand Up @@ -1054,6 +1053,13 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev)
dev->hw_ol_features |= NETDEV_RX_CHECKSUM_OFFLOAD;
}

if (info.rx_offload_capa & DEV_RX_OFFLOAD_SCATTER) {
dev->hw_ol_features |= NETDEV_RX_HW_SCATTER;
} else {
/* Do not warn on lack of scatter support */
dev->hw_ol_features &= ~NETDEV_RX_HW_SCATTER;
}

n_rxq = MIN(info.max_rx_queues, dev->up.n_rxq);
n_txq = MIN(info.max_tx_queues, dev->up.n_txq);

Expand Down

0 comments on commit 270d921

Please sign in to comment.