Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Sep 2014 08:28:35 +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: r272060 - head/sys/ofed/drivers/net/mlx4
Message-ID:  <201409240828.s8O8SZDI040748@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Sep 24 08:28:34 2014
New Revision: 272060
URL: http://svnweb.freebsd.org/changeset/base/272060

Log:
  Update code to use new network counter API.
  Fix some minor compile warnings while at it.
  
  Sponsored by:	Mellanox Technologies
  Suggested by:	glebius@
  MFC after:	1 week

Modified:
  head/sys/ofed/drivers/net/mlx4/en_port.c
  head/sys/ofed/drivers/net/mlx4/en_tx.c
  head/sys/ofed/drivers/net/mlx4/fw.h
  head/sys/ofed/drivers/net/mlx4/mlx4_en.h
  head/sys/ofed/drivers/net/mlx4/resource_tracker.c

Modified: head/sys/ofed/drivers/net/mlx4/en_port.c
==============================================================================
--- head/sys/ofed/drivers/net/mlx4/en_port.c	Wed Sep 24 08:18:11 2014	(r272059)
+++ head/sys/ofed/drivers/net/mlx4/en_port.c	Wed Sep 24 08:28:34 2014	(r272060)
@@ -546,17 +546,27 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_e
 	}
 
 	if (!mlx4_is_mfunc(mdev->dev)) {
-		/* netdevice stats format */
-                dev                     = mdev->pndev[port];
-		dev->if_ipackets        = priv->pkstats.rx_packets;
-		dev->if_opackets        = priv->pkstats.tx_packets;
-		dev->if_ibytes          = priv->pkstats.rx_bytes;
-		dev->if_obytes          = priv->pkstats.tx_bytes;
-		dev->if_ierrors         = priv->pkstats.rx_errors;
-		dev->if_iqdrops         = priv->pkstats.rx_dropped;
-		dev->if_imcasts         = priv->pkstats.rx_multicast_packets;
-                dev->if_omcasts         = priv->pkstats.tx_multicast_packets;
-                dev->if_collisions      = 0;
+		if (reset == 0) {
+			/* netdevice stats format */
+			dev                     = mdev->pndev[port];
+			if_inc_counter(dev, IFCOUNTER_IPACKETS,
+			    priv->pkstats.rx_packets - priv->pkstats_last.rx_packets);
+			if_inc_counter(dev, IFCOUNTER_OPACKETS,
+			    priv->pkstats.tx_packets - priv->pkstats_last.tx_packets);
+			if_inc_counter(dev, IFCOUNTER_IBYTES,
+			    priv->pkstats.rx_bytes - priv->pkstats_last.rx_bytes);
+			if_inc_counter(dev, IFCOUNTER_OBYTES,
+			    priv->pkstats.tx_bytes - priv->pkstats_last.tx_bytes);
+			if_inc_counter(dev, IFCOUNTER_IERRORS,
+			    priv->pkstats.rx_errors - priv->pkstats_last.rx_errors);
+			if_inc_counter(dev, IFCOUNTER_IQDROPS,
+			    priv->pkstats.rx_dropped - priv->pkstats_last.rx_dropped);
+			if_inc_counter(dev, IFCOUNTER_IMCASTS,
+			    priv->pkstats.rx_multicast_packets - priv->pkstats_last.rx_multicast_packets);
+			if_inc_counter(dev, IFCOUNTER_OMCASTS,
+			    priv->pkstats.tx_multicast_packets - priv->pkstats_last.tx_multicast_packets);
+		}
+		priv->pkstats_last = priv->pkstats;
 	}
 
 	spin_unlock(&priv->stats_lock);

Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c
==============================================================================
--- head/sys/ofed/drivers/net/mlx4/en_tx.c	Wed Sep 24 08:18:11 2014	(r272059)
+++ head/sys/ofed/drivers/net/mlx4/en_tx.c	Wed Sep 24 08:28:34 2014	(r272060)
@@ -1028,9 +1028,6 @@ mlx4_en_transmit_locked(struct ifnet *de
 		}
 		drbr_advance(dev, ring->br);
 		enqueued++;
-		dev->if_obytes += next->m_pkthdr.len;
-		if (next->m_flags & M_MCAST)
-			if_inc_counter(dev, IFCOUNTER_OMCASTS, 1);
 		if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0)
 			break;
 	}

Modified: head/sys/ofed/drivers/net/mlx4/fw.h
==============================================================================
--- head/sys/ofed/drivers/net/mlx4/fw.h	Wed Sep 24 08:18:11 2014	(r272059)
+++ head/sys/ofed/drivers/net/mlx4/fw.h	Wed Sep 24 08:28:34 2014	(r272060)
@@ -223,8 +223,6 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev,
 int mlx4_CLOSE_HCA(struct mlx4_dev *dev, int panic);
 int mlx4_map_cmd(struct mlx4_dev *dev, u16 op, struct mlx4_icm *icm, u64 virt);
 int mlx4_SET_ICM_SIZE(struct mlx4_dev *dev, u64 icm_size, u64 *aux_pages);
-int mlx4_MAP_ICM_AUX(struct mlx4_dev *dev, struct mlx4_icm *icm);
-int mlx4_UNMAP_ICM_AUX(struct mlx4_dev *dev);
 int mlx4_NOP(struct mlx4_dev *dev);
 int mlx4_MOD_STAT_CFG(struct mlx4_dev *dev, struct mlx4_mod_stat_cfg *cfg);
 void mlx4_opreq_action(struct work_struct *work);

Modified: head/sys/ofed/drivers/net/mlx4/mlx4_en.h
==============================================================================
--- head/sys/ofed/drivers/net/mlx4/mlx4_en.h	Wed Sep 24 08:18:11 2014	(r272059)
+++ head/sys/ofed/drivers/net/mlx4/mlx4_en.h	Wed Sep 24 08:28:34 2014	(r272060)
@@ -605,6 +605,7 @@ struct mlx4_en_priv {
 	struct delayed_work service_task;
 	struct mlx4_en_perf_stats pstats;
 	struct mlx4_en_pkt_stats pkstats;
+	struct mlx4_en_pkt_stats pkstats_last;
 	struct mlx4_en_flow_stats flowstats[MLX4_NUM_PRIORITIES];
 	struct mlx4_en_port_stats port_stats;
 	struct mlx4_en_vport_stats vport_stats;

Modified: head/sys/ofed/drivers/net/mlx4/resource_tracker.c
==============================================================================
--- head/sys/ofed/drivers/net/mlx4/resource_tracker.c	Wed Sep 24 08:18:11 2014	(r272059)
+++ head/sys/ofed/drivers/net/mlx4/resource_tracker.c	Wed Sep 24 08:28:34 2014	(r272060)
@@ -1843,7 +1843,7 @@ static int mac_alloc_res(struct mlx4_dev
 	int err = -EINVAL;
 	int port;
 	u64 mac;
-	u8 smac_index;
+	u8 smac_index = 0;
 
 	if (op != RES_OP_RESERVE_AND_MAP)
 		return err;



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