cregit-Linux how code gets into the kernel

Release 4.11 drivers/net/ethernet/mellanox/mlx5/core/mr.c

/*
 * Copyright (c) 2013-2015, Mellanox Technologies. 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/kernel.h>
#include <linux/module.h>
#include <linux/mlx5/driver.h>
#include <linux/mlx5/cmd.h>
#include "mlx5_core.h"


void mlx5_init_mkey_table(struct mlx5_core_dev *dev) { struct mlx5_mkey_table *table = &dev->priv.mkey_table; memset(table, 0, sizeof(*table)); rwlock_init(&table->lock); INIT_RADIX_TREE(&table->tree, GFP_ATOMIC); }

Contributors

PersonTokensPropCommitsCommitProp
Sagi Grimberg3769.81%133.33%
Majd Dibbiny1324.53%133.33%
Matan Barak35.66%133.33%
Total53100.00%3100.00%


void mlx5_cleanup_mkey_table(struct mlx5_core_dev *dev) { }

Contributors

PersonTokensPropCommitsCommitProp
Sagi Grimberg888.89%150.00%
Matan Barak111.11%150.00%
Total9100.00%2100.00%


int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey, u32 *in, int inlen, u32 *out, int outlen, mlx5_cmd_cbk_t callback, void *context) { struct mlx5_mkey_table *table = &dev->priv.mkey_table; u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {0}; u32 mkey_index; void *mkc; int err; u8 key; spin_lock_irq(&dev->priv.mkey_lock); key = dev->priv.mkey_key++; spin_unlock_irq(&dev->priv.mkey_lock); mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry); MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY); MLX5_SET(mkc, mkc, mkey_7_0, key); if (callback) return mlx5_cmd_exec_cb(dev, in, inlen, out, outlen, callback, context); err = mlx5_cmd_exec(dev, in, inlen, lout, sizeof(lout)); if (err) return err; mkey_index = MLX5_GET(create_mkey_out, lout, mkey_index); mkey->iova = MLX5_GET64(mkc, mkc, start_addr); mkey->size = MLX5_GET64(mkc, mkc, len); mkey->key = mlx5_idx_to_mkey(mkey_index) | key; mkey->pd = MLX5_GET(mkc, mkc, pd); mlx5_core_dbg(dev, "out 0x%x, key 0x%x, mkey 0x%x\n", mkey_index, key, mkey->key); /* connect to mkey tree */ write_lock_irq(&table->lock); err = radix_tree_insert(&table->tree, mlx5_base_mkey(mkey->key), mkey); write_unlock_irq(&table->lock); if (err) { mlx5_core_warn(dev, "failed radix tree insert of mkey 0x%x, %d\n", mlx5_base_mkey(mkey->key), err); mlx5_core_destroy_mkey(dev, mkey); } return err; }

Contributors

PersonTokensPropCommitsCommitProp
Eli Cohen14243.43%228.57%
Saeed Mahameed8225.08%114.29%
Sagi Grimberg6820.80%228.57%
Haggai Eran206.12%114.29%
Matan Barak154.59%114.29%
Total327100.00%7100.00%

EXPORT_SYMBOL(mlx5_core_create_mkey_cb);
int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey, u32 *in, int inlen) { return mlx5_core_create_mkey_cb(dev, mkey, in, inlen, NULL, 0, NULL, NULL); }

Contributors

PersonTokensPropCommitsCommitProp
Saeed Mahameed42100.00%1100.00%
Total42100.00%1100.00%

EXPORT_SYMBOL(mlx5_core_create_mkey);
int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey) { struct mlx5_mkey_table *table = &dev->priv.mkey_table; u32 out[MLX5_ST_SZ_DW(destroy_mkey_out)] = {0}; u32 in[MLX5_ST_SZ_DW(destroy_mkey_in)] = {0}; struct mlx5_core_mkey *deleted_mkey; unsigned long flags; write_lock_irqsave(&table->lock, flags); deleted_mkey = radix_tree_delete(&table->tree, mlx5_base_mkey(mkey->key)); write_unlock_irqrestore(&table->lock, flags); if (!deleted_mkey) { mlx5_core_warn(dev, "failed radix tree delete of mkey 0x%x\n", mlx5_base_mkey(mkey->key)); return -ENOENT; } MLX5_SET(destroy_mkey_in, in, opcode, MLX5_CMD_OP_DESTROY_MKEY); MLX5_SET(destroy_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey->key)); return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); }

Contributors

PersonTokensPropCommitsCommitProp
Sagi Grimberg7342.69%233.33%
Eli Cohen4828.07%116.67%
Saeed Mahameed3822.22%233.33%
Matan Barak127.02%116.67%
Total171100.00%6100.00%

EXPORT_SYMBOL(mlx5_core_destroy_mkey);
int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey, u32 *out, int outlen) { u32 in[MLX5_ST_SZ_DW(query_mkey_in)] = {0}; memset(out, 0, outlen); MLX5_SET(query_mkey_in, in, opcode, MLX5_CMD_OP_QUERY_MKEY); MLX5_SET(query_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey->key)); return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); }

Contributors

PersonTokensPropCommitsCommitProp
Eli Cohen5967.05%125.00%
Saeed Mahameed2629.55%250.00%
Matan Barak33.41%125.00%
Total88100.00%4100.00%

EXPORT_SYMBOL(mlx5_core_query_mkey);
int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *_mkey, u32 *mkey) { u32 out[MLX5_ST_SZ_DW(query_special_contexts_out)] = {0}; u32 in[MLX5_ST_SZ_DW(query_special_contexts_in)] = {0}; int err; MLX5_SET(query_special_contexts_in, in, opcode, MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS); err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); if (!err) *mkey = MLX5_GET(query_special_contexts_out, out, dump_fill_mkey); return err; }

Contributors

PersonTokensPropCommitsCommitProp
Eli Cohen6565.00%125.00%
Saeed Mahameed3333.00%250.00%
Matan Barak22.00%125.00%
Total100100.00%4100.00%

EXPORT_SYMBOL(mlx5_core_dump_fill_mkey);
static inline u32 mlx5_get_psv(u32 *out, int psv_index) { switch (psv_index) { case 1: return MLX5_GET(create_psv_out, out, psv1_index); case 2: return MLX5_GET(create_psv_out, out, psv2_index); case 3: return MLX5_GET(create_psv_out, out, psv3_index); default: return MLX5_GET(create_psv_out, out, psv0_index); } }

Contributors

PersonTokensPropCommitsCommitProp
Saeed Mahameed70100.00%1100.00%
Total70100.00%1100.00%


int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn, int npsvs, u32 *sig_index) { u32 out[MLX5_ST_SZ_DW(create_psv_out)] = {0}; u32 in[MLX5_ST_SZ_DW(create_psv_in)] = {0}; int i, err; if (npsvs > MLX5_MAX_PSVS) return -EINVAL; MLX5_SET(create_psv_in, in, opcode, MLX5_CMD_OP_CREATE_PSV); MLX5_SET(create_psv_in, in, pd, pdn); MLX5_SET(create_psv_in, in, num_psv, npsvs); err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); if (err) return err; for (i = 0; i < npsvs; i++) sig_index[i] = mlx5_get_psv(out, i); return err; }

Contributors

PersonTokensPropCommitsCommitProp
Sagi Grimberg10570.00%150.00%
Saeed Mahameed4530.00%150.00%
Total150100.00%2100.00%

EXPORT_SYMBOL(mlx5_core_create_psv);
int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num) { u32 out[MLX5_ST_SZ_DW(destroy_psv_out)] = {0}; u32 in[MLX5_ST_SZ_DW(destroy_psv_in)] = {0}; MLX5_SET(destroy_psv_in, in, opcode, MLX5_CMD_OP_DESTROY_PSV); MLX5_SET(destroy_psv_in, in, psvn, psv_num); return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); }

Contributors

PersonTokensPropCommitsCommitProp
Sagi Grimberg4656.79%133.33%
Saeed Mahameed3543.21%266.67%
Total81100.00%3100.00%

EXPORT_SYMBOL(mlx5_core_destroy_psv);

Overall Contributors

PersonTokensPropCommitsCommitProp
Saeed Mahameed37733.01%327.27%
Eli Cohen34930.56%218.18%
Sagi Grimberg34730.39%327.27%
Matan Barak363.15%19.09%
Haggai Eran201.75%19.09%
Majd Dibbiny131.14%19.09%
Total1142100.00%11100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.