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

Commit 31762eaa authored by Aaron Young's avatar Aaron Young Committed by David S. Miller
Browse files

ldmvsw: Split sunvnet driver into common code



  Split sunvnet.c into sunvnet.c and sunvnet_common.c.

  Details:

  Since the sunvnet and ldmvsw drivers will both use common sunvnet code,
  move the functions (and support functions) anticipated to be common code
  from sunvnet.c to sunvnet_common.c. Similarly, sunvnet.h was renamed to
  sunvnet_common.h. The sunvnet_common.c code will be compiled into the
  kernel and act as a library of functions that are linked by either
  (or both) drivers when loaded.

  Function names for external functions in sunvnet_common.c (to be
  called by both the sunvnet and ldmvsw drivers) were tagged with a "_common"
  suffix to clearly designate them as common functions.

  No functional changes as of yet... just moved code verbatim to the new
  sunvnet_common.c/h files.

  Makefile/Kconfig support added to build sunvnet_common.c file. The code
  is included in the kernel if SUN_LDOMS is defined/selected.

  NOTE - per the SubmittingPatches documentation, since the code was just
  moved from one file another, the code was NOT checkpatch'd in this commit
  to aid in review.

  Signed-off-by: default avatarAaron Young <aaron.young@oracle.com>
  Signed-off-by: default avatarRashmi Narasimhan <rashmi.narasimhan@oracle.com>
  Reviewed-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
  Reviewed-by: default avatarAlexandre Chartre <Alexandre.Chartre@oracle.com>

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1e6bb1a3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -69,6 +69,11 @@ config CASSINI
	  Support for the Sun Cassini chip, aka Sun GigaSwift Ethernet. See also
	  <http://docs.oracle.com/cd/E19113-01/giga.ether.pci/817-4341-10/817-4341-10.pdf>.

config SUNVNET_COMMON
	bool
	depends on SUN_LDOMS
	default y if SUN_LDOMS

config SUNVNET
	tristate "Sun Virtual Network support"
	depends on SUN_LDOMS
+1 −0
Original line number Diff line number Diff line
@@ -7,5 +7,6 @@ obj-$(CONFIG_SUNQE) += sunqe.o
obj-$(CONFIG_SUNBMAC) += sunbmac.o
obj-$(CONFIG_SUNGEM) += sungem.o
obj-$(CONFIG_CASSINI) += cassini.o
obj-$(CONFIG_SUNVNET_COMMON) += sunvnet_common.o
obj-$(CONFIG_SUNVNET) += sunvnet.o
obj-$(CONFIG_NIU) += niu.o
+25 −1730

File changed.

Preview size limit exceeded, changes collapsed.

+1753 −0

File added.

Preview size limit exceeded, changes collapsed.

+32 −13
Original line number Diff line number Diff line
#ifndef _SUNVNET_H
#define _SUNVNET_H
#ifndef _SUNVNETCOMMON_H
#define _SUNVNETCOMMON_H

#include <linux/interrupt.h>

#define DESC_NCOOKIES(entry_size)	\
	((entry_size) - sizeof(struct vio_net_desc))

/* length of time before we decide the hardware is borked,
 * and dev->tx_timeout() should be called to fix the problem
 */
#define VNET_TX_TIMEOUT			(5 * HZ)

/* length of time (or less) we expect pending descriptors to be marked
 * as VIO_DESC_DONE and skbs ready to be freed
 */
@@ -31,6 +23,8 @@

#define	VNET_MAXCOOKIES			(VNET_MAXPACKET / PAGE_SIZE + 1)

#define	VNET_MAX_TXQS		16

struct vnet_tx_entry {
	struct sk_buff		*skb;
	unsigned int		ncookies;
@@ -111,4 +105,29 @@ struct vnet {
	int			nports;
};

#endif /* _SUNVNET_H */
/* Common funcs */
void sunvnet_clean_timer_expire_common(unsigned long port0);
int sunvnet_open_common(struct net_device *dev);
int sunvnet_close_common(struct net_device *dev);
void sunvnet_set_rx_mode_common(struct net_device *dev);
int sunvnet_set_mac_addr_common(struct net_device *dev, void *p);
void sunvnet_tx_timeout_common(struct net_device *dev);
int sunvnet_change_mtu_common(struct net_device *dev, int new_mtu);
int sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev);
u16 sunvnet_select_queue_common(struct net_device *dev,
				struct sk_buff *skb,
				void *accel_priv,
				select_queue_fallback_t fallback);
#ifdef CONFIG_NET_POLL_CONTROLLER
void sunvnet_poll_controller_common(struct net_device *dev);
#endif
void sunvnet_event_common(void *arg, int event);
int sunvnet_send_attr_common(struct vio_driver_state *vio);
int sunvnet_handle_attr_common(struct vio_driver_state *vio, void *arg);
void sunvnet_handshake_complete_common(struct vio_driver_state *vio);
int sunvnet_poll_common(struct napi_struct *napi, int budget);
void sunvnet_port_free_tx_bufs_common(struct vnet_port *port);
void sunvnet_port_add_txq_common(struct vnet_port *port);
void sunvnet_port_rm_txq_common(struct vnet_port *port);

#endif /* _SUNVNETCOMMON_H */