From patchwork Wed Oct 29 00:52:36 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 6183 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 8BD1ADDE21 for ; Wed, 29 Oct 2008 11:53:37 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753445AbYJ2AxV (ORCPT ); Tue, 28 Oct 2008 20:53:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753424AbYJ2AxV (ORCPT ); Tue, 28 Oct 2008 20:53:21 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:47826 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751826AbYJ2AxS (ORCPT ); Tue, 28 Oct 2008 20:53:18 -0400 Received: from extreme (pool-96-225-231-79.ptldor.fios.verizon.net [96.225.231.79] (may be forged)) (authenticated bits=0) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id m9T0qgQo005175 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 28 Oct 2008 17:52:44 -0700 Date: Tue, 28 Oct 2008 17:52:36 -0700 From: Stephen Hemminger To: Patrick McHardy , David Miller Cc: netdev@vger.kernel.org Subject: [PATCH] vlan: propogate ethtool speed values Message-ID: <20081028175236.1659315c@extreme> Organization: Linux Foundation X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.9; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Spam-Status: No, hits=-5.595 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED, PATCH_SUBJECT_OSDL, RDNS_NONE X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This enables more ethtool information. The speed and settings of the underlying device are propagated up. This makes services like SNMP that use ethtool to get speed setting, work when managing a vlan, without adding silly heurtistics into SNMP daemon. For the driver info, just use existing driver strings. Signed-off-by: Stephen Hemminger --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/net/8021q/vlan.c 2008-10-28 17:39:54.000000000 -0700 +++ b/net/8021q/vlan.c 2008-10-28 17:40:48.000000000 -0700 @@ -46,10 +46,10 @@ int vlan_net_id; /* Our listing of VLAN group(s) */ static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE]; -static char vlan_fullname[] = "802.1Q VLAN Support"; -static char vlan_version[] = DRV_VERSION; -static char vlan_copyright[] = "Ben Greear "; -static char vlan_buggyright[] = "David S. Miller "; +const char vlan_fullname[] = "802.1Q VLAN Support"; +const char vlan_version[] = DRV_VERSION; +static const char vlan_copyright[] = "Ben Greear "; +static const char vlan_buggyright[] = "David S. Miller "; static struct packet_type vlan_packet_type = { .type = __constant_htons(ETH_P_8021Q), --- a/net/8021q/vlan.h 2008-10-28 17:40:58.000000000 -0700 +++ b/net/8021q/vlan.h 2008-10-28 17:43:36.000000000 -0700 @@ -108,8 +108,10 @@ static inline int vlan_gvrp_init(void) { static inline void vlan_gvrp_uninit(void) {} #endif -int vlan_netlink_init(void); -void vlan_netlink_fini(void); +extern const char vlan_fullname[]; +extern const char vlan_version[]; +extern int vlan_netlink_init(void); +extern void vlan_netlink_fini(void); extern struct rtnl_link_ops vlan_link_ops; --- a/net/8021q/vlan_dev.c 2008-10-28 17:33:55.000000000 -0700 +++ b/net/8021q/vlan_dev.c 2008-10-28 17:45:42.000000000 -0700 @@ -648,6 +648,26 @@ static void vlan_dev_uninit(struct net_d } } +static int vlan_ethtool_get_settings(struct net_device *dev, + struct ethtool_cmd *cmd) +{ + const struct vlan_dev_info *vlan = vlan_dev_info(dev); + struct net_device *real_dev = vlan->real_dev; + + if (!real_dev->ethtool_ops->get_settings) + return -EOPNOTSUPP; + + return real_dev->ethtool_ops->get_settings(real_dev, cmd); +} + +static void vlan_ethtool_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + strcpy(info->driver, vlan_fullname); + strcpy(info->version, vlan_version); + strcpy(info->fw_version, "N/A"); +} + static u32 vlan_ethtool_get_rx_csum(struct net_device *dev) { const struct vlan_dev_info *vlan = vlan_dev_info(dev); @@ -672,6 +692,8 @@ static u32 vlan_ethtool_get_flags(struct } static const struct ethtool_ops vlan_ethtool_ops = { + .get_settings = vlan_ethtool_get_settings, + .get_drvinfo = vlan_ethtool_get_drvinfo, .get_link = ethtool_op_get_link, .get_rx_csum = vlan_ethtool_get_rx_csum, .get_flags = vlan_ethtool_get_flags,