RDMA/hns: Fix coding style issues
[ Upstream commit dc93a0d987fcfe93b132871e72d4ea5aff36dd5c ] Just format the code without modifying anything, including fixing some redundant and missing blanks and spaces and changing the variable definition order. Link: https://lore.kernel.org/r/1607650657-35992-8-git-send-email-liweihang@huawei.com Signed-off-by: Lang Cheng <chenglang@huawei.com> Signed-off-by: Weihang Li <liweihang@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Stable-dep-of: cf5b608fb0e3 ("RDMA/hns: Fix hns_roce_table_get return value") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
cc1b04b699
commit
de1049dd18
@ -93,8 +93,8 @@ static int hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
void hns_roce_cmd_event(struct hns_roce_dev *hr_dev, u16 token, u8 status,
|
||||
u64 out_param)
|
||||
{
|
||||
struct hns_roce_cmd_context
|
||||
*context = &hr_dev->cmd.context[token & hr_dev->cmd.token_mask];
|
||||
struct hns_roce_cmd_context *context =
|
||||
&hr_dev->cmd.context[token % hr_dev->cmd.max_cmds];
|
||||
|
||||
if (token != context->token)
|
||||
return;
|
||||
@ -164,8 +164,8 @@ static int hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
|
||||
int ret;
|
||||
|
||||
down(&hr_dev->cmd.event_sem);
|
||||
ret = __hns_roce_cmd_mbox_wait(hr_dev, in_param, out_param,
|
||||
in_modifier, op_modifier, op, timeout);
|
||||
ret = __hns_roce_cmd_mbox_wait(hr_dev, in_param, out_param, in_modifier,
|
||||
op_modifier, op, timeout);
|
||||
up(&hr_dev->cmd.event_sem);
|
||||
|
||||
return ret;
|
||||
@ -231,9 +231,8 @@ int hns_roce_cmd_use_events(struct hns_roce_dev *hr_dev)
|
||||
struct hns_roce_cmdq *hr_cmd = &hr_dev->cmd;
|
||||
int i;
|
||||
|
||||
hr_cmd->context = kmalloc_array(hr_cmd->max_cmds,
|
||||
sizeof(*hr_cmd->context),
|
||||
GFP_KERNEL);
|
||||
hr_cmd->context =
|
||||
kcalloc(hr_cmd->max_cmds, sizeof(*hr_cmd->context), GFP_KERNEL);
|
||||
if (!hr_cmd->context)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -262,8 +261,8 @@ void hns_roce_cmd_use_polling(struct hns_roce_dev *hr_dev)
|
||||
hr_cmd->use_events = 0;
|
||||
}
|
||||
|
||||
struct hns_roce_cmd_mailbox
|
||||
*hns_roce_alloc_cmd_mailbox(struct hns_roce_dev *hr_dev)
|
||||
struct hns_roce_cmd_mailbox *
|
||||
hns_roce_alloc_cmd_mailbox(struct hns_roce_dev *hr_dev)
|
||||
{
|
||||
struct hns_roce_cmd_mailbox *mailbox;
|
||||
|
||||
@ -271,8 +270,8 @@ struct hns_roce_cmd_mailbox
|
||||
if (!mailbox)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
mailbox->buf = dma_pool_alloc(hr_dev->cmd.pool, GFP_KERNEL,
|
||||
&mailbox->dma);
|
||||
mailbox->buf =
|
||||
dma_pool_alloc(hr_dev->cmd.pool, GFP_KERNEL, &mailbox->dma);
|
||||
if (!mailbox->buf) {
|
||||
kfree(mailbox);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
@ -143,8 +143,8 @@ int hns_roce_cmd_mbox(struct hns_roce_dev *hr_dev, u64 in_param, u64 out_param,
|
||||
unsigned long in_modifier, u8 op_modifier, u16 op,
|
||||
unsigned long timeout);
|
||||
|
||||
struct hns_roce_cmd_mailbox
|
||||
*hns_roce_alloc_cmd_mailbox(struct hns_roce_dev *hr_dev);
|
||||
struct hns_roce_cmd_mailbox *
|
||||
hns_roce_alloc_cmd_mailbox(struct hns_roce_dev *hr_dev);
|
||||
void hns_roce_free_cmd_mailbox(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_cmd_mailbox *mailbox);
|
||||
|
||||
|
@ -41,9 +41,9 @@
|
||||
|
||||
static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
|
||||
{
|
||||
struct ib_device *ibdev = &hr_dev->ib_dev;
|
||||
struct hns_roce_cmd_mailbox *mailbox;
|
||||
struct hns_roce_cq_table *cq_table;
|
||||
struct ib_device *ibdev = &hr_dev->ib_dev;
|
||||
u64 mtts[MTT_MIN_COUNT] = { 0 };
|
||||
dma_addr_t dma_handle;
|
||||
int ret;
|
||||
|
@ -198,9 +198,9 @@ int hns_roce_calc_hem_mhop(struct hns_roce_dev *hr_dev,
|
||||
{
|
||||
struct device *dev = hr_dev->dev;
|
||||
u32 chunk_ba_num;
|
||||
u32 chunk_size;
|
||||
u32 table_idx;
|
||||
u32 bt_num;
|
||||
u32 chunk_size;
|
||||
|
||||
if (get_hem_table_config(hr_dev, mhop, table->type))
|
||||
return -EINVAL;
|
||||
@ -332,15 +332,15 @@ static int hns_roce_set_hem(struct hns_roce_dev *hr_dev,
|
||||
{
|
||||
spinlock_t *lock = &hr_dev->bt_cmd_lock;
|
||||
struct device *dev = hr_dev->dev;
|
||||
long end;
|
||||
unsigned long flags;
|
||||
struct hns_roce_hem_iter iter;
|
||||
void __iomem *bt_cmd;
|
||||
__le32 bt_cmd_val[2];
|
||||
__le32 bt_cmd_h = 0;
|
||||
unsigned long flags;
|
||||
__le32 bt_cmd_l;
|
||||
u64 bt_ba;
|
||||
int ret = 0;
|
||||
u64 bt_ba;
|
||||
long end;
|
||||
|
||||
/* Find the HEM(Hardware Entry Memory) entry */
|
||||
unsigned long i = (obj & (table->num_obj - 1)) /
|
||||
@ -640,8 +640,8 @@ int hns_roce_table_get(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_hem_table *table, unsigned long obj)
|
||||
{
|
||||
struct device *dev = hr_dev->dev;
|
||||
int ret = 0;
|
||||
unsigned long i;
|
||||
int ret = 0;
|
||||
|
||||
if (hns_roce_check_whether_mhop(hr_dev, table->type))
|
||||
return hns_roce_table_mhop_get(hr_dev, table, obj);
|
||||
@ -789,14 +789,14 @@ void *hns_roce_table_find(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_hem_chunk *chunk;
|
||||
struct hns_roce_hem_mhop mhop;
|
||||
struct hns_roce_hem *hem;
|
||||
void *addr = NULL;
|
||||
unsigned long mhop_obj = obj;
|
||||
unsigned long obj_per_chunk;
|
||||
unsigned long idx_offset;
|
||||
int offset, dma_offset;
|
||||
void *addr = NULL;
|
||||
u32 hem_idx = 0;
|
||||
int length;
|
||||
int i, j;
|
||||
u32 hem_idx = 0;
|
||||
|
||||
if (!table->lowmem)
|
||||
return NULL;
|
||||
@ -966,8 +966,8 @@ static void hns_roce_cleanup_mhop_hem_table(struct hns_roce_dev *hr_dev,
|
||||
{
|
||||
struct hns_roce_hem_mhop mhop;
|
||||
u32 buf_chunk_size;
|
||||
int i;
|
||||
u64 obj;
|
||||
int i;
|
||||
|
||||
if (hns_roce_calc_hem_mhop(hr_dev, table, NULL, &mhop))
|
||||
return;
|
||||
@ -1298,8 +1298,8 @@ static int hem_list_alloc_root_bt(struct hns_roce_dev *hr_dev,
|
||||
const struct hns_roce_buf_region *regions,
|
||||
int region_cnt)
|
||||
{
|
||||
struct roce_hem_item *hem, *temp_hem, *root_hem;
|
||||
struct list_head temp_list[HNS_ROCE_MAX_BT_REGION];
|
||||
struct roce_hem_item *hem, *temp_hem, *root_hem;
|
||||
const struct hns_roce_buf_region *r;
|
||||
struct list_head temp_root;
|
||||
struct list_head temp_btm;
|
||||
@ -1404,8 +1404,8 @@ int hns_roce_hem_list_request(struct hns_roce_dev *hr_dev,
|
||||
{
|
||||
const struct hns_roce_buf_region *r;
|
||||
int ofs, end;
|
||||
int ret;
|
||||
int unit;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
if (region_cnt > HNS_ROCE_MAX_BT_REGION) {
|
||||
|
@ -2760,7 +2760,6 @@ static int hns_roce_v1_m_qp(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
|
||||
roce_set_field(context->qpc_bytes_16,
|
||||
QP_CONTEXT_QPC_BYTES_16_QP_NUM_M,
|
||||
QP_CONTEXT_QPC_BYTES_16_QP_NUM_S, hr_qp->qpn);
|
||||
|
||||
} else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_INIT) {
|
||||
roce_set_field(context->qpc_bytes_4,
|
||||
QP_CONTEXT_QPC_BYTES_4_TRANSPORT_SERVICE_TYPE_M,
|
||||
@ -3793,7 +3792,6 @@ static int hns_roce_v1_aeq_int(struct hns_roce_dev *hr_dev,
|
||||
int event_type;
|
||||
|
||||
while ((aeqe = next_aeqe_sw_v1(eq))) {
|
||||
|
||||
/* Make sure we read the AEQ entry after we have checked the
|
||||
* ownership bit
|
||||
*/
|
||||
@ -3898,7 +3896,6 @@ static int hns_roce_v1_ceq_int(struct hns_roce_dev *hr_dev,
|
||||
u32 cqn;
|
||||
|
||||
while ((ceqe = next_ceqe_sw_v1(eq))) {
|
||||
|
||||
/* Make sure we read CEQ entry after we have checked the
|
||||
* ownership bit
|
||||
*/
|
||||
|
@ -2434,7 +2434,6 @@ static int hns_roce_init_link_table(struct hns_roce_dev *hr_dev,
|
||||
if (i < (pg_num - 1))
|
||||
entry[i].blk_ba1_nxt_ptr |=
|
||||
(i + 1) << HNS_ROCE_LINK_TABLE_NXT_PTR_S;
|
||||
|
||||
}
|
||||
link_tbl->npages = pg_num;
|
||||
link_tbl->pg_sz = buf_chk_sz;
|
||||
@ -5540,16 +5539,14 @@ static int hns_roce_v2_aeq_int(struct hns_roce_dev *hr_dev,
|
||||
case HNS_ROCE_EVENT_TYPE_CQ_OVERFLOW:
|
||||
hns_roce_cq_event(hr_dev, cqn, event_type);
|
||||
break;
|
||||
case HNS_ROCE_EVENT_TYPE_DB_OVERFLOW:
|
||||
break;
|
||||
case HNS_ROCE_EVENT_TYPE_MB:
|
||||
hns_roce_cmd_event(hr_dev,
|
||||
le16_to_cpu(aeqe->event.cmd.token),
|
||||
aeqe->event.cmd.status,
|
||||
le64_to_cpu(aeqe->event.cmd.out_param));
|
||||
break;
|
||||
case HNS_ROCE_EVENT_TYPE_DB_OVERFLOW:
|
||||
case HNS_ROCE_EVENT_TYPE_CEQ_OVERFLOW:
|
||||
break;
|
||||
case HNS_ROCE_EVENT_TYPE_FLR:
|
||||
break;
|
||||
default:
|
||||
|
@ -1076,8 +1076,8 @@ struct hns_roce_v2_ud_send_wqe {
|
||||
__le32 dmac;
|
||||
__le32 byte_48;
|
||||
u8 dgid[GID_LEN_V2];
|
||||
|
||||
};
|
||||
|
||||
#define V2_UD_SEND_WQE_BYTE_4_OPCODE_S 0
|
||||
#define V2_UD_SEND_WQE_BYTE_4_OPCODE_M GENMASK(4, 0)
|
||||
|
||||
|
@ -582,8 +582,8 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
|
||||
|
||||
static int hns_roce_init_hem(struct hns_roce_dev *hr_dev)
|
||||
{
|
||||
int ret;
|
||||
struct device *dev = hr_dev->dev;
|
||||
int ret;
|
||||
|
||||
ret = hns_roce_init_hem_table(hr_dev, &hr_dev->mr_table.mtpt_table,
|
||||
HEM_TYPE_MTPT, hr_dev->caps.mtpt_entry_sz,
|
||||
@ -723,8 +723,8 @@ static int hns_roce_init_hem(struct hns_roce_dev *hr_dev)
|
||||
*/
|
||||
static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)
|
||||
{
|
||||
int ret;
|
||||
struct device *dev = hr_dev->dev;
|
||||
int ret;
|
||||
|
||||
spin_lock_init(&hr_dev->sm_lock);
|
||||
spin_lock_init(&hr_dev->bt_cmd_lock);
|
||||
@ -847,8 +847,8 @@ void hns_roce_handle_device_err(struct hns_roce_dev *hr_dev)
|
||||
|
||||
int hns_roce_init(struct hns_roce_dev *hr_dev)
|
||||
{
|
||||
int ret;
|
||||
struct device *dev = hr_dev->dev;
|
||||
int ret;
|
||||
|
||||
if (hr_dev->hw->reset) {
|
||||
ret = hr_dev->hw->reset(hr_dev, true);
|
||||
|
@ -167,10 +167,10 @@ static void hns_roce_mr_free(struct hns_roce_dev *hr_dev,
|
||||
static int hns_roce_mr_enable(struct hns_roce_dev *hr_dev,
|
||||
struct hns_roce_mr *mr)
|
||||
{
|
||||
int ret;
|
||||
unsigned long mtpt_idx = key_to_hw_index(mr->key);
|
||||
struct device *dev = hr_dev->dev;
|
||||
struct hns_roce_cmd_mailbox *mailbox;
|
||||
struct device *dev = hr_dev->dev;
|
||||
int ret;
|
||||
|
||||
/* Allocate mailbox memory */
|
||||
mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
|
||||
|
@ -114,8 +114,8 @@ void hns_roce_qp_event(struct hns_roce_dev *hr_dev, u32 qpn, int event_type)
|
||||
static void hns_roce_ib_qp_event(struct hns_roce_qp *hr_qp,
|
||||
enum hns_roce_event type)
|
||||
{
|
||||
struct ib_event event;
|
||||
struct ib_qp *ibqp = &hr_qp->ibqp;
|
||||
struct ib_event event;
|
||||
|
||||
if (ibqp->event_handler) {
|
||||
event.device = ibqp->device;
|
||||
|
@ -245,7 +245,6 @@ static int alloc_srq_idx(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq,
|
||||
err = -ENOMEM;
|
||||
goto err_idx_mtr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user