]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
rds: C-style nits
authorKa-Cheong Poon <ka-cheong.poon@oracle.com>
Fri, 20 Oct 2017 09:07:12 +0000 (02:07 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 11 Dec 2017 04:19:57 +0000 (20:19 -0800)
Replace the use of NIPQUAD() with the proper format string and fix
checkpatch warnings.

Fix Copyright format and year.

Orabug: 25410192

Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Reviewed-by: HÃ¥kon Bugge <haakon.bugge@oracle.com>
net/rds/af_rds.c
net/rds/connection.c
net/rds/ib.c
net/rds/ib_cm.c
net/rds/ib_send.c
net/rds/rdma_transport.c
net/rds/recv.c
net/rds/send.c
net/rds/tcp.h
net/rds/threads.c

index c435c3eb020adfb2053acf69abd270a7ea839d3c..1fb7b34b85534a5ccf00dbaa4fe0189b75830cc6 100644 (file)
@@ -378,11 +378,10 @@ static int rds_user_reset(struct rds_sock *rs, char __user *optval, int optlen)
        if (conn) {
                bool is_tcp = conn->c_trans->t_type == RDS_TRANS_TCP;
 
-               printk(KERN_NOTICE "Resetting RDS/%s connection "
-                               "<%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
-                               is_tcp ? "tcp" : "IB",
-                               NIPQUAD(reset.src.s_addr),
-                               NIPQUAD(reset.dst.s_addr), conn->c_tos);
+               printk(KERN_NOTICE "Resetting RDS/%s connection <%pI4,%pI4,%d>\n",
+                      is_tcp ? "tcp" : "IB",
+                      &reset.src.s_addr,
+                      &reset.dst.s_addr, conn->c_tos);
                rds_user_conn_paths_drop(conn, DR_USER_RESET);
        }
 done:
index a5d695189706968333ec5daa690213fba2699676..7adea0f5339004906e3fc38091c4676940ef7e06 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Oracle.  All rights reserved.
+ * Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -375,9 +375,9 @@ void rds_conn_shutdown(struct rds_conn_path *cp)
        /* shut it down unless it's down already */
        if (!rds_conn_path_transition(cp, RDS_CONN_DOWN, RDS_CONN_DOWN)) {
                rds_rtd(RDS_RTD_CM_EXT,
-                       "RDS/%s: shutdown init <%u.%u.%u.%u,%u.%u.%u.%u,%d>, cn %p, cn->c_p %p\n",
+                       "RDS/%s: shutdown init <%pI4,%pI4,%d>, cn       %p, cn->c_p %p\n",
                        conn->c_trans->t_type == RDS_TRANS_TCP ? "TCP" : "IB",
-                       NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
+                       &conn->c_laddr, &conn->c_faddr,
                        conn->c_tos, conn, conn->c_passive);
                /*
                 * Quiesce the connection mgmt handlers before we start tearing
@@ -505,8 +505,8 @@ void rds_conn_destroy(struct rds_connection *conn, int shutdown)
        int i;
        int npaths = (conn->c_trans->t_mp_capable ? RDS_MPATH_WORKERS : 1);
 
-       rds_rtd(RDS_RTD_CM, "freeing conn %p <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
-               conn, NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
+       rds_rtd(RDS_RTD_CM, "freeing conn %p <%pI4,%pI4,%d>\n",
+               conn, &conn->c_laddr, &conn->c_faddr,
                conn->c_tos);
 
        conn->c_destroy_in_prog = 1;
@@ -849,25 +849,21 @@ void rds_conn_path_drop(struct rds_conn_path *cp, int reason)
                cp->cp_reconnect_err = 0;
                cp->cp_reconnect_racing = 0;
                if (conn->c_trans->t_type != RDS_TRANS_TCP)
-                       printk(KERN_INFO "RDS/IB: connection "
-                               "<%u.%u.%u.%u,%u.%u.%u.%u,%d> "
-                               "dropped due to '%s'\n",
-                               NIPQUAD(conn->c_laddr),
-                               NIPQUAD(conn->c_faddr),
-                               conn->c_tos,
-                               conn_drop_reason_str(cp->cp_drop_source));
+                       printk(KERN_INFO "RDS/IB: connection <%pI4,%pI4,%d> dropped due to '%s'\n",
+                              &conn->c_laddr,
+                              &conn->c_faddr,
+                              conn->c_tos,
+                              conn_drop_reason_str(cp->cp_drop_source));
 
        } else if ((cp->cp_reconnect_warn) &&
                   (now - cp->cp_reconnect_start > 60)) {
-               printk(KERN_INFO "RDS/%s: re-connect "
-                       "<%u.%u.%u.%u,%u.%u.%u.%u,%d> stalling "
-                       "for more than 1 min...(drops=%u err=%d)\n",
-                       conn->c_trans->t_type == RDS_TRANS_TCP ? "TCP" : "IB",
-                       NIPQUAD(conn->c_laddr),
-                       NIPQUAD(conn->c_faddr),
-                       conn->c_tos,
-                       cp->cp_reconnect_drops,
-                       cp->cp_reconnect_err);
+               printk(KERN_INFO "RDS/%s: re-connect <%pI4,%pI4,%d> stalling for more than 1 min...(drops=%u err=%d)\n",
+                      conn->c_trans->t_type == RDS_TRANS_TCP ? "TCP" : "IB",
+                      &conn->c_laddr,
+                      &conn->c_faddr,
+                      conn->c_tos,
+                      cp->cp_reconnect_drops,
+                      cp->cp_reconnect_err);
                cp->cp_reconnect_warn = 0;
        }
        cp->cp_reconnect_drops++;
@@ -875,9 +871,9 @@ void rds_conn_path_drop(struct rds_conn_path *cp, int reason)
        atomic_set(&cp->cp_state, RDS_CONN_ERROR);
 
        rds_rtd(RDS_RTD_CM_EXT,
-               "RDS/%s: queueing shutdown work, conn %p, <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
+               "RDS/%s: queueing shutdown work, conn %p, <%pI4,%pI4,%d>\n",
                conn->c_trans->t_type == RDS_TRANS_TCP ? "TCP" : "IB",
-               conn, NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
+               conn, &conn->c_laddr, &conn->c_faddr,
                conn->c_tos);
 
        queue_work(cp->cp_wq, &cp->cp_down_w);
@@ -902,8 +898,8 @@ void rds_conn_path_connect_if_down(struct rds_conn_path *cp)
        if (rds_conn_path_state(cp) == RDS_CONN_DOWN &&
            !test_and_set_bit(RDS_RECONNECT_PENDING, &cp->cp_flags)) {
                rds_rtd(RDS_RTD_CM_EXT,
-                       "queueing connect work, conn %p, <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
-                       conn, NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
+                       "queueing connect work, conn %p, <%pI4,%pI4,%d>\n",
+                       conn, &conn->c_laddr, &conn->c_faddr,
                        conn->c_tos);
                queue_delayed_work(cp->cp_wq, &cp->cp_conn_w, 0);
        }
index d32f1c9fbf6d60f0f6544354ea6b9fa2ea1809a6..cc465c5a01f755b2351ca4630bf1c28623bb7ad7 100644 (file)
@@ -125,6 +125,21 @@ DECLARE_DELAYED_WORK(riif_dlywork, rds_ib_initial_failovers);
 static int timeout_until_initial_failovers;
 static struct workqueue_struct *rds_ip_wq;
 
+/* Return a string representation of an IB port state. */
+static const char *rds_ib_port_state2name(int state)
+{
+       switch (state) {
+       case RDS_IB_PORT_INIT:
+               return "INIT";
+       case RDS_IB_PORT_UP:
+               return "UP";
+       case RDS_IB_PORT_DOWN:
+               return "DOWN";
+       default:
+               return "UNKNOWN";
+       }
+}
+
 /*
  * rds_detected_linklayer_up
  *
@@ -668,10 +683,9 @@ static int rds_ib_move_ip(char                     *from_dev,
 
                        if (ret) {
                                printk(KERN_ERR
-                                       "RDS/IP: failed to set IP %u.%u.%u.%u "
-                                       "on %s failed (%d)\n",
-                                       NIPQUAD(ip_config[to_port].ip_addr),
-                                       ip_config[to_port].dev->name, ret);
+                                      "RDS/IP: failed to set IP %pI4 on %s failed (%d)\n",
+                                      &ip_config[to_port].ip_addr,
+                                      ip_config[to_port].dev->name, ret);
                                goto out;
                        }
                } else if (ret) {
@@ -741,21 +755,19 @@ static int rds_ib_move_ip(char                    *from_dev,
 
        if (ret) {
                printk(KERN_NOTICE
-                       "RDS/IP: failed to move IP %u.%u.%u.%u "
-                       "from %s to %s\n",
-                       NIPQUAD(addr), from_dev2, to_dev2);
+                      "RDS/IP: failed to move IP %pI4 from %s to %s\n",
+                      &addr, from_dev2, to_dev2);
        } else {
                if (strcmp(from_dev2, to_dev2) == 0) {
                        /* from_dev2, to_dev2 are identical */
                        printk(KERN_NOTICE
-                              "RDS/IP: IP %u.%u.%u.%u resurrected on migrated "
-                              "interface %s\n",
-                              NIPQUAD(addr), to_dev2);
+                              "RDS/IP: IP %pI4 resurrected on migrated interface %s\n",
+                              &addr, to_dev2);
                } else {
                        /* from_dev2, to_dev2 are different! */
                        printk(KERN_NOTICE
-                              "RDS/IP: IP %u.%u.%u.%u migrated from %s to %s\n",
-                              NIPQUAD(addr), from_dev2, to_dev2);
+                              "RDS/IP: IP %pI4 migrated from %s to %s\n",
+                              &addr, from_dev2, to_dev2);
                }
 
                rds_ibdev = ip_config[from_port].rds_ibdev;
@@ -925,37 +937,35 @@ static int rds_ib_testset_ip(u8 port)
                                    ip_config[port].ip_bcast,
                                    ip_config[port].ip_mask);
                if (ret) {
-                       printk(KERN_ERR "RDS/IB: failed to resurrect "
-                              "IP %u.%u.%u.%u on %s failed (%d)\n",
-                              NIPQUAD(ip_config[port].ip_addr),
+                       printk(KERN_ERR "RDS/IB: failed to resurrect IP %pI4 on %s failed (%d)\n",
+                              &ip_config[port].ip_addr,
                               ip_config[port].dev->name, ret);
                        goto out;
                }
                printk(KERN_NOTICE
-                      "RDS/IB: IP %u.%u.%u.%u resurrected on interface %s\n",
-                      NIPQUAD(ip_config[port].ip_addr),
+                      "RDS/IB: IP %pI4 resurrected on interface %s\n",
+                      &ip_config[port].ip_addr,
                       ip_config[port].dev->name);
                for (ii = 0; ii < ip_config[port].alias_cnt; ii++) {
+                       struct rds_ib_alias *alias;
+
+                       alias = &ip_config[port].aliases[ii];
                        ret = rds_ib_set_ip(ip_config[port].dev,
-                                       ip_config[port].dev->dev_addr,
-                                       ip_config[port].aliases[ii].if_name,
-                                       ip_config[port].aliases[ii].ip_addr,
-                                       ip_config[port].aliases[ii].ip_bcast,
-                                       ip_config[port].aliases[ii].ip_mask);
+                                           ip_config[port].dev->dev_addr,
+                                           alias->if_name,
+                                           alias->ip_addr,
+                                           alias->ip_bcast,
+                                           alias->ip_mask);
                        if (ret) {
-                               printk(KERN_ERR "RDS/IB: failed to resurrect "
-                                      "IP %u.%u.%u.%u "
-                                      "on alias %s failed (%d)\n",
-                                      NIPQUAD(ip_config[port].
-                                              aliases[ii].ip_addr),
-                                      ip_config[port].aliases[ii].if_name,
+                               printk(KERN_ERR "RDS/IB: failed to resurrect IP %pI4 on alias %s failed (%d)\n",
+                                      &alias->ip_addr,
+                                      alias->if_name,
                                       ret);
                                goto out;
                        }
                        printk(KERN_NOTICE
-                              "RDS/IB: IP %u.%u.%u.%u resurrected"
-                              " on alias %s on interface %s\n",
-                              NIPQUAD(ip_config[port].ip_addr),
+                              "RDS/IB: IP %pI4 resurrected on alias %s on interface %s\n",
+                              &ip_config[port].ip_addr,
                               ip_config[port].aliases[ii].if_name,
                               ip_config[port].dev->name);
                }
@@ -996,8 +1006,8 @@ static void rds_ib_do_failover(u8 from_port, u8 to_port, u8 arp_port,
                if (!to_port) {
                        /* we tried, but did not get a failover port! */
                        rds_rtd(RDS_RTD_ERR,
-                               "RDS/IB: IP %u.%u.%u.%u failed to migrate from %s: no matching dest port avail!\n",
-                               NIPQUAD(ip_config[from_port].ip_addr),
+                               "RDS/IB: IP %pI4 failed to migrate from %s: no matching dest port avail!\n",
+                               &ip_config[from_port].ip_addr,
                                ip_config[from_port].if_name);
                        return;
                }
@@ -1410,9 +1420,7 @@ static void rds_ib_event_handler(struct ib_event_handler *handler,
                         "port state transition to " :
                         "port state transition NONE - "
                         "port retained in state ")),
-                      (ip_config[port].port_state == RDS_IB_PORT_UP ? "UP" :
-                       (ip_config[port].port_state == RDS_IB_PORT_DOWN ?
-                        "DOWN" : "INIT")),
+                      rds_ib_port_state2name(ip_config[port].port_state),
                       ip_config[port].port_layerflags);
 
                if (this_port_transition == RDSIBP_TRANSITION_NOOP) {
@@ -1506,10 +1514,8 @@ rds_ib_do_initial_failovers(void)
                         * port by its IP address!
                         */
                        if (ip_config[ii].ip_active_port == ii) {
-                               printk(KERN_NOTICE "RDS/IB: IP %u.%u.%u.%u "
-                                      "deactivated on interface %s "
-                                      "(no suitable failover target available)\n",
-                                      NIPQUAD(ip_config[ii].ip_addr),
+                               printk(KERN_NOTICE "RDS/IB: IP %pI4 deactivated on interface %s (no suitable failover target available)\n",
+                                      &ip_config[ii].ip_addr,
                                       ip_config[ii].dev->name);
 
                                ret = rds_ib_set_ip(NULL, NULL,
@@ -1575,34 +1581,30 @@ static void rds_ib_dump_ip_config(void)
        }
 
        for (i = 1; i <= ip_port_cnt; i++) {
-               printk(KERN_INFO "RDS/IB: %s/port_%d/%s: "
-                       "IP %d.%d.%d.%d/%d.%d.%d.%d/%d.%d.%d.%d "
-                       "state %s\n",
-                       ((ip_config[i].rds_ibdev) ?
-                               ((ip_config[i].rds_ibdev->dev) ?
-                                       ip_config[i].rds_ibdev->dev->name :
-                                               "No IB device") :
-                                                       "No RDS device"),
-                       ip_config[i].port_num,
-                       ip_config[i].if_name,
-                       NIPQUAD(ip_config[i].ip_addr),
-                       NIPQUAD(ip_config[i].ip_bcast),
-                       NIPQUAD(ip_config[i].ip_mask),
-                       (ip_config[i].port_state ==
-                        RDS_IB_PORT_UP ? "UP" :
-                        (ip_config[i].port_state ==
-                         RDS_IB_PORT_DOWN ? "DOWN" : "INIT")));
+               char *dev_name;
+
+               if (ip_config[i].rds_ibdev)
+                       if (ip_config[i].rds_ibdev->dev)
+                               dev_name = ip_config[i].rds_ibdev->dev->name;
+                       else
+                               dev_name = "No IB device";
+               else
+                       dev_name = "No RDS device";
+               printk(KERN_INFO "RDS/IB: %s/port_%d/%s: IP %pI4/%pI4/%pI4 state %s\n",
+                      dev_name,
+                      ip_config[i].port_num,
+                      ip_config[i].if_name,
+                      &ip_config[i].ip_addr,
+                      &ip_config[i].ip_bcast,
+                      &ip_config[i].ip_mask,
+                      rds_ib_port_state2name(ip_config[i].port_state));
 
                for (j = 0; j < ip_config[i].alias_cnt; j++) {
-                       printk(KERN_INFO "Alias %s "
-                               "IP %d.%d.%d.%d/%d.%d.%d.%d/%d.%d.%d.%d\n",
-                               ip_config[i].aliases[j].if_name,
-                               NIPQUAD(ip_config[i].
-                                       aliases[j].ip_addr),
-                               NIPQUAD(ip_config[i].
-                                       aliases[j].ip_bcast),
-                               NIPQUAD(ip_config[i].
-                                       aliases[j].ip_mask));
+                       printk(KERN_INFO "Alias %s IP %pI4/%pI4/%pI4\n",
+                              ip_config[i].aliases[j].if_name,
+                              &ip_config[i].aliases[j].ip_addr,
+                              &ip_config[i].aliases[j].ip_bcast,
+                              &ip_config[i].aliases[j].ip_mask);
                }
        }
 }
@@ -2622,9 +2624,7 @@ static int rds_ib_netdev_callback(struct notifier_block *self, unsigned long eve
                (port_transition == RDSIBP_TRANSITION_DOWN ?
                 "port state transition to " :
                 "port state transition NONE - port retained in state ")),
-              (ip_config[port].port_state == RDS_IB_PORT_UP ? "UP" :
-               (ip_config[port].port_state == RDS_IB_PORT_DOWN ?
-                "DOWN" : "INIT")),
+              rds_ib_port_state2name(ip_config[port].port_state),
               ip_config[port].port_layerflags);
 
        if (port_transition == RDSIBP_TRANSITION_NOOP) {
index cd4bbf9a78025454c9a66f219de9ed1809771169..356312a2fc23007fc75091ae2d29475dc1f51fec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Oracle.  All rights reserved.
+ * Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -271,12 +271,10 @@ void rds_ib_cm_connect_complete(struct rds_connection *conn, struct rdma_cm_even
 
        if (conn->c_version < RDS_PROTOCOL_VERSION) {
                if (conn->c_version != RDS_PROTOCOL_COMPAT_VERSION) {
-                       printk(KERN_NOTICE "RDS/IB: Connection to"
-                               " %u.%u.%u.%u version %u.%u failed,"
-                               " no longer supported\n",
-                               NIPQUAD(conn->c_faddr),
-                               RDS_PROTOCOL_MAJOR(conn->c_version),
-                               RDS_PROTOCOL_MINOR(conn->c_version));
+                       printk(KERN_NOTICE "RDS/IB: Connection to %pI4 version %u.%u failed, no longer supported\n",
+                              &conn->c_faddr,
+                              RDS_PROTOCOL_MAJOR(conn->c_version),
+                              RDS_PROTOCOL_MINOR(conn->c_version));
                        rds_ib_conn_destroy_init(conn);
                        return;
                }
@@ -478,10 +476,9 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,
        while ((nr = ib_poll_cq(cq, RDS_WC_MAX, wcs)) > 0) {
                for (i = 0; i < nr; i++) {
                        if ((++ic->i_rx_poll_cq % RDS_IB_RX_LIMIT) == 0) {
-                               rdsdebug("connection <%u.%u.%u.%u,%u.%u.%u.%u,%d>"
-                                        " RX poll_cq processed %d\n",
-                                        NIPQUAD(ic->conn->c_laddr),
-                                        NIPQUAD(ic->conn->c_faddr),
+                               rdsdebug("connection <%pI4,%pI4,%d> RX poll_cq processed %d\n",
+                                        &ic->conn->c_laddr,
+                                        &ic->conn->c_faddr,
                                         ic->conn->c_tos,
                                         ic->i_rx_poll_cq);
                        }
@@ -1081,9 +1078,9 @@ int rds_ib_cm_initiate_connect(struct rdma_cm_id *cm_id)
 
        ret = rds_ib_match_acl(ic->i_cm_id, conn->c_faddr);
        if (ret < 0) {
-               pr_err("RDS: IB: active conn=%p, <%u.%u.%u.%u,%u.%u.%u.%u,%d> destroyed due ACL violation\n",
-                       conn, NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
-                       conn->c_tos);
+               pr_err("RDS: IB: active conn=%p, <%pI4,%pI4,%d> destroyed due ACL violation\n",
+                      conn, &conn->c_laddr, &conn->c_faddr,
+                      conn->c_tos);
                rds_ib_conn_destroy_init(conn);
                return 0;
        }
@@ -1152,8 +1149,8 @@ int rds_ib_conn_path_connect(struct rds_conn_path *cp)
        }
 
        rds_rtd(RDS_RTD_CM_EXT,
-               "RDS/IB: conn init <%u.%u.%u.%u,%u.%u.%u.%u,%d> cm_id %p\n",
-               NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
+               "RDS/IB: conn init <%pI4,%pI4,%d> cm_id %p\n",
+               &conn->c_laddr, &conn->c_faddr,
                conn->c_tos, ic->i_cm_id);
 
        src.sin_family = AF_INET;
index b2a7827ebfc715ed6dce9e6a3b33e757d04fa254..dba94adf695001489716080ddc821f65b2f1524c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Oracle.  All rights reserved.
+ * Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -926,8 +926,8 @@ int rds_ib_xmit_atomic(struct rds_connection *conn, struct rm_atomic_op *op)
                 send, &send->s_wr, ret, failed_wr);
        BUG_ON(failed_wr != &send->s_wr);
        if (ret) {
-               printk(KERN_WARNING "RDS/IB: atomic ib_post_send to %u.%u.%u.%u "
-                      "returned %d\n", NIPQUAD(conn->c_faddr), ret);
+               printk(KERN_WARNING "RDS/IB: atomic ib_post_send to %pI4 returned %d\n",
+                      &conn->c_faddr, ret);
                rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc);
                rds_ib_sub_signaled(ic, nr_sig);
                goto out;
index 561d0cbf00155965584715e34a0f2195f4512946..6da92ca64a8ad6c5bb4036b03bb38d4a1707dcaa 100644 (file)
@@ -134,8 +134,8 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
                        if (conn) {
                                struct rds_ib_connection *ibic;
 
-                               printk(KERN_CRIT "rds dropping connection after rdma_resolve_route failure"
-                                      "connection %u.%u.%u.%u->%u.%u.%u.%u\n", NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr));
+                               printk(KERN_CRIT "rds dropping connection after rdma_resolve_route failure connection %pI4->%pI4\n",
+                                      &conn->c_laddr, &conn->c_faddr);
                                ibic = conn->c_transport_data;
                                if (ibic && ibic->i_cm_id == cm_id)
                                        ibic->i_cm_id = NULL;
@@ -167,9 +167,9 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
                                ret = trans->cm_initiate_connect(cm_id);
                        } else {
                                rds_rtd(RDS_RTD_CM,
-                                       "ROUTE_RESOLVED: calling rds_conn_drop, conn %p <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
-                                       conn, NIPQUAD(conn->c_laddr),
-                                       NIPQUAD(conn->c_faddr), conn->c_tos);
+                                       "ROUTE_RESOLVED: calling rds_conn_drop, conn %p <%pI4,%pI4,%d>\n",
+                                       conn, &conn->c_laddr,
+                                       &conn->c_faddr, conn->c_tos);
                                rds_conn_drop(conn, DR_IB_RDMA_CM_ID_MISMATCH);
                        }
                }
@@ -194,9 +194,9 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
 
                if (conn) {
                        rds_rtd(RDS_RTD_ERR,
-                               "ROUTE_ERROR: conn %p, calling rds_conn_drop <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
-                               conn, NIPQUAD(conn->c_laddr),
-                               NIPQUAD(conn->c_faddr), conn->c_tos);
+                               "ROUTE_ERROR: conn %p, calling rds_conn_drop <%pI4,%pI4,%d>\n",
+                               conn, &conn->c_laddr,
+                               &conn->c_faddr, conn->c_tos);
                        rds_conn_drop(conn, DR_IB_ROUTE_ERR);
                }
                break;
@@ -208,9 +208,9 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
        case RDMA_CM_EVENT_ADDR_ERROR:
                if (conn) {
                        rds_rtd(RDS_RTD_ERR,
-                               "ADDR_ERROR: conn %p, calling rds_conn_drop <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
-                               conn, NIPQUAD(conn->c_laddr),
-                               NIPQUAD(conn->c_faddr), conn->c_tos);
+                               "ADDR_ERROR: conn %p, calling rds_conn_drop <%pI4,%pI4,%d>\n",
+                               conn, &conn->c_laddr,
+                               &conn->c_faddr, conn->c_tos);
                        rds_conn_drop(conn, DR_IB_ADDR_ERR);
                }
                break;
@@ -220,9 +220,9 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
        case RDMA_CM_EVENT_DEVICE_REMOVAL:
                if (conn) {
                        rds_rtd(RDS_RTD_ERR,
-                               "CONN/UNREACHABLE/RMVAL ERR: conn %p, calling rds_conn_drop <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
-                               conn, NIPQUAD(conn->c_laddr),
-                               NIPQUAD(conn->c_faddr), conn->c_tos);
+                               "CONN/UNREACHABLE/RMVAL ERR: conn %p, calling rds_conn_drop <%pI4,%pI4,%d>\n",
+                               conn, &conn->c_laddr,
+                               &conn->c_faddr, conn->c_tos);
                        rds_conn_drop(conn, DR_IB_CONNECT_ERR);
                }
                break;
@@ -234,9 +234,9 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
                        if (event->status == RDS_REJ_CONSUMER_DEFINED &&
                            (*err) == 0) {
                                /* Rejection from RDSV3.1 */
-                               pr_warn("Rejected: CSR_DEF err 0, calling rds_conn_drop <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
-                                       NIPQUAD(conn->c_laddr),
-                                       NIPQUAD(conn->c_faddr), conn->c_tos);
+                               pr_warn("Rejected: CSR_DEF err 0, calling rds_conn_drop <%pI4,%pI4,%d>\n",
+                                       &conn->c_laddr,
+                                       &conn->c_faddr, conn->c_tos);
                                if (!conn->c_tos)
                                        conn->c_proposed_version =
                                                RDS_PROTOCOL_COMPAT_VERSION;
@@ -245,17 +245,17 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
                        } else if (event->status == RDS_REJ_CONSUMER_DEFINED &&
                                   (*err) == RDS_ACL_FAILURE) {
                                /* Rejection due to ACL violation */
-                               pr_err("RDS: IB: conn=%p, <%u.%u.%u.%u,%u.%u.%u.%u,%d> destroyed due to ACL violation\n",
-                                               conn, NIPQUAD(conn->c_laddr),
-                                               NIPQUAD(conn->c_faddr),
-                                               conn->c_tos);
+                               pr_err("RDS: IB: conn=%p, <%pI4,%pI4,%d> destroyed due to ACL violation\n",
+                                      conn, &conn->c_laddr,
+                                      &conn->c_faddr,
+                                      conn->c_tos);
                                rds_ib_conn_destroy_init(conn);
                        } else {
                                rds_rtd(RDS_RTD_ERR,
-                                       "Rejected: *err %d status %d calling rds_conn_drop <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
+                                       "Rejected: *err %d status %d calling rds_conn_drop <%pI4,%pI4,%d>\n",
                                        *err, event->status,
-                                       NIPQUAD(conn->c_laddr),
-                                       NIPQUAD(conn->c_faddr),
+                                       &conn->c_laddr,
+                                       &conn->c_faddr,
                                        conn->c_tos);
                                rds_conn_drop(conn, DR_IB_REJECTED_EVENT);
                        }
@@ -264,13 +264,13 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
 
        case RDMA_CM_EVENT_ADDR_CHANGE:
                rds_rtd(RDS_RTD_CM_EXT,
-                       "ADDR_CHANGE event <%u.%u.%u.%u,%u.%u.%u.%u>\n",
-                       NIPQUAD(conn->c_laddr),
-                       NIPQUAD(conn->c_faddr));
+                       "ADDR_CHANGE event <%pI4,%pI4>\n",
+                       &conn->c_laddr,
+                       &conn->c_faddr);
                if (conn) {
                        rds_rtd(RDS_RTD_CM,
-                               "ADDR_CHANGE: calling rds_conn_drop <%u.%u.%u.%u,%u.%u.%u.%u,%d>\n",
-                               NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
+                               "ADDR_CHANGE: calling rds_conn_drop <%pI4,%pI4,%d>\n",
+                               &conn->c_laddr, &conn->c_faddr,
                                conn->c_tos);
                        if (!rds_conn_self_loopback_passive(conn)) {
                                queue_delayed_work(conn->c_path[0].cp_wq,
index 8e8a07795a84e0bb75e6305e226302d0e2a7a16e..6133a3437ed7f14005aadd1323fc0bfec1a3be16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Oracle.  All rights reserved.
+ * Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -340,8 +340,9 @@ void rds_recv_incoming(struct rds_connection *conn, __be32 saddr, __be32 daddr,
        int    ret;
        struct rds_conn_path *cp;
 
-       rdsdebug(KERN_ALERT "incoming:  conn %p, inc %p, %u.%u.%u.%u : %d -> %u.%u.%u.%u : %d\n",
-                conn, inc, NIPQUAD(saddr), inc->i_hdr.h_sport, NIPQUAD(daddr), inc->i_hdr.h_dport);
+       rdsdebug(KERN_ALERT "incoming: conn %p, inc %p, %pI4:%d -> %pI4:%d\n",
+                conn, inc, &saddr, inc->i_hdr.h_sport, &daddr,
+                inc->i_hdr.h_dport);
 
        /* initialize some globals */
        rs = NULL;
@@ -378,8 +379,8 @@ void rds_recv_incoming(struct rds_connection *conn, __be32 saddr, __be32 daddr,
        if (NULL == skb) {
                /* if we have allocation problems, then we just need to depart */
                rds_rtd(RDS_RTD_ERR,
-                       "failure to allocate space for inc %p, %u.%u.%u.%u -> %u.%d.%u.%u tos %d\n",
-                       inc, NIPQUAD(saddr), NIPQUAD(daddr), conn->c_tos);
+                       "failure to allocate space for inc %p, %pI4 -> %pI4 tos %d\n",
+                       inc, &saddr, &daddr, conn->c_tos);
                rds_recv_local(cp, saddr, daddr, inc, gfp, rs);
                /* drop the reference if we had taken one */
                if (NULL != rs)
@@ -427,8 +428,8 @@ void rds_recv_incoming(struct rds_connection *conn, __be32 saddr, __be32 daddr,
        /* if we had a failure to convert, then just assuming to continue as local */
        else {
                rds_rtd(RDS_RTD_RCV_EXT,
-                       "failed to create skb form, conn %p, inc %p, %u.%u.%u.%u -> %u.%u.%u.%u tos %d\n",
-                       conn, inc, NIPQUAD(saddr), NIPQUAD(daddr), conn->c_tos);
+                       "failed to create skb form, conn %p, inc %p, %pI4 -> %pI4 tos %d\n",
+                       conn, inc, &saddr, &daddr, conn->c_tos);
                ret = 1;
        }
 
@@ -470,9 +471,8 @@ void rds_recv_incoming(struct rds_connection *conn, __be32 saddr, __be32 daddr,
        /* we don't really expect an error state from this call that isn't the done above */
        else {
                /* we don't really know how to handle this yet - just ignore for now */
-               printk(KERN_ERR "unacceptible state for skb ret %d, conn %p, inc %p, "
-                               "%u.%u.%u.%u -> %u.%u.%u.%u\n",
-                      ret, conn, inc, NIPQUAD(saddr), NIPQUAD(daddr));
+               printk(KERN_ERR "unacceptible state for skb ret %d, conn %p, inc %p, %pI4 -> %pI4\n",
+                      ret, conn, inc, &saddr, &daddr);
        }
 }
 EXPORT_SYMBOL_GPL(rds_recv_incoming);
@@ -482,8 +482,8 @@ rds_recv_drop(struct rds_connection *conn, __be32 saddr, __be32 daddr,
              struct rds_incoming *inc, gfp_t gfp)
 {
        /* drop the existing incoming message */
-       rdsdebug("dropping request on conn %p, inc %p, %u.%u.%u.%u -> %u.%u.%u.%u",
-                conn, inc, NIPQUAD(saddr), NIPQUAD(daddr));
+       rdsdebug("dropping request on conn %p, inc %p, %pI4 -> %pI4",
+                conn, inc, &saddr, &daddr);
 }
 
 static void
@@ -509,11 +509,11 @@ rds_recv_route(struct rds_connection *conn, struct rds_incoming *inc,
 
        /* cannot find a matching connection so drop the request */
        if (NULL == nconn) {
-               printk(KERN_ALERT "cannot find matching conn for inc %p, %u.%u.%u.%u -> %u.%u.%u.%u\n",
-                      inc, NIPQUAD(dst->saddr), NIPQUAD(dst->daddr));
+               printk(KERN_ALERT "cannot find matching conn for inc %p, %pI4 -> %pI4\n",
+                      inc, &dst->saddr, &dst->daddr);
 
-               rdsdebug("cannot find matching conn for inc %p, %u.%u.%u.%u -> %u.%u.%u.%u",
-                        inc, NIPQUAD(dst->saddr), NIPQUAD(dst->daddr));
+               rdsdebug("cannot find matching conn for inc %p, %pI4 -> %pI4",
+                        inc, &dst->saddr, &dst->daddr);
                rds_recv_drop(conn, dst->saddr, dst->daddr, inc, gfp);
        }
        /* this is a request for our local node, but potentially a different source
@@ -551,8 +551,8 @@ rds_recv_forward(struct rds_conn_path *cp, struct rds_incoming *inc,
        rs = rds_find_bound(dst->saddr, dst->sport);
        if (!rs) {
                rds_rtd(RDS_RTD_RCV,
-                       "failed to find output rds_socket dst %u.%u.%u.%u : %u, inc %p, conn %p tos %d\n",
-                       NIPQUAD(dst->daddr), dst->dport, inc, conn,
+                       "failed to find output rds_socket dst %pI4 : %u, inc %p, conn %p tos %d\n",
+                       &dst->daddr, dst->dport, inc, conn,
                        conn->c_tos);
                rds_stats_inc(s_recv_drop_no_sock);
                goto out;
@@ -565,8 +565,8 @@ rds_recv_forward(struct rds_conn_path *cp, struct rds_incoming *inc,
        ret = rds_send_internal(conn, rs, inc->i_skb, gfp);
        if (len != ret) {
                rds_rtd(RDS_RTD_RCV,
-                       "failed to send rds_data dst %u.%u.%u.%u : %u, inc %p, conn %p tos %d, len %d != ret %d\n",
-                       NIPQUAD(dst->daddr), dst->dport, inc, conn, conn->c_tos,
+                       "failed to send rds_data dst %pI4 : %u, inc %p, conn %p tos %d, len %d != ret %d\n",
+                       &dst->daddr, dst->dport, inc, conn, conn->c_tos,
                        len, ret);
                goto out;
        }
@@ -641,8 +641,8 @@ rds_recv_local(struct rds_conn_path *cp, __be32 saddr, __be32 daddr,
 
        if (inc_hdr_h_sequence != cp->cp_next_rx_seq) {
                rds_rtd(RDS_RTD_RCV,
-                       "conn %p <%u.%u.%u.%u,%u.%u.%u.%u,%d> expect seq# %llu, recved seq# %llu, retrans bit %d\n",
-                       conn, NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
+                       "conn %p <%pI4,%pI4,%d> expect seq# %llu, recved seq# %llu, retrans bit %d\n",
+                       conn, &conn->c_laddr, &conn->c_faddr,
                        conn->c_tos, cp->cp_next_rx_seq, inc_hdr_h_sequence,
                        inc->i_hdr.h_flags & RDS_FLAG_RETRANSMITTED);
        }
index 167934a666e45d60f315b6e114a1c068dbc23589..86a92011d6d7de9899f55a0e3d7e7571b89bb981 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Oracle.  All rights reserved.
+ * Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -1549,8 +1549,9 @@ int rds_send_internal(struct rds_connection *conn, struct rds_sock *rs,
        queue_delayed_work(conn->c_path[0].cp_wq,
                           &conn->c_path[0].cp_send_w, 1);
 
-       rdsdebug("message sent for rs %p, conn %p, len %d, %u.%u.%u.%u : %u -> %u.%u.%u.%u : %u\n",
-                rs, conn, skb->len, NIPQUAD(dst->saddr), dst->sport, NIPQUAD(dst->daddr), dst->dport);
+       rdsdebug("message sent for rs %p, conn %p, len %d, %pI4:%u->%pI4:%u\n",
+                rs, conn, skb->len, &dst->saddr, dst->sport, &dst->daddr,
+                dst->dport);
        ret = skb->len;
 
 out:
index 0d3e655702fae2f8c3f806e7e30ae56d8360d421..e3eff146bd0ba4204701c00306f63c911d8285f6 100644 (file)
@@ -94,16 +94,4 @@ DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats);
 unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter,
                                     unsigned int avail);
 
-#ifndef NIPQUAD
-#define NIPQUAD(addr) \
-       ((unsigned char *)&(addr))[0], \
-       ((unsigned char *)&(addr))[1], \
-       ((unsigned char *)&(addr))[2], \
-       ((unsigned char *)&(addr))[3]
-#endif
-
-#ifndef NIPQUAD_FMT
-#define NIPQUAD_FMT "%u.%u.%u.%u"
-#endif
-
 #endif
index b49889cf7407eae7205a2c5a6c84385e5aded322..81e037b59a203580ee12be7a92dbccfd108a8900 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Oracle.  All rights reserved.
+ * Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -287,8 +287,8 @@ void rds_hb_worker(struct work_struct *work)
                        cp->cp_hb_start = now;
                } else if (now - cp->cp_hb_start > rds_conn_hb_timeout) {
                        rds_rtd(RDS_RTD_CM,
-                               "RDS/IB: connection <%u.%u.%u.%u,%u.%u.%u.%u,%d> timed out (0x%lx,0x%lx)..discon and recon\n",
-                               NIPQUAD(conn->c_laddr), NIPQUAD(conn->c_faddr),
+                               "RDS/IB: connection <%pI4,%pI4,%d> timed out (0x%lx,0x%lx)..discon and recon\n",
+                               &conn->c_laddr, &conn->c_faddr,
                                conn->c_tos, cp->cp_hb_start, now);
                        rds_conn_path_drop(cp, DR_HB_TIMEOUT);
                        return;
@@ -342,13 +342,12 @@ void rds_shutdown_worker(struct work_struct *work)
                rds_sysctl_shutdown_trace_start_time) &&
            (now - cp->cp_reconnect_start <
                rds_sysctl_shutdown_trace_end_time))
-               pr_info("RDS/%s: connection <%u.%u.%u.%u,%u.%u.%u.%u,%d> "
-                               "shutdown init due to '%s'\n",
-                               (is_tcp ? "TCP" : "IB"),
-                               NIPQUAD(conn->c_laddr),
-                               NIPQUAD(conn->c_faddr),
-                               conn->c_tos,
-                               conn_drop_reason_str(cp->cp_drop_source));
+               pr_info("RDS/%s: connection <%pI4,%pI4,%d> shutdown init due to '%s'\n",
+                       (is_tcp ? "TCP" : "IB"),
+                       &conn->c_laddr,
+                       &conn->c_faddr,
+                       conn->c_tos,
+                       conn_drop_reason_str(cp->cp_drop_source));
 
        rds_conn_shutdown(cp);
 }