2005-04-16 22:20:36 +00:00
|
|
|
#ifndef _NET_INET_IPX_H_
|
|
|
|
#define _NET_INET_IPX_H_
|
|
|
|
/*
|
|
|
|
* The following information is in its entirety obtained from:
|
|
|
|
*
|
|
|
|
* Novell 'IPX Router Specification' Version 1.10
|
|
|
|
* Part No. 107-000029-001
|
|
|
|
*
|
|
|
|
* Which is available from ftp.novell.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <net/datalink.h>
|
|
|
|
#include <linux/ipx.h>
|
|
|
|
#include <linux/list.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
struct ipx_address {
|
2006-11-03 08:27:06 +00:00
|
|
|
__be32 net;
|
2005-04-16 22:20:36 +00:00
|
|
|
__u8 node[IPX_NODE_LEN];
|
2006-11-03 08:27:06 +00:00
|
|
|
__be16 sock;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define ipx_broadcast_node "\377\377\377\377\377\377"
|
|
|
|
#define ipx_this_node "\0\0\0\0\0\0"
|
|
|
|
|
|
|
|
#define IPX_MAX_PPROP_HOPS 8
|
|
|
|
|
|
|
|
struct ipxhdr {
|
2010-06-03 10:21:52 +00:00
|
|
|
__be16 ipx_checksum __packed;
|
2009-02-15 06:58:35 +00:00
|
|
|
#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)
|
2010-06-03 10:21:52 +00:00
|
|
|
__be16 ipx_pktsize __packed;
|
2005-04-16 22:20:36 +00:00
|
|
|
__u8 ipx_tctrl;
|
|
|
|
__u8 ipx_type;
|
|
|
|
#define IPX_TYPE_UNKNOWN 0x00
|
|
|
|
#define IPX_TYPE_RIP 0x01 /* may also be 0 */
|
|
|
|
#define IPX_TYPE_SAP 0x04 /* may also be 0 */
|
|
|
|
#define IPX_TYPE_SPX 0x05 /* SPX protocol */
|
|
|
|
#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */
|
|
|
|
#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */
|
2010-06-03 10:21:52 +00:00
|
|
|
struct ipx_address ipx_dest __packed;
|
|
|
|
struct ipx_address ipx_source __packed;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
|
|
|
|
{
|
2007-04-26 01:04:18 +00:00
|
|
|
return (struct ipxhdr *)skb_transport_header(skb);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ipx_interface {
|
|
|
|
/* IPX address */
|
2006-11-03 08:27:06 +00:00
|
|
|
__be32 if_netnum;
|
2005-04-16 22:20:36 +00:00
|
|
|
unsigned char if_node[IPX_NODE_LEN];
|
|
|
|
atomic_t refcnt;
|
|
|
|
|
|
|
|
/* physical device info */
|
|
|
|
struct net_device *if_dev;
|
|
|
|
struct datalink_proto *if_dlink;
|
2006-11-03 08:27:06 +00:00
|
|
|
__be16 if_dlink_type;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* socket support */
|
|
|
|
unsigned short if_sknum;
|
|
|
|
struct hlist_head if_sklist;
|
|
|
|
spinlock_t if_sklist_lock;
|
|
|
|
|
|
|
|
/* administrative overhead */
|
|
|
|
int if_ipx_offset;
|
|
|
|
unsigned char if_internal;
|
|
|
|
unsigned char if_primary;
|
|
|
|
|
|
|
|
struct list_head node; /* node in ipx_interfaces list */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ipx_route {
|
2006-11-03 08:27:06 +00:00
|
|
|
__be32 ir_net;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct ipx_interface *ir_intrfc;
|
|
|
|
unsigned char ir_routed;
|
|
|
|
unsigned char ir_router_node[IPX_NODE_LEN];
|
|
|
|
struct list_head node; /* node in ipx_routes list */
|
|
|
|
atomic_t refcnt;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ipx_cb {
|
|
|
|
u8 ipx_tctrl;
|
2006-11-03 08:27:06 +00:00
|
|
|
__be32 ipx_dest_net;
|
|
|
|
__be32 ipx_source_net;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct {
|
2006-11-03 08:27:06 +00:00
|
|
|
__be32 netnum;
|
2005-04-16 22:20:36 +00:00
|
|
|
int index;
|
|
|
|
} last_hop;
|
|
|
|
};
|
|
|
|
|
|
|
|
#include <net/sock.h>
|
|
|
|
|
|
|
|
struct ipx_sock {
|
|
|
|
/* struct sock has to be the first member of ipx_sock */
|
|
|
|
struct sock sk;
|
|
|
|
struct ipx_address dest_addr;
|
|
|
|
struct ipx_interface *intrfc;
|
2006-11-03 08:27:06 +00:00
|
|
|
__be16 port;
|
2005-04-16 22:20:36 +00:00
|
|
|
#ifdef CONFIG_IPX_INTERN
|
|
|
|
unsigned char node[IPX_NODE_LEN];
|
|
|
|
#endif
|
|
|
|
unsigned short type;
|
|
|
|
/*
|
|
|
|
* To handle special ncp connection-handling sockets for mars_nwe,
|
|
|
|
* the connection number must be stored in the socket.
|
|
|
|
*/
|
|
|
|
unsigned short ipx_ncp_conn;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct ipx_sock *ipx_sk(struct sock *sk)
|
|
|
|
{
|
|
|
|
return (struct ipx_sock *)sk;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define IPX_SKB_CB(__skb) ((struct ipx_cb *)&((__skb)->cb[0]))
|
|
|
|
|
|
|
|
#define IPX_MIN_EPHEMERAL_SOCKET 0x4000
|
|
|
|
#define IPX_MAX_EPHEMERAL_SOCKET 0x7fff
|
|
|
|
|
|
|
|
extern struct list_head ipx_routes;
|
|
|
|
extern rwlock_t ipx_routes_lock;
|
|
|
|
|
|
|
|
extern struct list_head ipx_interfaces;
|
2013-09-21 17:22:43 +00:00
|
|
|
struct ipx_interface *ipx_interfaces_head(void);
|
2005-04-16 22:20:36 +00:00
|
|
|
extern spinlock_t ipx_interfaces_lock;
|
|
|
|
|
|
|
|
extern struct ipx_interface *ipx_primary_net;
|
|
|
|
|
2013-09-21 17:22:43 +00:00
|
|
|
int ipx_proc_init(void);
|
|
|
|
void ipx_proc_exit(void);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-09-21 17:22:43 +00:00
|
|
|
const char *ipx_frame_name(__be16);
|
|
|
|
const char *ipx_device_name(struct ipx_interface *intrfc);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
|
|
|
|
{
|
|
|
|
atomic_inc(&intrfc->refcnt);
|
|
|
|
}
|
|
|
|
|
2013-09-21 17:22:43 +00:00
|
|
|
void ipxitf_down(struct ipx_interface *intrfc);
|
2014-02-09 16:54:33 +00:00
|
|
|
struct ipx_interface *ipxitf_find_using_net(__be32 net);
|
|
|
|
int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, char *node);
|
|
|
|
__be16 ipx_cksum(struct ipxhdr *packet, int length);
|
2014-02-09 16:56:32 +00:00
|
|
|
int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc,
|
|
|
|
unsigned char *node);
|
|
|
|
void ipxrtr_del_routes(struct ipx_interface *intrfc);
|
|
|
|
int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
|
|
|
|
struct iovec *iov, size_t len, int noblock);
|
|
|
|
int ipxrtr_route_skb(struct sk_buff *skb);
|
|
|
|
struct ipx_route *ipxrtr_lookup(__be32 net);
|
|
|
|
int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
static __inline__ void ipxitf_put(struct ipx_interface *intrfc)
|
|
|
|
{
|
|
|
|
if (atomic_dec_and_test(&intrfc->refcnt))
|
|
|
|
ipxitf_down(intrfc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline__ void ipxrtr_hold(struct ipx_route *rt)
|
|
|
|
{
|
|
|
|
atomic_inc(&rt->refcnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline__ void ipxrtr_put(struct ipx_route *rt)
|
|
|
|
{
|
|
|
|
if (atomic_dec_and_test(&rt->refcnt))
|
|
|
|
kfree(rt);
|
|
|
|
}
|
|
|
|
#endif /* _NET_INET_IPX_H_ */
|