Skip to content

Commit 4604ead

Browse files
committed
RDMA/efa: Align interrupt related fields to same type
JIRA: https://issues.redhat.com/browse/RHEL-83223 commit 802a9f8 Author: Yonatan Nachum <ynachum@amazon.com> Date: Sun Jan 5 13:14:21 2025 +0000 RDMA/efa: Align interrupt related fields to same type There is a lot of implicit casting of interrupt related fields. Use u32 as common type since this is what the device use as type for max supported EQs and what IB core expects in num_comp_vectors field. Reviewed-by: Daniel Kranzdorf <dkkranzd@amazon.com> Reviewed-by: Michael Margolin <mrgolin@amazon.com> Signed-off-by: Yonatan Nachum <ynachum@amazon.com> Link: https://patch.msgid.link/20250105131421.29030-1-ynachum@amazon.com Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Kamal Heib <kheib@redhat.com>
1 parent c1620f8 commit 4604ead

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

drivers/infiniband/hw/efa/efa.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
22
/*
3-
* Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
3+
* Copyright 2018-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
44
*/
55

66
#ifndef _EFA_H_
@@ -57,15 +57,15 @@ struct efa_dev {
5757
u64 db_bar_addr;
5858
u64 db_bar_len;
5959

60-
unsigned int num_irq_vectors;
61-
int admin_msix_vector_idx;
60+
u32 num_irq_vectors;
61+
u32 admin_msix_vector_idx;
6262
struct efa_irq admin_irq;
6363

6464
struct efa_stats stats;
6565

6666
/* Array of completion EQs */
6767
struct efa_eq *eqs;
68-
unsigned int neqs;
68+
u32 neqs;
6969

7070
/* Only stores CQs with interrupts enabled */
7171
struct xarray cqs_xa;

drivers/infiniband/hw/efa/efa_com.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
22
/*
3-
* Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
3+
* Copyright 2018-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
44
*/
55

66
#ifndef _EFA_COM_H_
@@ -65,7 +65,7 @@ struct efa_com_admin_queue {
6565
u16 depth;
6666
struct efa_com_admin_cq cq;
6767
struct efa_com_admin_sq sq;
68-
u16 msix_vector_idx;
68+
u32 msix_vector_idx;
6969

7070
unsigned long state;
7171

@@ -89,7 +89,7 @@ struct efa_com_aenq {
8989
struct efa_aenq_handlers *aenq_handlers;
9090
dma_addr_t dma_addr;
9191
u32 cc; /* consumer counter */
92-
u16 msix_vector_idx;
92+
u32 msix_vector_idx;
9393
u16 depth;
9494
u8 phase;
9595
};

drivers/infiniband/hw/efa/efa_main.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
22
/*
3-
* Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
3+
* Copyright 2018-2025 Amazon.com, Inc. or its affiliates. All rights reserved.
44
*/
55

66
#include <linux/module.h>
@@ -141,8 +141,7 @@ static int efa_request_irq(struct efa_dev *dev, struct efa_irq *irq)
141141
return 0;
142142
}
143143

144-
static void efa_setup_comp_irq(struct efa_dev *dev, struct efa_eq *eq,
145-
int vector)
144+
static void efa_setup_comp_irq(struct efa_dev *dev, struct efa_eq *eq, u32 vector)
146145
{
147146
u32 cpu;
148147

@@ -305,7 +304,7 @@ static void efa_destroy_eq(struct efa_dev *dev, struct efa_eq *eq)
305304
efa_free_irq(dev, &eq->irq);
306305
}
307306

308-
static int efa_create_eq(struct efa_dev *dev, struct efa_eq *eq, u8 msix_vec)
307+
static int efa_create_eq(struct efa_dev *dev, struct efa_eq *eq, u32 msix_vec)
309308
{
310309
int err;
311310

@@ -328,21 +327,17 @@ static int efa_create_eq(struct efa_dev *dev, struct efa_eq *eq, u8 msix_vec)
328327

329328
static int efa_create_eqs(struct efa_dev *dev)
330329
{
331-
unsigned int neqs = dev->dev_attr.max_eq;
332-
int err;
333-
int i;
334-
335-
neqs = min_t(unsigned int, neqs,
336-
dev->num_irq_vectors - EFA_COMP_EQS_VEC_BASE);
330+
u32 neqs = dev->dev_attr.max_eq;
331+
int err, i;
337332

333+
neqs = min_t(u32, neqs, dev->num_irq_vectors - EFA_COMP_EQS_VEC_BASE);
338334
dev->neqs = neqs;
339335
dev->eqs = kcalloc(neqs, sizeof(*dev->eqs), GFP_KERNEL);
340336
if (!dev->eqs)
341337
return -ENOMEM;
342338

343339
for (i = 0; i < neqs; i++) {
344-
err = efa_create_eq(dev, &dev->eqs[i],
345-
i + EFA_COMP_EQS_VEC_BASE);
340+
err = efa_create_eq(dev, &dev->eqs[i], i + EFA_COMP_EQS_VEC_BASE);
346341
if (err)
347342
goto err_destroy_eqs;
348343
}

0 commit comments

Comments
 (0)