From patchwork Thu May 24 20:58:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 161205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 4E67CB6F9D for ; Fri, 25 May 2012 06:58:50 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SXf78-0002IR-4o; Thu, 24 May 2012 20:58:30 +0000 Received: from mail.tpi.com ([70.99.223.143]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SXf74-0002HX-GE for kernel-team@lists.ubuntu.com; Thu, 24 May 2012 20:58:27 +0000 Received: from salmon.rtg.net (mail.tpi.com [70.99.223.143]) by mail.tpi.com (Postfix) with ESMTP id 632133166D5 for ; Thu, 24 May 2012 13:57:09 -0700 (PDT) Received: by salmon.rtg.net (Postfix, from userid 1000) id 2DF532045C; Thu, 24 May 2012 14:58:44 -0600 (MDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 01/12] dsa: Change dsa_uses_{dsa, trailer}_tags() into inline functions Date: Thu, 24 May 2012 14:58:13 -0600 Message-Id: <1337893104-130090-2-git-send-email-tim.gardner@canonical.com> X-Mailer: git-send-email 1.7.9.5 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Ben Hutchings BugLink: http://bugs.launchpad.net/bugs/1004148 eth_type_trans() will use these functions if DSA is enabled, which blocks building DSA as a module. Signed-off-by: Ben Hutchings Signed-off-by: David S. Miller (cherry picked from commit cf50dcc24f82a6dc2bce523eec2a979eb1b106e2) Signed-off-by: Tim Gardner --- include/linux/netdevice.h | 2 +- include/net/dsa.h | 53 +++++++++++++++++++++++++++++++++++++++++++-- net/dsa/dsa.c | 23 -------------------- net/dsa/dsa_priv.h | 33 ---------------------------- 4 files changed, 52 insertions(+), 59 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cbeb586..79df785 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1148,7 +1148,7 @@ struct net_device { struct vlan_group __rcu *vlgrp; /* VLAN group */ #endif #ifdef CONFIG_NET_DSA - void *dsa_ptr; /* dsa specific data */ + struct dsa_switch_tree *dsa_ptr; /* dsa specific data */ #endif void *atalk_ptr; /* AppleTalk link */ struct in_device __rcu *ip_ptr; /* IPv4 specific data */ diff --git a/include/net/dsa.h b/include/net/dsa.h index 839f768..32a1b49 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -11,6 +11,9 @@ #ifndef __LINUX_NET_DSA_H #define __LINUX_NET_DSA_H +#include +#include + #define DSA_MAX_SWITCHES 4 #define DSA_MAX_PORTS 12 @@ -54,8 +57,54 @@ struct dsa_platform_data { struct dsa_chip_data *chip; }; -extern bool dsa_uses_dsa_tags(void *dsa_ptr); -extern bool dsa_uses_trailer_tags(void *dsa_ptr); +struct dsa_switch_tree { + /* + * Configuration data for the platform device that owns + * this dsa switch tree instance. + */ + struct dsa_platform_data *pd; + + /* + * Reference to network device to use, and which tagging + * protocol to use. + */ + struct net_device *master_netdev; + __be16 tag_protocol; + + /* + * The switch and port to which the CPU is attached. + */ + s8 cpu_switch; + s8 cpu_port; + + /* + * Link state polling. + */ + int link_poll_needed; + struct work_struct link_poll_work; + struct timer_list link_poll_timer; + + /* + * Data for the individual switch chips. + */ + struct dsa_switch *ds[DSA_MAX_SWITCHES]; +}; + +/* + * The original DSA tag format and some other tag formats have no + * ethertype, which means that we need to add a little hack to the + * networking receive path to make sure that received frames get + * the right ->protocol assigned to them when one of those tag + * formats is in use. + */ +static inline bool dsa_uses_dsa_tags(struct dsa_switch_tree *dst) +{ + return !!(dst->tag_protocol == htons(ETH_P_DSA)); +} +static inline bool dsa_uses_trailer_tags(struct dsa_switch_tree *dst) +{ + return !!(dst->tag_protocol == htons(ETH_P_TRAILER)); +} #endif diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 0dc1589..66f5c04 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -199,29 +199,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds) } -/* hooks for ethertype-less tagging formats *********************************/ -/* - * The original DSA tag format and some other tag formats have no - * ethertype, which means that we need to add a little hack to the - * networking receive path to make sure that received frames get - * the right ->protocol assigned to them when one of those tag - * formats is in use. - */ -bool dsa_uses_dsa_tags(void *dsa_ptr) -{ - struct dsa_switch_tree *dst = dsa_ptr; - - return !!(dst->tag_protocol == htons(ETH_P_DSA)); -} - -bool dsa_uses_trailer_tags(void *dsa_ptr) -{ - struct dsa_switch_tree *dst = dsa_ptr; - - return !!(dst->tag_protocol == htons(ETH_P_TRAILER)); -} - - /* link polling *************************************************************/ static void dsa_link_poll_work(struct work_struct *ugly) { diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 4b0ea05..a45186cb 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -48,39 +48,6 @@ struct dsa_switch { struct net_device *ports[DSA_MAX_PORTS]; }; -struct dsa_switch_tree { - /* - * Configuration data for the platform device that owns - * this dsa switch tree instance. - */ - struct dsa_platform_data *pd; - - /* - * Reference to network device to use, and which tagging - * protocol to use. - */ - struct net_device *master_netdev; - __be16 tag_protocol; - - /* - * The switch and port to which the CPU is attached. - */ - s8 cpu_switch; - s8 cpu_port; - - /* - * Link state polling. - */ - int link_poll_needed; - struct work_struct link_poll_work; - struct timer_list link_poll_timer; - - /* - * Data for the individual switch chips. - */ - struct dsa_switch *ds[DSA_MAX_SWITCHES]; -}; - static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p) { return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port);