diff mbox series

[for-next,06/16] RDMA/rxe: Replace pr_xxx by rxe_dbg_qp in rxe_net.c

Message ID 20221101202238.32836-7-rpearsonhpe@gmail.com (mailing list archive)
State Superseded
Delegated to: Jason Gunthorpe
Headers show
Series Use ibdev_dbg instead of pr_xxx | expand

Commit Message

Bob Pearson Nov. 1, 2022, 8:22 p.m. UTC
Replace some calls to rxe_err/warn() in rxe_net.c with rxe_dbg_qp().

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_net.c | 35 ++++++++++++++++-------------
 1 file changed, 19 insertions(+), 16 deletions(-)

Comments

kernel test robot Nov. 2, 2022, 6:59 a.m. UTC | #1
Hi Bob,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 692373d186205dfb1b56f35f22702412d94d9420]

url:    https://github.com/intel-lab-lkp/linux/commits/Bob-Pearson/Use-ibdev_dbg-instead-of-pr_xxx/20221102-042644
base:   692373d186205dfb1b56f35f22702412d94d9420
patch link:    https://lore.kernel.org/r/20221101202238.32836-7-rpearsonhpe%40gmail.com
patch subject: [PATCH for-next 06/16] RDMA/rxe: Replace pr_xxx by rxe_dbg_qp in rxe_net.c
config: sparc-randconfig-r032-20221031
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/9075187153873821bc80c9276f89c51f9c848249
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Bob-Pearson/Use-ibdev_dbg-instead-of-pr_xxx/20221102-042644
        git checkout 9075187153873821bc80c9276f89c51f9c848249
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/infiniband/sw/rxe/rxe_net.c: In function 'rxe_find_route':
>> drivers/infiniband/sw/rxe/rxe_net.c:117:47: error: passing argument 1 of 'rxe_find_route6' from incompatible pointer type [-Werror=incompatible-pointer-types]
     117 |                         dst = rxe_find_route6(qp, ndev, saddr6, daddr6);
         |                                               ^~
         |                                               |
         |                                               struct rxe_qp *
   drivers/infiniband/sw/rxe/rxe_net.c:82:61: note: expected 'struct net_device *' but argument is of type 'struct rxe_qp *'
      82 | static struct dst_entry *rxe_find_route6(struct net_device *ndev,
         |                                          ~~~~~~~~~~~~~~~~~~~^~~~
   drivers/infiniband/sw/rxe/rxe_net.c:117:51: error: passing argument 2 of 'rxe_find_route6' from incompatible pointer type [-Werror=incompatible-pointer-types]
     117 |                         dst = rxe_find_route6(qp, ndev, saddr6, daddr6);
         |                                                   ^~~~
         |                                                   |
         |                                                   struct net_device *
   drivers/infiniband/sw/rxe/rxe_net.c:83:59: note: expected 'struct in6_addr *' but argument is of type 'struct net_device *'
      83 |                                          struct in6_addr *saddr,
         |                                          ~~~~~~~~~~~~~~~~~^~~~~
>> drivers/infiniband/sw/rxe/rxe_net.c:117:31: error: too many arguments to function 'rxe_find_route6'
     117 |                         dst = rxe_find_route6(qp, ndev, saddr6, daddr6);
         |                               ^~~~~~~~~~~~~~~
   drivers/infiniband/sw/rxe/rxe_net.c:82:26: note: declared here
      82 | static struct dst_entry *rxe_find_route6(struct net_device *ndev,
         |                          ^~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/rxe_find_route6 +117 drivers/infiniband/sw/rxe/rxe_net.c

    90	
    91	static struct dst_entry *rxe_find_route(struct net_device *ndev,
    92						struct rxe_qp *qp,
    93						struct rxe_av *av)
    94	{
    95		struct dst_entry *dst = NULL;
    96	
    97		if (qp_type(qp) == IB_QPT_RC)
    98			dst = sk_dst_get(qp->sk->sk);
    99	
   100		if (!dst || !dst_check(dst, qp->dst_cookie)) {
   101			if (dst)
   102				dst_release(dst);
   103	
   104			if (av->network_type == RXE_NETWORK_TYPE_IPV4) {
   105				struct in_addr *saddr;
   106				struct in_addr *daddr;
   107	
   108				saddr = &av->sgid_addr._sockaddr_in.sin_addr;
   109				daddr = &av->dgid_addr._sockaddr_in.sin_addr;
   110				dst = rxe_find_route4(qp, ndev, saddr, daddr);
   111			} else if (av->network_type == RXE_NETWORK_TYPE_IPV6) {
   112				struct in6_addr *saddr6;
   113				struct in6_addr *daddr6;
   114	
   115				saddr6 = &av->sgid_addr._sockaddr_in6.sin6_addr;
   116				daddr6 = &av->dgid_addr._sockaddr_in6.sin6_addr;
 > 117				dst = rxe_find_route6(qp, ndev, saddr6, daddr6);
   118	#if IS_ENABLED(CONFIG_IPV6)
   119				if (dst)
   120					qp->dst_cookie =
   121						rt6_get_cookie((struct rt6_info *)dst);
   122	#endif
   123			}
   124	
   125			if (dst && (qp_type(qp) == IB_QPT_RC)) {
   126				dst_hold(dst);
   127				sk_dst_set(qp->sk->sk, dst);
   128			}
   129		}
   130		return dst;
   131	}
   132
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index c36cad9c7a66..76a7668ca5bc 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -20,9 +20,10 @@ 
 
 static struct rxe_recv_sockets recv_sockets;
 
-static struct dst_entry *rxe_find_route4(struct net_device *ndev,
-				  struct in_addr *saddr,
-				  struct in_addr *daddr)
+static struct dst_entry *rxe_find_route4(struct rxe_qp *qp,
+					 struct net_device *ndev,
+					 struct in_addr *saddr,
+					 struct in_addr *daddr)
 {
 	struct rtable *rt;
 	struct flowi4 fl = { { 0 } };
@@ -35,7 +36,7 @@  static struct dst_entry *rxe_find_route4(struct net_device *ndev,
 
 	rt = ip_route_output_key(&init_net, &fl);
 	if (IS_ERR(rt)) {
-		pr_err_ratelimited("no route to %pI4\n", &daddr->s_addr);
+		rxe_dbg_qp(qp, "no route to %pI4\n", &daddr->s_addr);
 		return NULL;
 	}
 
@@ -43,7 +44,8 @@  static struct dst_entry *rxe_find_route4(struct net_device *ndev,
 }
 
 #if IS_ENABLED(CONFIG_IPV6)
-static struct dst_entry *rxe_find_route6(struct net_device *ndev,
+static struct dst_entry *rxe_find_route6(struct rxe_qp *qp,
+					 struct net_device *ndev,
 					 struct in6_addr *saddr,
 					 struct in6_addr *daddr)
 {
@@ -60,12 +62,12 @@  static struct dst_entry *rxe_find_route6(struct net_device *ndev,
 					       recv_sockets.sk6->sk, &fl6,
 					       NULL);
 	if (IS_ERR(ndst)) {
-		pr_err_ratelimited("no route to %pI6\n", daddr);
+		rxe_dbg_qp(qp, "no route to %pI6\n", daddr);
 		return NULL;
 	}
 
 	if (unlikely(ndst->error)) {
-		pr_err("no route to %pI6\n", daddr);
+		rxe_dbg_qp(qp, "no route to %pI6\n", daddr);
 		goto put;
 	}
 
@@ -105,14 +107,14 @@  static struct dst_entry *rxe_find_route(struct net_device *ndev,
 
 			saddr = &av->sgid_addr._sockaddr_in.sin_addr;
 			daddr = &av->dgid_addr._sockaddr_in.sin_addr;
-			dst = rxe_find_route4(ndev, saddr, daddr);
+			dst = rxe_find_route4(qp, ndev, saddr, daddr);
 		} else if (av->network_type == RXE_NETWORK_TYPE_IPV6) {
 			struct in6_addr *saddr6;
 			struct in6_addr *daddr6;
 
 			saddr6 = &av->sgid_addr._sockaddr_in6.sin6_addr;
 			daddr6 = &av->dgid_addr._sockaddr_in6.sin6_addr;
-			dst = rxe_find_route6(ndev, saddr6, daddr6);
+			dst = rxe_find_route6(qp, ndev, saddr6, daddr6);
 #if IS_ENABLED(CONFIG_IPV6)
 			if (dst)
 				qp->dst_cookie =
@@ -282,7 +284,7 @@  static int prepare4(struct rxe_av *av, struct rxe_pkt_info *pkt,
 
 	dst = rxe_find_route(skb->dev, qp, av);
 	if (!dst) {
-		pr_err("Host not reachable\n");
+		rxe_dbg_qp(qp, "Host not reachable\n");
 		return -EHOSTUNREACH;
 	}
 
@@ -306,7 +308,7 @@  static int prepare6(struct rxe_av *av, struct rxe_pkt_info *pkt,
 
 	dst = rxe_find_route(skb->dev, qp, av);
 	if (!dst) {
-		pr_err("Host not reachable\n");
+		rxe_dbg_qp(qp, "Host not reachable\n");
 		return -EHOSTUNREACH;
 	}
 
@@ -365,7 +367,8 @@  static int rxe_send(struct sk_buff *skb, struct rxe_pkt_info *pkt)
 	} else if (skb->protocol == htons(ETH_P_IPV6)) {
 		err = ip6_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
 	} else {
-		pr_err("Unknown layer 3 protocol: %d\n", skb->protocol);
+		rxe_dbg_qp(pkt->qp, "Unknown layer 3 protocol: %d\n",
+				skb->protocol);
 		atomic_dec(&pkt->qp->skb_out);
 		rxe_put(pkt->qp);
 		kfree_skb(skb);
@@ -373,7 +376,7 @@  static int rxe_send(struct sk_buff *skb, struct rxe_pkt_info *pkt)
 	}
 
 	if (unlikely(net_xmit_eval(err))) {
-		pr_debug("error sending packet: %d\n", err);
+		rxe_dbg_qp(pkt->qp, "error sending packet: %d\n", err);
 		return -EAGAIN;
 	}
 
@@ -411,7 +414,7 @@  int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
 
 	if ((is_request && (qp->req.state != QP_STATE_READY)) ||
 	    (!is_request && (qp->resp.state != QP_STATE_READY))) {
-		pr_info("Packet dropped. QP is not in ready state\n");
+		rxe_dbg_qp(qp, "Packet dropped. QP is not in ready state\n");
 		goto drop;
 	}
 
@@ -592,7 +595,7 @@  static int rxe_notify(struct notifier_block *not_blk,
 		rxe_port_down(rxe);
 		break;
 	case NETDEV_CHANGEMTU:
-		pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu);
+		rxe_dbg(rxe, "%s changed mtu to %d\n", ndev->name, ndev->mtu);
 		rxe_set_mtu(rxe, ndev->mtu);
 		break;
 	case NETDEV_CHANGE:
@@ -604,7 +607,7 @@  static int rxe_notify(struct notifier_block *not_blk,
 	case NETDEV_CHANGENAME:
 	case NETDEV_FEAT_CHANGE:
 	default:
-		pr_info("ignoring netdev event = %ld for %s\n",
+		rxe_dbg(rxe, "ignoring netdev event = %ld for %s\n",
 			event, ndev->name);
 		break;
 	}