Release 4.7 drivers/infiniband/core/cache.c
  
  
/*
 * 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.
 */
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/netdevice.h>
#include <net/addrconf.h>
#include <rdma/ib_cache.h>
#include "core_priv.h"
struct ib_pkey_cache {
	
int             table_len;
	
u16             table[0];
};
struct ib_update_work {
	
struct work_struct work;
	
struct ib_device  *device;
	
u8                 port_num;
};
union ib_gid zgid;
EXPORT_SYMBOL(zgid);
static const struct ib_gid_attr zattr;
enum gid_attr_find_mask {
	
GID_ATTR_FIND_MASK_GID          = 1UL << 0,
	
GID_ATTR_FIND_MASK_NETDEV	= 1UL << 1,
	
GID_ATTR_FIND_MASK_DEFAULT	= 1UL << 2,
	
GID_ATTR_FIND_MASK_GID_TYPE	= 1UL << 3,
};
enum gid_table_entry_props {
	
GID_TABLE_ENTRY_INVALID		= 1UL << 0,
	
GID_TABLE_ENTRY_DEFAULT		= 1UL << 1,
};
enum gid_table_write_action {
	
GID_TABLE_WRITE_ACTION_ADD,
	
GID_TABLE_WRITE_ACTION_DEL,
	/* MODIFY only updates the GID table. Currently only used by
         * ib_cache_update.
         */
	
GID_TABLE_WRITE_ACTION_MODIFY
};
struct ib_gid_table_entry {
	
unsigned long	    props;
	
union ib_gid        gid;
	
struct ib_gid_attr  attr;
	
void		   *context;
};
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.
         *
         * Add/delete should be carried out atomically.
         * This is done by locking this mutex from multiple
         * writers. We don't need this lock for IB, as the MAD
         * layer replaces all entries. All data_vec entries
         * are locked by this lock.
         **/
	
struct mutex         lock;
	/* This lock protects the table entries from being
         * read and written simultaneously.
         */
	
rwlock_t	     rwlock;
	
struct ib_gid_table_entry *data_vec;
};
static void dispatch_gid_change_event(struct ib_device *ib_dev, u8 port)
{
	if (rdma_cap_roce_gid_table(ib_dev, port)) {
		struct ib_event event;
		event.device		= ib_dev;
		event.element.port_num	= port;
		event.event		= IB_EVENT_GID_CHANGE;
		ib_dispatch_event(&event);
	}
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 55 | 100.00% | 1 | 100.00% | 
 | Total | 55 | 100.00% | 1 | 100.00% | 
static const char * const gid_type_str[] = {
	[IB_GID_TYPE_IB]	= "IB/RoCE v1",
	[IB_GID_TYPE_ROCE_UDP_ENCAP]	= "RoCE v2",
};
const char *ib_cache_gid_type_str(enum ib_gid_type gid_type)
{
	if (gid_type < ARRAY_SIZE(gid_type_str) && gid_type_str[gid_type])
		return gid_type_str[gid_type];
	return "Invalid GID type";
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 34 | 100.00% | 1 | 100.00% | 
 | Total | 34 | 100.00% | 1 | 100.00% | 
EXPORT_SYMBOL(ib_cache_gid_type_str);
int ib_cache_gid_parse_type_str(const char *buf)
{
	unsigned int 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;
		}
	return err;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 110 | 100.00% | 1 | 100.00% | 
 | Total | 110 | 100.00% | 1 | 100.00% | 
EXPORT_SYMBOL(ib_cache_gid_parse_type_str);
/* This function expects that rwlock will be write locked in all
 * scenarios and that lock will be locked in sleep-able (RoCE)
 * scenarios.
 */
static int write_gid(struct ib_device *ib_dev, u8 port,
		     struct ib_gid_table *table, int ix,
		     const union ib_gid *gid,
		     const struct ib_gid_attr *attr,
		     enum gid_table_write_action action,
		     bool  default_gid)
	__releases(&table->rwlockContributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 27 | 64.29% | 2 | 66.67% | 
| roland dreier | roland dreier | 15 | 35.71% | 1 | 33.33% | 
 | Total | 42 | 100.00% | 3 | 100.00% | 
) __acquires(&table->rwlock)
{
	int ret = 0;
	struct net_device *old_net_dev;
	enum ib_gid_type old_gid_type;
	/* in rdma_cap_roce_gid_table, this funciton should be protected by a
         * sleep-able lock.
         */
	if (rdma_cap_roce_gid_table(ib_dev, port)) {
		table->data_vec[ix].props |= GID_TABLE_ENTRY_INVALID;
		write_unlock_irq(&table->rwlock);
		/* GID_TABLE_WRITE_ACTION_MODIFY currently isn't supported by
                 * RoCE providers and thus only updates the cache.
                 */
		if (action == GID_TABLE_WRITE_ACTION_ADD)
			ret = ib_dev->add_gid(ib_dev, port, ix, gid, attr,
					      &table->data_vec[ix].context);
		else if (action == GID_TABLE_WRITE_ACTION_DEL)
			ret = ib_dev->del_gid(ib_dev, port, ix,
					      &table->data_vec[ix].context);
		write_lock_irq(&table->rwlock);
	}
	old_net_dev = table->data_vec[ix].attr.ndev;
	old_gid_type = table->data_vec[ix].attr.gid_type;
	if (old_net_dev && old_net_dev != attr->ndev)
		dev_put(old_net_dev);
	/* if modify_gid failed, just delete the old gid */
	if (ret || action == GID_TABLE_WRITE_ACTION_DEL) {
		gid = &zgid;
		attr = &zattr;
		table->data_vec[ix].context = NULL;
	}
	memcpy(&table->data_vec[ix].gid, gid, sizeof(*gid));
	memcpy(&table->data_vec[ix].attr, attr, sizeof(*attr));
	if (default_gid) {
		table->data_vec[ix].props |= GID_TABLE_ENTRY_DEFAULT;
		if (action == GID_TABLE_WRITE_ACTION_DEL)
			table->data_vec[ix].attr.gid_type = old_gid_type;
	}
	if (table->data_vec[ix].attr.ndev &&
	    table->data_vec[ix].attr.ndev != old_net_dev)
		dev_hold(table->data_vec[ix].attr.ndev);
	table->data_vec[ix].props &= ~GID_TABLE_ENTRY_INVALID;
	return ret;
}
static int add_gid(struct ib_device *ib_dev, u8 port,
		   struct ib_gid_table *table, int ix,
		   const union ib_gid *gid,
		   const struct ib_gid_attr *attr,
		   bool  default_gid) {
	return write_gid(ib_dev, port, table, ix, gid, attr,
			 GID_TABLE_WRITE_ACTION_ADD, default_gid);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 50 | 87.72% | 1 | 25.00% | 
| roland dreier | roland dreier | 6 | 10.53% | 2 | 50.00% | 
| ira weiny | ira weiny | 1 | 1.75% | 1 | 25.00% | 
 | Total | 57 | 100.00% | 4 | 100.00% | 
static int modify_gid(struct ib_device *ib_dev, u8 port,
		      struct ib_gid_table *table, int ix,
		      const union ib_gid *gid,
		      const struct ib_gid_attr *attr,
		      bool  default_gid) {
	return write_gid(ib_dev, port, table, ix, gid, attr,
			 GID_TABLE_WRITE_ACTION_MODIFY, default_gid);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 51 | 89.47% | 1 | 33.33% | 
| roland dreier | roland dreier | 6 | 10.53% | 2 | 66.67% | 
 | Total | 57 | 100.00% | 3 | 100.00% | 
static int del_gid(struct ib_device *ib_dev, u8 port,
		   struct ib_gid_table *table, int ix,
		   bool  default_gid) {
	return write_gid(ib_dev, port, table, ix, &zgid, &zattr,
			 GID_TABLE_WRITE_ACTION_DEL, default_gid);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 44 | 93.62% | 1 | 50.00% | 
| roland dreier | roland dreier | 3 | 6.38% | 1 | 50.00% | 
 | Total | 47 | 100.00% | 2 | 100.00% | 
/* rwlock should be read locked */
static int find_gid(struct ib_gid_table *table, const union ib_gid *gid,
		    const struct ib_gid_attr *val, bool default_gid,
		    unsigned long 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 = &data->attr;
		int curr_index = i;
		i++;
		if (data->props & GID_TABLE_ENTRY_INVALID)
			continue;
		if (empty < 0)
			if (!memcmp(&data->gid, &zgid, sizeof(*gid)) &&
			    !memcmp(attr, &zattr, sizeof(*attr)) &&
			    !data->props)
				empty = curr_index;
		if (found >= 0)
			continue;
		if (mask & GID_ATTR_FIND_MASK_GID_TYPE &&
		    attr->gid_type != val->gid_type)
			continue;
		if (mask & GID_ATTR_FIND_MASK_GID &&
		    memcmp(gid, &data->gid, sizeof(*gid)))
			continue;
		if (mask & GID_ATTR_FIND_MASK_NETDEV &&
		    attr->ndev != val->ndev)
			continue;
		if (mask & GID_ATTR_FIND_MASK_DEFAULT &&
		    !!(data->props & GID_TABLE_ENTRY_DEFAULT) !=
		    default_gid)
			continue;
		found = curr_index;
	}
	if (pempty)
		*pempty = empty;
	return found;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 260 | 100.00% | 4 | 100.00% | 
 | Total | 260 | 100.00% | 4 | 100.00% | 
static void make_default_gid(struct  net_device *dev, union ib_gid *gid)
{
	gid->global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL);
	addrconf_ifid_eui48(&gid->raw[8], dev);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 40 | 100.00% | 1 | 100.00% | 
 | Total | 40 | 100.00% | 1 | 100.00% | 
int ib_cache_gid_add(struct ib_device *ib_dev, u8 port,
		     union ib_gid *gid, struct ib_gid_attr *attr)
{
	struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
	struct ib_gid_table *table;
	int ix;
	int ret = 0;
	struct net_device *idev;
	int empty;
	table = ports_table[port - rdma_start_port(ib_dev)];
	if (!memcmp(gid, &zgid, sizeof(*gid)))
		return -EINVAL;
	if (ib_dev->get_netdev) {
		idev = ib_dev->get_netdev(ib_dev, port);
		if (idev && attr->ndev != idev) {
			union ib_gid default_gid;
			/* Adding default GIDs in not permitted */
			make_default_gid(idev, &default_gid);
			if (!memcmp(gid, &default_gid, sizeof(*gid))) {
				dev_put(idev);
				return -EPERM;
			}
		}
		if (idev)
			dev_put(idev);
	}
	mutex_lock(&table->lock);
	write_lock_irq(&table->rwlock);
	ix = find_gid(table, gid, attr, false, GID_ATTR_FIND_MASK_GID |
		      GID_ATTR_FIND_MASK_GID_TYPE |
		      GID_ATTR_FIND_MASK_NETDEV, &empty);
	if (ix >= 0)
		goto out_unlock;
	if (empty < 0) {
		ret = -ENOSPC;
		goto out_unlock;
	}
	ret = add_gid(ib_dev, port, table, empty, gid, attr, false);
	if (!ret)
		dispatch_gid_change_event(ib_dev, port);
out_unlock:
	write_unlock_irq(&table->rwlock);
	mutex_unlock(&table->lock);
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 285 | 100.00% | 4 | 100.00% | 
 | Total | 285 | 100.00% | 4 | 100.00% | 
int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
		     union ib_gid *gid, struct ib_gid_attr *attr)
{
	struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
	struct ib_gid_table *table;
	int ix;
	table = ports_table[port - rdma_start_port(ib_dev)];
	mutex_lock(&table->lock);
	write_lock_irq(&table->rwlock);
	ix = find_gid(table, gid, attr, false,
		      GID_ATTR_FIND_MASK_GID	  |
		      GID_ATTR_FIND_MASK_GID_TYPE |
		      GID_ATTR_FIND_MASK_NETDEV	  |
		      GID_ATTR_FIND_MASK_DEFAULT,
		      NULL);
	if (ix < 0)
		goto out_unlock;
	if (!del_gid(ib_dev, port, table, ix, false))
		dispatch_gid_change_event(ib_dev, port);
out_unlock:
	write_unlock_irq(&table->rwlock);
	mutex_unlock(&table->lock);
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 147 | 100.00% | 4 | 100.00% | 
 | Total | 147 | 100.00% | 4 | 100.00% | 
int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
				     struct net_device *ndev)
{
	struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
	struct ib_gid_table *table;
	int ix;
	bool deleted = false;
	table  = ports_table[port - rdma_start_port(ib_dev)];
	mutex_lock(&table->lock);
	write_lock_irq(&table->rwlock);
	for (ix = 0; ix < table->sz; ix++)
		if (table->data_vec[ix].attr.ndev == ndev)
			if (!del_gid(ib_dev, port, table, ix,
				     !!(table->data_vec[ix].props &
					GID_TABLE_ENTRY_DEFAULT)))
				deleted = true;
	write_unlock_irq(&table->rwlock);
	mutex_unlock(&table->lock);
	if (deleted)
		dispatch_gid_change_event(ib_dev, port);
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 150 | 91.46% | 2 | 66.67% | 
| talat batheesh | talat batheesh | 14 | 8.54% | 1 | 33.33% | 
 | Total | 164 | 100.00% | 3 | 100.00% | 
static int __ib_cache_gid_get(struct ib_device *ib_dev, u8 port, int index,
			      union ib_gid *gid, struct ib_gid_attr *attr)
{
	struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
	struct ib_gid_table *table;
	table = ports_table[port - rdma_start_port(ib_dev)];
	if (index < 0 || index >= table->sz)
		return -EINVAL;
	if (table->data_vec[index].props & GID_TABLE_ENTRY_INVALID)
		return -EAGAIN;
	memcpy(gid, &table->data_vec[index].gid, sizeof(*gid));
	if (attr) {
		memcpy(attr, &table->data_vec[index].attr, sizeof(*attr));
		if (attr->ndev)
			dev_hold(attr->ndev);
	}
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 153 | 100.00% | 1 | 100.00% | 
 | Total | 153 | 100.00% | 1 | 100.00% | 
static int _ib_cache_gid_table_find(struct ib_device *ib_dev,
				    const union ib_gid *gid,
				    const struct ib_gid_attr *val,
				    unsigned long mask,
				    u8 *port, u16 *index)
{
	struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
	struct ib_gid_table *table;
	u8 p;
	int local_index;
	unsigned long flags;
	for (p = 0; p < ib_dev->phys_port_cnt; p++) {
		table = ports_table[p];
		read_lock_irqsave(&table->rwlock, flags);
		local_index = find_gid(table, gid, val, false, mask, NULL);
		if (local_index >= 0) {
			if (index)
				*index = local_index;
			if (port)
				*port = p + rdma_start_port(ib_dev);
			read_unlock_irqrestore(&table->rwlock, flags);
			return 0;
		}
		read_unlock_irqrestore(&table->rwlock, flags);
	}
	return -ENOENT;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 171 | 100.00% | 3 | 100.00% | 
 | Total | 171 | 100.00% | 3 | 100.00% | 
static int ib_cache_gid_find(struct ib_device *ib_dev,
			     const union ib_gid *gid,
			     enum ib_gid_type gid_type,
			     struct net_device *ndev, u8 *port,
			     u16 *index)
{
	unsigned long 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};
	if (ndev)
		mask |= GID_ATTR_FIND_MASK_NETDEV;
	return _ib_cache_gid_table_find(ib_dev, gid, &gid_attr_val,
					mask, port, index);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 83 | 100.00% | 2 | 100.00% | 
 | Total | 83 | 100.00% | 2 | 100.00% | 
int ib_find_cached_gid_by_port(struct ib_device *ib_dev,
			       const union ib_gid *gid,
			       enum ib_gid_type gid_type,
			       u8 port, struct net_device *ndev,
			       u16 *index)
{
	int local_index;
	struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
	struct ib_gid_table *table;
	unsigned long mask = GID_ATTR_FIND_MASK_GID |
			     GID_ATTR_FIND_MASK_GID_TYPE;
	struct ib_gid_attr val = {.ndev = ndev, .gid_type = gid_type};
	unsigned long flags;
	if (port < rdma_start_port(ib_dev) ||
	    port > rdma_end_port(ib_dev))
		return -ENOENT;
	table = ports_table[port - rdma_start_port(ib_dev)];
	if (ndev)
		mask |= GID_ATTR_FIND_MASK_NETDEV;
	read_lock_irqsave(&table->rwlock, flags);
	local_index = find_gid(table, gid, &val, false, mask, NULL);
	if (local_index >= 0) {
		if (index)
			*index = local_index;
		read_unlock_irqrestore(&table->rwlock, flags);
		return 0;
	}
	read_unlock_irqrestore(&table->rwlock, flags);
	return -ENOENT;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 192 | 100.00% | 5 | 100.00% | 
 | Total | 192 | 100.00% | 5 | 100.00% | 
EXPORT_SYMBOL(ib_find_cached_gid_by_port);
/**
 * ib_find_gid_by_filter - Returns the GID table index where a specified
 * GID value occurs
 * @device: The device to query.
 * @gid: The GID value to search for.
 * @port_num: 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.
 * @index: The index into the cached GID table where the GID was found.  This
 *   parameter may be NULL.
 *
 * ib_cache_gid_find_by_filter() searches for the specified GID value
 * of which the filter function returns true in the port's GID table.
 * This function is only supported on RoCE ports.
 *
 */
static int ib_cache_gid_find_by_filter(struct ib_device *ib_dev,
				       const union ib_gid *gid,
				       u8 port,
				       bool (*filter)(const union ib_gid *,
						      const struct ib_gid_attr *,
						      void *),
				       void *context,
				       u16 *index)
{
	struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
	struct ib_gid_table *table;
	unsigned int i;
	unsigned long flags;
	bool found = false;
	if (!ports_table)
		return -EOPNOTSUPP;
	if (port < rdma_start_port(ib_dev) ||
	    port > rdma_end_port(ib_dev) ||
	    !rdma_protocol_roce(ib_dev, port))
		return -EPROTONOSUPPORT;
	table = ports_table[port - rdma_start_port(ib_dev)];
	read_lock_irqsave(&table->rwlock, flags);
	for (i = 0; i < table->sz; i++) {
		struct ib_gid_attr attr;
		if (table->data_vec[i].props & GID_TABLE_ENTRY_INVALID)
			goto next;
		if (memcmp(gid, &table->data_vec[i].gid, sizeof(*gid)))
			goto next;
		memcpy(&attr, &table->data_vec[i].attr, sizeof(attr));
		if (filter(gid, &attr, context))
			found = true;
next:
		if (found)
			break;
	}
	read_unlock_irqrestore(&table->rwlock, flags);
	if (!found)
		return -ENOENT;
	if (index)
		*index = i;
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 275 | 100.00% | 2 | 100.00% | 
 | Total | 275 | 100.00% | 2 | 100.00% | 
static struct ib_gid_table *alloc_gid_table(int sz)
{
	struct ib_gid_table *table =
		kzalloc(sizeof(struct ib_gid_table), GFP_KERNEL);
	if (!table)
		return NULL;
	table->data_vec = kcalloc(sz, sizeof(*table->data_vec), GFP_KERNEL);
	if (!table->data_vec)
		goto err_free_table;
	mutex_init(&table->lock);
	table->sz = sz;
	rwlock_init(&table->rwlock);
	return table;
err_free_table:
	kfree(table);
	return NULL;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 99 | 100.00% | 2 | 100.00% | 
 | Total | 99 | 100.00% | 2 | 100.00% | 
static void release_gid_table(struct ib_gid_table *table)
{
	if (table) {
		kfree(table->data_vec);
		kfree(table);
	}
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 29 | 100.00% | 1 | 100.00% | 
 | Total | 29 | 100.00% | 1 | 100.00% | 
static void cleanup_gid_table_port(struct ib_device *ib_dev, u8 port,
				   struct ib_gid_table *table)
{
	int i;
	bool deleted = false;
	if (!table)
		return;
	write_lock_irq(&table->rwlock);
	for (i = 0; i < table->sz; ++i) {
		if (memcmp(&table->data_vec[i].gid, &zgid,
			   sizeof(table->data_vec[i].gid)))
			if (!del_gid(ib_dev, port, table, i,
				     table->data_vec[i].props &
				     GID_ATTR_FIND_MASK_DEFAULT))
				deleted = true;
	}
	write_unlock_irq(&table->rwlock);
	if (deleted)
		dispatch_gid_change_event(ib_dev, port);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 136 | 100.00% | 2 | 100.00% | 
 | Total | 136 | 100.00% | 2 | 100.00% | 
void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
				  struct net_device *ndev,
				  unsigned long gid_type_mask,
				  enum ib_cache_gid_default_mode mode)
{
	struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
	union ib_gid gid;
	struct ib_gid_attr gid_attr;
	struct ib_gid_attr zattr_type = zattr;
	struct ib_gid_table *table;
	unsigned int gid_type;
	table  = ports_table[port - rdma_start_port(ib_dev)];
	make_default_gid(ndev, &gid);
	memset(&gid_attr, 0, sizeof(gid_attr));
	gid_attr.ndev = ndev;
	for (gid_type = 0; gid_type < IB_GID_TYPE_SIZE; ++gid_type) {
		int ix;
		union ib_gid current_gid;
		struct ib_gid_attr current_gid_attr = {};
		if (1UL << gid_type & ~gid_type_mask)
			continue;
		gid_attr.gid_type = gid_type;
		mutex_lock(&table->lock);
		write_lock_irq(&table->rwlock);
		ix = find_gid(table, NULL, &gid_attr, true,
			      GID_ATTR_FIND_MASK_GID_TYPE |
			      GID_ATTR_FIND_MASK_DEFAULT,
			      NULL);
		/* Coudn't find default GID location */
		if (WARN_ON(ix < 0))
			goto release;
		zattr_type.gid_type = gid_type;
		if (!__ib_cache_gid_get(ib_dev, port, ix,
					¤t_gid, ¤t_gid_attr) &&
		    mode == IB_CACHE_GID_DEFAULT_MODE_SET &&
		    !memcmp(&gid, ¤t_gid, sizeof(gid)) &&
		    !memcmp(&gid_attr, ¤t_gid_attr, sizeof(gid_attr)))
			goto release;
		if (memcmp(¤t_gid, &zgid, sizeof(current_gid)) ||
		    memcmp(¤t_gid_attr, &zattr_type,
			   sizeof(current_gid_attr))) {
			if (del_gid(ib_dev, port, table, ix, true)) {
				pr_warn("ib_cache_gid: can't delete index %d for default gid %pI6\n",
					ix, gid.raw);
				goto release;
			} else {
				dispatch_gid_change_event(ib_dev, port);
			}
		}
		if (mode == IB_CACHE_GID_DEFAULT_MODE_SET) {
			if (add_gid(ib_dev, port, table, ix, &gid, &gid_attr, true))
				pr_warn("ib_cache_gid: unable to add default gid %pI6\n",
					gid.raw);
			else
				dispatch_gid_change_event(ib_dev, port);
		}
release:
		if (current_gid_attr.ndev)
			dev_put(current_gid_attr.ndev);
		write_unlock_irq(&table->rwlock);
		mutex_unlock(&table->lock);
	}
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 390 | 96.53% | 4 | 66.67% | 
| doron tsur | doron tsur | 8 | 1.98% | 1 | 16.67% | 
| doug ledford | doug ledford | 6 | 1.49% | 1 | 16.67% | 
 | Total | 404 | 100.00% | 6 | 100.00% | 
static int gid_table_reserve_default(struct ib_device *ib_dev, u8 port,
				     struct ib_gid_table *table)
{
	unsigned int i;
	unsigned long roce_gid_type_mask;
	unsigned int num_default_gids;
	unsigned int current_gid = 0;
	roce_gid_type_mask = roce_gid_type_mask_support(ib_dev, port);
	num_default_gids = hweight_long(roce_gid_type_mask);
	for (i = 0; i < num_default_gids && i < table->sz; i++) {
		struct ib_gid_table_entry *entry =
			&table->data_vec[i];
		entry->props |= GID_TABLE_ENTRY_DEFAULT;
		current_gid = find_next_bit(&roce_gid_type_mask,
					    BITS_PER_LONG,
					    current_gid);
		entry->attr.gid_type = current_gid++;
	}
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 115 | 98.29% | 2 | 66.67% | 
| roland dreier | roland dreier | 2 | 1.71% | 1 | 33.33% | 
 | Total | 117 | 100.00% | 3 | 100.00% | 
static int _gid_table_setup_one(struct ib_device *ib_dev)
{
	u8 port;
	struct ib_gid_table **table;
	int err = 0;
	table = kcalloc(ib_dev->phys_port_cnt, sizeof(*table), GFP_KERNEL);
	if (!table) {
		pr_warn("failed to allocate ib gid cache for %s\n",
			ib_dev->name);
		return -ENOMEM;
	}
	for (port = 0; port < ib_dev->phys_port_cnt; port++) {
		u8 rdma_port = port + rdma_start_port(ib_dev);
		table[port] =
			alloc_gid_table(
				ib_dev->port_immutable[rdma_port].gid_tbl_len);
		if (!table[port]) {
			err = -ENOMEM;
			goto rollback_table_setup;
		}
		err = gid_table_reserve_default(ib_dev,
						port + rdma_start_port(ib_dev),
						table[port]);
		if (err)
			goto rollback_table_setup;
	}
	ib_dev->cache.gid_cache = table;
	return 0;
rollback_table_setup:
	for (port = 0; port < ib_dev->phys_port_cnt; port++) {
		cleanup_gid_table_port(ib_dev, port + rdma_start_port(ib_dev),
				       table[port]);
		release_gid_table(table[port]);
	}
	kfree(table);
	return err;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 193 | 90.61% | 1 | 33.33% | 
| roland dreier | roland dreier | 19 | 8.92% | 1 | 33.33% | 
| ira weiny | ira weiny | 1 | 0.47% | 1 | 33.33% | 
 | Total | 213 | 100.00% | 3 | 100.00% | 
static void gid_table_release_one(struct ib_device *ib_dev)
{
	struct ib_gid_table **table = ib_dev->cache.gid_cache;
	u8 port;
	if (!table)
		return;
	for (port = 0; port < ib_dev->phys_port_cnt; port++)
		release_gid_table(table[port]);
	kfree(table);
	ib_dev->cache.gid_cache = NULL;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 63 | 92.65% | 1 | 50.00% | 
| roland dreier | roland dreier | 5 | 7.35% | 1 | 50.00% | 
 | Total | 68 | 100.00% | 2 | 100.00% | 
static void gid_table_cleanup_one(struct ib_device *ib_dev)
{
	struct ib_gid_table **table = ib_dev->cache.gid_cache;
	u8 port;
	if (!table)
		return;
	for (port = 0; port < ib_dev->phys_port_cnt; port++)
		cleanup_gid_table_port(ib_dev, port + rdma_start_port(ib_dev),
				       table[port]);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 50 | 78.12% | 1 | 50.00% | 
| roland dreier | roland dreier | 14 | 21.88% | 1 | 50.00% | 
 | Total | 64 | 100.00% | 2 | 100.00% | 
static int gid_table_setup_one(struct ib_device *ib_dev)
{
	int err;
	err = _gid_table_setup_one(ib_dev);
	if (err)
		return err;
	err = roce_rescan_device(ib_dev);
	if (err) {
		gid_table_cleanup_one(ib_dev);
		gid_table_release_one(ib_dev);
	}
	return err;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 54 | 100.00% | 1 | 100.00% | 
 | Total | 54 | 100.00% | 1 | 100.00% | 
int ib_get_cached_gid(struct ib_device *device,
		      u8                port_num,
		      int               index,
		      union ib_gid     *gid,
		      struct ib_gid_attr *gid_attr)
{
	int res;
	unsigned long flags;
	struct ib_gid_table **ports_table = device->cache.gid_cache;
	struct ib_gid_table *table = ports_table[port_num - rdma_start_port(device)];
	if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device))
		return -EINVAL;
	read_lock_irqsave(&table->rwlock, flags);
	res = __ib_cache_gid_get(device, port_num, index, gid, gid_attr);
	read_unlock_irqrestore(&table->rwlock, flags);
	return res;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 105 | 88.98% | 3 | 60.00% | 
| roland dreier | roland dreier | 10 | 8.47% | 1 | 20.00% | 
| sean hefty | sean hefty | 3 | 2.54% | 1 | 20.00% | 
 | Total | 118 | 100.00% | 5 | 100.00% | 
EXPORT_SYMBOL(ib_get_cached_gid);
int ib_find_cached_gid(struct ib_device *device,
		       const union ib_gid *gid,
		       enum ib_gid_type gid_type,
		       struct net_device *ndev,
		       u8               *port_num,
		       u16              *index)
{
	return ib_cache_gid_find(device, gid, gid_type, ndev, port_num, index);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 46 | 93.88% | 3 | 75.00% | 
| roland dreier | roland dreier | 3 | 6.12% | 1 | 25.00% | 
 | Total | 49 | 100.00% | 4 | 100.00% | 
EXPORT_SYMBOL(ib_find_cached_gid);
int ib_find_gid_by_filter(struct ib_device *device,
			  const union ib_gid *gid,
			  u8 port_num,
			  bool (*filter)(const union ib_gid *gid,
					 const struct ib_gid_attr *,
					 void *),
			  void *context, u16 *index)
{
	/* Only RoCE GID table supports filter function */
	if (!rdma_cap_roce_gid_table(device, port_num) && filter)
		return -EPROTONOSUPPORT;
	return ib_cache_gid_find_by_filter(device, gid,
					   port_num, filter,
					   context, index);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 81 | 100.00% | 1 | 100.00% | 
 | Total | 81 | 100.00% | 1 | 100.00% | 
EXPORT_SYMBOL(ib_find_gid_by_filter);
int ib_get_cached_pkey(struct ib_device *device,
		       u8                port_num,
		       int               index,
		       u16              *pkey)
{
	struct ib_pkey_cache *cache;
	unsigned long flags;
	int ret = 0;
	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 - rdma_start_port(device)];
	if (index < 0 || index >= cache->table_len)
		ret = -EINVAL;
	else
		*pkey = cache->table[index];
	read_unlock_irqrestore(&device->cache.lock, flags);
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 122 | 97.60% | 2 | 66.67% | 
| ira weiny | ira weiny | 3 | 2.40% | 1 | 33.33% | 
 | Total | 125 | 100.00% | 3 | 100.00% | 
EXPORT_SYMBOL(ib_get_cached_pkey);
int ib_find_cached_pkey(struct ib_device *device,
			u8                port_num,
			u16               pkey,
			u16              *index)
{
	struct ib_pkey_cache *cache;
	unsigned long flags;
	int i;
	int ret = -ENOENT;
	int partial_ix = -1;
	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 - rdma_start_port(device)];
	*index = -1;
	for (i = 0; i < cache->table_len; ++i)
		if ((cache->table[i] & 0x7fff) == (pkey & 0x7fff)) {
			if (cache->table[i] & 0x8000) {
				*index = i;
				ret = 0;
				break;
			} else
				partial_ix = i;
		}
	if (ret && partial_ix >= 0) {
		*index = partial_ix;
		ret = 0;
	}
	read_unlock_irqrestore(&device->cache.lock, flags);
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 150 | 76.53% | 2 | 50.00% | 
| jack morgenstein | jack morgenstein | 43 | 21.94% | 1 | 25.00% | 
| ira weiny | ira weiny | 3 | 1.53% | 1 | 25.00% | 
 | Total | 196 | 100.00% | 4 | 100.00% | 
EXPORT_SYMBOL(ib_find_cached_pkey);
int ib_find_exact_cached_pkey(struct ib_device *device,
			      u8                port_num,
			      u16               pkey,
			      u16              *index)
{
	struct ib_pkey_cache *cache;
	unsigned long flags;
	int i;
	int ret = -ENOENT;
	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 - rdma_start_port(device)];
	*index = -1;
	for (i = 0; i < cache->table_len; ++i)
		if (cache->table[i] == pkey) {
			*index = i;
			ret = 0;
			break;
		}
	read_unlock_irqrestore(&device->cache.lock, flags);
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| jack morgenstein | jack morgenstein | 142 | 97.93% | 1 | 50.00% | 
| ira weiny | ira weiny | 3 | 2.07% | 1 | 50.00% | 
 | Total | 145 | 100.00% | 2 | 100.00% | 
EXPORT_SYMBOL(ib_find_exact_cached_pkey);
int ib_get_cached_lmc(struct ib_device *device,
		      u8                port_num,
		      u8                *lmc)
{
	unsigned long flags;
	int ret = 0;
	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 - rdma_start_port(device)];
	read_unlock_irqrestore(&device->cache.lock, flags);
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| jack morgenstein | jack morgenstein | 87 | 96.67% | 1 | 50.00% | 
| ira weiny | ira weiny | 3 | 3.33% | 1 | 50.00% | 
 | Total | 90 | 100.00% | 2 | 100.00% | 
EXPORT_SYMBOL(ib_get_cached_lmc);
static void ib_cache_update(struct ib_device *device,
			    u8                port)
{
	struct ib_port_attr       *tprops = NULL;
	struct ib_pkey_cache      *pkey_cache = NULL, *old_pkey_cache;
	struct ib_gid_cache {
		int             table_len;
		union ib_gid    table[0];
	}			  *gid_cache = NULL;
	int                        i;
	int                        ret;
	struct ib_gid_table	  *table;
	struct ib_gid_table	 **ports_table = device->cache.gid_cache;
	bool			   use_roce_gid_table =
					rdma_cap_roce_gid_table(device, port);
	if (port < rdma_start_port(device) || port > rdma_end_port(device))
		return;
	table = ports_table[port - rdma_start_port(device)];
	tprops = kmalloc(sizeof *tprops, GFP_KERNEL);
	if (!tprops)
		return;
	ret = ib_query_port(device, port, tprops);
	if (ret) {
		pr_warn("ib_query_port failed (%d) for %s\n",
			ret, device->name);
		goto err;
	}
	pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len *
			     sizeof *pkey_cache->table, GFP_KERNEL);
	if (!pkey_cache)
		goto err;
	pkey_cache->table_len = tprops->pkey_tbl_len;
	if (!use_roce_gid_table) {
		gid_cache = kmalloc(sizeof(*gid_cache) + tprops->gid_tbl_len *
			    sizeof(*gid_cache->table), GFP_KERNEL);
		if (!gid_cache)
			goto err;
		gid_cache->table_len = tprops->gid_tbl_len;
	}
	for (i = 0; i < pkey_cache->table_len; ++i) {
		ret = ib_query_pkey(device, port, i, pkey_cache->table + i);
		if (ret) {
			pr_warn("ib_query_pkey failed (%d) for %s (index %d)\n",
				ret, device->name, i);
			goto err;
		}
	}
	if (!use_roce_gid_table) {
		for (i = 0;  i < gid_cache->table_len; ++i) {
			ret = ib_query_gid(device, port, i,
					   gid_cache->table + i, NULL);
			if (ret) {
				pr_warn("ib_query_gid failed (%d) for %s (index %d)\n",
					ret, device->name, i);
				goto err;
			}
		}
	}
	write_lock_irq(&device->cache.lock);
	old_pkey_cache = device->cache.pkey_cache[port - rdma_start_port(device)];
	device->cache.pkey_cache[port - rdma_start_port(device)] = pkey_cache;
	if (!use_roce_gid_table) {
		write_lock(&table->rwlock);
		for (i = 0; i < gid_cache->table_len; i++) {
			modify_gid(device, port, table, i, gid_cache->table + i,
				   &zattr, false);
		}
		write_unlock(&table->rwlock);
	}
	device->cache.lmc_cache[port - rdma_start_port(device)] = tprops->lmc;
	write_unlock_irq(&device->cache.lock);
	kfree(gid_cache);
	kfree(old_pkey_cache);
	kfree(tprops);
	return;
err:
	kfree(pkey_cache);
	kfree(gid_cache);
	kfree(tprops);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 357 | 67.23% | 1 | 14.29% | 
| matan barak | matan barak | 151 | 28.44% | 3 | 42.86% | 
| jack morgenstein | jack morgenstein | 17 | 3.20% | 1 | 14.29% | 
| parav pandit | parav pandit | 3 | 0.56% | 1 | 14.29% | 
| ira weiny | ira weiny | 3 | 0.56% | 1 | 14.29% | 
 | Total | 531 | 100.00% | 7 | 100.00% | 
static void ib_cache_task(struct work_struct *_work)
{
	struct ib_update_work *work =
		container_of(_work, struct ib_update_work, work);
	ib_cache_update(work->device, work->port_num);
	kfree(work);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 30 | 71.43% | 1 | 50.00% | 
| david howells | david howells | 12 | 28.57% | 1 | 50.00% | 
 | Total | 42 | 100.00% | 2 | 100.00% | 
static void ib_cache_event(struct ib_event_handler *handler,
			   struct ib_event *event)
{
	struct ib_update_work *work;
	if (event->event == IB_EVENT_PORT_ERR    ||
	    event->event == IB_EVENT_PORT_ACTIVE ||
	    event->event == IB_EVENT_LID_CHANGE  ||
	    event->event == IB_EVENT_PKEY_CHANGE ||
	    event->event == IB_EVENT_SM_CHANGE   ||
	    event->event == IB_EVENT_CLIENT_REREGISTER ||
	    event->event == IB_EVENT_GID_CHANGE) {
		work = kmalloc(sizeof *work, GFP_ATOMIC);
		if (work) {
			INIT_WORK(&work->work, ib_cache_task);
			work->device   = event->device;
			work->port_num = event->element.port_num;
			queue_work(ib_wq, &work->work);
		}
	}
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 107 | 87.70% | 1 | 25.00% | 
| jack morgenstein | jack morgenstein | 6 | 4.92% | 1 | 25.00% | 
| or gerlitz | or gerlitz | 6 | 4.92% | 1 | 25.00% | 
| tejun heo | tejun heo | 3 | 2.46% | 1 | 25.00% | 
 | Total | 122 | 100.00% | 4 | 100.00% | 
int ib_cache_setup_one(struct ib_device *device)
{
	int p;
	int err;
	rwlock_init(&device->cache.lock);
	device->cache.pkey_cache =
		kzalloc(sizeof *device->cache.pkey_cache *
			(rdma_end_port(device) - rdma_start_port(device) + 1), GFP_KERNEL);
	device->cache.lmc_cache = kmalloc(sizeof *device->cache.lmc_cache *
					  (rdma_end_port(device) -
					   rdma_start_port(device) + 1),
					  GFP_KERNEL);
	if (!device->cache.pkey_cache ||
	    !device->cache.lmc_cache) {
		pr_warn("Couldn't allocate cache for %s\n", device->name);
		return -ENOMEM;
	}
	err = gid_table_setup_one(device);
	if (err)
		/* Allocated memory will be cleaned in the release function */
		return err;
	for (p = 0; p <= rdma_end_port(device) - rdma_start_port(device); ++p)
		ib_cache_update(device, p + rdma_start_port(device));
	INIT_IB_EVENT_HANDLER(&device->cache.event_handler,
			      device, ib_cache_event);
	err = ib_register_event_handler(&device->cache.event_handler);
	if (err)
		goto err;
	return 0;
err:
	gid_table_cleanup_one(device);
	return err;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 136 | 62.67% | 1 | 16.67% | 
| matan barak | matan barak | 43 | 19.82% | 1 | 16.67% | 
| jack morgenstein | jack morgenstein | 28 | 12.90% | 1 | 16.67% | 
| ira weiny | ira weiny | 7 | 3.23% | 1 | 16.67% | 
| parav pandit | parav pandit | 2 | 0.92% | 1 | 16.67% | 
| jason gunthorpe | jason gunthorpe | 1 | 0.46% | 1 | 16.67% | 
 | Total | 217 | 100.00% | 6 | 100.00% | 
void ib_cache_release_one(struct ib_device *device)
{
	int p;
	/*
         * 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.
         */
	if (device->cache.pkey_cache)
		for (p = 0;
		     p <= rdma_end_port(device) - rdma_start_port(device); ++p)
			kfree(device->cache.pkey_cache[p]);
	gid_table_release_one(device);
	kfree(device->cache.pkey_cache);
	kfree(device->cache.lmc_cache);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 51 | 65.38% | 1 | 25.00% | 
| matan barak | matan barak | 22 | 28.21% | 1 | 25.00% | 
| jack morgenstein | jack morgenstein | 3 | 3.85% | 1 | 25.00% | 
| ira weiny | ira weiny | 2 | 2.56% | 1 | 25.00% | 
 | Total | 78 | 100.00% | 4 | 100.00% | 
void ib_cache_cleanup_one(struct ib_device *device)
{
	/* The cleanup function unregisters the event handler,
         * 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.
         */
	ib_unregister_event_handler(&device->cache.event_handler);
	flush_workqueue(ib_wq);
	gid_table_cleanup_one(device);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 21 | 67.74% | 1 | 25.00% | 
| jack morgenstein | jack morgenstein | 4 | 12.90% | 1 | 25.00% | 
| tejun heo | tejun heo | 4 | 12.90% | 1 | 25.00% | 
| matan barak | matan barak | 2 | 6.45% | 1 | 25.00% | 
 | Total | 31 | 100.00% | 4 | 100.00% | 
void __init ib_cache_setup(void)
{
	roce_gid_mgmt_init();
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 7 | 63.64% | 1 | 50.00% | 
| matan barak | matan barak | 4 | 36.36% | 1 | 50.00% | 
 | Total | 11 | 100.00% | 2 | 100.00% | 
void __exit ib_cache_cleanup(void)
{
	roce_gid_mgmt_cleanup();
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| roland dreier | roland dreier | 9 | 81.82% | 1 | 50.00% | 
| matan barak | matan barak | 2 | 18.18% | 1 | 50.00% | 
 | Total | 11 | 100.00% | 2 | 100.00% | 
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| matan barak | matan barak | 4115 | 71.23% | 11 | 32.35% | 
| roland dreier | roland dreier | 1171 | 20.27% | 4 | 11.76% | 
| jack morgenstein | jack morgenstein | 340 | 5.89% | 4 | 11.76% | 
| aviv heller | aviv heller | 53 | 0.92% | 1 | 2.94% | 
| ira weiny | ira weiny | 26 | 0.45% | 2 | 5.88% | 
| talat batheesh | talat batheesh | 14 | 0.24% | 1 | 2.94% | 
| david howells | david howells | 12 | 0.21% | 1 | 2.94% | 
| doron tsur | doron tsur | 8 | 0.14% | 1 | 2.94% | 
| tejun heo | tejun heo | 7 | 0.12% | 1 | 2.94% | 
| or gerlitz | or gerlitz | 6 | 0.10% | 1 | 2.94% | 
| doug ledford | doug ledford | 6 | 0.10% | 1 | 2.94% | 
| moni shoua | moni shoua | 5 | 0.09% | 1 | 2.94% | 
| parav pandit | parav pandit | 5 | 0.09% | 1 | 2.94% | 
| alexey dobriyan | alexey dobriyan | 3 | 0.05% | 1 | 2.94% | 
| sean hefty | sean hefty | 3 | 0.05% | 1 | 2.94% | 
| tom duffy | tom duffy | 2 | 0.03% | 1 | 2.94% | 
| jason gunthorpe | jason gunthorpe | 1 | 0.02% | 1 | 2.94% | 
 | Total | 5777 | 100.00% | 34 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.