Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2018 15:47:18 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330657 - head/sys/dev/mlx5/mlx5_en
Message-ID:  <201803081547.w28FlIFT012379@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Mar  8 15:47:17 2018
New Revision: 330657
URL: https://svnweb.freebsd.org/changeset/base/330657

Log:
  Use vport rather than physical-port MTU in mlx5en(4).
  
  Set and report vport MTU rather than physical MTU,
  The driver will set both vport and physical port mtu
  and will rely on the query of vport mtu.
  
  SRIOV VFs have to report their MTU to their vport manager (PF),
  and this will allow them to work with any MTU they need
  without failing the request.
  
  Also for some cases where the PF is not a port owner, PF can
  work with MTU less than the physical port mtu if set physical
  port mtu didn't take effect.
  
  Based on Linux upstream commit:
  cd255efff9baadd654d6160e52d17ae7c568c9d3
  
  Submitted by:	Meny Yossefi <menyy@mellanox.com>
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Thu Mar  8 15:43:41 2018	(r330656)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Thu Mar  8 15:47:17 2018	(r330657)
@@ -2442,15 +2442,29 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp, int sw_mtu)
 	int hw_mtu;
 	int err;
 
-	err = mlx5_set_port_mtu(mdev, MLX5E_SW2HW_MTU(sw_mtu));
+	hw_mtu = MLX5E_SW2HW_MTU(sw_mtu);
+
+	err = mlx5_set_port_mtu(mdev, hw_mtu);
 	if (err) {
 		if_printf(ifp, "%s: mlx5_set_port_mtu failed setting %d, err=%d\n",
 		    __func__, sw_mtu, err);
 		return (err);
 	}
 
+	/* Update vport context MTU */
+	err = mlx5_set_vport_mtu(mdev, hw_mtu);
+	if (err) {
+		if_printf(ifp, "%s: Failed updating vport context with MTU size, err=%d\n",
+		    __func__, err);
+	}
+
 	ifp->if_mtu = sw_mtu;
-	err = mlx5_query_port_oper_mtu(mdev, &hw_mtu);
+
+	err = mlx5_query_vport_mtu(mdev, &hw_mtu);
+	if (err || !hw_mtu) {
+		/* fallback to port oper mtu */
+		err = mlx5_query_port_oper_mtu(mdev, &hw_mtu);
+	}
 	if (err) {
 		if_printf(ifp, "Query port MTU, after setting new "
 		    "MTU value, failed\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803081547.w28FlIFT012379>