net: stmmac: Check if CBS is supported before configuring
authorJose Abreu <[email protected]>
Wed, 9 Jan 2019 09:05:58 +0000 (10:05 +0100)
committerDavid S. Miller <[email protected]>
Fri, 11 Jan 2019 23:35:06 +0000 (15:35 -0800)
Check if CBS is currently supported before trying to configure it in HW.

Cc: Joao Pinto <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Signed-off-by: Jose Abreu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c

index 531294f4978bc42bbb0e3cb0177b1312a33bef61..58ea18af9813ab950b1252cde08d626abe61c30e 100644 (file)
@@ -301,6 +301,8 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
        /* Queue 0 is not AVB capable */
        if (queue <= 0 || queue >= tx_queues_count)
                return -EINVAL;
+       if (!priv->dma_cap.av)
+               return -EOPNOTSUPP;
        if (priv->speed != SPEED_100 && priv->speed != SPEED_1000)
                return -EOPNOTSUPP;