From 0a9024a2d7c6006e5e3f61852755ce7c5dc8a99e Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Thu, 10 Apr 2008 15:50:25 -0700 Subject: [PATCH] Changes based on feedback from GigaFin. --- datapath/linux-2.4/compat-2.4/compat24.c | 1 + datapath/linux-2.4/compat-2.4/genetlink.c | 1 + .../compat-2.4/include-arm/asm/atomic.h | 6 +- .../linux-2.4/compat-2.4/include/linux/llc.h | 80 +++++++++++++++++++ datapath/linux-2.4/compat-2.4/random32.c | 3 +- datapath/unit.c | 1 + include/netlink.h | 1 + include/openflow-netlink.h | 1 + lib/netlink.c | 2 + 9 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 datapath/linux-2.4/compat-2.4/include/linux/llc.h diff --git a/datapath/linux-2.4/compat-2.4/compat24.c b/datapath/linux-2.4/compat-2.4/compat24.c index bbacf311..f00569df 100644 --- a/datapath/linux-2.4/compat-2.4/compat24.c +++ b/datapath/linux-2.4/compat-2.4/compat24.c @@ -2,6 +2,7 @@ * Distributed under the terms of the GNU GPL version 2. */ +#include #include #include "compat24.h" diff --git a/datapath/linux-2.4/compat-2.4/genetlink.c b/datapath/linux-2.4/compat-2.4/genetlink.c index c9fc55a6..fe7812a7 100644 --- a/datapath/linux-2.4/compat-2.4/genetlink.c +++ b/datapath/linux-2.4/compat-2.4/genetlink.c @@ -6,6 +6,7 @@ * Johannes Berg */ +#include #include #include #include diff --git a/datapath/linux-2.4/compat-2.4/include-arm/asm/atomic.h b/datapath/linux-2.4/compat-2.4/include-arm/asm/atomic.h index 1a1bb450..4b770086 100644 --- a/datapath/linux-2.4/compat-2.4/include-arm/asm/atomic.h +++ b/datapath/linux-2.4/compat-2.4/include-arm/asm/atomic.h @@ -3,8 +3,6 @@ #include_next -#error "Cribbed from linux-2.6/include/asm-arm/atomic.h but untested" - #ifdef __KERNEL__ #if __LINUX_ARM_ARCH__ >= 6 @@ -40,11 +38,11 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new) int ret; unsigned long flags; - raw_local_irq_save(flags); + local_irq_save(flags); ret = v->counter; if (likely(ret == old)) v->counter = new; - raw_local_irq_restore(flags); + local_irq_restore(flags); return ret; } diff --git a/datapath/linux-2.4/compat-2.4/include/linux/llc.h b/datapath/linux-2.4/compat-2.4/include/linux/llc.h new file mode 100644 index 00000000..09f2e6d0 --- /dev/null +++ b/datapath/linux-2.4/compat-2.4/include/linux/llc.h @@ -0,0 +1,80 @@ +#ifndef __LINUX_LLC_H +#define __LINUX_LLC_H +/* + * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators. + * + * Copyright (c) 2001 by Jay Schulist + * + * This program can be redistributed or modified under the terms of the + * GNU General Public License as published by the Free Software Foundation. + * This program is distributed without any warranty or implied warranty + * of merchantability or fitness for a particular purpose. + * + * See the GNU General Public License for more details. + */ +#define __LLC_SOCK_SIZE__ 16 /* sizeof(sockaddr_llc), word align. */ +struct sockaddr_llc { + sa_family_t sllc_family; /* AF_LLC */ + sa_family_t sllc_arphrd; /* ARPHRD_ETHER */ + unsigned char sllc_test; + unsigned char sllc_xid; + unsigned char sllc_ua; /* UA data, only for SOCK_STREAM. */ + unsigned char sllc_sap; + unsigned char sllc_mac[IFHWADDRLEN]; + unsigned char __pad[__LLC_SOCK_SIZE__ - sizeof(sa_family_t) * 2 - + sizeof(unsigned char) * 4 - IFHWADDRLEN]; +}; + +/* sockopt definitions. */ +enum llc_sockopts { + LLC_OPT_UNKNOWN = 0, + LLC_OPT_RETRY, /* max retrans attempts. */ + LLC_OPT_SIZE, /* max PDU size (octets). */ + LLC_OPT_ACK_TMR_EXP, /* ack expire time (secs). */ + LLC_OPT_P_TMR_EXP, /* pf cycle expire time (secs). */ + LLC_OPT_REJ_TMR_EXP, /* rej sent expire time (secs). */ + LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */ + LLC_OPT_TX_WIN, /* tx window size. */ + LLC_OPT_RX_WIN, /* rx window size. */ + LLC_OPT_MAX +}; + +#define LLC_OPT_MAX_RETRY 100 +#define LLC_OPT_MAX_SIZE 4196 +#define LLC_OPT_MAX_WIN 127 +#define LLC_OPT_MAX_ACK_TMR_EXP 60 +#define LLC_OPT_MAX_P_TMR_EXP 60 +#define LLC_OPT_MAX_REJ_TMR_EXP 60 +#define LLC_OPT_MAX_BUSY_TMR_EXP 60 + +/* LLC SAP types. */ +#define LLC_SAP_NULL 0x00 /* NULL SAP. */ +#define LLC_SAP_LLC 0x02 /* LLC Sublayer Managment. */ +#define LLC_SAP_SNA 0x04 /* SNA Path Control. */ +#define LLC_SAP_PNM 0x0E /* Proway Network Managment. */ +#define LLC_SAP_IP 0x06 /* TCP/IP. */ +#define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */ +#define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */ +#define LLC_SAP_8208 0x7E /* ISO 8208 */ +#define LLC_SAP_3COM 0x80 /* 3COM. */ +#define LLC_SAP_PRO 0x8E /* Proway Active Station List */ +#define LLC_SAP_SNAP 0xAA /* SNAP. */ +#define LLC_SAP_BANYAN 0xBC /* Banyan. */ +#define LLC_SAP_IPX 0xE0 /* IPX/SPX. */ +#define LLC_SAP_NETBEUI 0xF0 /* NetBEUI. */ +#define LLC_SAP_LANMGR 0xF4 /* LanManager. */ +#define LLC_SAP_IMPL 0xF8 /* IMPL */ +#define LLC_SAP_DISC 0xFC /* Discovery */ +#define LLC_SAP_OSI 0xFE /* OSI Network Layers. */ +#define LLC_SAP_LAR 0xDC /* LAN Address Resolution */ +#define LLC_SAP_RM 0xD4 /* Resource Management */ +#define LLC_SAP_GLOBAL 0xFF /* Global SAP. */ + +#ifdef __KERNEL__ +#define LLC_SAP_DYN_START 0xC0 +#define LLC_SAP_DYN_STOP 0xDE +#define LLC_SAP_DYN_TRIES 4 + +#define llc_ui_skb_cb(__skb) ((struct sockaddr_llc *)&((__skb)->cb[0])) +#endif /* __KERNEL__ */ +#endif /* __LINUX_LLC_H */ diff --git a/datapath/linux-2.4/compat-2.4/random32.c b/datapath/linux-2.4/compat-2.4/random32.c index 3a19e73a..f3c30e19 100644 --- a/datapath/linux-2.4/compat-2.4/random32.c +++ b/datapath/linux-2.4/compat-2.4/random32.c @@ -33,8 +33,9 @@ */ -#include +#include #include +#include #include #include #include diff --git a/datapath/unit.c b/datapath/unit.c index d9e06f27..94a4439c 100644 --- a/datapath/unit.c +++ b/datapath/unit.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include diff --git a/include/netlink.h b/include/netlink.h index ccd52b0a..48bedbfd 100644 --- a/include/netlink.h +++ b/include/netlink.h @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include diff --git a/include/openflow-netlink.h b/include/openflow-netlink.h index cad7b47b..d9862b0b 100644 --- a/include/openflow-netlink.h +++ b/include/openflow-netlink.h @@ -34,6 +34,7 @@ #ifndef OPENFLOW_NETLINK_H #define OPENFLOW_NETLINK_H 1 +#include #include #define DP_GENL_FAMILY_NAME "OpenFlow" diff --git a/lib/netlink.c b/lib/netlink.c index eb199e59..898f7400 100644 --- a/lib/netlink.c +++ b/lib/netlink.c @@ -150,6 +150,7 @@ nl_sock_create(int protocol, int multicast_group, goto error_free_pid; } +#ifdef NETLINK_ADD_MEMBERSHIP /* This method of joining multicast groups is only supported by newish * kernels, but it allows for an arbitrary number of multicast groups. */ if (multicast_group > 32 @@ -159,6 +160,7 @@ nl_sock_create(int protocol, int multicast_group, multicast_group, strerror(errno)); goto error_free_pid; } +#endif *sockp = sock; return 0; -- 2.30.2