git: ecf32f2daa78 - stable/13 - mlx5: Remove support for FreeBSD 10 and older.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Tue, 08 Feb 2022 15:13:44 UTC
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=ecf32f2daa7803d36ea1dc5797c890bb306f21a3

commit ecf32f2daa7803d36ea1dc5797c890bb306f21a3
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-02-08 15:08:51 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-02-08 15:08:51 +0000

    mlx5: Remove support for FreeBSD 10 and older.
    
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit 788e9e74780e85aca8863ac4871b2f265b6630a3)
---
 sys/dev/mlx5/driver.h                  |  2 --
 sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c | 14 ----------
 sys/dev/mlx5/mlx5_en/mlx5_en_main.c    | 47 ----------------------------------
 sys/dev/mlx5/mlx5_en/mlx5_en_tx.c      | 10 --------
 4 files changed, 73 deletions(-)

diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h
index 614a308e8e2f..0bb2621fec6b 100644
--- a/sys/dev/mlx5/driver.h
+++ b/sys/dev/mlx5/driver.h
@@ -388,9 +388,7 @@ struct mlx5_core_psv {
 struct mlx5_core_sig_ctx {
 	struct mlx5_core_psv	psv_memory;
 	struct mlx5_core_psv	psv_wire;
-#if (__FreeBSD_version >= 1100000)
 	struct ib_sig_err       err_item;
-#endif
 	bool			sig_status_checked;
 	bool			sig_err_exists;
 	u32			sigerr_count;
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
index 11f47e3f8aa3..9423e274de81 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
@@ -1474,9 +1474,6 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv)
 			    CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU",
 			    mlx5e_params_desc[2 * x + 1]);
 		} else {
-#if (__FreeBSD_version < 1100000)
-			char path[64];
-#endif
 			/*
 			 * NOTE: In FreeBSD-11 and newer the
 			 * CTLFLAG_RWTUN flag will take care of
@@ -1487,17 +1484,6 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv)
 			    mlx5e_params_desc[2 * x], CTLTYPE_U64 | CTLFLAG_RWTUN |
 			    CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU",
 			    mlx5e_params_desc[2 * x + 1]);
-
-#if (__FreeBSD_version < 1100000)
-			/* compute path for sysctl */
-			snprintf(path, sizeof(path), "dev.mce.%d.conf.%s",
-			    device_get_unit(priv->mdev->pdev->dev.bsddev),
-			    mlx5e_params_desc[2 * x]);
-
-			/* try to fetch tunable, if any */
-			if (TUNABLE_QUAD_FETCH(path, &priv->params_ethtool.arg[x]))
-				mlx5e_ethtool_handler(NULL, priv, x, NULL);
-#endif
 		}
 	}
 
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 4209e3fde72f..126884210b58 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -803,10 +803,6 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
 	struct mlx5_core_dev *mdev = priv->mdev;
 	struct mlx5e_vport_stats *s = &priv->stats.vport;
 	struct mlx5e_sq_stats *sq_stats;
-#if (__FreeBSD_version < 1100000)
-	struct ifnet *ifp = priv->ifp;
-#endif
-
 	u32 in[MLX5_ST_SZ_DW(query_vport_counter_in)];
 	u32 *out;
 	int outlen = MLX5_ST_SZ_BYTES(query_vport_counter_out);
@@ -979,24 +975,6 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
 	    priv->stats.port_stats_debug.tx_stat_p4096to8191octets +
 	    priv->stats.port_stats_debug.tx_stat_p8192to10239octets;
 
-#if (__FreeBSD_version < 1100000)
-	/* no get_counters interface in fbsd 10 */
-	ifp->if_ipackets = s->rx_packets;
-	ifp->if_ierrors = priv->stats.pport.in_range_len_errors +
-	    priv->stats.pport.out_of_range_len +
-	    priv->stats.pport.too_long_errors +
-	    priv->stats.pport.check_seq_err +
-	    priv->stats.pport.alignment_err;
-	ifp->if_iqdrops = s->rx_out_of_buffer;
-	ifp->if_opackets = s->tx_packets;
-	ifp->if_oerrors = priv->stats.port_stats_debug.out_discards;
-	ifp->if_snd.ifq_drops = s->tx_queue_dropped;
-	ifp->if_ibytes = s->rx_bytes;
-	ifp->if_obytes = s->tx_bytes;
-	ifp->if_collisions =
-	    priv->stats.pport.collisions;
-#endif
-
 free_out:
 	kvfree(out);
 
@@ -3206,7 +3184,6 @@ mlx5e_close_locked(struct ifnet *ifp)
 	return (0);
 }
 
-#if (__FreeBSD_version >= 1100000)
 static uint64_t
 mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt)
 {
@@ -3259,7 +3236,6 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt)
 	/* PRIV_UNLOCK(priv); XXX not allowed */
 	return (retval);
 }
-#endif
 
 static void
 mlx5e_set_rx_mode(struct ifnet *ifp)
@@ -4098,9 +4074,6 @@ done:
 static void
 mlx5e_setup_pauseframes(struct mlx5e_priv *priv)
 {
-#if (__FreeBSD_version < 1100000)
-	char path[96];
-#endif
 	int error;
 
 	/* enable pauseframes by default */
@@ -4111,22 +4084,6 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv)
 	priv->params.tx_priority_flow_control = 0;
 	priv->params.rx_priority_flow_control = 0;
 
-#if (__FreeBSD_version < 1100000)
-	/* compute path for sysctl */
-	snprintf(path, sizeof(path), "dev.mce.%d.tx_pauseframe_control",
-	    device_get_unit(priv->mdev->pdev->dev.bsddev));
-
-	/* try to fetch tunable, if any */
-	TUNABLE_INT_FETCH(path, &priv->params.tx_pauseframe_control);
-
-	/* compute path for sysctl */
-	snprintf(path, sizeof(path), "dev.mce.%d.rx_pauseframe_control",
-	    device_get_unit(priv->mdev->pdev->dev.bsddev));
-
-	/* try to fetch tunable, if any */
-	TUNABLE_INT_FETCH(path, &priv->params.rx_pauseframe_control);
-#endif
-
 	/* register pauseframe SYSCTLs */
 	SYSCTL_ADD_INT(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet),
 	    OID_AUTO, "tx_pauseframe_control", CTLFLAG_RDTUN,
@@ -4443,9 +4400,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
 	ifp->if_ioctl = mlx5e_ioctl;
 	ifp->if_transmit = mlx5e_xmit;
 	ifp->if_qflush = if_qflush;
-#if (__FreeBSD_version >= 1100000)
 	ifp->if_get_counter = mlx5e_get_counter;
-#endif
 	ifp->if_snd.ifq_maxlen = ifqmaxlen;
 	/*
          * Set driver features
@@ -4900,8 +4855,6 @@ mlx5e_cleanup(void)
 module_init_order(mlx5e_init, SI_ORDER_SIXTH);
 module_exit_order(mlx5e_cleanup, SI_ORDER_SIXTH);
 
-#if (__FreeBSD_version >= 1100000)
 MODULE_DEPEND(mlx5en, linuxkpi, 1, 1, 1);
-#endif
 MODULE_DEPEND(mlx5en, mlx5, 1, 1, 1);
 MODULE_VERSION(mlx5en, 1);
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
index 35ab3d016392..24899ef0b881 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
@@ -75,7 +75,6 @@ mlx5e_send_nop(struct mlx5e_sq *sq, u32 ds_cnt)
 	sq->pc += sq->mbuf[pi].num_wqebbs;
 }
 
-#if (__FreeBSD_version >= 1100000)
 static uint32_t mlx5e_hash_value;
 
 static void
@@ -86,7 +85,6 @@ mlx5e_hash_init(void *arg)
 
 /* Make kernel call mlx5e_hash_init after the random stack finished initializing */
 SYSINIT(mlx5e_hash_init, SI_SUB_RANDOM, SI_ORDER_ANY, &mlx5e_hash_init, NULL);
-#endif
 
 static struct mlx5e_sq *
 mlx5e_select_queue_by_send_tag(struct ifnet *ifp, struct mbuf *mb)
@@ -166,16 +164,8 @@ mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb)
 #endif
 			ch = (mb->m_pkthdr.flowid % 128) % ch;
 	} else {
-#if (__FreeBSD_version >= 1100000)
 		ch = m_ether_tcpip_hash(MBUF_HASHFLAG_L3 |
 		    MBUF_HASHFLAG_L4, mb, mlx5e_hash_value) % ch;
-#else
-		/*
-		 * m_ether_tcpip_hash not present in stable, so just
-		 * throw unhashed mbufs on queue 0
-		 */
-		ch = 0;
-#endif
 	}
 
 	/* check if send queue is running */