Skip to content

Commit 4d19266

Browse files
Sameeh Jubrandavem330
authored andcommitted
net: ena: multiple queue creation related cleanups
- Rename ena_calc_queue_size() to ena_calc_io_queue_size() for clarity and consistency - Remove redundant number of io queues parameter in functions ena_enable_msix() and ena_enable_msix_and_set_admin_interrupts(), which already get adapter parameter, so use adapter->num_io_queues in the function instead. - Use the local variable ena_dev instead of ctx->ena_dev in ena_calc_io_queue_size - Fix multi row comment alignments Signed-off-by: Arthur Kiyanovski <[email protected]> Signed-off-by: Sameeh Jubran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent faa615f commit 4d19266

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

drivers/net/ethernet/amazon/ena/ena_netdev.c

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ static irqreturn_t ena_intr_msix_io(int irq, void *data)
13311331
* the number of potential io queues is the minimum of what the device
13321332
* supports and the number of vCPUs.
13331333
*/
1334-
static int ena_enable_msix(struct ena_adapter *adapter, int num_queues)
1334+
static int ena_enable_msix(struct ena_adapter *adapter)
13351335
{
13361336
int msix_vecs, irq_cnt;
13371337

@@ -1342,7 +1342,7 @@ static int ena_enable_msix(struct ena_adapter *adapter, int num_queues)
13421342
}
13431343

13441344
/* Reserved the max msix vectors we might need */
1345-
msix_vecs = ENA_MAX_MSIX_VEC(num_queues);
1345+
msix_vecs = ENA_MAX_MSIX_VEC(adapter->num_io_queues);
13461346
netif_dbg(adapter, probe, adapter->netdev,
13471347
"trying to enable MSI-X, vectors %d\n", msix_vecs);
13481348

@@ -2682,14 +2682,13 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev,
26822682
return rc;
26832683
}
26842684

2685-
static int ena_enable_msix_and_set_admin_interrupts(struct ena_adapter *adapter,
2686-
int io_vectors)
2685+
static int ena_enable_msix_and_set_admin_interrupts(struct ena_adapter *adapter)
26872686
{
26882687
struct ena_com_dev *ena_dev = adapter->ena_dev;
26892688
struct device *dev = &adapter->pdev->dev;
26902689
int rc;
26912690

2692-
rc = ena_enable_msix(adapter, io_vectors);
2691+
rc = ena_enable_msix(adapter);
26932692
if (rc) {
26942693
dev_err(dev, "Can not reserve msix vectors\n");
26952694
return rc;
@@ -2782,8 +2781,7 @@ static int ena_restore_device(struct ena_adapter *adapter)
27822781
goto err_device_destroy;
27832782
}
27842783

2785-
rc = ena_enable_msix_and_set_admin_interrupts(adapter,
2786-
adapter->num_io_queues);
2784+
rc = ena_enable_msix_and_set_admin_interrupts(adapter);
27872785
if (rc) {
27882786
dev_err(&pdev->dev, "Enable MSI-X failed\n");
27892787
goto err_device_destroy;
@@ -3349,7 +3347,7 @@ static void set_default_llq_configurations(struct ena_llq_configurations *llq_co
33493347
llq_config->llq_ring_entry_size_value = 128;
33503348
}
33513349

3352-
static int ena_calc_queue_size(struct ena_calc_queue_size_ctx *ctx)
3350+
static int ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx)
33533351
{
33543352
struct ena_admin_feature_llq_desc *llq = &ctx->get_feat_ctx->llq;
33553353
struct ena_com_dev *ena_dev = ctx->ena_dev;
@@ -3358,7 +3356,7 @@ static int ena_calc_queue_size(struct ena_calc_queue_size_ctx *ctx)
33583356
u32 max_tx_queue_size;
33593357
u32 max_rx_queue_size;
33603358

3361-
if (ctx->ena_dev->supported_features & BIT(ENA_ADMIN_MAX_QUEUES_EXT)) {
3359+
if (ena_dev->supported_features & BIT(ENA_ADMIN_MAX_QUEUES_EXT)) {
33623360
struct ena_admin_queue_ext_feature_fields *max_queue_ext =
33633361
&ctx->get_feat_ctx->max_queue_ext.max_queue_ext;
33643362
max_rx_queue_size = min_t(u32, max_queue_ext->max_rx_cq_depth,
@@ -3497,25 +3495,18 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
34973495
calc_queue_ctx.pdev = pdev;
34983496

34993497
/* Initial Tx and RX interrupt delay. Assumes 1 usec granularity.
3500-
* Updated during device initialization with the real granularity
3501-
*/
3498+
* Updated during device initialization with the real granularity
3499+
*/
35023500
ena_dev->intr_moder_tx_interval = ENA_INTR_INITIAL_TX_INTERVAL_USECS;
35033501
ena_dev->intr_moder_rx_interval = ENA_INTR_INITIAL_RX_INTERVAL_USECS;
35043502
ena_dev->intr_delay_resolution = ENA_DEFAULT_INTR_DELAY_RESOLUTION;
35053503
io_queue_num = ena_calc_io_queue_num(pdev, ena_dev, &get_feat_ctx);
3506-
rc = ena_calc_queue_size(&calc_queue_ctx);
3504+
rc = ena_calc_io_queue_size(&calc_queue_ctx);
35073505
if (rc || io_queue_num <= 0) {
35083506
rc = -EFAULT;
35093507
goto err_device_destroy;
35103508
}
35113509

3512-
dev_info(&pdev->dev, "creating %d io queues. rx queue size: %d tx queue size. %d LLQ is %s\n",
3513-
io_queue_num,
3514-
calc_queue_ctx.rx_queue_size,
3515-
calc_queue_ctx.tx_queue_size,
3516-
(ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) ?
3517-
"ENABLED" : "DISABLED");
3518-
35193510
/* dev zeroed in init_etherdev */
35203511
netdev = alloc_etherdev_mq(sizeof(struct ena_adapter), io_queue_num);
35213512
if (!netdev) {
@@ -3569,7 +3560,7 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
35693560

35703561
u64_stats_init(&adapter->syncp);
35713562

3572-
rc = ena_enable_msix_and_set_admin_interrupts(adapter, io_queue_num);
3563+
rc = ena_enable_msix_and_set_admin_interrupts(adapter);
35733564
if (rc) {
35743565
dev_err(&pdev->dev,
35753566
"Failed to enable and set the admin interrupts\n");

0 commit comments

Comments
 (0)