net/af_xdp: enforce an MTU of 1500

Message ID 20191107132710.14912-1-ciara.loftus@intel.com (mailing list archive)
State Rejected, archived
Delegated to: Ferruh Yigit
Headers
Series net/af_xdp: enforce an MTU of 1500 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Loftus, Ciara Nov. 7, 2019, 1:27 p.m. UTC
  Packets larger than this will fail to be transmitted by AF_XDP,
so limit the MTU to 1500.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Eelco Chaudron Nov. 7, 2019, 2:05 p.m. UTC | #1
On 7 Nov 2019, at 14:27, Ciara Loftus wrote:

> Packets larger than this will fail to be transmitted by AF_XDP,
> so limit the MTU to 1500.
>
> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c 
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index 2b1245ee4..62c801500 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -595,7 +595,7 @@ eth_dev_info(struct rte_eth_dev *dev, struct 
> rte_eth_dev_info *dev_info)
>  	dev_info->max_tx_queues = internals->queue_cnt;
>
>  	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
> -	dev_info->max_mtu = ETH_AF_XDP_FRAME_SIZE - 
> ETH_AF_XDP_DATA_HEADROOM;
> +	dev_info->max_mtu = 1500;

Why is this limited to 1500 in the AF_XDP PMD? For native AF_XDP in OVS 
the limit is mainly by the driver/XDP page limit:
	min(PAGE_SIZE, ETH_AF_XDP_FRAME_SIZE ) - ETH_XDP_DATA_HEADROOM - 
XDP_PACKET_HEADROOM

>
>  	dev_info->default_rxportconf.nb_queues = 1;
>  	dev_info->default_txportconf.nb_queues = 1;
> @@ -1328,6 +1328,8 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device 
> *dev)
>  		return -1;
>  	}
>
> +	eth_dev_mtu_set(eth_dev, 1500);
> +
>  	rte_eth_dev_probing_finish(eth_dev);
>
>  	return 0;
> -- 
> 2.17.1
  

Patch

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 2b1245ee4..62c801500 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -595,7 +595,7 @@  eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_tx_queues = internals->queue_cnt;
 
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
-	dev_info->max_mtu = ETH_AF_XDP_FRAME_SIZE - ETH_AF_XDP_DATA_HEADROOM;
+	dev_info->max_mtu = 1500;
 
 	dev_info->default_rxportconf.nb_queues = 1;
 	dev_info->default_txportconf.nb_queues = 1;
@@ -1328,6 +1328,8 @@  rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 		return -1;
 	}
 
+	eth_dev_mtu_set(eth_dev, 1500);
+
 	rte_eth_dev_probing_finish(eth_dev);
 
 	return 0;