|
@@ -2709,6 +2709,42 @@ static void fec_reset_phy(struct platform_device *pdev)
|
|
}
|
|
}
|
|
#endif /* CONFIG_OF */
|
|
#endif /* CONFIG_OF */
|
|
|
|
|
|
|
|
+static void
|
|
|
|
+fec_enet_get_queue_num(struct platform_device *pdev, int *num_tx, int *num_rx)
|
|
|
|
+{
|
|
|
|
+ struct device_node *np = pdev->dev.of_node;
|
|
|
|
+ int err;
|
|
|
|
+
|
|
|
|
+ *num_tx = *num_rx = 1;
|
|
|
|
+
|
|
|
|
+ if (!np || !of_device_is_available(np))
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ /* parse the num of tx and rx queues */
|
|
|
|
+ err = of_property_read_u32(np, "fsl,num-tx-queues", num_tx);
|
|
|
|
+ err |= of_property_read_u32(np, "fsl,num-rx-queues", num_rx);
|
|
|
|
+ if (err) {
|
|
|
|
+ *num_tx = 1;
|
|
|
|
+ *num_rx = 1;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (*num_tx < 1 || *num_tx > FEC_ENET_MAX_TX_QS) {
|
|
|
|
+ dev_err(&pdev->dev, "Invalidate num_tx(=%d), fail back to 1\n",
|
|
|
|
+ *num_tx);
|
|
|
|
+ *num_tx = 1;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (*num_rx < 1 || *num_rx > FEC_ENET_MAX_RX_QS) {
|
|
|
|
+ dev_err(&pdev->dev, "Invalidate num_rx(=%d), fail back to 1\n",
|
|
|
|
+ *num_rx);
|
|
|
|
+ *num_rx = 1;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
static int
|
|
static int
|
|
fec_probe(struct platform_device *pdev)
|
|
fec_probe(struct platform_device *pdev)
|
|
{
|
|
{
|
|
@@ -2720,13 +2756,18 @@ fec_probe(struct platform_device *pdev)
|
|
const struct of_device_id *of_id;
|
|
const struct of_device_id *of_id;
|
|
static int dev_id;
|
|
static int dev_id;
|
|
struct device_node *np = pdev->dev.of_node, *phy_node;
|
|
struct device_node *np = pdev->dev.of_node, *phy_node;
|
|
|
|
+ int num_tx_qs = 1;
|
|
|
|
+ int num_rx_qs = 1;
|
|
|
|
|
|
of_id = of_match_device(fec_dt_ids, &pdev->dev);
|
|
of_id = of_match_device(fec_dt_ids, &pdev->dev);
|
|
if (of_id)
|
|
if (of_id)
|
|
pdev->id_entry = of_id->data;
|
|
pdev->id_entry = of_id->data;
|
|
|
|
|
|
|
|
+ fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs);
|
|
|
|
+
|
|
/* Init network device */
|
|
/* Init network device */
|
|
- ndev = alloc_etherdev(sizeof(struct fec_enet_private));
|
|
|
|
|
|
+ ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private),
|
|
|
|
+ num_tx_qs, num_rx_qs);
|
|
if (!ndev)
|
|
if (!ndev)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
@@ -2735,6 +2776,9 @@ fec_probe(struct platform_device *pdev)
|
|
/* setup board info structure */
|
|
/* setup board info structure */
|
|
fep = netdev_priv(ndev);
|
|
fep = netdev_priv(ndev);
|
|
|
|
|
|
|
|
+ fep->num_rx_queues = num_rx_qs;
|
|
|
|
+ fep->num_tx_queues = num_tx_qs;
|
|
|
|
+
|
|
#if !defined(CONFIG_M5272)
|
|
#if !defined(CONFIG_M5272)
|
|
/* default enable pause frame auto negotiation */
|
|
/* default enable pause frame auto negotiation */
|
|
if (pdev->id_entry &&
|
|
if (pdev->id_entry &&
|