diff options
author | Ioana Radulescu <ruxandra.radulescu@freescale.com> | 2013-04-09 13:54:22 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-04-16 23:08:27 (GMT) |
commit | 7f557d42038f803724f56ff0e958e73aefb3772b (patch) | |
tree | bbdcd5db5fb8053e23003a2dd47c9fa04605db7a | |
parent | 8507cb00e53316b71d6acc2bc1616c190c487e36 (diff) | |
download | linux-fsl-qoriq-7f557d42038f803724f56ff0e958e73aefb3772b.tar.xz |
dpaa_eth: Add support for the new netdev features framework
Kernel 3.8 brings a new way of organizing the netdev features
(feature sets include hardware features, currently enabled features,
vlan features and wanted features). Some ethtool ops also replaced
by a set of new ndo's.
Update the DPAA Ethernet driver to account for these changes.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@freescale.com>
Change-Id: I073920040f9c92665773cac5fb30d305320699be
Reviewed-on: http://git.am.freescale.net:8181/1399
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth.c | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c index f2b247e..898e695 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c @@ -3219,19 +3219,31 @@ static u16 dpa_select_queue(struct net_device *net_dev, struct sk_buff *skb) } #endif - -static int dpa_ndo_set_features(struct net_device *dev, - netdev_features_t features) +static netdev_features_t dpa_fix_features(struct net_device *dev, + netdev_features_t features) { - /* - * TODO either differentiate between MAC-less and MAC-ful (e.g. for - * NETIF_F_RXCSUM), or use a different callback. - * - * Also, for things like NETIF_F_RXCSUM we ought to gain control - * of the FMan port. + struct dpa_priv_s *priv = netdev_priv(dev); + netdev_features_t unsupported_features = 0; + + /* In theory we should never be requested to enable features that + * we didn't set in netdev->features and netdev->hw_features at probe + * time, but double check just to be on the safe side. */ - pr_err(".ndo_set_features = %s() not yet implemented!\n", __func__); - return -EINVAL; + if (!priv->mac_dev) + unsupported_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + /* We don't support enabling Rx csum through ethtool yet */ + unsupported_features |= NETIF_F_RXCSUM; + + features &= ~unsupported_features; + + return features; +} + +static int dpa_set_features(struct net_device *dev, netdev_features_t features) +{ + /* Not much to do here for now */ + dev->features = features; + return 0; } @@ -3249,7 +3261,8 @@ static const struct net_device_ops dpa_private_ops = { .ndo_change_mtu = dpa_change_mtu, .ndo_set_rx_mode = dpa_set_rx_mode, .ndo_init = dpa_ndo_init, - .ndo_set_features = dpa_ndo_set_features, + .ndo_set_features = dpa_set_features, + .ndo_fix_features = dpa_fix_features, #ifdef CONFIG_FSL_DPA_1588 .ndo_do_ioctl = dpa_ioctl, #endif @@ -3269,7 +3282,8 @@ static const struct net_device_ops dpa_shared_ops = { .ndo_change_mtu = dpa_change_mtu, .ndo_set_rx_mode = dpa_set_rx_mode, .ndo_init = dpa_ndo_init, - .ndo_set_features = dpa_ndo_set_features, + .ndo_set_features = dpa_set_features, + .ndo_fix_features = dpa_fix_features, #ifdef CONFIG_FSL_DPA_1588 .ndo_do_ioctl = dpa_ioctl, #endif @@ -3663,8 +3677,7 @@ static int dpa_netdev_init(struct device_node *dpa_node, struct dpa_priv_s *priv = netdev_priv(net_dev); struct device *dev = net_dev->dev.parent; - net_dev->features |= DPA_NETIF_FEATURES; - net_dev->vlan_features |= DPA_NETIF_FEATURES; + net_dev->hw_features |= DPA_NETIF_FEATURES; if (!priv->mac_dev) { /* Get the MAC address */ @@ -3679,9 +3692,7 @@ static int dpa_netdev_init(struct device_node *dpa_node, net_dev->mem_end = priv->mac_dev->res->end; mac_addr = priv->mac_dev->addr; - net_dev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | - NETIF_F_LLTX); - net_dev->vlan_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + net_dev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_LLTX); /* @@ -3690,22 +3701,21 @@ static int dpa_netdev_init(struct device_node *dpa_node, */ if (!priv->shared) { #ifdef CONFIG_DPAA_ETH_SG_SUPPORT - net_dev->features |= NETIF_F_SG | NETIF_F_HIGHDMA - /* - * Recent kernels enable GSO automatically, if - * we declare NETIF_F_SG. For conformity, we'll - * still declare GSO explicitly. - */ - | NETIF_F_GSO; - net_dev->vlan_features |= NETIF_F_SG | NETIF_F_HIGHDMA - | NETIF_F_GSO; + net_dev->hw_features |= NETIF_F_SG | NETIF_F_HIGHDMA; + /* Recent kernels enable GSO automatically, if + * we declare NETIF_F_SG. For conformity, we'll + * still declare GSO explicitly. + */ + net_dev->features |= NETIF_F_GSO; #endif /* Advertise GRO support */ net_dev->features |= NETIF_F_GRO; - net_dev->vlan_features |= NETIF_F_GRO; } } + net_dev->features |= net_dev->hw_features; + net_dev->vlan_features = net_dev->features; + memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len); memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len); |