Skip to content

Commit d38b4d0

Browse files
michalQbkuba-moo
authored andcommitted
idpf: set scheduling mode for completion queue
The HW must be programmed differently for queue-based scheduling mode. To program the completion queue context correctly, the control plane must know the scheduling mode not only for the Tx queue, but also for the completion queue. Unfortunately, currently the driver sets the scheduling mode only for the Tx queues. Propagate the scheduling mode data for the completion queue as well when sending the queue configuration messages. Fixes: 1c325aa ("idpf: configure resources for TX queues") Reviewed-by: Alexander Lobakin <[email protected]> Signed-off-by: Michal Kubiak <[email protected]> Reviewed-by: Alan Brady <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Tested-by: Krishneil Singh <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 81a4169 commit d38b4d0

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

drivers/net/ethernet/intel/idpf/idpf_txrx.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,13 +1160,17 @@ static void idpf_rxq_set_descids(struct idpf_vport *vport, struct idpf_queue *q)
11601160
*/
11611161
static int idpf_txq_group_alloc(struct idpf_vport *vport, u16 num_txq)
11621162
{
1163+
bool flow_sch_en;
11631164
int err, i;
11641165

11651166
vport->txq_grps = kcalloc(vport->num_txq_grp,
11661167
sizeof(*vport->txq_grps), GFP_KERNEL);
11671168
if (!vport->txq_grps)
11681169
return -ENOMEM;
11691170

1171+
flow_sch_en = !idpf_is_cap_ena(vport->adapter, IDPF_OTHER_CAPS,
1172+
VIRTCHNL2_CAP_SPLITQ_QSCHED);
1173+
11701174
for (i = 0; i < vport->num_txq_grp; i++) {
11711175
struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i];
11721176
struct idpf_adapter *adapter = vport->adapter;
@@ -1195,8 +1199,7 @@ static int idpf_txq_group_alloc(struct idpf_vport *vport, u16 num_txq)
11951199
q->txq_grp = tx_qgrp;
11961200
hash_init(q->sched_buf_hash);
11971201

1198-
if (!idpf_is_cap_ena(adapter, IDPF_OTHER_CAPS,
1199-
VIRTCHNL2_CAP_SPLITQ_QSCHED))
1202+
if (flow_sch_en)
12001203
set_bit(__IDPF_Q_FLOW_SCH_EN, q->flags);
12011204
}
12021205

@@ -1215,6 +1218,9 @@ static int idpf_txq_group_alloc(struct idpf_vport *vport, u16 num_txq)
12151218
tx_qgrp->complq->desc_count = vport->complq_desc_count;
12161219
tx_qgrp->complq->vport = vport;
12171220
tx_qgrp->complq->txq_grp = tx_qgrp;
1221+
1222+
if (flow_sch_en)
1223+
__set_bit(__IDPF_Q_FLOW_SCH_EN, tx_qgrp->complq->flags);
12181224
}
12191225

12201226
return 0;

drivers/net/ethernet/intel/idpf/idpf_virtchnl.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ static int idpf_send_config_tx_queues_msg(struct idpf_vport *vport)
14731473
/* Populate the queue info buffer with all queue context info */
14741474
for (i = 0; i < vport->num_txq_grp; i++) {
14751475
struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i];
1476-
int j;
1476+
int j, sched_mode;
14771477

14781478
for (j = 0; j < tx_qgrp->num_txq; j++, k++) {
14791479
qi[k].queue_id =
@@ -1514,6 +1514,12 @@ static int idpf_send_config_tx_queues_msg(struct idpf_vport *vport)
15141514
qi[k].ring_len = cpu_to_le16(tx_qgrp->complq->desc_count);
15151515
qi[k].dma_ring_addr = cpu_to_le64(tx_qgrp->complq->dma);
15161516

1517+
if (test_bit(__IDPF_Q_FLOW_SCH_EN, tx_qgrp->complq->flags))
1518+
sched_mode = VIRTCHNL2_TXQ_SCHED_MODE_FLOW;
1519+
else
1520+
sched_mode = VIRTCHNL2_TXQ_SCHED_MODE_QUEUE;
1521+
qi[k].sched_mode = cpu_to_le16(sched_mode);
1522+
15171523
k++;
15181524
}
15191525

0 commit comments

Comments
 (0)