Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf50dcc2 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller
Browse files

dsa: Change dsa_uses_{dsa, trailer}_tags() into inline functions



eth_type_trans() will use these functions if DSA is enabled, which
blocks building DSA as a module.

Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6dec4ac4
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1080,7 +1080,7 @@ struct net_device {
	struct vlan_group __rcu	*vlgrp;		/* VLAN group */
	struct vlan_group __rcu	*vlgrp;		/* VLAN group */
#endif
#endif
#ifdef CONFIG_NET_DSA
#ifdef CONFIG_NET_DSA
	void			*dsa_ptr;	/* dsa specific data */
	struct dsa_switch_tree	*dsa_ptr;	/* dsa specific data */
#endif
#endif
	void 			*atalk_ptr;	/* AppleTalk link 	*/
	void 			*atalk_ptr;	/* AppleTalk link 	*/
	struct in_device __rcu	*ip_ptr;	/* IPv4 specific data	*/
	struct in_device __rcu	*ip_ptr;	/* IPv4 specific data	*/
+51 −2
Original line number Original line Diff line number Diff line
@@ -11,6 +11,9 @@
#ifndef __LINUX_NET_DSA_H
#ifndef __LINUX_NET_DSA_H
#define __LINUX_NET_DSA_H
#define __LINUX_NET_DSA_H


#include <linux/timer.h>
#include <linux/workqueue.h>

#define DSA_MAX_SWITCHES	4
#define DSA_MAX_SWITCHES	4
#define DSA_MAX_PORTS		12
#define DSA_MAX_PORTS		12


@@ -54,8 +57,54 @@ struct dsa_platform_data {
	struct dsa_chip_data	*chip;
	struct dsa_chip_data	*chip;
};
};


extern bool dsa_uses_dsa_tags(void *dsa_ptr);
struct dsa_switch_tree {
extern bool dsa_uses_trailer_tags(void *dsa_ptr);
	/*
	 * 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
#endif
+0 −23
Original line number Original line Diff line number Diff line
@@ -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 *************************************************************/
/* link polling *************************************************************/
static void dsa_link_poll_work(struct work_struct *ugly)
static void dsa_link_poll_work(struct work_struct *ugly)
{
{
+0 −33
Original line number Original line Diff line number Diff line
@@ -48,39 +48,6 @@ struct dsa_switch {
	struct net_device	*ports[DSA_MAX_PORTS];
	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)
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);
	return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port);