Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Oct 2019 09:28:54 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r353226 - stable/11/sys/dev/mlx5/mlx5_en
Message-ID:  <201910070928.x979Ssaj086380@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Mon Oct  7 09:28:53 2019
New Revision: 353226
URL: https://svnweb.freebsd.org/changeset/base/353226

Log:
  MFC r352976:
  Unify prints in mlx5en(4).
  
  All prints in mlx5en(4) should use on of the macros:
  mlx5_en_err/dbg/warn
  
  Submitted by:	slavash@
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_en/en.h
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/en.h	Mon Oct  7 09:25:14 2019	(r353225)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h	Mon Oct  7 09:28:53 2019	(r353226)
@@ -141,6 +141,21 @@ struct mlx5e_cq;
 
 typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *);
 
+#define	mlx5_en_err(_dev, format, ...)				\
+	if_printf(_dev, "ERR: ""%s:%d:(pid %d): " format, \
+	    __func__, __LINE__, curthread->td_proc->p_pid,	\
+	    ##__VA_ARGS__)
+
+#define	mlx5_en_warn(_dev, format, ...)				\
+	if_printf(_dev, "WARN: ""%s:%d:(pid %d): " format, \
+	    __func__, __LINE__, curthread->td_proc->p_pid,	\
+	    ##__VA_ARGS__)
+
+#define	mlx5_en_info(_dev, format, ...)				\
+	if_printf(_dev, "INFO: ""%s:%d:(pid %d): " format, \
+	    __func__, __LINE__, curthread->td_proc->p_pid,	\
+	    ##__VA_ARGS__)
+
 #define	MLX5E_STATS_COUNT(a, ...) a
 #define	MLX5E_STATS_VAR(a, b, c, ...) b c;
 #define	MLX5E_STATS_DESC(a, b, c, d, e, ...) d, e,

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c	Mon Oct  7 09:25:14 2019	(r353225)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c	Mon Oct  7 09:28:53 2019	(r353226)
@@ -684,7 +684,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
 			} else {
 				priv->params.hw_lro_en = false;
 
-				if_printf(priv->ifp, "To enable HW LRO "
+				mlx5_en_warn(priv->ifp, "To enable HW LRO "
 				    "please also enable LRO via ifconfig(8).\n");
 			}
 		} else {
@@ -824,8 +824,8 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct 
 
 	ret = mlx5_query_module_num(dev, &eeprom->module_num);
 	if (ret) {
-		if_printf(priv->ifp, "%s:%d: Failed query module error=%d\n",
-		    __func__, __LINE__, ret);
+		mlx5_en_err(priv->ifp, "Failed query module error=%d\n",
+		    ret);
 		return (ret);
 	}
 
@@ -834,8 +834,8 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct 
 	    eeprom->device_addr, MLX5E_EEPROM_INFO_BYTES, eeprom->module_num, &data,
 	    &size_read);
 	if (ret) {
-		if_printf(priv->ifp, "%s:%d: Failed query eeprom module error=0x%x\n",
-		    __func__, __LINE__, ret);
+		mlx5_en_err(priv->ifp,
+		    "Failed query eeprom module error=0x%x\n", ret);
 		return (ret);
 	}
 
@@ -862,8 +862,9 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct 
 		eeprom->len = MLX5E_ETH_MODULE_SFF_8472_LEN;
 		break;
 	default:
-		if_printf(priv->ifp, "%s:%d: Not recognized cable type = 0x%x(%s)\n",
-		    __func__, __LINE__, data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK,
+		mlx5_en_err(priv->ifp,
+		    "Not recognized cable type = 0x%x(%s)\n",
+		    data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK,
 		    sff_8024_id[data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK]);
 		return (EINVAL);
 	}
@@ -887,8 +888,8 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e
 		    ee->len - ee->device_addr, ee->module_num,
 		    ee->data + (ee->device_addr / 4), &size_read);
 		if (ret) {
-			if_printf(priv->ifp, "%s:%d: Failed reading eeprom, "
-			    "error = 0x%02x\n", __func__, __LINE__, ret);
+			mlx5_en_err(priv->ifp,
+			    "Failed reading eeprom, error = 0x%02x\n",ret);
 			return (ret);
 		}
 		ee->device_addr += size_read;
@@ -906,8 +907,9 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e
 			    ((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET) / 4),
 			    &size_read);
 			if (ret) {
-				if_printf(priv->ifp, "%s:%d: Failed reading eeprom, "
-				    "error = 0x%02x\n", __func__, __LINE__, ret);
+				mlx5_en_err(priv->ifp,
+				    "Failed reading eeprom, error = 0x%02x\n",
+				    ret);
 				return (ret);
 			}
 			ee->device_addr += size_read;
@@ -983,8 +985,8 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS)
 		/* Read three first bytes to get important info */
 		error = mlx5e_get_eeprom_info(priv, &eeprom);
 		if (error) {
-			if_printf(priv->ifp, "%s:%d: Failed reading eeprom's "
-			    "initial information\n", __func__, __LINE__);
+			mlx5_en_err(priv->ifp,
+			    "Failed reading eeprom's initial information\n");
 			error = 0;
 			goto done;
 		}
@@ -998,8 +1000,7 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS)
 		/* Read the whole eeprom information */
 		error = mlx5e_get_eeprom(priv, &eeprom);
 		if (error) {
-			if_printf(priv->ifp, "%s:%d: Failed reading eeprom\n",
-			    __func__, __LINE__);
+			mlx5_en_err(priv->ifp, "Failed reading eeprom\n");
 			error = 0;
 			/*
 			 * Continue printing partial information in case of

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c	Mon Oct  7 09:25:14 2019	(r353225)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c	Mon Oct  7 09:28:53 2019	(r353226)
@@ -436,7 +436,7 @@ mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv,
 	match_value	= mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
 	match_criteria	= mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
 	if (!match_value || !match_criteria) {
-		if_printf(priv->ifp, "%s: alloc failed\n", __func__);
+		mlx5_en_err(priv->ifp, "alloc failed\n");
 		err = -ENOMEM;
 		goto add_eth_addr_rule_out;
 	}
@@ -467,7 +467,7 @@ static int mlx5e_vport_context_update_vlans(struct mlx
 	max_list_size = 1 << MLX5_CAP_GEN(priv->mdev, log_max_vlan_list);
 
 	if (list_size > max_list_size) {
-		if_printf(ifp,
+		mlx5_en_err(ifp,
 			    "ifnet vlans list size (%d) > (%d) max vport list size, some vlans will be dropped\n",
 			    list_size, max_list_size);
 		list_size = max_list_size;
@@ -486,7 +486,7 @@ static int mlx5e_vport_context_update_vlans(struct mlx
 
 	err = mlx5_modify_nic_vport_vlans(priv->mdev, vlans, list_size);
 	if (err)
-		if_printf(ifp, "Failed to modify vport vlans list err(%d)\n",
+		mlx5_en_err(ifp, "Failed to modify vport vlans list err(%d)\n",
 			   err);
 
 	kfree(vlans);
@@ -549,7 +549,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv,
 	if (IS_ERR(*rule_p)) {
 		err = PTR_ERR(*rule_p);
 		*rule_p = NULL;
-		if_printf(priv->ifp, "%s: add rule failed\n", __func__);
+		mlx5_en_err(priv->ifp, "add rule failed\n");
 	}
 
 	return (err);
@@ -566,7 +566,7 @@ mlx5e_add_vlan_rule(struct mlx5e_priv *priv,
 	match_value	= mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
 	match_criteria	= mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param));
 	if (!match_value || !match_criteria) {
-		if_printf(priv->ifp, "%s: alloc failed\n", __func__);
+		mlx5_en_err(priv->ifp, "alloc failed\n");
 		err = -ENOMEM;
 		goto add_vlan_rule_out;
 	}
@@ -948,7 +948,7 @@ static void mlx5e_vport_context_update_addr_list(struc
 		size++;
 
 	if (size > max_size) {
-		if_printf(priv->ifp,
+		mlx5_en_err(priv->ifp,
 			    "ifp %s list size (%d) > (%d) max vport list size, some addresses will be dropped\n",
 			    is_uc ? "UC" : "MC", size, max_size);
 		size = max_size;
@@ -966,7 +966,7 @@ static void mlx5e_vport_context_update_addr_list(struc
 	err = mlx5_modify_nic_vport_mac_list(priv->mdev, list_type, addr_array, size);
 out:
 	if (err)
-		if_printf(priv->ifp,
+		mlx5_en_err(priv->ifp,
 			   "Failed to modify vport %s list err(%d)\n",
 			   is_uc ? "UC" : "MC", err);
 	kfree(addr_array);

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Mon Oct  7 09:25:14 2019	(r353225)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Mon Oct  7 09:28:53 2019	(r353226)
@@ -428,8 +428,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
 	if (error) {
 		priv->media_active_last = IFM_ETHER;
 		priv->ifp->if_baudrate = 1;
-		if_printf(priv->ifp, "%s: query port ptys failed: "
-		    "0x%x\n", __func__, error);
+		mlx5_en_err(priv->ifp, "query port ptys failed: 0x%x\n",
+		    error);
 		return;
 	}
 
@@ -447,8 +447,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
 	}
 
 	if (media_entry.subtype == 0) {
-		if_printf(priv->ifp, "%s: Could not find operational "
-		    "media subtype\n", __func__);
+		mlx5_en_err(priv->ifp,
+		    "Could not find operational media subtype\n");
 		return;
 	}
 
@@ -456,8 +456,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
 	case IFM_10G_ER:
 		error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type);
 		if (error != 0) {
-			if_printf(priv->ifp, "%s: query port pddr failed: %d\n",
-				  __func__, error);
+			mlx5_en_err(priv->ifp,
+			    "query port pddr failed: %d\n", error);
 		}
 		if (error != 0 || is_er_type == 0)
 			media_entry.subtype = IFM_10G_LR;
@@ -465,8 +465,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
 	case IFM_40G_LR4:
 		error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type);
 		if (error != 0) {
-			if_printf(priv->ifp, "%s: query port pddr failed: %d\n",
-				  __func__, error);
+			mlx5_en_err(priv->ifp,
+			    "query port pddr failed: %d\n", error);
 		}
 		if (error == 0 && is_er_type != 0)
 			media_entry.subtype = IFM_40G_ER4;
@@ -545,9 +545,8 @@ mlx5e_set_port_pfc(struct mlx5e_priv *priv)
 		error = -ENXIO;
 	} else if (priv->params.rx_pauseframe_control ||
 	    priv->params.tx_pauseframe_control) {
-		if_printf(priv->ifp,
-		    "Global pauseframes must be disabled before "
-		    "enabling PFC.\n");
+		mlx5_en_err(priv->ifp,
+		    "Global pauseframes must be disabled before enabling PFC.\n");
 		error = -EINVAL;
 	} else {
 		error = mlx5e_set_port_pause_and_pfc(priv);
@@ -580,7 +579,7 @@ mlx5e_media_change(struct ifnet *dev)
 	error = mlx5_query_port_ptys(mdev, out, sizeof(out),
 	    MLX5_PTYS_EN, 1);
 	if (error != 0) {
-		if_printf(dev, "Query port media capability failed\n");
+		mlx5_en_err(dev, "Query port media capability failed\n");
 		goto done;
 	}
 
@@ -595,14 +594,14 @@ mlx5e_media_change(struct ifnet *dev)
 	if (IFM_SUBTYPE(priv->media.ifm_media) == IFM_AUTO) {
 		link_mode = eth_proto_cap;
 		if (link_mode == 0) {
-			if_printf(dev, "Port media capability is zero\n");
+			mlx5_en_err(dev, "Port media capability is zero\n");
 			error = EINVAL;
 			goto done;
 		}
 	} else {
 		link_mode = link_mode & eth_proto_cap;
 		if (link_mode == 0) {
-			if_printf(dev, "Not supported link mode requested\n");
+			mlx5_en_err(dev, "Not supported link mode requested\n");
 			error = EINVAL;
 			goto done;
 		}
@@ -611,7 +610,7 @@ mlx5e_media_change(struct ifnet *dev)
 		/* check if PFC is enabled */
 		if (priv->params.rx_priority_flow_control ||
 		    priv->params.tx_priority_flow_control) {
-			if_printf(dev, "PFC must be disabled before enabling global pauseframes.\n");
+			mlx5_en_err(dev, "PFC must be disabled before enabling global pauseframes.\n");
 			error = EINVAL;
 			goto done;
 		}
@@ -1020,7 +1019,8 @@ free_out:
 		    priv->params_ethtool.diag_pci_enable ? &priv->params_pci : NULL,
 		    priv->params_ethtool.diag_general_enable ? &priv->params_general : NULL);
 		if (error != 0)
-			if_printf(priv->ifp, "Failed reading diagnostics: %d\n", error);
+			mlx5_en_err(priv->ifp,
+			    "Failed reading diagnostics: %d\n", error);
 	}
 }
 
@@ -1764,7 +1764,7 @@ mlx5e_drain_sq(struct mlx5e_sq *sq)
 	/* error out remaining requests */
 	error = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR);
 	if (error != 0) {
-		if_printf(sq->ifp,
+		mlx5_en_err(sq->ifp,
 		    "mlx5e_modify_sq() from RDY to ERR failed: %d\n", error);
 	}
 
@@ -2828,16 +2828,17 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp, int 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);
+		mlx5_en_err(ifp, "mlx5_set_port_mtu failed setting %d, err=%d\n",
+		    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);
+		mlx5_en_err(ifp,
+		    "Failed updating vport context with MTU size, err=%d\n",
+		    err);
 	}
 
 	ifp->if_mtu = sw_mtu;
@@ -2848,17 +2849,19 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp, int sw_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");
+		mlx5_en_err(ifp,
+		    "Query port MTU, after setting new MTU value, failed\n");
 		return (err);
 	} else if (MLX5E_HW2SW_MTU(hw_mtu) < sw_mtu) {
 		err = -E2BIG,
-		if_printf(ifp, "Port MTU %d is smaller than "
-                    "ifp mtu %d\n", hw_mtu, sw_mtu);
+		mlx5_en_err(ifp,
+		    "Port MTU %d is smaller than ifp mtu %d\n",
+		    hw_mtu, sw_mtu);
 	} else if (MLX5E_HW2SW_MTU(hw_mtu) > sw_mtu) {
 		err = -EINVAL;
-                if_printf(ifp, "Port MTU %d is bigger than "
-                    "ifp mtu %d\n", hw_mtu, sw_mtu);
+                mlx5_en_err(ifp,
+		    "Port MTU %d is bigger than ifp mtu %d\n",
+		    hw_mtu, sw_mtu);
 	}
 	priv->params_ethtool.hw_mtu = hw_mtu;
 
@@ -2878,23 +2881,21 @@ mlx5e_open_locked(struct ifnet *ifp)
 
 #ifdef RSS
 	if (rss_getnumbuckets() > priv->params.num_channels) {
-		if_printf(ifp, "NOTE: There are more RSS buckets(%u) than "
-		    "channels(%u) available\n", rss_getnumbuckets(),
-		    priv->params.num_channels);
+		mlx5_en_info(ifp,
+		    "NOTE: There are more RSS buckets(%u) than channels(%u) available\n",
+		    rss_getnumbuckets(), priv->params.num_channels);
 	}
 #endif
 	err = mlx5e_open_tises(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_tises failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5e_open_tises failed, %d\n", err);
 		return (err);
 	}
 	err = mlx5_vport_alloc_q_counter(priv->mdev,
 	    MLX5_INTERFACE_PROTOCOL_ETH, &set_id);
 	if (err) {
-		if_printf(priv->ifp,
-		    "%s: mlx5_vport_alloc_q_counter failed: %d\n",
-		    __func__, err);
+		mlx5_en_err(priv->ifp,
+		    "mlx5_vport_alloc_q_counter failed: %d\n", err);
 		goto err_close_tises;
 	}
 	/* store counter set ID */
@@ -2902,32 +2903,30 @@ mlx5e_open_locked(struct ifnet *ifp)
 
 	err = mlx5e_open_channels(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_channels failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp,
+		    "mlx5e_open_channels failed, %d\n", err);
 		goto err_dalloc_q_counter;
 	}
 	err = mlx5e_open_rqt(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_rqt failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5e_open_rqt failed, %d\n", err);
 		goto err_close_channels;
 	}
 	err = mlx5e_open_tirs(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_tir failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5e_open_tir failed, %d\n", err);
 		goto err_close_rqls;
 	}
 	err = mlx5e_open_flow_table(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_open_flow_table failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp,
+		    "mlx5e_open_flow_table failed, %d\n", err);
 		goto err_close_tirs;
 	}
 	err = mlx5e_add_all_vlan_rules(priv);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_add_all_vlan_rules failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp,
+		    "mlx5e_add_all_vlan_rules failed, %d\n", err);
 		goto err_close_flow_table;
 	}
 	set_bit(MLX5E_STATE_OPENED, &priv->state);
@@ -2966,9 +2965,8 @@ mlx5e_open(void *arg)
 
 	PRIV_LOCK(priv);
 	if (mlx5_set_port_status(priv->mdev, MLX5_PORT_UP))
-		if_printf(priv->ifp,
-		    "%s: Setting port status to up failed\n",
-		    __func__);
+		mlx5_en_err(priv->ifp,
+		    "Setting port status to up failed\n");
 
 	mlx5e_open_locked(priv->ifp);
 	priv->ifp->if_drv_flags |= IFF_DRV_RUNNING;
@@ -3105,7 +3103,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 				mlx5e_open_locked(ifp);
 		} else {
 			error = EINVAL;
-			if_printf(ifp, "Invalid MTU value. Min val: %d, Max val: %d\n",
+			mlx5_en_err(ifp,
+			    "Invalid MTU value. Min val: %d, Max val: %d\n",
 			    MLX5E_MTU_MIN, MIN(MLX5E_MTU_MAX, max_mtu));
 		}
 		PRIV_UNLOCK(priv);
@@ -3159,7 +3158,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 			    !(IFCAP_TXCSUM & ifp->if_capenable)) {
 				ifp->if_capenable &= ~IFCAP_TSO4;
 				ifp->if_hwassist &= ~CSUM_IP_TSO;
-				if_printf(ifp,
+				mlx5_en_err(ifp,
 				    "tso4 disabled due to -txcsum.\n");
 			}
 		}
@@ -3171,7 +3170,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 			    !(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
 				ifp->if_capenable &= ~IFCAP_TSO6;
 				ifp->if_hwassist &= ~CSUM_IP6_TSO;
-				if_printf(ifp,
+				mlx5_en_err(ifp,
 				    "tso6 disabled due to -txcsum6.\n");
 			}
 		}
@@ -3182,7 +3181,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 		if (mask & IFCAP_TSO4) {
 			if (!(IFCAP_TSO4 & ifp->if_capenable) &&
 			    !(IFCAP_TXCSUM & ifp->if_capenable)) {
-				if_printf(ifp, "enable txcsum first.\n");
+				mlx5_en_err(ifp, "enable txcsum first.\n");
 				error = EAGAIN;
 				goto out;
 			}
@@ -3192,7 +3191,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 		if (mask & IFCAP_TSO6) {
 			if (!(IFCAP_TSO6 & ifp->if_capenable) &&
 			    !(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
-				if_printf(ifp, "enable txcsum6 first.\n");
+				mlx5_en_err(ifp, "enable txcsum6 first.\n");
 				error = EAGAIN;
 				goto out;
 			}
@@ -3262,8 +3261,8 @@ out:
 		/* Get module_num which is required for the query_eeprom */
 		error = mlx5_query_module_num(priv->mdev, &module_num);
 		if (error) {
-			if_printf(ifp, "Query module num failed, eeprom "
-			    "reading is not supported\n");
+			mlx5_en_err(ifp,
+			    "Query module num failed, eeprom reading is not supported\n");
 			error = EINVAL;
 			goto err_i2c;
 		}
@@ -3282,8 +3281,9 @@ out:
 		else if (i2c.dev_addr == 0xA2)
 			read_addr = MLX5E_I2C_ADDR_HIGH;
 		else {
-			if_printf(ifp, "Query eeprom failed, "
-			    "Invalid Address: %X\n", i2c.dev_addr);
+			mlx5_en_err(ifp,
+			    "Query eeprom failed, Invalid Address: %X\n",
+			    i2c.dev_addr);
 			error = EINVAL;
 			goto err_i2c;
 		}
@@ -3292,8 +3292,8 @@ out:
 		    (uint32_t)i2c.offset, (uint32_t)i2c.len, module_num,
 		    (uint32_t *)i2c.data, &size_read);
 		if (error) {
-			if_printf(ifp, "Query eeprom failed, eeprom "
-			    "reading is not supported\n");
+			mlx5_en_err(ifp,
+			    "Query eeprom failed, eeprom reading is not supported\n");
 			error = EINVAL;
 			goto err_i2c;
 		}
@@ -3306,8 +3306,8 @@ out:
 			    (uint32_t *)(i2c.data + size_read), &size_read);
 		}
 		if (error) {
-			if_printf(ifp, "Query eeprom failed, eeprom "
-			    "reading is not supported\n");
+			mlx5_en_err(ifp,
+			    "Query eeprom failed, eeprom reading is not supported\n");
 			error = EINVAL;
 			goto err_i2c;
 		}
@@ -3443,7 +3443,7 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn,
 
 	in = mlx5_vzalloc(inlen);
 	if (in == NULL) {
-		if_printf(ifp, "%s: failed to allocate inbox\n", __func__);
+		mlx5_en_err(ifp, "failed to allocate inbox\n");
 		return (-ENOMEM);
 	}
 
@@ -3458,8 +3458,8 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn,
 
 	err = mlx5_core_create_mkey(mdev, mkey, in, inlen);
 	if (err)
-		if_printf(ifp, "%s: mlx5_core_create_mkey failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5_core_create_mkey failed, %d\n",
+		    err);
 
 	kvfree(in);
 	return (err);
@@ -3540,7 +3540,7 @@ mlx5e_resume_sq(struct mlx5e_sq *sq)
 	err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_ERR,
 	    MLX5_SQC_STATE_RST);
 	if (err != 0) {
-		if_printf(sq->ifp,
+		mlx5_en_err(sq->ifp,
 		    "mlx5e_modify_sq() from ERR to RST failed: %d\n", err);
 	}
 
@@ -3553,7 +3553,7 @@ mlx5e_resume_sq(struct mlx5e_sq *sq)
 	err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RST,
 	    MLX5_SQC_STATE_RDY);
 	if (err != 0) {
-		if_printf(sq->ifp,
+		mlx5_en_err(sq->ifp,
 		    "mlx5e_modify_sq() from RST to RDY failed: %d\n", err);
 	}
 
@@ -3585,7 +3585,7 @@ mlx5e_disable_rx_dma(struct mlx5e_channel *ch)
 
 	err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR);
 	if (err != 0) {
-		if_printf(rq->ifp,
+		mlx5_en_err(rq->ifp,
 		    "mlx5e_modify_rq() from RDY to RST failed: %d\n", err);
 	}
 
@@ -3600,7 +3600,7 @@ mlx5e_disable_rx_dma(struct mlx5e_channel *ch)
 	 */
 	err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_ERR, MLX5_RQC_STATE_RST);
 	if (err != 0) {
-		if_printf(rq->ifp,
+		mlx5_en_err(rq->ifp,
 		    "mlx5e_modify_rq() from ERR to RST failed: %d\n", err);
 	}
 }
@@ -3615,7 +3615,7 @@ mlx5e_enable_rx_dma(struct mlx5e_channel *ch)
 	mlx5_wq_ll_update_db_record(&rq->wq);
 	err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RST, MLX5_RQC_STATE_RDY);
 	if (err != 0) {
-		if_printf(rq->ifp,
+		mlx5_en_err(rq->ifp,
 		    "mlx5e_modify_rq() from RST to RDY failed: %d\n", err);
         }
 
@@ -3823,7 +3823,7 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv)
 	/* update firmware */
 	error = mlx5e_set_port_pause_and_pfc(priv);
 	if (error == -EINVAL) {
-		if_printf(priv->ifp,
+		mlx5_en_err(priv->ifp,
 		    "Global pauseframes must be disabled before enabling PFC.\n");
 		priv->params.rx_priority_flow_control = 0;
 		priv->params.tx_priority_flow_control = 0;
@@ -3943,26 +3943,23 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
 
 	err = mlx5_alloc_map_uar(mdev, &priv->cq_uar);
 	if (err) {
-		if_printf(ifp, "%s: mlx5_alloc_map_uar failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5_alloc_map_uar failed, %d\n", err);
 		goto err_free_wq;
 	}
 	err = mlx5_core_alloc_pd(mdev, &priv->pdn);
 	if (err) {
-		if_printf(ifp, "%s: mlx5_core_alloc_pd failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5_core_alloc_pd failed, %d\n", err);
 		goto err_unmap_free_uar;
 	}
 	err = mlx5_alloc_transport_domain(mdev, &priv->tdn);
 	if (err) {
-		if_printf(ifp, "%s: mlx5_alloc_transport_domain failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp,
+		    "mlx5_alloc_transport_domain failed, %d\n", err);
 		goto err_dealloc_pd;
 	}
 	err = mlx5e_create_mkey(priv, priv->pdn, &priv->mr);
 	if (err) {
-		if_printf(ifp, "%s: mlx5e_create_mkey failed, %d\n",
-		    __func__, err);
+		mlx5_en_err(ifp, "mlx5e_create_mkey failed, %d\n", err);
 		goto err_dealloc_transport_domain;
 	}
 	mlx5_query_nic_vport_mac_address(priv->mdev, 0, dev_addr);
@@ -3971,7 +3968,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
 	if (MLX5_CAP_GEN(priv->mdev, vport_group_manager) == 0 &&
 	    is_zero_ether_addr(dev_addr)) {
 		random_ether_addr(dev_addr);
-		if_printf(ifp, "Assigned random MAC address\n");
+		mlx5_en_err(ifp, "Assigned random MAC address\n");
 	}
 
 	/* set default MTU */
@@ -3997,8 +3994,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
 			    connector_type);
 	} else {
 		eth_proto_cap = 0;
-		if_printf(ifp, "%s: Query port media capability failed,"
-		    " %d\n", __func__, err);
+		mlx5_en_err(ifp, "Query port media capability failed, %d\n", err);
 	}
 
 	ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK,

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c	Mon Oct  7 09:25:14 2019	(r353225)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c	Mon Oct  7 09:28:53 2019	(r353226)
@@ -48,6 +48,6 @@ mlx5e_cq_error_event(struct mlx5_core_cq *mcq, int eve
 {
 	struct mlx5e_cq *cq = container_of(mcq, struct mlx5e_cq, mcq);
 
-	if_printf(cq->priv->ifp, "%s: cqn=0x%.6x event=0x%.2x\n",
-	    __func__, mcq->cqn, event);
+	mlx5_en_err(cq->priv->ifp, "cqn=0x%.6x event=0x%.2x\n",
+	    mcq->cqn, event);
 }



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