Re: [PATCH 08/30] IB/core: Support find sgid index using a filter function

Haggai Eran
2015-02-19T12:41:49Z

On 20/02/2015 00:02, Somnath Kotur wrote:
> @@ -111,6 +111,33 @@ int ib_find_cached_gid_by_port(struct ib_device *device,
> struct net *net,
> int if_index,
> u16 *index);
> +
> +/**
> + * ib_find_cached_gid_by_port - Returns the GID table index where a specified
You probably meant ib_find_gid_by_filter.

> + * 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 be NULL
> + * when RoCE GID cache isn't supported on the respective device's port.
> + * @index: The index into the cached GID table where the GID was found. This
> + * parameter may be NULL.
> + *
> + * ib_find_cached_gid_by_port() searches for the specified GID value in
Here too.

> + * the local software cache.
> + */
> +int ib_find_gid_by_filter(struct ib_device *device,
> + union ib_gid *gid,
> + u8 port_num,
> + bool (*filter)(const union ib_gid *gid,
> + const struct ib_gid_attr *,
> + void *),
> + void *context, u16 *index);
> /**
> * ib_get_cached_pkey - Returns a cached PKey table entry
> * @device: The device to query.