diff options
Diffstat (limited to 'drivers/net/ethernet/freescale')
8 files changed, 43 insertions, 59 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_debugfs.c b/drivers/net/ethernet/freescale/dpa/dpaa_debugfs.c index a0ae535..dee4384 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_debugfs.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_debugfs.c @@ -78,11 +78,7 @@ static int dpa_debugfs_show(struct seq_file *file, void *offset) for_each_online_cpu(i) { percpu_priv = per_cpu_ptr(priv->percpu_priv, i); - /* Only private interfaces have an associated counter for bp - * buffers. Also the counter isn't initialized before the first - * ifconfig up - */ - if (!priv->shared && percpu_priv->dpa_bp_count) + if (percpu_priv->dpa_bp_count) dpa_bp_count = *percpu_priv->dpa_bp_count; total.in_interrupt += percpu_priv->in_interrupt; diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c index 6339de6..3fce5ee 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c @@ -488,9 +488,31 @@ static const dpa_fq_cbs_t private_fq_cbs = { .egress_ern = { .cb = { .ern = priv_ern } } }; -static int __cold dpa_eth_priv_start(struct net_device *net_dev) +static void dpaa_eth_napi_enable(struct dpa_priv_s *priv) +{ + struct dpa_percpu_priv_s *percpu_priv; + int i; + + for_each_online_cpu(i) { + percpu_priv = per_cpu_ptr(priv->percpu_priv, i); + napi_enable(&percpu_priv->napi); + } +} + +static void dpaa_eth_napi_disable(struct dpa_priv_s *priv) { + struct dpa_percpu_priv_s *percpu_priv; int i; + + for_each_online_cpu(i) { + percpu_priv = per_cpu_ptr(priv->percpu_priv, i); + napi_disable(&percpu_priv->napi); + } +} + +static int __cold dpa_eth_priv_start(struct net_device *net_dev) +{ + int i, err; struct dpa_priv_s *priv; struct dpa_percpu_priv_s *percpu_priv; @@ -515,7 +537,13 @@ static int __cold dpa_eth_priv_start(struct net_device *net_dev) } } - return dpa_start(net_dev); + dpaa_eth_napi_enable(priv); + + err = dpa_start(net_dev); + if (err < 0) + dpaa_eth_napi_disable(priv); + + return err; } @@ -701,8 +729,6 @@ static int dpa_priv_bp_create(struct net_device *net_dev, struct dpa_bp *dpa_bp, struct dpa_priv_s *priv = netdev_priv(net_dev); int i; - priv->shared = 0; - if (netif_msg_probe(priv)) dev_dbg(net_dev->dev.parent, "Using private BM buffer pools\n"); @@ -774,6 +800,7 @@ dpaa_eth_priv_probe(struct platform_device *_of_dev) priv = netdev_priv(net_dev); priv->net_dev = net_dev; + strcpy(priv->if_type, "private"); priv->msg_enable = netif_msg_init(debug, -1); diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpa/dpaa_eth.h index 43f325f..900bf11 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.h +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.h @@ -416,7 +416,6 @@ struct dpa_priv_s { * (even though it can be computed based on the fields of buf_layout) */ uint16_t tx_headroom; - int shared; struct net_device *net_dev; struct mac_device *mac_dev; struct qman_fq *egress_fqs[DPAA_ETH_TX_QUEUES]; @@ -468,8 +467,8 @@ struct dpa_priv_s { #endif /* CONFIG_FSL_DPAA_TS */ struct dpa_buffer_layout_s *buf_layout; - u8 macless_idx; uint16_t rx_headroom; + char if_type[30]; }; struct fm_port_fqs { diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c index 5349476..f214f58 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c @@ -120,34 +120,6 @@ int dpa_netdev_init(struct device_node *dpa_node, return 0; } -static void dpaa_eth_napi_enable(struct dpa_priv_s *priv) -{ - struct dpa_percpu_priv_s *percpu_priv; - int i; - - if (priv->shared) - return; - - for_each_online_cpu(i) { - percpu_priv = per_cpu_ptr(priv->percpu_priv, i); - napi_enable(&percpu_priv->napi); - } -} - -void dpaa_eth_napi_disable(struct dpa_priv_s *priv) -{ - struct dpa_percpu_priv_s *percpu_priv; - int i; - - if (priv->shared) - return; - - for_each_online_cpu(i) { - percpu_priv = per_cpu_ptr(priv->percpu_priv, i); - napi_disable(&percpu_priv->napi); - } -} - int __cold dpa_start(struct net_device *net_dev) { int err, i; @@ -157,13 +129,11 @@ int __cold dpa_start(struct net_device *net_dev) priv = netdev_priv(net_dev); mac_dev = priv->mac_dev; - dpaa_eth_napi_enable(priv); - err = mac_dev->init_phy(net_dev); if (err < 0) { if (netif_msg_ifup(priv)) netdev_err(net_dev, "init_phy() = %d\n", err); - goto init_phy_failed; + return err; } for_each_port_device(i, mac_dev->port_dev) @@ -184,9 +154,6 @@ mac_start_failed: for_each_port_device(i, mac_dev->port_dev) fm_port_disable(mac_dev->port_dev[i]); -init_phy_failed: - dpaa_eth_napi_disable(priv); - return err; } @@ -911,8 +878,6 @@ int dpa_bp_create(struct net_device *net_dev, struct dpa_bp *dpa_bp, struct dpa_priv_s *priv = netdev_priv(net_dev); int i; - priv->shared = 1; - priv->dpa_bp = dpa_bp; priv->bp_count = count; @@ -1316,7 +1281,6 @@ void dpa_fq_setup(struct dpa_priv_s *priv, const dpa_fq_cbs_t *fq_cbs, break; case FQ_TYPE_TX_CONF_MQ: BUG_ON(!priv->mac_dev); - BUG_ON(priv->shared); dpa_setup_ingress(priv, fq, &fq_cbs->tx_defq); priv->conf_fqs[conf_cnt++] = &fq->fq_base; break; @@ -1327,7 +1291,6 @@ void dpa_fq_setup(struct dpa_priv_s *priv, const dpa_fq_cbs_t *fq_cbs, #ifdef CONFIG_FSL_DPAA_TX_RECYCLE case FQ_TYPE_TX_RECYCLE: BUG_ON(!priv->mac_dev); - BUG_ON(priv->shared); dpa_setup_egress(priv, fq, tx_port, &fq_cbs->egress_ern); priv->recycle_fqs[recycle_cnt++] = &fq->fq_base; diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.h b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.h index c97501b..6c47496 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.h +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.h @@ -56,7 +56,6 @@ int dpa_netdev_init(struct device_node *dpa_node, struct net_device *net_dev, const uint8_t *mac_addr, uint16_t tx_timeout); -void dpaa_eth_napi_disable(struct dpa_priv_s *priv); int __cold dpa_start(struct net_device *net_dev); int __cold dpa_stop(struct net_device *net_dev); void __cold dpa_timeout(struct net_device *net_dev); diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_macless.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_macless.c index 4e0c35b..7f09ade 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_macless.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_macless.c @@ -264,6 +264,7 @@ static int dpaa_eth_macless_probe(struct platform_device *_of_dev) priv = netdev_priv(net_dev); priv->net_dev = net_dev; + sprintf(priv->if_type, "macless%d", macless_idx++); priv->msg_enable = netif_msg_init(debug, -1); @@ -340,11 +341,10 @@ static int dpaa_eth_macless_probe(struct platform_device *_of_dev) if (err < 0) goto netdev_init_failed; - priv->macless_idx = macless_idx++; - dpaa_eth_sysfs_init(&net_dev->dev); - printk(KERN_INFO "fsl_dpa_macless: Probed macless interface %s\n", net_dev->name); + printk(KERN_INFO "fsl_dpa_macless: Probed %s interface as %s\n", + priv->if_type, net_dev->name); return 0; diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c index ea584ff..0cf48dc 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c @@ -593,6 +593,7 @@ dpaa_eth_shared_probe(struct platform_device *_of_dev) priv = netdev_priv(net_dev); priv->net_dev = net_dev; + strcpy(priv->if_type, "shared"); priv->msg_enable = netif_msg_init(debug, -1); diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sysfs.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sysfs.c index edd9f1d..9e293da 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sysfs.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sysfs.c @@ -58,13 +58,12 @@ static ssize_t dpaa_eth_show_type(struct device *dev, struct device_attribute *attr, char *buf) { struct dpa_priv_s *priv = netdev_priv(to_net_dev(dev)); + ssize_t res = 0; - if (!priv->mac_dev) - return sprintf(buf, "macless%d", priv->macless_idx); - else if (priv->shared) - return sprintf(buf, "shared"); - else - return sprintf(buf, "private"); + if (priv) + res = sprintf(buf, "%s", priv->if_type); + + return res; } static ssize_t dpaa_eth_show_fqids(struct device *dev, |