/* * Copyright (c) 2004 Topspin Communications. All rights reserved. * Copyright (c) 2005 Intel Corporation. All rights reserved. * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2005 Voltaire, Inc. 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 * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
*/
enum gid_table_entry_state {
GID_TABLE_ENTRY_INVALID = 1,
GID_TABLE_ENTRY_VALID = 2, /* * Indicates that entry is pending to be removed, there may * be active users of this GID entry. * When last user of the GID entry releases reference to it, * GID entry is detached from the table.
*/
GID_TABLE_ENTRY_PENDING_DEL = 3,
};
struct ib_gid_table_entry { struct kref kref; struct work_struct del_work; struct ib_gid_attr attr; void *context; /* Store the ndev pointer to release reference later on in * call_rcu context because by that time gid_table_entry * and attr might be already freed. So keep a copy of it. * ndev_storage is freed by rcu callback.
*/ struct roce_gid_ndev_storage *ndev_storage; enum gid_table_entry_state state;
};
struct ib_gid_table { int sz; /* In RoCE, adding a GID to the table requires: * (a) Find if this GID is already exists. * (b) Find a free space. * (c) Write the new GID * * Delete requires different set of operations: * (a) Find the GID * (b) Delete it. *
**/ /* Any writer to data_vec must hold this lock and the write side of * rwlock. Readers must hold only rwlock. All writers must be in a * sleepable context.
*/ struct mutex lock; /* rwlock protects data_vec[ix]->state and entry pointer.
*/
rwlock_t rwlock; struct ib_gid_table_entry **data_vec; /* bit field, each bit indicates the index of default GID */
u32 default_gid_indices;
};
staticconstchar * const gid_type_str[] = { /* IB/RoCE v1 value is set for IB_GID_TYPE_IB and IB_GID_TYPE_ROCE for * user space compatibility reasons.
*/
[IB_GID_TYPE_IB] = "IB/RoCE v1",
[IB_GID_TYPE_ROCE] = "IB/RoCE v1",
[IB_GID_TYPE_ROCE_UDP_ENCAP] = "RoCE v2",
};
/** rdma_is_zero_gid - Check if given GID is zero or not. * @gid: GID to check * Returns true if given GID is zero, returns false otherwise.
*/ bool rdma_is_zero_gid(constunion ib_gid *gid)
{ return !memcmp(gid, &zgid, sizeof(*gid));
}
EXPORT_SYMBOL(rdma_is_zero_gid);
/** is_gid_index_default - Check if a given index belongs to * reserved default GIDs or not. * @table: GID table pointer * @index: Index to check in GID table * Returns true if index is one of the reserved default GID index otherwise * returns false.
*/ staticbool is_gid_index_default(conststruct ib_gid_table *table, unsignedint index)
{ return index < 32 && (BIT(index) & table->default_gid_indices);
}
int ib_cache_gid_parse_type_str(constchar *buf)
{ unsignedint i;
size_t len; int err = -EINVAL;
len = strlen(buf); if (len == 0) return -EINVAL;
if (buf[len - 1] == '\n')
len--;
for (i = 0; i < ARRAY_SIZE(gid_type_str); ++i) if (gid_type_str[i] && !strncmp(buf, gid_type_str[i], len) &&
len == strlen(gid_type_str[i])) {
err = i; break;
}
WARN_ON(!storage->ndev); /* At this point its safe to release netdev reference, * as all callers working on gid_attr->ndev are done * using this netdev.
*/
dev_put(storage->ndev);
kfree(storage);
}
/* * The only way to avoid overwriting NULL in table is * by comparing if it is same entry in table or not! * If new entry in table is added by the time we free here, * don't overwrite the table entry.
*/ if (entry == table->data_vec[entry->attr.index])
table->data_vec[entry->attr.index] = NULL; /* Now this index is ready to be allocated */
write_unlock_irq(&table->rwlock);
if (entry->ndev_storage)
call_rcu(&entry->ndev_storage->rcu_head, put_gid_ndev);
kfree(entry);
}
/** * free_gid_work - Release reference to the GID entry * @work: Work structure to refer to GID entry which needs to be * deleted. * * free_gid_work() frees the entry from the HCA's hardware table * if provider supports it. It releases reference to netdevice.
*/ staticvoid free_gid_work(struct work_struct *work)
{ struct ib_gid_table_entry *entry =
container_of(work, struct ib_gid_table_entry, del_work); struct ib_device *device = entry->attr.device;
u32 port_num = entry->attr.port_num; struct ib_gid_table *table = rdma_gid_table(device, port_num);
/** * del_gid - Delete GID table entry * * @ib_dev: IB device whose GID entry to be deleted * @port: Port number of the IB device * @table: GID table of the IB device for a port * @ix: GID entry index to delete *
*/ staticvoid del_gid(struct ib_device *ib_dev, u32 port, struct ib_gid_table *table, int ix)
{ struct roce_gid_ndev_storage *ndev_storage; struct ib_gid_table_entry *entry;
write_lock_irq(&table->rwlock);
entry = table->data_vec[ix];
entry->state = GID_TABLE_ENTRY_PENDING_DEL; /* * For non RoCE protocol, GID entry slot is ready to use.
*/ if (!rdma_protocol_roce(ib_dev, port))
table->data_vec[ix] = NULL;
write_unlock_irq(&table->rwlock);
if (rdma_cap_roce_gid_table(ib_dev, port))
ib_dev->ops.del_gid(&entry->attr, &entry->context);
/** * add_modify_gid - Add or modify GID table entry * * @table: GID table in which GID to be added or modified * @attr: Attributes of the GID * * Returns 0 on success or appropriate error code. It accepts zero * GID addition for non RoCE ports for HCA's who report them as valid * GID. However such zero GIDs are not added to the cache.
*/ staticint add_modify_gid(struct ib_gid_table *table, conststruct ib_gid_attr *attr)
{ struct ib_gid_table_entry *entry; int ret = 0;
/* * Invalidate any old entry in the table to make it safe to write to * this index.
*/ if (is_gid_entry_valid(table->data_vec[attr->index]))
del_gid(attr->device, attr->port_num, table, attr->index);
/* * Some HCA's report multiple GID entries with only one valid GID, and * leave other unused entries as the zero GID. Convert zero GIDs to * empty table entries instead of storing them.
*/ if (rdma_is_zero_gid(&attr->gid)) return 0;
entry = alloc_gid_entry(attr); if (!entry) return -ENOMEM;
if (rdma_protocol_roce(attr->device, attr->port_num)) {
ret = add_roce_gid(entry); if (ret) goto done;
}
store_gid_entry(table, entry); return 0;
done:
put_gid_entry(entry); return ret;
}
/* rwlock should be read locked, or lock should be held */ staticint find_gid(struct ib_gid_table *table, constunion ib_gid *gid, conststruct ib_gid_attr *val, bool default_gid, unsignedlong mask, int *pempty)
{ int i = 0; int found = -1; int empty = pempty ? -1 : 0;
while (i < table->sz && (found < 0 || empty < 0)) { struct ib_gid_table_entry *data = table->data_vec[i]; struct ib_gid_attr *attr; int curr_index = i;
i++;
/* find_gid() is used during GID addition where it is expected * to return a free entry slot which is not duplicate. * Free entry slot is requested and returned if pempty is set, * so lookup free slot only if requested.
*/ if (pempty && empty < 0) { if (is_gid_entry_free(data) &&
default_gid ==
is_gid_index_default(table, curr_index)) { /* * Found an invalid (free) entry; allocate it. * If default GID is requested, then our * found slot must be one of the DEFAULT * reserved slots or we fail. * This ensures that only DEFAULT reserved * slots are used for default property GIDs.
*/
empty = curr_index;
}
}
/* * Additionally find_gid() is used to find valid entry during * lookup operation; so ignore the entries which are marked as * pending for removal and the entries which are marked as * invalid.
*/ if (!is_gid_entry_valid(data)) continue;
staticint __ib_cache_gid_add(struct ib_device *ib_dev, u32 port, union ib_gid *gid, struct ib_gid_attr *attr, unsignedlong mask, bool default_gid)
{ struct ib_gid_table *table; int ret = 0; int empty; int ix;
/* Do not allow adding zero GID in support of * IB spec version 1.3 section 4.1.1 point (6) and * section 12.7.10 and section 12.7.20
*/ if (rdma_is_zero_gid(gid)) return -EINVAL;
table = rdma_gid_table(ib_dev, port);
mutex_lock(&table->lock);
ix = find_gid(table, gid, attr, default_gid, mask, &empty); if (ix >= 0) goto out_unlock;
if (empty < 0) {
ret = -ENOSPC; goto out_unlock;
}
attr->device = ib_dev;
attr->index = empty;
attr->port_num = port;
attr->gid = *gid;
ret = add_modify_gid(table, attr); if (!ret)
dispatch_gid_change_event(ib_dev, port);
out_unlock:
mutex_unlock(&table->lock); if (ret)
pr_warn_ratelimited("%s: unable to add gid %pI6 error=%d\n",
__func__, gid->raw, ret); return ret;
}
int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u32 port, struct net_device *ndev)
{ struct ib_gid_table *table; int ix; bool deleted = false;
table = rdma_gid_table(ib_dev, port);
mutex_lock(&table->lock);
for (ix = 0; ix < table->sz; ix++) { if (is_gid_entry_valid(table->data_vec[ix]) &&
table->data_vec[ix]->attr.ndev == ndev) {
del_gid(ib_dev, port, table, ix);
deleted = true;
}
}
mutex_unlock(&table->lock);
if (deleted)
dispatch_gid_change_event(ib_dev, port);
return 0;
}
/** * rdma_find_gid_by_port - Returns the GID entry attributes when it finds * a valid GID entry for given search parameters. It searches for the specified * GID value in the local software cache. * @ib_dev: The device to query. * @gid: The GID value to search for. * @gid_type: The GID type to search for. * @port: The port number of the device where the GID value should be searched. * @ndev: In RoCE, the net device of the device. NULL means ignore. * * Returns sgid attributes if the GID is found with valid reference or * returns ERR_PTR for the error. * The caller must invoke rdma_put_gid_attr() to release the reference.
*/ conststruct ib_gid_attr *
rdma_find_gid_by_port(struct ib_device *ib_dev, constunion ib_gid *gid, enum ib_gid_type gid_type,
u32 port, struct net_device *ndev)
{ int local_index; struct ib_gid_table *table; unsignedlong mask = GID_ATTR_FIND_MASK_GID |
GID_ATTR_FIND_MASK_GID_TYPE; struct ib_gid_attr val = {.ndev = ndev, .gid_type = gid_type}; conststruct ib_gid_attr *attr; unsignedlong flags;
if (!rdma_is_port_valid(ib_dev, port)) return ERR_PTR(-ENOENT);
/** * rdma_find_gid_by_filter - Returns the GID table attribute where a * specified GID value occurs * @ib_dev: The device to query. * @gid: The GID value to search for. * @port: The port number of the device where the GID value could be * searched. * @filter: The filter function is executed on any matching GID in the table. * If the filter function returns true, the corresponding index is returned, * otherwise, we continue searching the GID table. It's guaranteed that * while filter is executed, ndev field is valid and the structure won't * change. filter is executed in an atomic context. filter must not be NULL. * @context: Private data to pass into the call-back. * * rdma_find_gid_by_filter() searches for the specified GID value * of which the filter function returns true in the port's GID table. *
*/ conststruct ib_gid_attr *rdma_find_gid_by_filter( struct ib_device *ib_dev, constunion ib_gid *gid, u32 port, bool (*filter)(constunion ib_gid *gid, conststruct ib_gid_attr *, void *), void *context)
{ conststruct ib_gid_attr *res = ERR_PTR(-ENOENT); struct ib_gid_table *table; unsignedlong flags; unsignedint i;
if (!rdma_is_port_valid(ib_dev, port)) return ERR_PTR(-EINVAL);
table = rdma_gid_table(ib_dev, port);
read_lock_irqsave(&table->rwlock, flags); for (i = 0; i < table->sz; i++) { struct ib_gid_table_entry *entry = table->data_vec[i];
if (!is_gid_entry_valid(entry)) continue;
if (memcmp(gid, &entry->attr.gid, sizeof(*gid))) continue;
if (filter(gid, &entry->attr, context)) {
get_gid_entry(entry);
res = &entry->attr; break;
}
}
read_unlock_irqrestore(&table->rwlock, flags); return res;
}
mutex_lock(&table->lock); for (i = 0; i < table->sz; ++i) { if (is_gid_entry_valid(table->data_vec[i]))
del_gid(ib_dev, port, table, i);
}
mutex_unlock(&table->lock);
}
staticint gid_table_setup_one(struct ib_device *ib_dev)
{ int err;
err = _gid_table_setup_one(ib_dev);
if (err) return err;
rdma_roce_rescan_device(ib_dev);
return err;
}
/** * rdma_query_gid - Read the GID content from the GID software cache * @device: Device to query the GID * @port_num: Port number of the device * @index: Index of the GID table entry to read * @gid: Pointer to GID where to store the entry's GID * * rdma_query_gid() only reads the GID entry content for requested device, * port and index. It reads for IB, RoCE and iWarp link layers. It doesn't * hold any reference to the GID table entry in the HCA or software cache. * * Returns 0 on success or appropriate error code. *
*/ int rdma_query_gid(struct ib_device *device, u32 port_num, int index, union ib_gid *gid)
{ struct ib_gid_table *table; unsignedlong flags; int res;
if (!rdma_is_port_valid(device, port_num)) return -EINVAL;
/** * rdma_read_gid_hw_context - Read the HW GID context from GID attribute * @attr: Potinter to the GID attribute * * rdma_read_gid_hw_context() reads the drivers GID HW context corresponding * to the SGID attr. Callers are required to already be holding the reference * to an existing GID entry. * * Returns the HW GID context *
*/ void *rdma_read_gid_hw_context(conststruct ib_gid_attr *attr)
{ return container_of(attr, struct ib_gid_table_entry, attr)->context;
}
EXPORT_SYMBOL(rdma_read_gid_hw_context);
/** * rdma_find_gid - Returns SGID attributes if the matching GID is found. * @device: The device to query. * @gid: The GID value to search for. * @gid_type: The GID type to search for. * @ndev: In RoCE, the net device of the device. NULL means ignore. * * rdma_find_gid() searches for the specified GID value in the software cache. * * Returns GID attributes if a valid GID is found or returns ERR_PTR for the * error. The caller must invoke rdma_put_gid_attr() to release the reference. *
*/ conststruct ib_gid_attr *rdma_find_gid(struct ib_device *device, constunion ib_gid *gid, enum ib_gid_type gid_type, struct net_device *ndev)
{ unsignedlong mask = GID_ATTR_FIND_MASK_GID |
GID_ATTR_FIND_MASK_GID_TYPE; struct ib_gid_attr gid_attr_val = {.ndev = ndev, .gid_type = gid_type};
u32 p;
if (ndev)
mask |= GID_ATTR_FIND_MASK_NETDEV;
rdma_for_each_port(device, p) { struct ib_gid_table *table; unsignedlong flags; int index;
/** * rdma_get_gid_attr - Returns GID attributes for a port of a device * at a requested gid_index, if a valid GID entry exists. * @device: The device to query. * @port_num: The port number on the device where the GID value * is to be queried. * @index: Index of the GID table entry whose attributes are to * be queried. * * rdma_get_gid_attr() acquires reference count of gid attributes from the * cached GID table. Caller must invoke rdma_put_gid_attr() to release * reference to gid attribute regardless of link layer. * * Returns pointer to valid gid attribute or ERR_PTR for the appropriate error * code.
*/ conststruct ib_gid_attr *
rdma_get_gid_attr(struct ib_device *device, u32 port_num, int index)
{ conststruct ib_gid_attr *attr = ERR_PTR(-ENODATA); struct ib_gid_table *table; unsignedlong flags;
if (!rdma_is_port_valid(device, port_num)) return ERR_PTR(-EINVAL);
table = rdma_gid_table(device, port_num); if (index < 0 || index >= table->sz) return ERR_PTR(-EINVAL);
read_lock_irqsave(&table->rwlock, flags); if (!is_gid_entry_valid(table->data_vec[index])) goto done;
/** * rdma_query_gid_table - Reads GID table entries of all the ports of a device up to max_entries. * @device: The device to query. * @entries: Entries where GID entries are returned. * @max_entries: Maximum number of entries that can be returned. * Entries array must be allocated to hold max_entries number of entries. * * Returns number of entries on success or appropriate error code.
*/
ssize_t rdma_query_gid_table(struct ib_device *device, struct ib_uverbs_gid_entry *entries,
size_t max_entries)
{ conststruct ib_gid_attr *gid_attr;
ssize_t num_entries = 0, ret; struct ib_gid_table *table;
u32 port_num, i; struct net_device *ndev; unsignedlong flags;
rdma_for_each_port(device, port_num) {
table = rdma_gid_table(device, port_num);
read_lock_irqsave(&table->rwlock, flags); for (i = 0; i < table->sz; i++) { if (!is_gid_entry_valid(table->data_vec[i])) continue; if (num_entries >= max_entries) {
ret = -EINVAL; goto err;
}
/** * rdma_put_gid_attr - Release reference to the GID attribute * @attr: Pointer to the GID attribute whose reference * needs to be released. * * rdma_put_gid_attr() must be used to release reference whose * reference is acquired using rdma_get_gid_attr() or any APIs * which returns a pointer to the ib_gid_attr regardless of link layer * of IB or RoCE. *
*/ void rdma_put_gid_attr(conststruct ib_gid_attr *attr)
{ struct ib_gid_table_entry *entry =
container_of(attr, struct ib_gid_table_entry, attr);
/** * rdma_hold_gid_attr - Get reference to existing GID attribute * * @attr: Pointer to the GID attribute whose reference * needs to be taken. * * Increase the reference count to a GID attribute to keep it from being * freed. Callers are required to already be holding a reference to attribute. *
*/ void rdma_hold_gid_attr(conststruct ib_gid_attr *attr)
{ struct ib_gid_table_entry *entry =
container_of(attr, struct ib_gid_table_entry, attr);
/** * rdma_read_gid_attr_ndev_rcu - Read GID attribute netdevice * which must be in UP state. * * @attr:Pointer to the GID attribute * * Returns pointer to netdevice if the netdevice was attached to GID and * netdevice is in UP state. Caller must hold RCU lock as this API * reads the netdev flags which can change while netdevice migrates to * different net namespace. Returns ERR_PTR with error code otherwise. *
*/ struct net_device *rdma_read_gid_attr_ndev_rcu(conststruct ib_gid_attr *attr)
{ struct ib_gid_table_entry *entry =
container_of(attr, struct ib_gid_table_entry, attr); struct ib_device *device = entry->attr.device; struct net_device *ndev = ERR_PTR(-EINVAL);
u32 port_num = entry->attr.port_num; struct ib_gid_table *table; unsignedlong flags; bool valid;
if (is_vlan_dev(lower_dev))
*vlan_id = vlan_dev_vlan_id(lower_dev);
/* We are interested only in first level vlan device, so * always return 1 to stop iterating over next level devices.
*/ return 1;
}
/** * rdma_read_gid_l2_fields - Read the vlan ID and source MAC address * of a GID entry. * * @attr: GID attribute pointer whose L2 fields to be read * @vlan_id: Pointer to vlan id to fill up if the GID entry has * vlan id. It is optional. * @smac: Pointer to smac to fill up for a GID entry. It is optional. * * rdma_read_gid_l2_fields() returns 0 on success and returns vlan id * (if gid entry has vlan) and source MAC, or returns error.
*/ int rdma_read_gid_l2_fields(conststruct ib_gid_attr *attr,
u16 *vlan_id, u8 *smac)
{ struct netdev_nested_priv priv = {
.data = (void *)vlan_id,
}; struct net_device *ndev;
rcu_read_lock();
ndev = rcu_dereference(attr->ndev); if (!ndev) {
rcu_read_unlock(); return -ENODEV;
} if (smac)
ether_addr_copy(smac, ndev->dev_addr); if (vlan_id) {
*vlan_id = 0xffff; if (is_vlan_dev(ndev)) {
*vlan_id = vlan_dev_vlan_id(ndev);
} else { /* If the netdev is upper device and if it's lower * device is vlan device, consider vlan id of * the lower vlan device for this gid entry.
*/
netdev_walk_all_lower_dev_rcu(attr->ndev,
get_lower_dev_vlan, &priv);
}
}
rcu_read_unlock(); return 0;
}
EXPORT_SYMBOL(rdma_read_gid_l2_fields);
staticint config_non_roce_gid_cache(struct ib_device *device,
u32 port, struct ib_port_attr *tprops)
{ struct ib_gid_attr gid_attr = {}; struct ib_gid_table *table; int ret = 0; int i;
mutex_lock(&table->lock); for (i = 0; i < tprops->gid_tbl_len; ++i) { if (!device->ops.query_gid) continue;
ret = device->ops.query_gid(device, port, i, &gid_attr.gid); if (ret) {
dev_warn(&device->dev, "query_gid failed (%d) for index %d\n", ret,
i); goto err;
}
if (rdma_protocol_iwarp(device, port)) { struct net_device *ndev;
if (!rdma_is_port_valid(device, port)) return -EINVAL;
tprops = kmalloc(sizeof *tprops, GFP_KERNEL); if (!tprops) return -ENOMEM;
ret = ib_query_port(device, port, tprops); if (ret) {
dev_warn(&device->dev, "ib_query_port failed (%d)\n", ret); goto err;
}
if (!rdma_protocol_roce(device, port) && update_gids) {
ret = config_non_roce_gid_cache(device, port,
tprops); if (ret) goto err;
}
update_pkeys &= !!tprops->pkey_tbl_len;
if (update_pkeys) {
pkey_cache = kmalloc(struct_size(pkey_cache, table,
tprops->pkey_tbl_len),
GFP_KERNEL); if (!pkey_cache) {
ret = -ENOMEM; goto err;
}
pkey_cache->table_len = tprops->pkey_tbl_len;
for (i = 0; i < pkey_cache->table_len; ++i) {
ret = ib_query_pkey(device, port, i,
pkey_cache->table + i); if (ret) {
dev_warn(&device->dev, "ib_query_pkey failed (%d) for index %d\n",
ret, i); goto err;
}
}
}
/* Before distributing the cache update event, first sync * the cache.
*/
ret = ib_cache_update(work->event.device, work->event.element.port_num,
work->event.event == IB_EVENT_GID_CHANGE,
work->event.event == IB_EVENT_PKEY_CHANGE,
work->enforce_security);
/* GID event is notified already for individual GID entries by * dispatch_gid_change_event(). Hence, notifiy for rest of the * events.
*/ if (!ret && work->event.event != IB_EVENT_GID_CHANGE)
ib_dispatch_event_clients(&work->event);
/** * ib_dispatch_event - Dispatch an asynchronous event * @event:Event to dispatch * * Low-level drivers must call ib_dispatch_event() to dispatch the * event to all registered event handlers when an asynchronous event * occurs.
*/ void ib_dispatch_event(conststruct ib_event *event)
{ struct ib_update_work *work;
work = kzalloc(sizeof(*work), GFP_ATOMIC); if (!work) return;
if (is_cache_update_event(event))
INIT_WORK(&work->work, ib_cache_event_task); else
INIT_WORK(&work->work, ib_generic_event_task);
/* * The release function frees all the cache elements. * This function should be called as part of freeing * all the device's resources when the cache could no * longer be accessed.
*/
rdma_for_each_port (device, p)
kfree(device->port_data[p].cache.pkey);
gid_table_release_one(device);
}
void ib_cache_cleanup_one(struct ib_device *device)
{ /* The cleanup function waits for all in-progress workqueue * elements and cleans up the GID cache. This function should be * called after the device was removed from the devices list and * all clients were removed, so the cache exists but is * non-functional and shouldn't be updated anymore.
*/
flush_workqueue(ib_wq);
gid_table_cleanup_one(device);
/* * Flush the wq second time for any pending GID delete work.
*/
flush_workqueue(ib_wq);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.