]> git.openfabrics.org - compat-rdma/compat-rdma.git/commitdiff
ib_core: Fixed backport
authorVladimir Sokolovsky <vlad@mellanox.com>
Thu, 1 Dec 2016 15:48:33 +0000 (17:48 +0200)
committerVladimir Sokolovsky <vlad@mellanox.com>
Thu, 1 Dec 2016 15:48:33 +0000 (17:48 +0200)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
patches/0001-BACKPORT-ib_core.patch

index 44a6f63063c4c97c38f05c76957ff28e6a3d99e7..dee7c6df45414d121e8f571adb67f4c7db326cef 100644 (file)
@@ -4,19 +4,19 @@ Subject: [PATCH] BACKPORT: ib_core
 Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
 ---
  drivers/infiniband/core/cma.c           | 23 ++++++++
- drivers/infiniband/core/cma_configfs.c  | 98 +++++++++++++++++++++++++++++++++
+ drivers/infiniband/core/cma_configfs.c  | 97 ++++++++++++++++++++++++++++++++-
  drivers/infiniband/core/core_priv.h     | 28 ++++++----
  drivers/infiniband/core/cq.c            |  6 ++
  drivers/infiniband/core/mad.c           |  3 +
  drivers/infiniband/core/netlink.c       |  3 +
- drivers/infiniband/core/roce_gid_mgmt.c | 51 +++++++++++++++++
+ drivers/infiniband/core/roce_gid_mgmt.c | 27 +++++++++
  drivers/infiniband/core/sa_query.c      | 19 +++++++
  drivers/infiniband/core/umem.c          | 17 +++++-
  drivers/infiniband/core/user_mad.c      |  3 +
  drivers/infiniband/core/verbs.c         |  4 ++
  include/rdma/ib_addr.h                  | 23 ++++++++
  include/rdma/ib_verbs.h                 | 22 ++++++++
- 13 files changed, 288 insertions(+), 12 deletions(-)
+ 13 files changed, 262 insertions(+), 13 deletions(-)
 
 diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
 index xxxxxxx..xxxxxxx xxxxxx
@@ -165,15 +165,12 @@ index xxxxxxx..xxxxxxx xxxxxx
  static int cma_configfs_params_get(struct config_item *item,
                                   struct cma_device **pcma_dev,
                                   struct cma_dev_port_group **pgroup)
-@@ -140,11 +189,25 @@ static ssize_t default_roce_mode_store(struct config_item *item,
+@@ -140,11 +189,22 @@ static ssize_t default_roce_mode_store(struct config_item *item,
  CONFIGFS_ATTR(, default_roce_mode);
  
  static struct configfs_attribute *cma_configfs_attributes[] = {
-+#ifdef HAVE_OLD_CONFIGFS_API
+-      &attr_default_roce_mode,
 +      CONFIGFS_ATTR_ADD(attr_default_roce_mode),
-+#else
-       &attr_default_roce_mode,
-+#endif
        NULL,
  };
  
@@ -182,16 +179,17 @@ index xxxxxxx..xxxxxxx xxxxxx
 +      .show_attribute         = cma_configfs_attr_show,
 +      .store_attribute        = cma_configfs_attr_store,
 +};
++#else /* HAVE_OLD_CONFIGFS_API */
++static struct configfs_item_operations cma_item_ops = {
++};
 +#endif
 +
  static struct config_item_type cma_port_group_type = {
-+#ifdef HAVE_OLD_CONFIGFS_API
 +      .ct_item_ops    = &cma_item_ops,
-+#endif
        .ct_attrs       = cma_configfs_attributes,
        .ct_owner       = THIS_MODULE
  };
-@@ -172,6 +235,13 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
+@@ -172,6 +232,13 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
                goto free;
        }
  
@@ -205,7 +203,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        for (i = 0; i < ports_num; i++) {
                char port_str[10];
  
-@@ -181,10 +251,17 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
+@@ -181,10 +248,17 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
                config_group_init_type_name(&ports[i].group,
                                            port_str,
                                            &cma_port_group_type);
@@ -223,7 +221,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        cma_dev_group->ports = ports;
  
        return 0;
-@@ -252,6 +329,14 @@ static struct config_group *make_cma_dev(struct config_group *group,
+@@ -252,6 +326,14 @@ static struct config_group *make_cma_dev(struct config_group *group,
                err = -ENOMEM;
                goto fail;
        }
@@ -238,7 +236,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        strncpy(cma_dev_group->name, name, sizeof(cma_dev_group->name));
  
-@@ -260,16 +345,29 @@ static struct config_group *make_cma_dev(struct config_group *group,
+@@ -260,16 +342,29 @@ static struct config_group *make_cma_dev(struct config_group *group,
  
        err = make_cma_ports(cma_dev_group, cma_dev);
        if (err)
@@ -421,57 +419,15 @@ index xxxxxxx..xxxxxxx xxxxxx
        }
  
        return BONDING_SLAVE_STATE_NA;
-@@ -189,6 +194,33 @@ static int pass_all_filter(struct ib_device *ib_dev, u8 port,
-       return 1;
- }
-+#ifndef HAVE_NETDEV_CHANGEUPPER
-+#define IS_NETDEV_BONDING_MASTER(ndev)        \
-+      (((ndev)->priv_flags & IFF_BONDING) && \
-+       ((ndev)->flags & IFF_MASTER))
-+
-+static int bonding_slaves_filter(struct ib_device *ib_dev, u8 port,
-+                               struct net_device *idev, void *cookie)
-+{
-+      struct net_device *rdev;
-+      struct net_device *ndev = (struct net_device *)cookie;
-+      int res;
-+
-+      rdev = rdma_vlan_dev_real_dev(ndev);
-+
-+      ndev = rdev ? rdev : ndev;
-+      if (!idev || !IS_NETDEV_BONDING_MASTER(ndev))
-+              return 0;
-+
-+      rcu_read_lock();
-+      res = rdma_is_upper_dev_rcu(idev, ndev);
-+      rcu_read_unlock();
-+
-+      return res;
-+}
-+#endif
-+
-+#ifdef HAVE_NETDEV_CHANGEUPPER
- static int upper_device_filter(struct ib_device *ib_dev, u8 port,
-                              struct net_device *rdma_ndev, void *cookie)
- {
-@@ -207,6 +239,7 @@ static int upper_device_filter(struct ib_device *ib_dev, u8 port,
-       return res;
- }
-+#endif
- static void update_gid_ip(enum gid_op_type gid_op,
-                         struct ib_device *ib_dev,
-@@ -437,6 +470,7 @@ static void callback_for_addr_gid_device_scan(struct ib_device *device,
+@@ -437,6 +442,7 @@ static void callback_for_addr_gid_device_scan(struct ib_device *device,
                          &parsed->gid_attr);
  }
  
-+#ifdef HAVE_NETDEV_CHANGEUPPER
++#ifdef HAVE_NETDEV_NOTIFIER_CHANGEUPPER_INFO
  static void handle_netdev_upper(struct ib_device *ib_dev, u8 port,
                                void *cookie,
                                void (*handle_netdev)(struct ib_device *ib_dev,
-@@ -497,6 +531,7 @@ static void add_netdev_upper_ips(struct ib_device *ib_dev, u8 port,
+@@ -497,6 +503,7 @@ static void add_netdev_upper_ips(struct ib_device *ib_dev, u8 port,
  {
        handle_netdev_upper(ib_dev, port, cookie, _add_netdev_ips);
  }
@@ -479,15 +435,16 @@ index xxxxxxx..xxxxxxx xxxxxx
  
  static void del_netdev_default_ips_join(struct ib_device *ib_dev, u8 port,
                                        struct net_device *rdma_ndev,
-@@ -578,6 +613,7 @@ static int netdevice_queue_work(struct netdev_event_work_cmd *cmds,
+@@ -578,6 +585,8 @@ static int netdevice_queue_work(struct netdev_event_work_cmd *cmds,
  
  static const struct netdev_event_work_cmd add_cmd = {
        .cb = add_netdev_ips, .filter = is_eth_port_of_netdev};
-+#ifdef HAVE_NETDEV_CHANGEUPPER
++
++#ifdef HAVE_NETDEV_NOTIFIER_CHANGEUPPER_INFO
  static const struct netdev_event_work_cmd add_cmd_upper_ips = {
        .cb = add_netdev_upper_ips, .filter = is_eth_port_of_netdev};
  
-@@ -601,10 +637,15 @@ static void netdevice_event_changeupper(struct netdev_notifier_changeupper_info
+@@ -601,10 +610,15 @@ static void netdevice_event_changeupper(struct netdev_notifier_changeupper_info
                cmds[1].filter_ndev = changeupper_info->upper_dev;
        }
  }
@@ -496,30 +453,40 @@ index xxxxxxx..xxxxxxx xxxxxx
  static int netdevice_event(struct notifier_block *this, unsigned long event,
                           void *ptr)
  {
-+#ifndef HAVE_NETDEV_CHANGEUPPER
++#ifndef HAVE_NETDEV_NOTIFIER_CHANGEUPPER_INFO
 +      static const struct netdev_event_work_cmd add_cmd = {
 +              .cb = add_netdev_ips, .filter = is_eth_port_of_netdev};
 +#endif
        static const struct netdev_event_work_cmd del_cmd = {
                .cb = del_netdev_ips, .filter = pass_all_filter};
        static const struct netdev_event_work_cmd bonding_default_del_cmd_join = {
-@@ -612,7 +653,11 @@ static int netdevice_event(struct notifier_block *this, unsigned long event,
+@@ -612,7 +626,11 @@ static int netdevice_event(struct notifier_block *this, unsigned long event,
        static const struct netdev_event_work_cmd default_del_cmd = {
                .cb = del_netdev_default_ips, .filter = pass_all_filter};
        static const struct netdev_event_work_cmd bonding_event_ips_del_cmd = {
-+#ifdef HAVE_NETDEV_CHANGEUPPER
++#ifdef HAVE_NETDEV_NOTIFIER_CHANGEUPPER_INFO
                .cb = del_netdev_upper_ips, .filter = upper_device_filter};
 +#else
-+              .cb = del_netdev_ips, .filter = bonding_slaves_filter};
++      .cb = del_netdev_ips, .filter = upper_device_filter};
 +#endif
        struct net_device *ndev = netdev_notifier_info_to_dev(ptr);
        struct netdev_event_work_cmd cmds[ROCE_NETDEV_CALLBACK_SZ] = { {NULL} };
  
-@@ -638,16 +683,22 @@ static int netdevice_event(struct notifier_block *this, unsigned long event,
+@@ -622,6 +640,9 @@ static int netdevice_event(struct notifier_block *this, unsigned long event,
+       switch (event) {
+       case NETDEV_REGISTER:
+       case NETDEV_UP:
++#ifndef HAVE_NETDEV_NOTIFIER_CHANGEUPPER_INFO
++      case NETDEV_JOIN:
++#endif
+               cmds[0] = bonding_default_del_cmd_join;
+               cmds[1] = add_cmd;
+               break;
+@@ -638,16 +659,22 @@ static int netdevice_event(struct notifier_block *this, unsigned long event,
                cmds[1] = add_cmd;
                break;
  
-+#ifdef HAVE_NETDEV_CHANGEUPPER
++#ifdef HAVE_NETDEV_NOTIFIER_CHANGEUPPER_INFO
        case NETDEV_CHANGEUPPER:
                netdevice_event_changeupper(
                        container_of(ptr, struct netdev_notifier_changeupper_info, info),
@@ -530,7 +497,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        case NETDEV_BONDING_FAILOVER:
                cmds[0] = bonding_event_ips_del_cmd;
                cmds[1] = bonding_default_del_cmd_join;
-+#ifdef HAVE_NETDEV_CHANGEUPPER
++#ifdef HAVE_NETDEV_NOTIFIER_CHANGEUPPER_INFO
                cmds[2] = add_cmd_upper_ips;
 +#else
 +              cmds[2] = add_cmd;