Convert management helpers to Core Capability bits
Subsystems (6)
cover Convert management helpers to Core Capability bits
From: Ira Weiny <[email protected]>
The following 5 patches complete the conversion of Michaels management helpers to use new Core Capability bits to signal core capabilities rather than inferring these capabilities from the device protocols.
The first makes the start_port and end_port functions common rather than being declared in 2 places.
The second uses the start and end port common functions (rather than declaring yet another copy of them) in the user_mad code.
The third fixes a bug which was uncovered after I changed the implementation of rdma_cap_ib_mad and utilizes the first 2 patches.
The forth formalizes the creation of immutable per port data which is stored in the ib_device structure for use by the core code. This is now accomplished by a new mandatory device function.
The fifth converts the management helpers to use a new bit mask which is stored in the immutable per port device data.
The 2 OPA patches have been removed at Hals request and will be submitted as part of a new OPA MAD series.
Ira Weiny (5):
IB/core: Create common start/end port functions IB/user_mad: Remove local start/end port variable and use the new
common functions
IB/user_mad: Fix bug in ib_umad_remove_one when rdma_cap_ib_mad
implementation changed
IB/core: Formalize the creation of immutable per port data within the
ib_device object
IB/core: Convert management helpers to core capability bits
drivers/infiniband/core/cache.c | 61 ++++++--------- drivers/infiniband/core/device.c | 82 ++++++++------------ drivers/infiniband/core/sysfs.c | 1 + drivers/infiniband/core/user_mad.c | 16 +--- drivers/infiniband/hw/amso1100/c2_provider.c | 25 ++++-- drivers/infiniband/hw/cxgb3/iwch_provider.c | 25 ++++-- drivers/infiniband/hw/cxgb4/provider.c | 25 ++++-- drivers/infiniband/hw/ehca/ehca_hca.c | 6 -- drivers/infiniband/hw/ehca/ehca_main.c | 19 ++++- drivers/infiniband/hw/ipath/ipath_verbs.c | 25 ++++-- drivers/infiniband/hw/mlx4/main.c | 32 +++++--- drivers/infiniband/hw/mlx5/main.c | 25 ++++-- drivers/infiniband/hw/mthca/mthca_provider.c | 25 ++++-- drivers/infiniband/hw/nes/nes_verbs.c | 24 ++++-- drivers/infiniband/hw/ocrdma/ocrdma_main.c | 19 ++++- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 -- drivers/infiniband/hw/qib/qib_verbs.c | 25 ++++-- drivers/infiniband/hw/usnic/usnic_ib_main.c | 18 ++++- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 6 -- include/rdma/ib_verbs.h | 110 ++++++++++++++++++++++----- 20 files changed, 371 insertions(+), 204 deletions(-)
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1431561779-13714-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH 1/5 IB/core: Create common start/end port functions
From: Ira Weiny <[email protected]>
Previously start_port and end_port were defined in 2 places, cache.c and device.c and this prevented their use in other modules.
Make these common functions, change the name to reflect the rdma name space, and update existing users.
--- drivers/infiniband/core/cache.c | 61 ++++++++++++++++------------------------ drivers/infiniband/core/device.c | 26 +++++------------ include/rdma/ib_verbs.h | 27 ++++++++++++++++++ 3 files changed, 59 insertions(+), 55 deletions(-)
drivers/infiniband/core/cache.c +25 -36
@@ -58,17 +58,6 @@ struct ib_update_work {u8 port_num; }; -static inline int start_port (struct ib_device *device) -{ -return (device->node_type ==RDMA_NODE_IB_SWITCH ) ?0 :1 ; -} - -static inline int end_port (struct ib_device *device) -{ -return (device->node_type ==RDMA_NODE_IB_SWITCH ) ? -0 : device->phys_port_cnt; -} - int ib_get_cached_gid(struct ib_device *device, u8 port_num, int index,
@@ -78,12 +67,12 @@ int ib_get_cached_gid(struct ib_device *device,unsigned long flags;int ret =0 ; -if (port_num <start_port (device) || port_num >end_port (device)) +if (port_num <rdma_start_port (device) || port_num >rdma_end_port (device))return -EINVAL ;read_lock_irqsave (&device->cache.lock, flags); - cache = device->cache.gid_cache[port_num -start_port (device)]; + cache = device->cache.gid_cache[port_num -rdma_start_port (device)];if (index <0 || index >= cache->table_len) ret = -EINVAL ;
@@ -112,11 +101,11 @@ int ib_find_cached_gid(struct ib_device *device,read_lock_irqsave (&device->cache.lock, flags); -for (p =0 ; p <=end_port (device) -start_port (device); ++p) { +for (p =0 ; p <=rdma_end_port (device) -rdma_start_port (device); ++p) { cache = device->cache.gid_cache[p];for (i =0 ; i < cache->table_len; ++i) {if (!memcmp (gid, &cache->table[i],sizeof *gid)) { - *port_num = p +start_port (device); + *port_num = p +rdma_start_port (device);if (index) *index = i; ret =0 ;
@@ -140,12 +129,12 @@ int ib_get_cached_pkey(struct ib_device *device,unsigned long flags;int ret =0 ; -if (port_num <start_port (device) || port_num >end_port (device)) +if (port_num <rdma_start_port (device) || port_num >rdma_end_port (device))return -EINVAL ;read_lock_irqsave (&device->cache.lock, flags); - cache = device->cache.pkey_cache[port_num -start_port (device)]; + cache = device->cache.pkey_cache[port_num -rdma_start_port (device)];if (index <0 || index >= cache->table_len) ret = -EINVAL ;
@@ -169,12 +158,12 @@ int ib_find_cached_pkey(struct ib_device *device,int ret = -ENOENT ;int partial_ix =-1 ; -if (port_num <start_port (device) || port_num >end_port (device)) +if (port_num <rdma_start_port (device) || port_num >rdma_end_port (device))return -EINVAL ;read_lock_irqsave (&device->cache.lock, flags); - cache = device->cache.pkey_cache[port_num -start_port (device)]; + cache = device->cache.pkey_cache[port_num -rdma_start_port (device)]; *index =-1 ;
@@ -209,12 +198,12 @@ int ib_find_exact_cached_pkey(struct ib_device *device,int i;int ret = -ENOENT ; -if (port_num <start_port (device) || port_num >end_port (device)) +if (port_num <rdma_start_port (device) || port_num >rdma_end_port (device))return -EINVAL ;read_lock_irqsave (&device->cache.lock, flags); - cache = device->cache.pkey_cache[port_num -start_port (device)]; + cache = device->cache.pkey_cache[port_num -rdma_start_port (device)]; *index =-1 ;
@@ -238,11 +227,11 @@ int ib_get_cached_lmc(struct ib_device *device,unsigned long flags;int ret =0 ; -if (port_num <start_port (device) || port_num >end_port (device)) +if (port_num <rdma_start_port (device) || port_num >rdma_end_port (device))return -EINVAL ;read_lock_irqsave (&device->cache.lock, flags); - *lmc = device->cache.lmc_cache[port_num -start_port (device)]; + *lmc = device->cache.lmc_cache[port_num -rdma_start_port (device)];read_unlock_irqrestore (&device->cache.lock, flags);return ret;
@@ -303,13 +292,13 @@ static void ib_cache_update(struct ib_device *device,write_lock_irq (&device->cache.lock); - old_pkey_cache = device->cache.pkey_cache[port -start_port (device)]; - old_gid_cache = device->cache.gid_cache [port -start_port (device)]; + old_pkey_cache = device->cache.pkey_cache[port -rdma_start_port (device)]; + old_gid_cache = device->cache.gid_cache [port -rdma_start_port (device)]; - device->cache.pkey_cache[port -start_port (device)] = pkey_cache; - device->cache.gid_cache [port -start_port (device)] = gid_cache; + device->cache.pkey_cache[port -rdma_start_port (device)] = pkey_cache; + device->cache.gid_cache [port -rdma_start_port (device)] = gid_cache; - device->cache.lmc_cache[port -start_port (device)] = tprops->lmc; + device->cache.lmc_cache[port -rdma_start_port (device)] = tprops->lmc;write_unlock_irq (&device->cache.lock);
@@ -363,14 +352,14 @@ static void ib_cache_setup_one(struct ib_device *device) device->cache.pkey_cache =kmalloc (sizeof *device->cache.pkey_cache * - (end_port (device) -start_port (device) +1 ),GFP_KERNEL ); + (rdma_end_port (device) -rdma_start_port (device) +1 ),GFP_KERNEL ); device->cache.gid_cache =kmalloc (sizeof *device->cache.gid_cache * - (end_port (device) -start_port (device) +1 ),GFP_KERNEL ); + (rdma_end_port (device) -rdma_start_port (device) +1 ),GFP_KERNEL ); device->cache.lmc_cache =kmalloc (sizeof *device->cache.lmc_cache * - (end_port (device) - -start_port (device) +1 ), + (rdma_end_port (device) - +rdma_start_port (device) +1 ),GFP_KERNEL ); if (!device->cache.pkey_cache || !device->cache.gid_cache ||
@@ -380,10 +369,10 @@ static void ib_cache_setup_one(struct ib_device *device) goto err; } -for (p =0 ; p <=end_port (device) -start_port (device); ++p) { +for (p =0 ; p <=rdma_end_port (device) -rdma_start_port (device); ++p) { device->cache.pkey_cache[p] =NULL ; device->cache.gid_cache [p] =NULL ; -ib_cache_update (device, p +start_port (device)); +ib_cache_update (device, p +rdma_start_port (device)); } INIT_IB_EVENT_HANDLER(&device->cache.event_handler,
@@ -394,7 +383,7 @@ static void ib_cache_setup_one(struct ib_device *device)return ; err_cache: -for (p =0 ; p <=end_port (device) -start_port (device); ++p) { +for (p =0 ; p <=rdma_end_port (device) -rdma_start_port (device); ++p) {kfree (device->cache.pkey_cache[p]);kfree (device->cache.gid_cache[p]); }
@@ -412,7 +401,7 @@ static void ib_cache_cleanup_one(struct ib_device *device)ib_unregister_event_handler (&device->cache.event_handler);flush_workqueue (ib_wq); -for (p =0 ; p <=end_port (device) -start_port (device); ++p) { +for (p =0 ; p <=rdma_end_port (device) -rdma_start_port (device); ++p) {kfree (device->cache.pkey_cache[p]);kfree (device->cache.gid_cache[p]); }
drivers/infiniband/core/device.c +7 -19
@@ -152,18 +152,6 @@ static int alloc_name(char *name)return 0 ; } -static int start_port (struct ib_device *device) -{ -return (device->node_type ==RDMA_NODE_IB_SWITCH ) ?0 :1 ; -} - - -static int end_port (struct ib_device *device) -{ -return (device->node_type ==RDMA_NODE_IB_SWITCH ) ? -0 : device->phys_port_cnt; -} -/** * ib_alloc_device - allocate an IB device struct * @size:size of structure to allocate
@@ -233,7 +221,7 @@ static int read_port_table_lengths(struct ib_device *device)if (!tprops) goto out; - num_ports =end_port (device) -start_port (device) +1 ; + num_ports =rdma_end_port (device) -rdma_start_port (device) +1 ; device->pkey_tbl_len =kmalloc (sizeof *device->pkey_tbl_len * num_ports,GFP_KERNEL );
@@ -243,7 +231,7 @@ static int read_port_table_lengths(struct ib_device *device) goto err;for (port_index =0 ; port_index < num_ports; ++port_index) { - ret =ib_query_port (device, port_index +start_port (device), + ret =ib_query_port (device, port_index +rdma_start_port (device), tprops);if (ret) goto err;
@@ -576,7 +564,7 @@ int ib_query_port(struct ib_device *device, u8 port_num, struct ib_port_attr *port_attr) { -if (port_num <start_port (device) || port_num >end_port (device)) +if (port_num <rdma_start_port (device) || port_num >rdma_end_port (device))return -EINVAL ;return device->query_port (device, port_num, port_attr);
@@ -654,7 +642,7 @@ int ib_modify_port(struct ib_device *device,if (!device->modify_port)return -ENOSYS ; -if (port_num <start_port (device) || port_num >end_port (device)) +if (port_num <rdma_start_port (device) || port_num >rdma_end_port (device))return -EINVAL ; return device->modify_port(device, port_num, port_modify_mask,
@@ -677,8 +665,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid,union ib_gid tmp_gid;int ret, port, i; -for (port =start_port (device); port <=end_port (device); ++port) { -for (i =0 ; i < device->gid_tbl_len[port -start_port (device)]; ++i) { +for (port =rdma_start_port (device); port <=rdma_end_port (device); ++port) { +for (i =0 ; i < device->gid_tbl_len[port -rdma_start_port (device)]; ++i) { ret =ib_query_gid (device, port, i, &tmp_gid);if (ret)return ret;
@@ -710,7 +698,7 @@ int ib_find_pkey(struct ib_device *device,u16 tmp_pkey;int partial_ix =-1 ; -for (i =0 ; i < device->pkey_tbl_len[port_num -start_port (device)]; ++i) { +for (i =0 ; i < device->pkey_tbl_len[port_num -rdma_start_port (device)]; ++i) { ret =ib_query_pkey (device, port_num, i, &tmp_pkey);if (ret)return ret;
include/rdma/ib_verbs.h +27 -0
@@ -1752,6 +1752,33 @@ int ib_query_port(struct ib_device *device,enum rdma_link_layer rdma_port_get_link_layer (struct ib_device *device,u8 port_num); +/** +* rdma_start_port - Return the first valid port number for the device +* specified +* +* @device: Device to be checked +* +* Return start port number +*/ +static inline u8 rdma_start_port (const struct ib_device *device) +{ +return (device->node_type ==RDMA_NODE_IB_SWITCH ) ?0 :1 ; +} + +/** +* rdma_end_port - Return the last valid port number for the device +* specified +* +* @device: Device to be checked +* +* Return last port number +*/ +static inline u8 rdma_end_port (const struct ib_device *device) +{ +return (device->node_type ==RDMA_NODE_IB_SWITCH ) ? +0 : device->phys_port_cnt; +} +static inline bool rdma_protocol_ib (struct ib_device *device,u8 port_num) {return device->query_protocol (device, port_num) ==RDMA_PROTOCOL_IB ;
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/5 IB/user_mad: Remove local start/end port variable and use the new common functions
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
The start_port and end_port was duplicated data.
Use the new common rdma_[start|end]_port functions instead and remove the unnecessary duplicated data.
--- drivers/infiniband/core/user_mad.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/infiniband/core/user_mad.c +3 -11
@@ -99,7 +99,6 @@ struct ib_umad_port { };struct ib_umad_device { -int start_port, end_port;struct kobject kobj;struct ib_umad_port port[0 ]; };
@@ -1275,12 +1274,8 @@ static void ib_umad_add_one(struct ib_device *device)int s, e, i;int count =0 ; -if (device->node_type ==RDMA_NODE_IB_SWITCH ) - s = e =0 ; -else { - s =1 ; - e = device->phys_port_cnt; - } + s =rdma_start_port (device); + e =rdma_end_port (device); umad_dev = kzalloc(sizeof *umad_dev + (e - s + 1) * sizeof (struct ib_umad_port),
@@ -1290,9 +1285,6 @@ static void ib_umad_add_one(struct ib_device *device)kobject_init (&umad_dev->kobj, &ib_umad_dev_ktype); - umad_dev->start_port = s; - umad_dev->end_port = e; -for (i = s; i <= e; ++i) {if (!rdma_cap_ib_mad (device, i))continue ;
@@ -1332,7 +1324,7 @@ static void ib_umad_remove_one(struct ib_device *device)if (!umad_dev)return ; -for (i =0 ; i <= umad_dev->end_port - umad_dev->start_port; ++i) { +for (i =0 ; i <=rdma_end_port (device) -rdma_start_port (device); ++i) {if (rdma_cap_ib_mad (device, i))ib_umad_kill_port (&umad_dev->port[i]); }
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/5 IB/user_mad: Fix bug in ib_umad_remove_one when rdma_cap_ib_mad implementation changed
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
The addition of the rdma_cap_ib_mad is technically broken in ib_umad_remove_one because the loop "i" value is not a port value.
This bug resulted in the ib_umad failing to properly remove its resources when the core capability functions were converted to bit fields.
NOTE: e17371d73908 did not result in broken behavior on its own. It was only an issue when the implementation of rdma_cap_ib_mad was changed.
Pass the port value to rdma_cap_ib_mad.
---
Changes from V1:
Add brackets around if statement
use new rdma_start_port to properly index the port.
drivers/infiniband/core/user_mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/user_mad.c +1 -1
@@ -1325,7 +1325,7 @@ static void ib_umad_remove_one(struct ib_device *device)return ;for (i =0 ; i <=rdma_end_port (device) -rdma_start_port (device); ++i) { -if (rdma_cap_ib_mad (device, i)) +if (rdma_cap_ib_mad (device, i +rdma_start_port (device)))ib_umad_kill_port (&umad_dev->port[i]); }
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/5 IB/core: Formalize the creation of immutable per port data within the ib_device object
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
As of commit 5eb620c81ce3 "IB/core: Add helpers for uncached GID and P_Key searches"; pkey_tbl_len and gid_tbl_len are immutable data which are stored in the ib_device.
The per port core capability flags to be added later are also immutable data to be stored in the ib_device object.
In preparation for this create a structure for per port immutable data and place the pkey and gid table lengths within this structure.
"get_port_immutable" is added as a mandatory device function to allow the drivers to fill in this data.
---
Changes since V1:
Clean up allocation of port_immutable array (and document it) kzalloc the array/remove memsets in drivers
Delay freeing port_immutable until ib_device_release Update printk to reflect new function
drivers/infiniband/core/device.c | 63 +++++++++++++--------------- drivers/infiniband/core/sysfs.c | 1 + drivers/infiniband/hw/amso1100/c2_provider.c | 17 ++++++++ drivers/infiniband/hw/cxgb3/iwch_provider.c | 17 ++++++++ drivers/infiniband/hw/cxgb4/provider.c | 17 ++++++++ drivers/infiniband/hw/ehca/ehca_main.c | 17 ++++++++ drivers/infiniband/hw/ipath/ipath_verbs.c | 17 ++++++++ drivers/infiniband/hw/mlx4/main.c | 17 ++++++++ drivers/infiniband/hw/mlx5/main.c | 17 ++++++++ drivers/infiniband/hw/mthca/mthca_provider.c | 17 ++++++++ drivers/infiniband/hw/nes/nes_verbs.c | 16 +++++++ drivers/infiniband/hw/ocrdma/ocrdma_main.c | 17 ++++++++ drivers/infiniband/hw/qib/qib_verbs.c | 17 ++++++++ drivers/infiniband/hw/usnic/usnic_ib_main.c | 17 ++++++++ include/rdma/ib_verbs.h | 19 ++++++++- 15 files changed, 249 insertions(+), 37 deletions(-)
drivers/infiniband/core/device.c +28 -35
@@ -93,7 +93,8 @@ static int ib_device_check_mandatory(struct ib_device *device)IB_MANDATORY_FUNC (poll_cq),IB_MANDATORY_FUNC (req_notify_cq),IB_MANDATORY_FUNC (get_dma_mr), - IB_MANDATORY_FUNC(dereg_mr) +IB_MANDATORY_FUNC (dereg_mr), + IB_MANDATORY_FUNC(get_port_immutable) };int i;
@@ -211,42 +212,38 @@ static int add_client_context(struct ib_device *device, struct ib_client *clientreturn 0 ; } -static int read_port_table_lengths (struct ib_device *device) +static int read_port_immutable (struct ib_device *device) { -struct ib_port_attr *tprops =NULL ; -int num_ports, ret = -ENOMEM ; -u8 port_index; - - tprops =kmalloc (sizeof *tprops,GFP_KERNEL ); -if (!tprops) - goto out; - - num_ports =rdma_end_port (device) -rdma_start_port (device) +1 ; - - device->pkey_tbl_len =kmalloc (sizeof *device->pkey_tbl_len * num_ports, -GFP_KERNEL ); - device->gid_tbl_len =kmalloc (sizeof *device->gid_tbl_len * num_ports, -GFP_KERNEL ); -if (!device->pkey_tbl_len || !device->gid_tbl_len) +int ret = -ENOMEM ; +u8 start_port =rdma_start_port (device); +u8 end_port =rdma_end_port (device); +u8 port; + +/** +* device->port_immutable is indexed directly by the port number to make +* access to this data as efficient as possible. +* +* Therefore port_immutable is declared as a 1 based array with +* potential empty slots at the beginning. +*/ + device->port_immutable =kzalloc (sizeof (*device->port_immutable) + * (end_port +1 ), +GFP_KERNEL ); +if (!device->port_immutable) goto err; -for (port_index =0 ; port_index < num_ports; ++port_index) { - ret =ib_query_port (device, port_index +rdma_start_port (device), - tprops); +for (port = start_port; port <= end_port; ++port) { + ret = device->get_port_immutable (device, port, + &device->port_immutable[port]);if (ret) goto err; - device->pkey_tbl_len[port_index] = tprops->pkey_tbl_len; - device->gid_tbl_len[port_index] = tprops->gid_tbl_len; } ret =0 ; goto out; - err: -kfree (device->gid_tbl_len); -kfree (device->pkey_tbl_len); +kfree (device->port_immutable); out: -kfree (tprops);return ret; }
@@ -283,9 +280,9 @@ int ib_register_device(struct ib_device *device,spin_lock_init (&device->event_handler_lock);spin_lock_init (&device->client_data_lock); - ret =read_port_table_lengths (device); + ret =read_port_immutable (device);if (ret) { -printk (KERN_WARNING "Couldn't create table lengths cache for device %s\n" , +printk (KERN_WARNING "Couldn't create per port immutable data %s\n" , device->name); goto out; }
@@ -294,8 +291,7 @@ int ib_register_device(struct ib_device *device,if (ret) {printk (KERN_WARNING "Couldn't register device %s with driver model\n" , device->name); -kfree (device->gid_tbl_len); -kfree (device->pkey_tbl_len); +kfree (device->port_immutable); goto out; }
@@ -337,9 +333,6 @@ void ib_unregister_device(struct ib_device *device)list_del (&device->core_list); -kfree (device->gid_tbl_len); -kfree (device->pkey_tbl_len); -mutex_unlock (&device_mutex);ib_device_unregister_sysfs (device);
@@ -666,7 +659,7 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid,int ret, port, i;for (port =rdma_start_port (device); port <=rdma_end_port (device); ++port) { -for (i =0 ; i < device->gid_tbl_len[port -rdma_start_port (device)]; ++i) { +for (i =0 ; i < device->port_immutable[port].gid_tbl_len; ++i) { ret =ib_query_gid (device, port, i, &tmp_gid);if (ret)return ret;
@@ -698,7 +691,7 @@ int ib_find_pkey(struct ib_device *device,u16 tmp_pkey;int partial_ix =-1 ; -for (i =0 ; i < device->pkey_tbl_len[port_num -rdma_start_port (device)]; ++i) { +for (i =0 ; i < device->port_immutable[port_num].pkey_tbl_len; ++i) { ret =ib_query_pkey (device, port_num, i, &tmp_pkey);if (ret)return ret;
drivers/infiniband/core/sysfs.c +1 -0
@@ -456,6 +456,7 @@ static void ib_device_release(struct device *device) { struct ib_device *dev = container_of(device, struct ib_device, dev); +kfree (dev->port_immutable);kfree (dev); }
drivers/infiniband/hw/amso1100/c2_provider.c +17 -0
@@ -763,6 +763,22 @@ static struct net_device *c2_pseudo_netdev_init(struct c2_dev *c2dev)return netdev; } +static int c2_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =c2_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +int c2_register_device (struct c2_dev *dev) {int ret = -ENOMEM ;
@@ -827,6 +843,7 @@ int c2_register_device(struct c2_dev *dev) dev->ibdev.reg_phys_mr = c2_reg_phys_mr; dev->ibdev.reg_user_mr = c2_reg_user_mr; dev->ibdev.dereg_mr = c2_dereg_mr; + dev->ibdev.get_port_immutable = c2_port_immutable; dev->ibdev.alloc_fmr =NULL ; dev->ibdev.unmap_fmr =NULL ;
drivers/infiniband/hw/cxgb3/iwch_provider.c +17 -0
@@ -1349,6 +1349,22 @@ static struct device_attribute *iwch_class_attributes[] = { &dev_attr_board_id, }; +static int iwch_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =iwch_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +int iwch_register_device (struct iwch_dev *dev) {int ret;
@@ -1427,6 +1443,7 @@ int iwch_register_device(struct iwch_dev *dev) dev->ibdev.post_recv = iwch_post_receive; dev->ibdev.get_protocol_stats = iwch_get_mib; dev->ibdev.uverbs_abi_ver =IWCH_UVERBS_ABI_VERSION ; + dev->ibdev.get_port_immutable = iwch_port_immutable; dev->ibdev.iwcm =kmalloc (sizeof (struct iw_cm_verbs ),GFP_KERNEL );if (!dev->ibdev.iwcm)
drivers/infiniband/hw/cxgb4/provider.c +17 -0
@@ -471,6 +471,22 @@ static struct device_attribute *c4iw_class_attributes[] = { &dev_attr_board_id, }; +static int c4iw_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =c4iw_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +int c4iw_register_device (struct c4iw_dev *dev) {int ret;
@@ -549,6 +565,7 @@ int c4iw_register_device(struct c4iw_dev *dev) dev->ibdev.post_recv = c4iw_post_receive; dev->ibdev.get_protocol_stats = c4iw_get_mib; dev->ibdev.uverbs_abi_ver =C4IW_UVERBS_ABI_VERSION ; + dev->ibdev.get_port_immutable = c4iw_port_immutable; dev->ibdev.iwcm =kmalloc (sizeof (struct iw_cm_verbs ),GFP_KERNEL );if (!dev->ibdev.iwcm)
drivers/infiniband/hw/ehca/ehca_main.c +17 -0
@@ -431,6 +431,22 @@ init_node_guid1:return ret; } +static int ehca_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =ehca_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +static int ehca_init_device (struct ehca_shca *shca) {int ret;
@@ -511,6 +527,7 @@ static int ehca_init_device(struct ehca_shca *shca) shca->ib_device.process_mad = ehca_process_mad; shca->ib_device.mmap = ehca_mmap; shca->ib_device.dma_ops = &ehca_dma_mapping_ops; + shca->ib_device.get_port_immutable = ehca_port_immutable;if (EHCA_BMASK_GET (HCA_CAP_SRQ , shca->hca_cap)) { shca->ib_device.uverbs_cmd_mask |=
drivers/infiniband/hw/ipath/ipath_verbs.c +17 -0
@@ -1986,6 +1986,22 @@ static int disable_timer(struct ipath_devdata *dd)return 0 ; } +static int ipath_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =ipath_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +/** * ipath_register_ib_device - register our device with the infiniband core * @dd: the device data structure
@@ -2186,6 +2202,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd) dev->process_mad = ipath_process_mad; dev->mmap = ipath_mmap; dev->dma_ops = &ipath_dma_mapping_ops; + dev->get_port_immutable = ipath_port_immutable;snprintf (dev->node_desc,sizeof (dev->node_desc),IPATH_IDSTR " %s" ,init_utsname ()->nodename);
drivers/infiniband/hw/mlx4/main.c +17 -0
@@ -2124,6 +2124,22 @@ static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)kfree (ibdev->eq_table); } +static int mlx4_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =mlx4_ib_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +static void *mlx4_ib_add (struct mlx4_dev *dev) {struct mlx4_ib_dev *ibdev;
@@ -2252,6 +2268,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) ibdev->ib_dev.attach_mcast = mlx4_ib_mcg_attach; ibdev->ib_dev.detach_mcast = mlx4_ib_mcg_detach; ibdev->ib_dev.process_mad = mlx4_ib_process_mad; + ibdev->ib_dev.get_port_immutable = mlx4_port_immutable;if (!mlx4_is_slave (ibdev->dev)) { ibdev->ib_dev.alloc_fmr = mlx4_ib_fmr_alloc;
drivers/infiniband/hw/mlx5/main.c +17 -0
@@ -1188,6 +1188,22 @@ static void destroy_dev_resources(struct mlx5_ib_resources *devr)mlx5_ib_dealloc_pd (devr->p0); } +static int mlx5_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =mlx5_ib_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +static void *mlx5_ib_add (struct mlx5_core_dev *mdev) {struct mlx5_ib_dev *dev;
@@ -1292,6 +1308,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->ib_dev.alloc_fast_reg_page_list = mlx5_ib_alloc_fast_reg_page_list; dev->ib_dev.free_fast_reg_page_list = mlx5_ib_free_fast_reg_page_list; dev->ib_dev.check_mr_status = mlx5_ib_check_mr_status; + dev->ib_dev.get_port_immutable = mlx5_port_immutable;mlx5_ib_internal_query_odp_caps (dev);
drivers/infiniband/hw/mthca/mthca_provider.c +17 -0
@@ -1250,6 +1250,22 @@ out:return err; } +static int mthca_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =mthca_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +int mthca_register_device (struct mthca_dev *dev) {int ret;
@@ -1330,6 +1346,7 @@ int mthca_register_device(struct mthca_dev *dev) dev->ib_dev.reg_phys_mr = mthca_reg_phys_mr; dev->ib_dev.reg_user_mr = mthca_reg_user_mr; dev->ib_dev.dereg_mr = mthca_dereg_mr; + dev->ib_dev.get_port_immutable = mthca_port_immutable;if (dev->mthca_flags &MTHCA_FLAG_FMR ) { dev->ib_dev.alloc_fmr = mthca_alloc_fmr;
drivers/infiniband/hw/nes/nes_verbs.c +16 -0
@@ -3833,6 +3833,21 @@ static int nes_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_return 0 ; } +static int nes_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =nes_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +}/** * nes_init_ofa_device
@@ -3934,6 +3949,7 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev) nesibdev->ibdev.iwcm->reject = nes_reject; nesibdev->ibdev.iwcm->create_listen = nes_create_listen; nesibdev->ibdev.iwcm->destroy_listen = nes_destroy_listen; + nesibdev->ibdev.get_port_immutable = nes_port_immutable;return nesibdev; }
drivers/infiniband/hw/ocrdma/ocrdma_main.c +17 -0
@@ -202,6 +202,22 @@ static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device,return IB_LINK_LAYER_ETHERNET ; } +static int ocrdma_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =ocrdma_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +static int ocrdma_register_device (struct ocrdma_dev *dev) {strlcpy (dev->ibdev.name,"ocrdma%d" ,IB_DEVICE_NAME_MAX );
@@ -287,6 +303,7 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) dev->ibdev.dma_device = &dev->nic_info.pdev->dev; dev->ibdev.process_mad = ocrdma_process_mad; + dev->ibdev.get_port_immutable = ocrdma_port_immutable;if (ocrdma_get_asic_type (dev) ==OCRDMA_ASIC_GEN_SKH_R ) { dev->ibdev.uverbs_cmd_mask |=
drivers/infiniband/hw/qib/qib_verbs.c +17 -0
@@ -2046,6 +2046,22 @@ static void init_ibport(struct qib_pportdata *ppd)RCU_INIT_POINTER (ibp->qp1,NULL ); } +static int qib_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =qib_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +/** * qib_register_ib_device - register our device with the infiniband core * @dd: the device data structure
@@ -2234,6 +2250,7 @@ int qib_register_ib_device(struct qib_devdata *dd) ibdev->process_mad = qib_process_mad; ibdev->mmap = qib_mmap; ibdev->dma_ops = &qib_dma_mapping_ops; + ibdev->get_port_immutable = qib_port_immutable;snprintf (ibdev->node_desc,sizeof (ibdev->node_desc),"Intel Infiniband HCA %s" ,init_utsname ()->nodename);
drivers/infiniband/hw/usnic/usnic_ib_main.c +17 -0
@@ -300,6 +300,22 @@ static struct notifier_block usnic_ib_inetaddr_notifier = { };/* End of inet section*/ +static int usnic_port_immutable (struct ib_device *ibdev,u8 port_num, +struct ib_port_immutable *immutable) +{ +struct ib_port_attr attr; +int err; + + err =usnic_ib_query_port (ibdev, port_num, &attr); +if (err) +return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + +return 0 ; +} +/* Start of PF discovery section */ static void *usnic_ib_device_add (struct pci_dev *dev) {
@@ -384,6 +400,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev) us_ibdev->ib_dev.poll_cq = usnic_ib_poll_cq; us_ibdev->ib_dev.req_notify_cq = usnic_ib_req_notify_cq; us_ibdev->ib_dev.get_dma_mr = usnic_ib_get_dma_mr; + us_ibdev->ib_dev.get_port_immutable = usnic_port_immutable;if (ib_register_device (&us_ibdev->ib_dev,NULL ))
include/rdma/ib_verbs.h +17 -2
@@ -1481,6 +1481,11 @@ struct ib_dma_mapping_ops {struct iw_cm_verbs ; +struct ib_port_immutable { +int pkey_tbl_len; +int gid_tbl_len; +}; +struct ib_device {struct device *dma_device;
@@ -1494,8 +1499,10 @@ struct ib_device {struct list_head client_data_list;struct ib_cache cache; -int *pkey_tbl_len; -int *gid_tbl_len; +/** +* port_immutable is indexed by port number +*/ +struct ib_port_immutable *port_immutable;int num_comp_vectors;
@@ -1684,6 +1691,14 @@ struct ib_device {u32 local_dma_lkey;u8 node_type;u8 phys_port_cnt; + +/** +* The following mandatory functions are used only at device +* registration. Keep functions such as these at the end of this +* structure to avoid cache line misses when accessing struct ib_device +* in fast paths. +*/ +int (*get_port_immutable)(struct ib_device *,u8 ,struct ib_port_immutable *); };struct ib_client {
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/5 IB/core: Convert management helpers to core capability bits
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
Remove query_protocol callback
Use the new Core Capability bits for:
rdma_protocol_*rdma_cap_ib_madrdma_cap_ib_smirdma_cap_ib_cmrdma_cap_iw_cmrdma_cap_ib_sardma_cap_ib_mcastrdma_cap_af_ibrdma_cap_eth_ah
---
Changes since V1:
Change IBOE to ROCE
Clean up flag checks when returning bool
drivers/infiniband/core/device.c | 1 - drivers/infiniband/hw/amso1100/c2_provider.c | 8 +--- drivers/infiniband/hw/cxgb3/iwch_provider.c | 8 +--- drivers/infiniband/hw/cxgb4/provider.c | 8 +--- drivers/infiniband/hw/ehca/ehca_hca.c | 6 --- drivers/infiniband/hw/ehca/ehca_main.c | 2 +- drivers/infiniband/hw/ipath/ipath_verbs.c | 8 +--- drivers/infiniband/hw/mlx4/main.c | 15 +++---- drivers/infiniband/hw/mlx5/main.c | 8 +--- drivers/infiniband/hw/mthca/mthca_provider.c | 8 +--- drivers/infiniband/hw/nes/nes_verbs.c | 8 +--- drivers/infiniband/hw/ocrdma/ocrdma_main.c | 2 +- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 --- drivers/infiniband/hw/qib/qib_verbs.c | 8 +--- drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 - drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 6 --- include/rdma/ib_verbs.h | 64 +++++++++++++++++++++------- 17 files changed, 63 insertions(+), 104 deletions(-)
drivers/infiniband/core/device.c +0 -1
@@ -76,7 +76,6 @@ static int ib_device_check_mandatory(struct ib_device *device) } mandatory_table[] = {IB_MANDATORY_FUNC (query_device),IB_MANDATORY_FUNC (query_port), -IB_MANDATORY_FUNC (query_protocol),IB_MANDATORY_FUNC (query_pkey),IB_MANDATORY_FUNC (query_gid), IB_MANDATORY_FUNC(alloc_pd),
drivers/infiniband/hw/amso1100/c2_provider.c +1 -7
@@ -99,12 +99,6 @@ static int c2_query_port(struct ib_device *ibdev,return 0 ; } -static enum rdma_protocol_type -c2_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IWARP ; -} -static int c2_query_pkey (struct ib_device *ibdev,u8 port,u16 index,u16 * pkey) {
@@ -775,6 +769,7 @@ static int c2_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IWARP ;return 0 ; }
@@ -823,7 +818,6 @@ int c2_register_device(struct c2_dev *dev) dev->ibdev.dma_device = &dev->pcidev->dev; dev->ibdev.query_device = c2_query_device; dev->ibdev.query_port = c2_query_port; - dev->ibdev.query_protocol = c2_query_protocol; dev->ibdev.query_pkey = c2_query_pkey; dev->ibdev.query_gid = c2_query_gid; dev->ibdev.alloc_ucontext = c2_alloc_ucontext;
drivers/infiniband/hw/cxgb3/iwch_provider.c +1 -7
@@ -1232,12 +1232,6 @@ static int iwch_query_port(struct ib_device *ibdev,return 0 ; } -static enum rdma_protocol_type -iwch_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IWARP ; -} -static ssize_t show_rev (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -1361,6 +1355,7 @@ static int iwch_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IWARP ;return 0 ; }
@@ -1407,7 +1402,6 @@ int iwch_register_device(struct iwch_dev *dev) dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev); dev->ibdev.query_device = iwch_query_device; dev->ibdev.query_port = iwch_query_port; - dev->ibdev.query_protocol = iwch_query_protocol; dev->ibdev.query_pkey = iwch_query_pkey; dev->ibdev.query_gid = iwch_query_gid; dev->ibdev.alloc_ucontext = iwch_alloc_ucontext;
drivers/infiniband/hw/cxgb4/provider.c +1 -7
@@ -390,12 +390,6 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,return 0 ; } -static enum rdma_protocol_type -c4iw_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IWARP ; -} -static ssize_t show_rev (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -483,6 +477,7 @@ static int c4iw_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IWARP ;return 0 ; }
@@ -528,7 +523,6 @@ int c4iw_register_device(struct c4iw_dev *dev) dev->ibdev.dma_device = &(dev->rdev.lldi.pdev->dev); dev->ibdev.query_device = c4iw_query_device; dev->ibdev.query_port = c4iw_query_port; - dev->ibdev.query_protocol = c4iw_query_protocol; dev->ibdev.query_pkey = c4iw_query_pkey; dev->ibdev.query_gid = c4iw_query_gid; dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
drivers/infiniband/hw/ehca/ehca_hca.c +0 -6
@@ -242,12 +242,6 @@ query_port1:return ret; } -enum rdma_protocol_type -ehca_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IB ; -} -int ehca_query_sma_attr (struct ehca_shca *shca,u8 port,struct ehca_sma_attr *attr) {
drivers/infiniband/hw/ehca/ehca_main.c +1 -1
@@ -443,6 +443,7 @@ static int ehca_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IBA_IB ;return 0 ; }
@@ -483,7 +484,6 @@ static int ehca_init_device(struct ehca_shca *shca) shca->ib_device.dma_device = &shca->ofdev->dev; shca->ib_device.query_device = ehca_query_device; shca->ib_device.query_port = ehca_query_port; - shca->ib_device.query_protocol = ehca_query_protocol; shca->ib_device.query_gid = ehca_query_gid; shca->ib_device.query_pkey = ehca_query_pkey;/* shca->in_device.modify_device = ehca_modify_device */
drivers/infiniband/hw/ipath/ipath_verbs.c +1 -7
@@ -1638,12 +1638,6 @@ static int ipath_query_port(struct ib_device *ibdev,return 0 ; } -static enum rdma_protocol_type -ipath_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IB ; -} -static int ipath_modify_device (struct ib_device *device,int device_modify_mask,struct ib_device_modify *device_modify)
@@ -1998,6 +1992,7 @@ static int ipath_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IBA_IB ;return 0 ; }
@@ -2162,7 +2157,6 @@ int ipath_register_ib_device(struct ipath_devdata *dd) dev->query_device = ipath_query_device; dev->modify_device = ipath_modify_device; dev->query_port = ipath_query_port; - dev->query_protocol = ipath_query_protocol; dev->modify_port = ipath_modify_port; dev->query_pkey = ipath_query_pkey; dev->query_gid = ipath_query_gid;
drivers/infiniband/hw/mlx4/main.c +5 -10
@@ -420,15 +420,6 @@ static int mlx4_ib_query_port(struct ib_device *ibdev, u8 port,return __mlx4_ib_query_port (ibdev, port, props,0 ); } -static enum rdma_protocol_type -mlx4_ib_query_protocol (struct ib_device *device,u8 port_num) -{ -struct mlx4_dev *dev =to_mdev (device)->dev; - -return dev->caps.port_mask[port_num] ==MLX4_PORT_TYPE_IB ? -RDMA_PROTOCOL_IB :RDMA_PROTOCOL_IBOE ; -} -int __mlx4_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid,int netw_view) {
@@ -2137,6 +2128,11 @@ static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; +if (mlx4_ib_port_link_layer (ibdev, port_num) ==IB_LINK_LAYER_INFINIBAND ) + immutable->core_cap_flags =RDMA_CORE_PORT_IBA_IB ; +else + immutable->core_cap_flags =RDMA_CORE_PORT_IBA_ROCE ; +return 0 ; }
@@ -2227,7 +2223,6 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) ibdev->ib_dev.query_device = mlx4_ib_query_device; ibdev->ib_dev.query_port = mlx4_ib_query_port; - ibdev->ib_dev.query_protocol = mlx4_ib_query_protocol; ibdev->ib_dev.get_link_layer = mlx4_ib_port_link_layer; ibdev->ib_dev.query_gid = mlx4_ib_query_gid; ibdev->ib_dev.query_pkey = mlx4_ib_query_pkey;
drivers/infiniband/hw/mlx5/main.c +1 -7
@@ -262,12 +262,6 @@ out:return err; } -static enum rdma_protocol_type -mlx5_ib_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IB ; -} -static int mlx5_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid) {
@@ -1200,6 +1194,7 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IBA_IB ;return 0 ; }
@@ -1266,7 +1261,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->ib_dev.query_device = mlx5_ib_query_device; dev->ib_dev.query_port = mlx5_ib_query_port; - dev->ib_dev.query_protocol = mlx5_ib_query_protocol; dev->ib_dev.query_gid = mlx5_ib_query_gid; dev->ib_dev.query_pkey = mlx5_ib_query_pkey; dev->ib_dev.modify_device = mlx5_ib_modify_device;
drivers/infiniband/hw/mthca/mthca_provider.c +1 -7
@@ -179,12 +179,6 @@ static int mthca_query_port(struct ib_device *ibdev,return err; } -static enum rdma_protocol_type -mthca_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IB ; -} -static int mthca_modify_device (struct ib_device *ibdev,int mask,struct ib_device_modify *props)
@@ -1262,6 +1256,7 @@ static int mthca_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IBA_IB ;return 0 ; }
@@ -1303,7 +1298,6 @@ int mthca_register_device(struct mthca_dev *dev) dev->ib_dev.dma_device = &dev->pdev->dev; dev->ib_dev.query_device = mthca_query_device; dev->ib_dev.query_port = mthca_query_port; - dev->ib_dev.query_protocol = mthca_query_protocol; dev->ib_dev.modify_device = mthca_modify_device; dev->ib_dev.modify_port = mthca_modify_port; dev->ib_dev.query_pkey = mthca_query_pkey;
drivers/infiniband/hw/nes/nes_verbs.c +1 -7
@@ -606,12 +606,6 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attrreturn 0 ; } -static enum rdma_protocol_type -nes_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IWARP ; -} -/** * nes_query_pkey */
@@ -3845,6 +3839,7 @@ static int nes_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IWARP ;return 0 ; }
@@ -3899,7 +3894,6 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev) nesibdev->ibdev.dev.parent = &nesdev->pcidev->dev; nesibdev->ibdev.query_device = nes_query_device; nesibdev->ibdev.query_port = nes_query_port; - nesibdev->ibdev.query_protocol = nes_query_protocol; nesibdev->ibdev.query_pkey = nes_query_pkey; nesibdev->ibdev.query_gid = nes_query_gid; nesibdev->ibdev.alloc_ucontext = nes_alloc_ucontext;
drivers/infiniband/hw/ocrdma/ocrdma_main.c +1 -1
@@ -214,6 +214,7 @@ static int ocrdma_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IBA_ROCE ;return 0 ; }
@@ -260,7 +261,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)/* mandatory verbs. */ dev->ibdev.query_device = ocrdma_query_device; dev->ibdev.query_port = ocrdma_query_port; - dev->ibdev.query_protocol = ocrdma_query_protocol; dev->ibdev.modify_port = ocrdma_modify_port; dev->ibdev.query_gid = ocrdma_query_gid; dev->ibdev.get_link_layer = ocrdma_link_layer;
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +0 -6
@@ -187,12 +187,6 @@ int ocrdma_query_port(struct ib_device *ibdev,return 0 ; } -enum rdma_protocol_type -ocrdma_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IBOE ; -} -int ocrdma_modify_port (struct ib_device *ibdev,u8 port,int mask,struct ib_port_modify *props) {
drivers/infiniband/hw/qib/qib_verbs.c +1 -7
@@ -1650,12 +1650,6 @@ static int qib_query_port(struct ib_device *ibdev, u8 port,return 0 ; } -static enum rdma_protocol_type -qib_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_IB ; -} -static int qib_modify_device (struct ib_device *device,int device_modify_mask,struct ib_device_modify *device_modify)
@@ -2058,6 +2052,7 @@ static int qib_port_immutable(struct ib_device *ibdev, u8 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags =RDMA_CORE_PORT_IBA_IB ;return 0 ; }
@@ -2206,7 +2201,6 @@ int qib_register_ib_device(struct qib_devdata *dd) ibdev->query_device = qib_query_device; ibdev->modify_device = qib_modify_device; ibdev->query_port = qib_query_port; - ibdev->query_protocol = qib_query_protocol; ibdev->modify_port = qib_modify_port; ibdev->query_pkey = qib_query_pkey; ibdev->query_gid = qib_query_gid;
drivers/infiniband/hw/usnic/usnic_ib_main.c +0 -1
@@ -376,7 +376,6 @@ static void *usnic_ib_device_add(struct pci_dev *dev) us_ibdev->ib_dev.query_device = usnic_ib_query_device; us_ibdev->ib_dev.query_port = usnic_ib_query_port; - us_ibdev->ib_dev.query_protocol = usnic_ib_query_protocol; us_ibdev->ib_dev.query_pkey = usnic_ib_query_pkey; us_ibdev->ib_dev.query_gid = usnic_ib_query_gid; us_ibdev->ib_dev.get_link_layer = usnic_ib_port_link_layer;
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +0 -6
@@ -348,12 +348,6 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,return 0 ; } -enum rdma_protocol_type -usnic_ib_query_protocol (struct ib_device *device,u8 port_num) -{ -return RDMA_PROTOCOL_USNIC_UDP ; -} -int usnic_ib_query_qp (struct ib_qp *qp,struct ib_qp_attr *qp_attr,int qp_attr_mask,struct ib_qp_init_attr *qp_init_attr)
include/rdma/ib_verbs.h +48 -16
148 lines not on this page · raw message
Signature · 6 lines
1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1431561779-13714-6-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 5/5] IB/core: Convert management helpers to core capability bits
On 5/13/2015 8:02 PM, [email protected] wrote:
<snip...>
Quoted 63 lines
include/rdma/ib_verbs.h +35
-2@@ -353,6 +353,40 @@ union rdma_protocol_stats {struct iw_protocol_stats iw; }; +/* Define bits for the various functionality this port needs to be supported by +* the core. +*/ +/* Management 0x00000FFF */ +#define RDMA_CORE_CAP_IB_MAD 0x00000001 +#define RDMA_CORE_CAP_IB_SMI 0x00000002 +#define RDMA_CORE_CAP_IB_CM 0x00000004 +#define RDMA_CORE_CAP_IW_CM 0x00000008 +#define RDMA_CORE_CAP_IB_SA 0x00000010 + +/* Address format 0x000FF000 */ +#define RDMA_CORE_CAP_AF_IB 0x00001000 +#define RDMA_CORE_CAP_ETH_AH 0x00002000 + +/* Protocol 0xFFF00000 */ +#define RDMA_CORE_CAP_PROT_IB 0x00100000 +#define RDMA_CORE_CAP_PROT_ROCE 0x00200000 +#define RDMA_CORE_CAP_PROT_IWARP 0x00400000 + +#define RDMA_CORE_PORT_IBA_IB (RDMA_CORE_CAP_PROT_IB \ + | RDMA_CORE_CAP_IB_MAD \ + | RDMA_CORE_CAP_IB_SMI \ + | RDMA_CORE_CAP_IB_CM \ + | RDMA_CORE_CAP_IB_SA \ + | RDMA_CORE_CAP_AF_IB) +#define RDMA_CORE_PORT_IBA_ROCE (RDMA_CORE_CAP_PROT_ROCE \ + | RDMA_CORE_CAP_IB_MAD \ + | RDMA_CORE_CAP_IB_CM \ + | RDMA_CORE_CAP_IB_SA \ + | RDMA_CORE_CAP_AF_IB \ + | RDMA_CORE_CAP_ETH_AH) +#define RDMA_CORE_PORT_IWARP (RDMA_CORE_CAP_PROT_IWARP \ + | RDMA_CORE_CAP_IW_CM) +struct ib_port_attr {enum ib_port_state state;enum ib_mtu max_mtu;@@ -1484,6 +1518,7 @@ struct iw_cm_verbs;struct ib_port_immutable {int pkey_tbl_len;int gid_tbl_len; +u32 core_cap_flags; };struct ib_device {@@ -1515,8 +1550,6 @@ struct ib_device {int (*query_port)(struct ib_device *device,u8 port_num,struct ib_port_attr *port_attr); -enum rdma_protocol_type (*query_protocol)(struct ib_device *device, -u8 port_num);enum rdma_link_layer (*get_link_layer)(struct ib_device *device,u8 port_num); int (*query_gid)(struct ib_device *device,
include/rdma/ib_verbs.h static inline u8 rdma_end_port(const struct ib_device *device) · line 1835
Quoted 8 lines
include/rdma/ib_verbs.h +1
-1@@ -1796,24 +1829,23 @@ static inline u8 rdma_end_port(const struct ib_device *device)static inline bool rdma_protocol_ib (struct ib_device *device,u8 port_num) { -return device->query_protocol (device, port_num) ==RDMA_PROTOCOL_IB ; +return device->port_immutable[port_num].core_cap_flags &RDMA_CORE_CAP_PROT_IB ; }static inline bool rdma_protocol_iboe (struct ib_device *device,u8 port_num)
Should this helper be renamed rdma_protocol_roce (and change any consumers of this helper to use that name) ? If so, should it be done in this patch or follow on patch ?
-- Hal
<snip...>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 5554AE23.3020909-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
RE: [PATCH 5/5] IB/core: Convert management helpers to core capability bits
Quoted 8 lines
Review
Quoted 3 lines
static inline bool rdma_protocol_ib(struct
ib_device*device, u8port_num) {(quoted diff) +0
-1- return device->query_protocol(device, port_num) ==
RDMA_PROTOCOL_IB;Quoted 4 lines
include/rdma/ib_verbs.h +2
-0+return device->port_immutable[port_num].core_cap_flags & +RDMA_CORE_CAP_PROT_IB ; }
Quoted 7 lines
Quoted 2 lines
static inline bool rdma_protocol_iboe(struct
ib_device*device, u8port_num)Should this helper be renamed
rdma_protocol_roce(and change any consumers of this helper to use that name) ? If so, should it be done in this patch or follow on patch ?
I'll create a follow on patch.
Ira
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 2807E5FD2F6FDA4886F6618EAC48510E1107E715-8k97q/[email protected]
Re: [PATCH 5/5] IB/core: Convert management helpers to core capability bits
Quoted 16 lines · Ira
Quoted 8 lines
Review
Quoted 3 lines
static inline bool rdma_protocol_ib(struct
ib_device*device, u8port_num) {(quoted diff) +0
-1- return device->query_protocol(device, port_num) ==
RDMA_PROTOCOL_IB;Quoted 4 lines
include/rdma/ib_verbs.h +2
-0+return device->port_immutable[port_num].core_cap_flags & +RDMA_CORE_CAP_PROT_IB ; }Quoted 7 lines
Quoted 2 lines
static inline bool rdma_protocol_iboe(struct
ib_device*device, u8port_num)Should this helper be renamed
rdma_protocol_roce(and change any consumers of this helper to use that name) ? If so, should it be done in this patch or follow on patch ?
Quoted 2 lines
I'll create a follow on patch.
Since we are going down this path perhaps someone can change all the other iboe references. These counts were after changing the rdma_protocol_* names.
12:24:45 > grep -r iboe drivers/infiniband/ | grep -v Binary | wc -l 123
12:24:51 > grep -r iboe include/rdma | grep -v Binary | wc -l 4
Ira
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20150514162654.GA10941-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org
Re: [PATCH 5/5] IB/core: Convert management helpers to core capability bits
Quoted 20 lines · ira.weiny
Quoted 16 lines · Ira
Quoted 8 lines
Review
Quoted 3 lines
static inline bool rdma_protocol_ib(struct
ib_device*device, u8port_num) {(quoted diff) +0
-1- return device->query_protocol(device, port_num) ==
RDMA_PROTOCOL_IB;Quoted 4 lines
(quoted diff) +2
-0+ return device->port_immutable[port_num].core_cap_flags & +RDMA_CORE_CAP_PROT_IB; }Quoted 7 lines
Quoted 2 lines
static inline bool rdma_protocol_iboe(struct
ib_device*device, u8port_num)Should this helper be renamed
rdma_protocol_roce(and change any consumers of this helper to use that name) ? If so, should it be done in this patch or follow on patch ?Quoted 2 lines
I'll create a follow on patch.
Quoted 8 lines
Since we are going down this path perhaps someone can change all the other iboe references. These counts were after changing the rdma_protocol_* names.
12:24:45 > grep -r iboe
drivers/infiniband/| grep -v Binary | wc -l 12312:24:51 > grep -r iboe
include/rdma| grep -v Binary | wc -l 4
No biggie, I'll take care of it.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Quoted 9 lines · On Thu, May 14, 2015 at 3:02 AM, <[email protected]…
Ira Weiny (5):
IB/core: Create common start/end port functions IB/user_mad: Remove local start/end port variable and use the new
common functions
IB/user_mad: Fix bug inib_umad_remove_onewhenrdma_cap_ib_mad
implementation changed
IB/core: Formalize the creation of immutable per port data within the
ib_deviceobject
IB/core: Convert management helpers to core capability bits
Hi Ira,
Just small feedback... commit titles needs to be (1) short (2) tell the essence of
what you're doing e.g here are quick suggestions to few titles above which are way too long:
IB/user_mad: Use the start/end port common helpers IB/user_mad: Fix bug in remove_one
IB/core: Formalize immutable per port data creation within IB device
Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html