some improvements:
- Update parameters for mlx5_device_bond_pci_match function.
- Fix spelling and typos in comments.
- Prevent breaking lines on drv logs.

Signed-off-by: Michael Baum <michae...@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_os.c | 96 ++++++++++++++------------------
 1 file changed, 42 insertions(+), 54 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 3d204f99f7..375bc55e79 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1984,14 +1984,14 @@ mlx5_dev_spawn_data_cmp(const void *a, const void *b)
 /**
  * Match PCI information for possible slaves of bonding device.
  *
- * @param[in] ibv_dev
- *   Pointer to Infiniband device structure.
+ * @param[in] ibdev_name
+ *   Name of Infiniband device.
  * @param[in] pci_dev
  *   Pointer to primary PCI address structure to match.
  * @param[in] nl_rdma
  *   Netlink RDMA group socket handle.
  * @param[in] owner
- *   Rerepsentor owner PF index.
+ *   Representor owner PF index.
  * @param[out] bond_info
  *   Pointer to bonding information.
  *
@@ -2000,7 +2000,7 @@ mlx5_dev_spawn_data_cmp(const void *a, const void *b)
  *   positive index of slave PF in bonding.
  */
 static int
-mlx5_device_bond_pci_match(const struct ibv_device *ibv_dev,
+mlx5_device_bond_pci_match(const char *ibdev_name,
                           const struct rte_pci_addr *pci_dev,
                           int nl_rdma, uint16_t owner,
                           struct mlx5_bond_info *bond_info)
@@ -2013,27 +2013,25 @@ mlx5_device_bond_pci_match(const struct ibv_device 
*ibv_dev,
        int ret;
 
        /*
-        * Try to get master device name. If something goes
-        * wrong suppose the lack of kernel support and no
-        * bonding devices.
+        * Try to get master device name. If something goes wrong suppose
+        * the lack of kernel support and no bonding devices.
         */
        memset(bond_info, 0, sizeof(*bond_info));
        if (nl_rdma < 0)
                return -1;
-       if (!strstr(ibv_dev->name, "bond"))
+       if (!strstr(ibdev_name, "bond"))
                return -1;
-       np = mlx5_nl_portnum(nl_rdma, ibv_dev->name);
+       np = mlx5_nl_portnum(nl_rdma, ibdev_name);
        if (!np)
                return -1;
        /*
-        * The Master device might not be on the predefined
-        * port (not on port index 1, it is not garanted),
-        * we have to scan all Infiniband device port and
-        * find master.
+        * The master device might not be on the predefined port(not on port
+        * index 1, it is not guaranteed), we have to scan all Infiniband
+        * device ports and find master.
         */
        for (i = 1; i <= np; ++i) {
                /* Check whether Infiniband port is populated. */
-               ifindex = mlx5_nl_ifindex(nl_rdma, ibv_dev->name, i);
+               ifindex = mlx5_nl_ifindex(nl_rdma, ibdev_name, i);
                if (!ifindex)
                        continue;
                if (!if_indextoname(ifindex, ifname))
@@ -2058,8 +2056,9 @@ mlx5_device_bond_pci_match(const struct ibv_device 
*ibv_dev,
                snprintf(tmp_str, sizeof(tmp_str),
                         "/sys/class/net/%s", ifname);
                if (mlx5_get_pci_addr(tmp_str, &pci_addr)) {
-                       DRV_LOG(WARNING, "can not get PCI address"
-                                        " for netdev \"%s\"", ifname);
+                       DRV_LOG(WARNING,
+                               "Cannot get PCI address for netdev \"%s\".",
+                               ifname);
                        continue;
                }
                /* Slave interface PCI address match found. */
@@ -2218,9 +2217,8 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
                struct rte_pci_addr pci_addr;
 
                DRV_LOG(DEBUG, "checking device \"%s\"", ibv_list[ret]->name);
-               bd = mlx5_device_bond_pci_match
-                               (ibv_list[ret], &owner_pci, nl_rdma, owner_id,
-                                &bond_info);
+               bd = mlx5_device_bond_pci_match(ibv_list[ret]->name, &owner_pci,
+                                               nl_rdma, owner_id, &bond_info);
                if (bd >= 0) {
                        /*
                         * Bonding device detected. Only one match is allowed,
@@ -2240,9 +2238,9 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
                        /* Amend owner pci address if owner PF ID specified. */
                        if (eth_da.nb_representor_ports)
                                owner_pci.function += owner_id;
-                       DRV_LOG(INFO, "PCI information matches for"
-                                     " slave %d bonding device \"%s\"",
-                                     bd, ibv_list[ret]->name);
+                       DRV_LOG(INFO,
+                               "PCI information matches for slave %d bonding 
device \"%s\"",
+                               bd, ibv_list[ret]->name);
                        ibv_match[nd++] = ibv_list[ret];
                        break;
                } else {
@@ -2281,23 +2279,19 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
                if (nl_rdma >= 0)
                        np = mlx5_nl_portnum(nl_rdma, ibv_match[0]->name);
                if (!np)
-                       DRV_LOG(WARNING, "can not get IB device \"%s\""
-                                        " ports number", ibv_match[0]->name);
+                       DRV_LOG(WARNING,
+                               "Cannot get IB device \"%s\" ports number.",
+                               ibv_match[0]->name);
                if (bd >= 0 && !np) {
-                       DRV_LOG(ERR, "can not get ports"
-                                    " for bonding device");
+                       DRV_LOG(ERR, "Cannot get ports for bonding device.");
                        rte_errno = ENOENT;
                        ret = -rte_errno;
                        goto exit;
                }
        }
-       /*
-        * Now we can determine the maximal
-        * amount of devices to be spawned.
-        */
+       /* Now we can determine the maximal amount of devices to be spawned. */
        list = mlx5_malloc(MLX5_MEM_ZERO,
-                          sizeof(struct mlx5_dev_spawn_data) *
-                          (np ? np : nd),
+                          sizeof(struct mlx5_dev_spawn_data) * (np ? np : nd),
                           RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);
        if (!list) {
                DRV_LOG(ERR, "spawn data array allocation failure");
@@ -2339,10 +2333,9 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
                        }
                        ret = -1;
                        if (nl_route >= 0)
-                               ret = mlx5_nl_switch_info
-                                              (nl_route,
-                                               list[ns].ifindex,
-                                               &list[ns].info);
+                               ret = mlx5_nl_switch_info(nl_route,
+                                                         list[ns].ifindex,
+                                                         &list[ns].info);
                        if (ret || (!list[ns].info.representor &&
                                    !list[ns].info.master)) {
                                /*
@@ -2350,9 +2343,8 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
                                 * Netlink, let's try to perform the task
                                 * with sysfs.
                                 */
-                               ret =  mlx5_sysfs_switch_info
-                                               (list[ns].ifindex,
-                                                &list[ns].info);
+                               ret = mlx5_sysfs_switch_info(list[ns].ifindex,
+                                                            &list[ns].info);
                        }
                        if (!ret && bd >= 0) {
                                switch (list[ns].info.name_type) {
@@ -2465,10 +2457,9 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
                        }
                        ret = -1;
                        if (nl_route >= 0)
-                               ret = mlx5_nl_switch_info
-                                              (nl_route,
-                                               list[ns].ifindex,
-                                               &list[ns].info);
+                               ret = mlx5_nl_switch_info(nl_route,
+                                                         list[ns].ifindex,
+                                                         &list[ns].info);
                        if (ret || (!list[ns].info.representor &&
                                    !list[ns].info.master)) {
                                /*
@@ -2476,9 +2467,8 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
                                 * Netlink, let's try to perform the task
                                 * with sysfs.
                                 */
-                               ret =  mlx5_sysfs_switch_info
-                                               (list[ns].ifindex,
-                                                &list[ns].info);
+                               ret = mlx5_sysfs_switch_info(list[ns].ifindex,
+                                                            &list[ns].info);
                        }
                        if (!ret && (list[ns].info.representor ^
                                     list[ns].info.master)) {
@@ -2487,11 +2477,10 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
                                   !list[ns].info.representor &&
                                   !list[ns].info.master) {
                                /*
-                                * Single IB device with
-                                * one physical port and
+                                * Single IB device with one physical port and
                                 * attached network device.
-                                * May be SRIOV is not enabled
-                                * or there is no representors.
+                                * May be SRIOV is not enabled or there is no
+                                * representors.
                                 */
                                DRV_LOG(INFO, "no E-Switch support detected");
                                ns++;
@@ -2508,10 +2497,9 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
                }
                /*
                 * New kernels may add the switch_id attribute for the case
-                * there is no E-Switch and we wrongly recognized the
-                * only device as master. Override this if there is the
-                * single device with single port and new device name
-                * format present.
+                * there is no E-Switch and we wrongly recognized the only
+                * device as master. Override this if there is the single
+                * device with single port and new device name format present.
                 */
                if (nd == 1 &&
                    list[0].info.name_type == MLX5_PHYS_PORT_NAME_TYPE_UPLINK) {
-- 
2.25.1

Reply via email to