diff options
| author | David S. Miller <davem@nuts.davemloft.net> | 2004-07-21 01:55:16 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2004-07-21 01:55:16 -0700 |
| commit | 7795f94ed30d2edff05ad42362e11616abc2dcf1 (patch) | |
| tree | bfe5e4966b9d9e302c9b154d0fcad99e5b2eb224 /include/net | |
| parent | fe235463f24633840bc6bedc34fc4be0985c3744 (diff) | |
| parent | d6e19c362f91c4e98d5fdf1efb996b5ff595d471 (diff) | |
Merge bk://bk.skbuff.net:20608/linux-2.6-dgramconnect/
into nuts.davemloft.net:/disk1/BK/net-2.6
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/bluetooth/hci.h | 2 | ||||
| -rw-r--r-- | include/net/icmp.h | 12 | ||||
| -rw-r--r-- | include/net/snmp.h | 363 | ||||
| -rw-r--r-- | include/net/tcp.h | 16 |
4 files changed, 96 insertions, 297 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 8bdea57738b0..06e19d370efd 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -432,7 +432,7 @@ struct inquiry_info_with_rssi { __u8 pscan_period_mode; __u8 dev_class[3]; __u16 clock_offset; - __u8 rssi; + __s8 rssi; } __attribute__ ((packed)); #define HCI_EV_CONN_COMPLETE 0x03 diff --git a/include/net/icmp.h b/include/net/icmp.h index edefb1387c95..aa260fcad767 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h @@ -37,18 +37,6 @@ DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics); #define ICMP_INC_STATS(field) SNMP_INC_STATS(icmp_statistics, field) #define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field) #define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field) -#define ICMP_INC_STATS_FIELD(offt) \ - (*((unsigned long *) ((void *) \ - per_cpu_ptr(icmp_statistics[!in_softirq()],\ - smp_processor_id()) + offt)))++ -#define ICMP_INC_STATS_BH_FIELD(offt) \ - (*((unsigned long *) ((void *) \ - per_cpu_ptr(icmp_statistics[0], \ - smp_processor_id()) + offt)))++ -#define ICMP_INC_STATS_USER_FIELD(offt) \ - (*((unsigned long *) ((void *) \ - per_cpu_ptr(icmp_statistics[1], \ - smp_processor_id()) + offt)))++ extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); extern int icmp_rcv(struct sk_buff *skb); diff --git a/include/net/snmp.h b/include/net/snmp.h index c702dda23a4b..b7068876e0eb 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h @@ -22,291 +22,102 @@ #define _SNMP_H #include <linux/cache.h> - -/* - * We use all unsigned longs. Linux will soon be so reliable that even these - * will rapidly get too small 8-). Seriously consider the IpInReceives count - * on the 20Gb/s + networks people expect in a few years time! - */ - -/* - * The rule for padding: - * Best is power of two because then the right structure can be found by a simple - * shift. The structure should be always cache line aligned. - * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add instructions - * to emulate multiply in case it is not power-of-two. Currently n is always <=3 for - * all sizes so simple cache line alignment is enough. - * - * The best solution would be a global CPU local area , especially on 64 and 128byte - * cacheline machine it makes a *lot* of sense -AK - */ - -struct snmp_item { - char *name; - int offset; -}; - -#define SNMP_ITEM(mib,entry,procname) { \ - .name = procname, \ - .offset = offsetof(mib, entry), \ -} - -#define SNMP_ITEM_SENTINEL { \ - .name = NULL, \ - .offset = 0, \ -} +#include <linux/snmp.h> /* - * RFC 1213: MIB-II - * RFC 2011 (updates 1213): SNMPv2-MIB-IP - * RFC 2863: Interfaces Group MIB - * RFC 2465: IPv6 MIB: General Group - * draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables + * Mibs are stored in array of unsigned long. */ -struct ipstats_mib -{ - unsigned long InReceives; - unsigned long InHdrErrors; - unsigned long InTooBigErrors; - unsigned long InNoRoutes; - unsigned long InAddrErrors; - unsigned long InUnknownProtos; - unsigned long InTruncatedPkts; - unsigned long InDiscards; - unsigned long InDelivers; - unsigned long OutForwDatagrams; - unsigned long OutRequests; - unsigned long OutDiscards; - unsigned long OutNoRoutes; - unsigned long ReasmTimeout; - unsigned long ReasmReqds; - unsigned long ReasmOKs; - unsigned long ReasmFails; - unsigned long FragOKs; - unsigned long FragFails; - unsigned long FragCreates; - unsigned long InMcastPkts; - unsigned long OutMcastPkts; - unsigned long __pad[0]; -}; - /* - * RFC 1213: MIB-II ICMP Group - * RFC 2011 (updates 1213): SNMPv2 MIB for IP: ICMP group + * struct snmp_mib{} + * - list of entries for particular API (such as /proc/net/snmp) + * - name of entries. */ -struct icmp_mib -{ - unsigned long IcmpInMsgs; - unsigned long IcmpInErrors; - unsigned long IcmpInDestUnreachs; - unsigned long IcmpInTimeExcds; - unsigned long IcmpInParmProbs; - unsigned long IcmpInSrcQuenchs; - unsigned long IcmpInRedirects; - unsigned long IcmpInEchos; - unsigned long IcmpInEchoReps; - unsigned long IcmpInTimestamps; - unsigned long IcmpInTimestampReps; - unsigned long IcmpInAddrMasks; - unsigned long IcmpInAddrMaskReps; - unsigned long IcmpOutMsgs; - unsigned long IcmpOutErrors; - unsigned long IcmpOutDestUnreachs; - unsigned long IcmpOutTimeExcds; - unsigned long IcmpOutParmProbs; - unsigned long IcmpOutSrcQuenchs; - unsigned long IcmpOutRedirects; - unsigned long IcmpOutEchos; - unsigned long IcmpOutEchoReps; - unsigned long IcmpOutTimestamps; - unsigned long IcmpOutTimestampReps; - unsigned long IcmpOutAddrMasks; - unsigned long IcmpOutAddrMaskReps; - unsigned long dummy; - unsigned long __pad[0]; +struct snmp_mib { + char *name; + int entry; }; -/* - * RFC 2466: ICMPv6-MIB - */ -struct icmpv6_mib -{ - unsigned long Icmp6InMsgs; - unsigned long Icmp6InErrors; - - unsigned long Icmp6InDestUnreachs; - unsigned long Icmp6InPktTooBigs; - unsigned long Icmp6InTimeExcds; - unsigned long Icmp6InParmProblems; - - unsigned long Icmp6InEchos; - unsigned long Icmp6InEchoReplies; - unsigned long Icmp6InGroupMembQueries; - unsigned long Icmp6InGroupMembResponses; - unsigned long Icmp6InGroupMembReductions; - unsigned long Icmp6InRouterSolicits; - unsigned long Icmp6InRouterAdvertisements; - unsigned long Icmp6InNeighborSolicits; - unsigned long Icmp6InNeighborAdvertisements; - unsigned long Icmp6InRedirects; - - unsigned long Icmp6OutMsgs; +#define SNMP_MIB_ITEM(_name,_entry) { \ + .name = _name, \ + .entry = _entry, \ +} - unsigned long Icmp6OutDestUnreachs; - unsigned long Icmp6OutPktTooBigs; - unsigned long Icmp6OutTimeExcds; - unsigned long Icmp6OutParmProblems; +#define SNMP_MIB_SENTINEL { \ + .name = NULL, \ + .entry = 0, \ +} - unsigned long Icmp6OutEchoReplies; - unsigned long Icmp6OutRouterSolicits; - unsigned long Icmp6OutNeighborSolicits; - unsigned long Icmp6OutNeighborAdvertisements; - unsigned long Icmp6OutRedirects; - unsigned long Icmp6OutGroupMembResponses; - unsigned long Icmp6OutGroupMembReductions; - unsigned long __pad[0]; -}; - -/* - * RFC 1213: MIB-II TCP group - * RFC 2012 (updates 1213): SNMPv2-MIB-TCP - */ -struct tcp_mib -{ - unsigned long TcpRtoAlgorithm; - unsigned long TcpRtoMin; - unsigned long TcpRtoMax; - unsigned long TcpMaxConn; - unsigned long TcpActiveOpens; - unsigned long TcpPassiveOpens; - unsigned long TcpAttemptFails; - unsigned long TcpEstabResets; - unsigned long TcpCurrEstab; - unsigned long TcpInSegs; - unsigned long TcpOutSegs; - unsigned long TcpRetransSegs; - unsigned long TcpInErrs; - unsigned long TcpOutRsts; - unsigned long __pad[0]; -}; - /* - * RFC 1213: MIB-II UDP group - * RFC 2013 (updates 1213): SNMPv2-MIB-UDP + * We use all unsigned longs. Linux will soon be so reliable that even + * these will rapidly get too small 8-). Seriously consider the IpInReceives + * count on the 20Gb/s + networks people expect in a few years time! */ -struct udp_mib -{ - unsigned long UdpInDatagrams; - unsigned long UdpNoPorts; - unsigned long UdpInErrors; - unsigned long UdpOutDatagrams; - unsigned long __pad[0]; -}; -/* draft-ietf-sigtran-sctp-mib-07.txt */ -struct sctp_mib -{ - unsigned long SctpCurrEstab; - unsigned long SctpActiveEstabs; - unsigned long SctpPassiveEstabs; - unsigned long SctpAborteds; - unsigned long SctpShutdowns; - unsigned long SctpOutOfBlues; - unsigned long SctpChecksumErrors; - unsigned long SctpOutCtrlChunks; - unsigned long SctpOutOrderChunks; - unsigned long SctpOutUnorderChunks; - unsigned long SctpInCtrlChunks; - unsigned long SctpInOrderChunks; - unsigned long SctpInUnorderChunks; - unsigned long SctpFragUsrMsgs; - unsigned long SctpReasmUsrMsgs; - unsigned long SctpOutSCTPPacks; - unsigned long SctpInSCTPPacks; - unsigned long SctpRtoAlgorithm; - unsigned long SctpRtoMin; - unsigned long SctpRtoMax; - unsigned long SctpRtoInitial; - unsigned long SctpValCookieLife; - unsigned long SctpMaxInitRetr; - unsigned long __pad[0]; -}; +/* + * The rule for padding: + * Best is power of two because then the right structure can be found by a + * simple shift. The structure should be always cache line aligned. + * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add + * instructions to emulate multiply in case it is not power-of-two. + * Currently n is always <=3 for all sizes so simple cache line alignment + * is enough. + * + * The best solution would be a global CPU local area , especially on 64 + * and 128byte cacheline machine it makes a *lot* of sense -AK + */ -struct linux_mib -{ - unsigned long SyncookiesSent; - unsigned long SyncookiesRecv; - unsigned long SyncookiesFailed; - unsigned long EmbryonicRsts; - unsigned long PruneCalled; - unsigned long RcvPruned; - unsigned long OfoPruned; - unsigned long OutOfWindowIcmps; - unsigned long LockDroppedIcmps; - unsigned long ArpFilter; - unsigned long TimeWaited; - unsigned long TimeWaitRecycled; - unsigned long TimeWaitKilled; - unsigned long PAWSPassiveRejected; - unsigned long PAWSActiveRejected; - unsigned long PAWSEstabRejected; - unsigned long DelayedACKs; - unsigned long DelayedACKLocked; - unsigned long DelayedACKLost; - unsigned long ListenOverflows; - unsigned long ListenDrops; - unsigned long TCPPrequeued; - unsigned long TCPDirectCopyFromBacklog; - unsigned long TCPDirectCopyFromPrequeue; - unsigned long TCPPrequeueDropped; - unsigned long TCPHPHits; - unsigned long TCPHPHitsToUser; - unsigned long TCPPureAcks; - unsigned long TCPHPAcks; - unsigned long TCPRenoRecovery; - unsigned long TCPSackRecovery; - unsigned long TCPSACKReneging; - unsigned long TCPFACKReorder; - unsigned long TCPSACKReorder; - unsigned long TCPRenoReorder; - unsigned long TCPTSReorder; - unsigned long TCPFullUndo; - unsigned long TCPPartialUndo; - unsigned long TCPDSACKUndo; - unsigned long TCPLossUndo; - unsigned long TCPLoss; - unsigned long TCPLostRetransmit; - unsigned long TCPRenoFailures; - unsigned long TCPSackFailures; - unsigned long TCPLossFailures; - unsigned long TCPFastRetrans; - unsigned long TCPForwardRetrans; - unsigned long TCPSlowStartRetrans; - unsigned long TCPTimeouts; - unsigned long TCPRenoRecoveryFail; - unsigned long TCPSackRecoveryFail; - unsigned long TCPSchedulerFailed; - unsigned long TCPRcvCollapsed; - unsigned long TCPDSACKOldSent; - unsigned long TCPDSACKOfoSent; - unsigned long TCPDSACKRecv; - unsigned long TCPDSACKOfoRecv; - unsigned long TCPAbortOnSyn; - unsigned long TCPAbortOnData; - unsigned long TCPAbortOnClose; - unsigned long TCPAbortOnMemory; - unsigned long TCPAbortOnTimeout; - unsigned long TCPAbortOnLinger; - unsigned long TCPAbortFailed; - unsigned long TCPMemoryPressures; - unsigned long __pad[0]; +#define __SNMP_MIB_ALIGN__ ____cacheline_aligned + +/* IPstats */ +#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX +struct ipstats_mib { + unsigned long mibs[IPSTATS_MIB_MAX]; +} __SNMP_MIB_ALIGN__; + +/* ICMP */ +#define ICMP_MIB_DUMMY __ICMP_MIB_MAX +#define ICMP_MIB_MAX (__ICMP_MIB_MAX + 1) + +struct icmp_mib { + unsigned long mibs[ICMP_MIB_MAX]; +} __SNMP_MIB_ALIGN__; + +/* ICMP6 (IPv6-ICMP) */ +#define ICMP6_MIB_MAX __ICMP6_MIB_MAX +struct icmpv6_mib { + unsigned long mibs[ICMP6_MIB_MAX]; +} __SNMP_MIB_ALIGN__; + +/* TCP */ +#define TCP_MIB_MAX __TCP_MIB_MAX +struct tcp_mib { + unsigned long mibs[TCP_MIB_MAX]; +} __SNMP_MIB_ALIGN__; + +/* UDP */ +#define UDP_MIB_MAX __UDP_MIB_MAX +struct udp_mib { + unsigned long mibs[UDP_MIB_MAX]; +} __SNMP_MIB_ALIGN__; + +/* SCTP */ +#define SCTP_MIB_MAX __SCTP_MIB_MAX +struct sctp_mib { + unsigned long mibs[SCTP_MIB_MAX]; +} __SNMP_MIB_ALIGN__; + +/* Linux */ +#define LINUX_MIB_MAX __LINUX_MIB_MAX +struct linux_mib { + unsigned long mibs[LINUX_MIB_MAX]; }; /* - * FIXME: On x86 and some other CPUs the split into user and softirq parts is not needed because - * addl $1,memory is atomic against interrupts (but atomic_inc would be overkill because of the lock - * cycles). Wants new nonlocked_atomic_inc() primitives -AK + * FIXME: On x86 and some other CPUs the split into user and softirq parts + * is not needed because addl $1,memory is atomic against interrupts (but + * atomic_inc would be overkill because of the lock cycles). Wants new + * nonlocked_atomic_inc() primitives -AK */ #define DEFINE_SNMP_STAT(type, name) \ __typeof__(type) *name[2] @@ -317,18 +128,18 @@ struct linux_mib #define SNMP_STAT_USRPTR(name) (name[1]) #define SNMP_INC_STATS_BH(mib, field) \ - (per_cpu_ptr(mib[0], smp_processor_id())->field++) + (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field]++) #define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ - ((*((&per_cpu_ptr(mib[0], smp_processor_id())->field) + (offset)))++) + (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field + (offset)]++) #define SNMP_INC_STATS_USER(mib, field) \ - (per_cpu_ptr(mib[1], smp_processor_id())->field++) + (per_cpu_ptr(mib[1], smp_processor_id())->mibs[field]++) #define SNMP_INC_STATS(mib, field) \ - (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->field++) + (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->mibs[field]++) #define SNMP_DEC_STATS(mib, field) \ - (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->field--) + (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->mibs[field]--) #define SNMP_ADD_STATS_BH(mib, field, addend) \ - (per_cpu_ptr(mib[0], smp_processor_id())->field += addend) + (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field] += addend) #define SNMP_ADD_STATS_USER(mib, field, addend) \ - (per_cpu_ptr(mib[1], smp_processor_id())->field += addend) - + (per_cpu_ptr(mib[1], smp_processor_id())->mibs[field] += addend) + #endif diff --git a/include/net/tcp.h b/include/net/tcp.h index 6c033d3db177..c7d711f5e645 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1543,7 +1543,7 @@ static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb) while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { sk->sk_backlog_rcv(sk, skb1); - NET_INC_STATS_BH(TCPPrequeueDropped); + NET_INC_STATS_BH(LINUX_MIB_TCPPREQUEUEDROPPED); } tp->ucopy.memory = 0; @@ -1575,12 +1575,12 @@ static __inline__ void tcp_set_state(struct sock *sk, int state) switch (state) { case TCP_ESTABLISHED: if (oldstate != TCP_ESTABLISHED) - TCP_INC_STATS(TcpCurrEstab); + TCP_INC_STATS(TCP_MIB_CURRESTAB); break; case TCP_CLOSE: if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) - TCP_INC_STATS(TcpEstabResets); + TCP_INC_STATS(TCP_MIB_ESTABRESETS); sk->sk_prot->unhash(sk); if (tcp_sk(sk)->bind_hash && @@ -1589,7 +1589,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state) /* fall through */ default: if (oldstate==TCP_ESTABLISHED) - TCP_DEC_STATS(TcpCurrEstab); + TCP_DEC_STATS(TCP_MIB_CURRESTAB); } /* Change state AFTER socket is unhashed to avoid closed @@ -1961,10 +1961,10 @@ static inline int tcp_use_frto(const struct sock *sk) static inline void tcp_mib_init(void) { /* See RFC 2012 */ - TCP_ADD_STATS_USER(TcpRtoAlgorithm, 1); - TCP_ADD_STATS_USER(TcpRtoMin, TCP_RTO_MIN*1000/HZ); - TCP_ADD_STATS_USER(TcpRtoMax, TCP_RTO_MAX*1000/HZ); - TCP_ADD_STATS_USER(TcpMaxConn, -1); + TCP_ADD_STATS_USER(TCP_MIB_RTOALGORITHM, 1); + TCP_ADD_STATS_USER(TCP_MIB_RTOMIN, TCP_RTO_MIN*1000/HZ); + TCP_ADD_STATS_USER(TCP_MIB_RTOMAX, TCP_RTO_MAX*1000/HZ); + TCP_ADD_STATS_USER(TCP_MIB_MAXCONN, -1); } /* /proc */ |
