Stupid question:  Can we assume ethtool will only be used for networking
devices with a 6-byte hardware address?

If not, then the driver-specific approach would give the flexibility of
copying anything up to MAX_ADDR_LEN.

Perhaps increasing the count to MAX_ADDR_LEN is the way to go??

6/half-dozen

-Jeb

> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> On Behalf Of John W. Linville
> Sent: Wednesday, July 27, 2005 6:15 PM
> To: Jon Wetzel
> Cc: netdev@vger.kernel.org; [EMAIL PROTECTED]
> Subject: [patch 2.6.13-rc3] ethtool: add generic
ethtool_op_get_perm_addr
> routine
> 
> Add generic ethtool operation for getting permanenet hardware address.
> 
> Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
> ---
> This moves and renames the basically generic e1000_get_perm_addr
> routine to ethtool_op_get_perm_addr, and causes e1000 to make use of
> the new name.
> 
>  drivers/net/e1000/e1000_ethtool.c |    9 +--------
>  include/linux/ethtool.h           |    1 +
>  net/core/ethtool.c                |    7 +++++++
>  3 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/e1000/e1000_ethtool.c
> b/drivers/net/e1000/e1000_ethtool.c
> --- a/drivers/net/e1000/e1000_ethtool.c
> +++ b/drivers/net/e1000/e1000_ethtool.c
> @@ -1704,13 +1704,6 @@ e1000_get_strings(struct net_device *net
>       }
>  }
> 
> -static int
> -e1000_get_perm_addr(struct net_device *netdev, struct ethtool_addr
*eaddr)
> -{
> -     memcpy(eaddr->addr, netdev->perm_addr, ETH_MAX_ADDR_LEN);
> -     return 0;
> -}
> -
>  struct ethtool_ops e1000_ethtool_ops = {
>       .get_settings           = e1000_get_settings,
>       .set_settings           = e1000_set_settings,
> @@ -1746,7 +1739,7 @@ struct ethtool_ops e1000_ethtool_ops = {
>       .phys_id                = e1000_phys_id,
>       .get_stats_count        = e1000_get_stats_count,
>       .get_ethtool_stats      = e1000_get_ethtool_stats,
> -     .get_perm_addr          = e1000_get_perm_addr,
> +     .get_perm_addr          = ethtool_op_get_perm_addr,
>  };
> 
>  void e1000_set_ethtool_ops(struct net_device *netdev)
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -268,6 +268,7 @@ u32 ethtool_op_get_sg(struct net_device
>  int ethtool_op_set_sg(struct net_device *dev, u32 data);
>  u32 ethtool_op_get_tso(struct net_device *dev);
>  int ethtool_op_set_tso(struct net_device *dev, u32 data);
> +int ethtool_op_get_perm_addr(struct net_device *dev, struct
ethtool_addr
> *);
> 
>  /**
>   * &ethtool_ops - Alter and report network device settings
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -81,6 +81,12 @@ int ethtool_op_set_tso(struct net_device
>       return 0;
>  }
> 
> +int ethtool_op_get_perm_addr(struct net_device *netdev, struct
> ethtool_addr *eaddr)
> +{
> +     memcpy(eaddr->addr, netdev->perm_addr, ETH_MAX_ADDR_LEN);
> +     return 0;
> +}
> +
>  /* Handlers for each ethtool command */
> 
>  static int ethtool_get_settings(struct net_device *dev, void __user
> *useraddr)
> @@ -845,6 +851,7 @@ int dev_ethtool(struct ifreq *ifr)
> 
>  EXPORT_SYMBOL(dev_ethtool);
>  EXPORT_SYMBOL(ethtool_op_get_link);
> +EXPORT_SYMBOL_GPL(ethtool_op_get_perm_addr);
>  EXPORT_SYMBOL(ethtool_op_get_sg);
>  EXPORT_SYMBOL(ethtool_op_get_tso);
>  EXPORT_SYMBOL(ethtool_op_get_tx_csum);
> --
> John W. Linville
> [EMAIL PROTECTED]
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to