On 13 Oct 2018, at 23:12, Ophir Munk wrote:
On , October 12, 2018 12:25 PM Eelco Chaudron wrote:
On 10 Oct 2018, at 18:14, Ophir Munk wrote:
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 <[email protected]>
---
v1-v4
This patch was not included in version v1-v4 of the series
v5
Initial version
lib/netdev-dpdk.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index
4dd0ec3..ecca276 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -367,6 +367,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
};
/*
@@ -894,13 +895,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;
}
}
@@ -1035,6 +1034,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;
Don’t think we need to clear it explicitly, none of the other
capabilities do
this.
The other capabilities do clear explicitly.
There is a difference between NETDEV_RX_HW_SCATTER flag (which should
be set or cleared in dpdk_eth_dev_init()) and DEV_RX_OFFLOAD_SCATTER
flag (which is only set in dpdk_eth_dev_port_config()).
Flags of type "NETDEV_RX_XXXXXX" are cleared explicitly. For example,
we clear:
dev->hw_ol_features &= ~NETDEV_RX_HW_CRC_STRIP;
dev->hw_ol_features &= ~NETDEV_RX_CHECKSUM_OFFLOAD;
in the following code snippet:
if (strstr(info.driver_name, "vf") != NULL) {
VLOG_INFO("Virtual function detected, HW_CRC_STRIP will be
enabled");
dev->hw_ol_features |= NETDEV_RX_HW_CRC_STRIP;
} else {
dev->hw_ol_features &= ~NETDEV_RX_HW_CRC_STRIP;
}
if ((info.rx_offload_capa & rx_chksm_offload_capa) !=
rx_chksm_offload_capa) {
VLOG_WARN("Rx checksum offload is not supported on port "
DPDK_PORT_ID_FMT, dev->port_id);
dev->hw_ol_features &= ~NETDEV_RX_CHECKSUM_OFFLOAD;
} else {
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;
}
During configuration we only set DEV_RX_OFFLOAD_SCATTER flag:
if (dev->mtu > ETHER_MTU) {
if (dev->hw_ol_features & NETDEV_RX_HW_SCATTER) {
conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER;
I suggest keeping the patch as is.
I agree, and the rest of this patch is fine.
Acked-by: Eelco Chaudron <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev