Skip to content

Commit 579923d

Browse files
RajuRangojukuba-moo
authored andcommitted
amd-xgbe: TX Flow Ctrl Registers are h/w ver dependent
There is difference in the TX Flow Control registers (TFCR) between the revisions of the hardware. The older revisions of hardware used to have single register per queue. Whereas, the newer revision of hardware (from ver 30H onwards) have one register per priority. Update the driver to use the TFCR based on the reported version of the hardware. Fixes: c5aa9e3 ("amd-xgbe: Initial AMD 10GbE platform driver") Co-developed-by: Ajith Nayak <[email protected]> Signed-off-by: Ajith Nayak <[email protected]> Signed-off-by: Raju Rangoju <[email protected]> Acked-by: Shyam Sundar S K <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0ea90f3 commit 579923d

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-dev.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,19 +524,28 @@ static void xgbe_disable_vxlan(struct xgbe_prv_data *pdata)
524524
netif_dbg(pdata, drv, pdata->netdev, "VXLAN acceleration disabled\n");
525525
}
526526

527+
static unsigned int xgbe_get_fc_queue_count(struct xgbe_prv_data *pdata)
528+
{
529+
unsigned int max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
530+
531+
/* From MAC ver 30H the TFCR is per priority, instead of per queue */
532+
if (XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER) >= 0x30)
533+
return max_q_count;
534+
else
535+
return min_t(unsigned int, pdata->tx_q_count, max_q_count);
536+
}
537+
527538
static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata)
528539
{
529-
unsigned int max_q_count, q_count;
530540
unsigned int reg, reg_val;
531-
unsigned int i;
541+
unsigned int i, q_count;
532542

533543
/* Clear MTL flow control */
534544
for (i = 0; i < pdata->rx_q_count; i++)
535545
XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, 0);
536546

537547
/* Clear MAC flow control */
538-
max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
539-
q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count);
548+
q_count = xgbe_get_fc_queue_count(pdata);
540549
reg = MAC_Q0TFCR;
541550
for (i = 0; i < q_count; i++) {
542551
reg_val = XGMAC_IOREAD(pdata, reg);
@@ -553,9 +562,8 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata)
553562
{
554563
struct ieee_pfc *pfc = pdata->pfc;
555564
struct ieee_ets *ets = pdata->ets;
556-
unsigned int max_q_count, q_count;
557565
unsigned int reg, reg_val;
558-
unsigned int i;
566+
unsigned int i, q_count;
559567

560568
/* Set MTL flow control */
561569
for (i = 0; i < pdata->rx_q_count; i++) {
@@ -579,8 +587,7 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata)
579587
}
580588

581589
/* Set MAC flow control */
582-
max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
583-
q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count);
590+
q_count = xgbe_get_fc_queue_count(pdata);
584591
reg = MAC_Q0TFCR;
585592
for (i = 0; i < q_count; i++) {
586593
reg_val = XGMAC_IOREAD(pdata, reg);

0 commit comments

Comments
 (0)