Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Oct 2021 20:15:06 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9d593d5a76f2 - main - mlx4: rename conflicting netdev_priv() to mlx4_netdev_priv()
Message-ID:  <202110252015.19PKF6Hk017712@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

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

commit 9d593d5a76f22a315d7c6ab99e5e76003ec2b3f5
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-10-25 16:18:11 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-10-25 20:12:32 +0000

    mlx4: rename conflicting netdev_priv() to mlx4_netdev_priv()
    
    netdev_priv() is a LinuxKPI function which was used with the old ifnet
    linux/netdevice.h implementation which was not adaptable to modern
    Linux drviers unless rewriting them for ifnet in first place which
    defeats the purpose.
    Rename the netdev_priv() calls in mlx4 to mlx4_netdev_priv()
    returning the ifnet softc to avoid conflicting symbol names
    with different implementations in the future.
    
    MFC after:      3 days
    Reviewed by:    hselasky, kib
    Differential Revision: https://reviews.freebsd.org/D32640
---
 sys/dev/mlx4/mlx4_en/en.h             | 13 ++++++++++---
 sys/dev/mlx4/mlx4_en/mlx4_en_main.c   |  2 +-
 sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c | 34 +++++++++++++++++-----------------
 sys/dev/mlx4/mlx4_en/mlx4_en_port.c   |  8 ++++----
 sys/dev/mlx4/mlx4_en/mlx4_en_rx.c     |  6 +++---
 sys/dev/mlx4/mlx4_en/mlx4_en_tx.c     | 16 ++++++++--------
 sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c   |  2 +-
 7 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/sys/dev/mlx4/mlx4_en/en.h b/sys/dev/mlx4/mlx4_en/en.h
index 4a8b4fbd5fd4..440b9a340221 100644
--- a/sys/dev/mlx4/mlx4_en/en.h
+++ b/sys/dev/mlx4/mlx4_en/en.h
@@ -39,13 +39,20 @@
 #include <linux/list.h>
 #include <linux/mutex.h>
 #include <linux/kobject.h>
-#include <linux/netdevice.h>
 #include <linux/if_vlan.h>
 #include <linux/if_ether.h>
 #ifdef CONFIG_MLX4_EN_DCB
 #include <linux/dcbnl.h>
 #endif
 
+#include <sys/socket.h>
+#include <sys/taskqueue.h>
+
+#include <net/if_types.h>
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_dl.h>
+
 #include <dev/mlx4/device.h>
 #include <dev/mlx4/qp.h>
 #include <dev/mlx4/cq.h>
@@ -655,7 +662,7 @@ struct mlx4_mac_entry {
 };
 
 static inline void *
-netdev_priv(const struct ifnet *dev)
+mlx4_netdev_priv(const struct ifnet *dev)
 {
 	return (dev->if_softc);
 }
@@ -710,7 +717,7 @@ static inline bool mlx4_en_cq_lock_poll(struct mlx4_en_cq *cq)
 	spin_lock_bh(&cq->poll_lock);
 	if ((cq->state & MLX4_CQ_LOCKED)) {
 		struct ifnet *dev = cq->dev;
-		struct mlx4_en_priv *priv = netdev_priv(dev);
+		struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 		struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring];
 
 		cq->state |= MLX4_EN_CQ_STATE_POLL_YIELD;
diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_main.c b/sys/dev/mlx4/mlx4_en/mlx4_en_main.c
index fe3adfe9c162..e328fb228982 100644
--- a/sys/dev/mlx4/mlx4_en/mlx4_en_main.c
+++ b/sys/dev/mlx4/mlx4_en/mlx4_en_main.c
@@ -119,7 +119,7 @@ static void mlx4_en_event(struct mlx4_dev *dev, void *endev_ptr,
 	case MLX4_DEV_EVENT_PORT_DOWN:
 		if (!mdev->pndev[port])
 			return;
-		priv = netdev_priv(mdev->pndev[port]);
+		priv = mlx4_netdev_priv(mdev->pndev[port]);
 		/* To prevent races, we poll the link state in a separate
 		  task rather than changing it here */
 		priv->link_state = event;
diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
index 672affcce623..14289cb20e13 100644
--- a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
+++ b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
@@ -65,7 +65,7 @@ static int mlx4_en_low_latency_recv(struct napi_struct *napi)
 {
 	struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi);
 	struct ifnet *dev = cq->dev;
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring];
 	int done;
 
@@ -291,7 +291,7 @@ static int
 mlx4_en_filter_rfs(struct ifnet *net_dev, const struct sk_buff *skb,
 		   u16 rxq_index, u32 flow_id)
 {
-	struct mlx4_en_priv *priv = netdev_priv(net_dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(net_dev);
 	struct mlx4_en_filter *filter;
 	const struct iphdr *ip;
 	const __be16 *ports;
@@ -402,7 +402,7 @@ static void mlx4_en_filter_rfs_expire(struct mlx4_en_priv *priv)
 
 static void mlx4_en_vlan_rx_add_vid(void *arg, struct ifnet *dev, u16 vid)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int err;
 	int idx;
@@ -429,7 +429,7 @@ static void mlx4_en_vlan_rx_add_vid(void *arg, struct ifnet *dev, u16 vid)
 
 static void mlx4_en_vlan_rx_kill_vid(void *arg, struct ifnet *dev, u16 vid)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int err;
 
@@ -608,7 +608,7 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv)
 
 static void mlx4_en_clear_uclist(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_addr_list *tmp, *uc_to_del;
 
 	list_for_each_entry_safe(uc_to_del, tmp, &priv->uc_list, list) {
@@ -637,7 +637,7 @@ static u_int mlx4_copy_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
 
 static void mlx4_en_cache_uclist(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 
 	mlx4_en_clear_uclist(dev);
 	if_foreach_lladdr(dev, mlx4_copy_addr, priv);
@@ -645,7 +645,7 @@ static void mlx4_en_cache_uclist(struct ifnet *dev)
 
 static void mlx4_en_clear_mclist(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_addr_list *tmp, *mc_to_del;
 
 	list_for_each_entry_safe(mc_to_del, tmp, &priv->mc_list, list) {
@@ -673,7 +673,7 @@ static u_int mlx4_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int count)
 
 static void mlx4_en_cache_mclist(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 
 	mlx4_en_clear_mclist(dev);
 	if_foreach_llmaddr(dev, mlx4_copy_maddr, priv);
@@ -730,7 +730,7 @@ static void update_addr_list_flags(struct mlx4_en_priv *priv,
 
 static void mlx4_en_set_rx_mode(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 
 	if (!priv->port_up)
 		return;
@@ -1260,7 +1260,7 @@ static void mlx4_en_linkstate(struct work_struct *work)
 
 int mlx4_en_start_port(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	struct mlx4_en_cq *cq;
 	struct mlx4_en_tx_ring *tx_ring;
@@ -1453,7 +1453,7 @@ cq_err:
 
 void mlx4_en_stop_port(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	struct mlx4_en_addr_list *addr_list, *tmp;
 	int i;
@@ -1603,7 +1603,7 @@ reset:
 
 static void mlx4_en_clear_stats(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int i;
 
@@ -1762,7 +1762,7 @@ struct en_port_attribute en_port_attr_##_name = __ATTR(_name, _mode, _show, _sto
 
 void mlx4_en_destroy_netdev(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 
 	en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port);
@@ -1817,7 +1817,7 @@ void mlx4_en_destroy_netdev(struct ifnet *dev)
 
 static int mlx4_en_change_mtu(struct ifnet *dev, int new_mtu)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int err = 0;
 
@@ -2353,7 +2353,7 @@ out:
 static int mlx4_en_set_ring_size(struct ifnet *dev,
     int rx_size, int tx_size)
 {
-        struct mlx4_en_priv *priv = netdev_priv(dev);
+        struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
         struct mlx4_en_dev *mdev = priv->mdev;
         int port_up = 0;
         int err = 0;
@@ -2427,7 +2427,7 @@ static int mlx4_en_set_tx_ring_size(SYSCTL_HANDLER_ARGS)
 static int mlx4_en_get_module_info(struct ifnet *dev,
 				   struct ethtool_modinfo *modinfo)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int ret;
 	u8 data[4];
@@ -2475,7 +2475,7 @@ static int mlx4_en_get_module_eeprom(struct ifnet *dev,
 				     struct ethtool_eeprom *ee,
 				     u8 *data)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int offset = ee->offset;
 	int i = 0, ret;
diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_port.c b/sys/dev/mlx4/mlx4_en/mlx4_en_port.c
index 9a0edac109f4..2e19130b9e96 100644
--- a/sys/dev/mlx4/mlx4_en/mlx4_en_port.c
+++ b/sys/dev/mlx4/mlx4_en/mlx4_en_port.c
@@ -74,7 +74,7 @@ int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, struct mlx4_en_priv *priv)
 int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port)
 {
 	struct mlx4_en_query_port_context *qport_context;
-	struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(mdev->pndev[port]);
 	struct mlx4_en_port_state *state = &priv->port_state;
 	struct mlx4_cmd_mailbox *mailbox;
 	int err;
@@ -151,7 +151,7 @@ static u64 en_stats_adder(__be64 *start, __be64 *next, int num)
 
 static void mlx4_en_fold_software_stats(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	u64 packets, bytes;
 	int i;
@@ -188,7 +188,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
 	struct mlx4_en_stat_out_mbox *mlx4_en_stats;
 	struct mlx4_en_stat_out_flow_control_mbox *flowstats;
 	struct ifnet *dev = mdev->pndev[port];
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats;
 	struct mlx4_cmd_mailbox *mailbox;
 	u64 in_mod = reset << 8 | port;
@@ -436,7 +436,7 @@ out:
 
 int mlx4_en_get_vport_stats(struct mlx4_en_dev *mdev, u8 port)
 {
-	struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(mdev->pndev[port]);
 	struct mlx4_counter tmp_vport_stats;
 	struct mlx4_en_vf_stats *vf_stats = &priv->vf_stats;
 	int err, i, counter_index;
diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c
index 8e7c410d1c55..56e8711c6599 100644
--- a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c
+++ b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c
@@ -340,7 +340,7 @@ void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev)
 
 void mlx4_en_calc_rx_buf(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN +
 	    MLX4_NET_IP_ALIGN;
 
@@ -737,7 +737,7 @@ mlx4_en_rss_hash(__be16 status, int udp_rss)
 #define CQE_FACTOR_INDEX(index, factor) (((index) << (factor)) + (factor))
 int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_cqe *cqe;
 	struct mlx4_en_rx_ring *ring = priv->rx_ring[cq->ring];
 	struct mlx4_en_rx_mbuf *mb_list;
@@ -880,7 +880,7 @@ static int mlx4_en_poll_rx_cq(struct mlx4_en_cq *cq, int budget)
 void mlx4_en_rx_irq(struct mlx4_cq *mcq)
 {
 	struct mlx4_en_cq *cq = container_of(mcq, struct mlx4_en_cq, mcq);
-	struct mlx4_en_priv *priv = netdev_priv(cq->dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(cq->dev);
         int done;
 
         // Shoot one within the irq context 
diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
index f3a41a15f8b6..34af99ae0340 100644
--- a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
+++ b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
@@ -310,7 +310,7 @@ done:
 
 int mlx4_en_free_tx_buf(struct ifnet *dev, struct mlx4_en_tx_ring *ring)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	int cnt = 0;
 
 	/* Skip last polled descriptor */
@@ -347,7 +347,7 @@ mlx4_en_tx_ring_is_full(struct mlx4_en_tx_ring *ring)
 static int mlx4_en_process_tx_cq(struct ifnet *dev,
 				 struct mlx4_en_cq *cq)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_cq *mcq = &cq->mcq;
 	struct mlx4_en_tx_ring *ring = priv->tx_ring[cq->ring];
 	struct mlx4_cqe *cqe;
@@ -423,7 +423,7 @@ static int mlx4_en_process_tx_cq(struct ifnet *dev,
 void mlx4_en_tx_irq(struct mlx4_cq *mcq)
 {
 	struct mlx4_en_cq *cq = container_of(mcq, struct mlx4_en_cq, mcq);
-	struct mlx4_en_priv *priv = netdev_priv(cq->dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(cq->dev);
 	struct mlx4_en_tx_ring *ring = priv->tx_ring[cq->ring];
 
 	if (priv->port_up == 0 || !spin_trylock(&ring->comp_lock))
@@ -436,7 +436,7 @@ void mlx4_en_tx_irq(struct mlx4_cq *mcq)
 void mlx4_en_poll_tx_cq(unsigned long data)
 {
 	struct mlx4_en_cq *cq = (struct mlx4_en_cq *) data;
-	struct mlx4_en_priv *priv = netdev_priv(cq->dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(cq->dev);
 	struct mlx4_en_tx_ring *ring = priv->tx_ring[cq->ring];
 	u32 inflight;
 
@@ -606,7 +606,7 @@ SYSINIT(hashrandom_init, SI_SUB_RANDOM, SI_ORDER_ANY, &hashrandom_init, NULL);
 
 u16 mlx4_en_select_queue(struct ifnet *dev, struct mbuf *mb)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	u32 rings_p_up = priv->num_tx_rings_p_up;
 	u32 up = 0;
 	u32 queue_index;
@@ -929,7 +929,7 @@ tx_drop:
 static int
 mlx4_en_transmit_locked(struct ifnet *ifp, int tx_ind, struct mbuf *mb)
 {
-	struct mlx4_en_priv *priv = netdev_priv(ifp);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(ifp);
 	struct mlx4_en_tx_ring *ring = priv->tx_ring[tx_ind];
 	int err = 0;
 
@@ -954,7 +954,7 @@ mlx4_en_transmit_locked(struct ifnet *ifp, int tx_ind, struct mbuf *mb)
 int
 mlx4_en_transmit(struct ifnet *dev, struct mbuf *m)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 	struct mlx4_en_tx_ring *ring;
 	int i, err = 0;
 
@@ -994,7 +994,7 @@ mlx4_en_transmit(struct ifnet *dev, struct mbuf *m)
 void
 mlx4_en_qflush(struct ifnet *dev)
 {
-	struct mlx4_en_priv *priv = netdev_priv(dev);
+	struct mlx4_en_priv *priv = mlx4_netdev_priv(dev);
 
 	if (priv->port_up == 0)
 		return;
diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
index f9ac3121199a..b8a61c87f827 100644
--- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
+++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
@@ -148,7 +148,7 @@ static struct ifnet *mlx4_ib_get_netdev(struct ib_device *device, u8 port_num)
 			if (upper) {
 				struct ifnet *active;
 
-				active = bond_option_active_slave_get_rcu(netdev_priv(upper));
+				active = bond_option_active_slave_get_rcu(mlx4_netdev_priv(upper));
 				if (active)
 					dev = active;
 			}



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