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

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
...@@ -69,6 +69,11 @@ config CASSINI ...@@ -69,6 +69,11 @@ config CASSINI
Support for the Sun Cassini chip, aka Sun GigaSwift Ethernet. See also 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>. <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 config SUNVNET
tristate "Sun Virtual Network support" tristate "Sun Virtual Network support"
depends on SUN_LDOMS depends on SUN_LDOMS
......
...@@ -7,5 +7,6 @@ obj-$(CONFIG_SUNQE) += sunqe.o ...@@ -7,5 +7,6 @@ obj-$(CONFIG_SUNQE) += sunqe.o
obj-$(CONFIG_SUNBMAC) += sunbmac.o obj-$(CONFIG_SUNBMAC) += sunbmac.o
obj-$(CONFIG_SUNGEM) += sungem.o obj-$(CONFIG_SUNGEM) += sungem.o
obj-$(CONFIG_CASSINI) += cassini.o obj-$(CONFIG_CASSINI) += cassini.o
obj-$(CONFIG_SUNVNET_COMMON) += sunvnet_common.o
obj-$(CONFIG_SUNVNET) += sunvnet.o obj-$(CONFIG_SUNVNET) += sunvnet.o
obj-$(CONFIG_NIU) += niu.o obj-$(CONFIG_NIU) += niu.o
This diff is collapsed.
This diff is collapsed.
#ifndef _SUNVNET_H #ifndef _SUNVNETCOMMON_H
#define _SUNVNET_H #define _SUNVNETCOMMON_H
#include <linux/interrupt.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 /* length of time (or less) we expect pending descriptors to be marked
* as VIO_DESC_DONE and skbs ready to be freed * as VIO_DESC_DONE and skbs ready to be freed
*/ */
#define VNET_CLEAN_TIMEOUT ((HZ/100)+1) #define VNET_CLEAN_TIMEOUT ((HZ / 100) + 1)
#define VNET_MAXPACKET (65535ULL + ETH_HLEN + VLAN_HLEN) #define VNET_MAXPACKET (65535ULL + ETH_HLEN + VLAN_HLEN)
#define VNET_TX_RING_SIZE 512 #define VNET_TX_RING_SIZE 512
...@@ -29,7 +21,9 @@ ...@@ -29,7 +21,9 @@
*/ */
#define VNET_PACKET_SKIP 6 #define VNET_PACKET_SKIP 6
#define VNET_MAXCOOKIES (VNET_MAXPACKET/PAGE_SIZE + 1) #define VNET_MAXCOOKIES (VNET_MAXPACKET / PAGE_SIZE + 1)
#define VNET_MAX_TXQS 16
struct vnet_tx_entry { struct vnet_tx_entry {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -111,4 +105,29 @@ struct vnet { ...@@ -111,4 +105,29 @@ struct vnet {
int nports; 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 */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment