From: Kenn H. <ke...@us...> - 2002-06-06 00:12:29
|
Update of /cvsroot/linux-vax/kernel-2.5/net/core In directory usw-pr-cvs1:/tmp/cvs-serv18183/net/core Modified Files: Makefile datagram.c dev.c neighbour.c rtnetlink.c scm.c skbuff.c sock.c Log Message: Merge with Linus' 2.5.3 release Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/net/core/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile 24 May 2002 00:06:03 -0000 1.3 +++ Makefile 6 Jun 2002 00:12:24 -0000 1.4 @@ -26,5 +26,8 @@ obj-$(CONFIG_NETFILTER) += netfilter.o obj-$(CONFIG_NET_DIVERT) += dv.o obj-$(CONFIG_NET_PROFILE) += profile.o +obj-$(CONFIG_NET_RADIO) += wireless.o +# Ugly. I wish all wireless drivers were moved in drivers/net/wireless +obj-$(CONFIG_NET_PCMCIA_RADIO) += wireless.o include $(TOPDIR)/Rules.make Index: datagram.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/net/core/datagram.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- datagram.c 24 May 2002 00:06:05 -0000 1.3 +++ datagram.c 6 Jun 2002 00:12:24 -0000 1.4 @@ -30,21 +30,18 @@ #include <asm/system.h> #include <linux/mm.h> #include <linux/interrupt.h> -#include <linux/in.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/inet.h> #include <linux/netdevice.h> +#include <linux/rtnetlink.h> #include <linux/poll.h> #include <linux/highmem.h> -#include <net/ip.h> #include <net/protocol.h> -#include <net/route.h> -#include <net/tcp.h> -#include <net/udp.h> #include <linux/skbuff.h> #include <net/sock.h> +#include <net/checksum.h> /* Index: dev.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/net/core/dev.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- dev.c 24 May 2002 00:06:05 -0000 1.3 +++ dev.c 6 Jun 2002 00:12:24 -0000 1.4 @@ -102,6 +102,7 @@ #include <linux/module.h> #if defined(CONFIG_NET_RADIO) || defined(CONFIG_NET_PCMCIA_RADIO) #include <linux/wireless.h> /* Note : will define WIRELESS_EXT */ +#include <net/iw_handler.h> #endif /* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */ #ifdef CONFIG_PLIP extern int plip_init(void); @@ -238,7 +239,7 @@ #ifdef CONFIG_NET_FASTROUTE /* Hack to detect packet socket */ - if (pt->data) { + if ((pt->data) && ((int)(pt->data)!=1)) { netdev_fastroute_obstacles++; dev_clear_fastroute(pt->dev); } @@ -875,7 +876,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) { struct packet_type *ptype; - get_fast_time(&skb->stamp); + do_gettimeofday(&skb->stamp); br_read_lock(BR_NETPROTO_LOCK); for (ptype = ptype_all; ptype!=NULL; ptype = ptype->next) @@ -1218,7 +1219,7 @@ unsigned long flags; if (skb->stamp.tv_sec == 0) - get_fast_time(&skb->stamp); + do_gettimeofday(&skb->stamp); /* The code is rearranged so that the path is the most short when CPU is congested, but is still operating. @@ -1796,122 +1797,6 @@ #endif /* CONFIG_PROC_FS */ -#ifdef WIRELESS_EXT -#ifdef CONFIG_PROC_FS - -/* - * Print one entry of /proc/net/wireless - * This is a clone of /proc/net/dev (just above) - */ -static int sprintf_wireless_stats(char *buffer, struct net_device *dev) -{ - /* Get stats from the driver */ - struct iw_statistics *stats = (dev->get_wireless_stats ? - dev->get_wireless_stats(dev) : - (struct iw_statistics *) NULL); - int size; - - if (stats != (struct iw_statistics *) NULL) { - size = sprintf(buffer, - "%6s: %04x %3d%c %3d%c %3d%c %6d %6d %6d %6d %6d %6d\n", - dev->name, - stats->status, - stats->qual.qual, - stats->qual.updated & 1 ? '.' : ' ', - stats->qual.level, - stats->qual.updated & 2 ? '.' : ' ', - stats->qual.noise, - stats->qual.updated & 4 ? '.' : ' ', - stats->discard.nwid, - stats->discard.code, - stats->discard.fragment, - stats->discard.retries, - stats->discard.misc, - stats->miss.beacon); - stats->qual.updated = 0; - } - else - size = 0; - - return size; -} - -/* - * Print info for /proc/net/wireless (print all entries) - * This is a clone of /proc/net/dev (just above) - */ -static int dev_get_wireless_info(char * buffer, char **start, off_t offset, - int length) -{ - int len = 0; - off_t begin = 0; - off_t pos = 0; - int size; - - struct net_device * dev; - - size = sprintf(buffer, - "Inter-| sta-| Quality | Discarded packets | Missed\n" - " face | tus | link level noise | nwid crypt frag retry misc | beacon\n" - ); - - pos += size; - len += size; - - read_lock(&dev_base_lock); - for (dev = dev_base; dev != NULL; dev = dev->next) { - size = sprintf_wireless_stats(buffer + len, dev); - len += size; - pos = begin + len; - - if (pos < offset) { - len = 0; - begin = pos; - } - if (pos > offset + length) - break; - } - read_unlock(&dev_base_lock); - - *start = buffer + (offset - begin); /* Start of wanted data */ - len -= (offset - begin); /* Start slop */ - if (len > length) - len = length; /* Ending slop */ - if (len < 0) - len = 0; - - return len; -} -#endif /* CONFIG_PROC_FS */ - -/* - * Allow programatic access to /proc/net/wireless even if /proc - * doesn't exist... Also more efficient... - */ -static inline int dev_iwstats(struct net_device *dev, struct ifreq *ifr) -{ - /* Get stats from the driver */ - struct iw_statistics *stats = (dev->get_wireless_stats ? - dev->get_wireless_stats(dev) : - (struct iw_statistics *) NULL); - - if (stats != (struct iw_statistics *) NULL) { - struct iwreq * wrq = (struct iwreq *)ifr; - - /* Copy statistics to the user buffer */ - if(copy_to_user(wrq->u.data.pointer, stats, - sizeof(struct iw_statistics))) - return -EFAULT; - - /* Check if we need to clear the update flag */ - if(wrq->u.data.flags != 0) - stats->qual.updated = 0; - return(0); - } else - return -EOPNOTSUPP; -} -#endif /* WIRELESS_EXT */ - /** * netdev_set_master - set up master/slave pair * @slave: slave device @@ -2209,11 +2094,6 @@ notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); return 0; -#ifdef WIRELESS_EXT - case SIOCGIWSTATS: - return dev_iwstats(dev, ifr); -#endif /* WIRELESS_EXT */ - /* * Unknown or private ioctl */ @@ -2239,17 +2119,6 @@ return -EOPNOTSUPP; } -#ifdef WIRELESS_EXT - if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { - if (dev->do_ioctl) { - if (!netif_device_present(dev)) - return -ENODEV; - return dev->do_ioctl(dev, ifr, cmd); - } - return -EOPNOTSUPP; - } -#endif /* WIRELESS_EXT */ - } return -EINVAL; } @@ -2431,7 +2300,8 @@ } dev_load(ifr.ifr_name); rtnl_lock(); - ret = dev_ifsioc(&ifr, cmd); + /* Follow me in net/core/wireless.c */ + ret = wireless_process_ioctl(&ifr, cmd); rtnl_unlock(); if (!ret && IW_IS_GET(cmd) && copy_to_user(arg, &ifr, sizeof(struct ifreq))) @@ -2856,6 +2726,7 @@ proc_net_create("dev", 0, dev_get_info); create_proc_read_entry("net/softnet_stat", 0, 0, dev_proc_stats, NULL); #ifdef WIRELESS_EXT + /* Available in net/core/wireless.c */ proc_net_create("wireless", 0, dev_get_wireless_info); #endif /* WIRELESS_EXT */ #endif /* CONFIG_PROC_FS */ Index: neighbour.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/net/core/neighbour.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- neighbour.c 24 May 2002 00:06:05 -0000 1.3 +++ neighbour.c 6 Jun 2002 00:12:25 -0000 1.4 @@ -1172,9 +1172,6 @@ return 0; } -#ifdef CONFIG_RTNETLINK - - int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) { struct ndmsg *ndm = NLMSG_DATA(nlh); @@ -1438,12 +1435,7 @@ netlink_broadcast(rtnl, skb, 0, RTMGRP_NEIGH, GFP_ATOMIC); } - - -#endif - - -#endif +#endif /* CONFIG_ARPD */ #ifdef CONFIG_SYSCTL Index: rtnetlink.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/net/core/rtnetlink.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- rtnetlink.c 24 May 2002 00:06:06 -0000 1.3 +++ rtnetlink.c 6 Jun 2002 00:12:25 -0000 1.4 @@ -45,7 +45,6 @@ #include <net/protocol.h> #include <net/arp.h> #include <net/route.h> -#include <net/tcp.h> #include <net/udp.h> #include <net/sock.h> #include <net/pkt_sched.h> @@ -77,15 +76,10 @@ return 0; } -#ifdef CONFIG_RTNETLINK struct sock *rtnl; struct rtnetlink_link * rtnetlink_links[NPROTO]; -#define _S 1 /* superuser privileges required */ -#define _X 2 /* exclusive access to tables required */ -#define _G 4 /* GET request */ - static const int rtm_min[(RTM_MAX+1-RTM_BASE)/4] = { NLMSG_LENGTH(sizeof(struct ifinfomsg)), @@ -533,7 +527,3 @@ rtnetlink_links[PF_UNSPEC] = link_rtnetlink_table; rtnetlink_links[PF_PACKET] = link_rtnetlink_table; } - - - -#endif Index: scm.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/net/core/scm.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- scm.c 24 May 2002 00:06:06 -0000 1.3 +++ scm.c 6 Jun 2002 00:12:25 -0000 1.4 @@ -26,11 +26,7 @@ #include <asm/system.h> #include <asm/uaccess.h> -#include <linux/inet.h> -#include <net/ip.h> #include <net/protocol.h> -#include <net/tcp.h> -#include <net/udp.h> #include <linux/skbuff.h> #include <net/sock.h> #include <net/scm.h> Index: skbuff.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/net/core/skbuff.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- skbuff.c 24 May 2002 00:06:06 -0000 1.3 +++ skbuff.c 6 Jun 2002 00:12:25 -0000 1.4 @@ -49,15 +49,14 @@ #include <linux/string.h> #include <linux/skbuff.h> #include <linux/cache.h> +#include <linux/rtnetlink.h> #include <linux/init.h> #include <linux/highmem.h> -#include <net/ip.h> #include <net/protocol.h> #include <net/dst.h> -#include <net/tcp.h> -#include <net/udp.h> #include <net/sock.h> +#include <net/checksum.h> #include <asm/uaccess.h> #include <asm/system.h> Index: sock.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/net/core/sock.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- sock.c 24 May 2002 00:06:06 -0000 1.3 +++ sock.c 6 Jun 2002 00:12:25 -0000 1.4 @@ -113,24 +113,20 @@ #include <asm/uaccess.h> #include <asm/system.h> -#include <linux/inet.h> #include <linux/netdevice.h> -#include <net/ip.h> #include <net/protocol.h> -#include <net/arp.h> -#include <net/route.h> -#include <net/tcp.h> -#include <net/udp.h> #include <linux/skbuff.h> #include <net/sock.h> -#include <net/raw.h> -#include <net/icmp.h> #include <linux/ipsec.h> #ifdef CONFIG_FILTER #include <linux/filter.h> #endif +#ifdef CONFIG_INET +#include <net/tcp.h> +#endif + /* Run time adjustable parameters. */ __u32 sysctl_wmem_max = SK_WMEM_MAX; __u32 sysctl_rmem_max = SK_RMEM_MAX; @@ -759,48 +755,62 @@ * Generic send/receive buffer handlers */ -struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, - int noblock, int *errcode) +struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len, + unsigned long data_len, int noblock, int *errcode) { - int err; struct sk_buff *skb; long timeo; + int err; timeo = sock_sndtimeo(sk, noblock); - while (1) { - unsigned long try_size = size; - err = sock_error(sk); if (err != 0) goto failure; - /* - * We should send SIGPIPE in these cases according to - * 1003.1g draft 6.4. If we (the user) did a shutdown() - * call however we should not. - * - * Note: This routine isnt just used for datagrams and - * anyway some datagram protocols have a notion of - * close down. - */ - err = -EPIPE; - if (sk->shutdown&SEND_SHUTDOWN) + if (sk->shutdown & SEND_SHUTDOWN) goto failure; if (atomic_read(&sk->wmem_alloc) < sk->sndbuf) { - skb = alloc_skb(try_size, sk->allocation); - if (skb) + skb = alloc_skb(header_len, sk->allocation); + if (skb) { + int npages; + int i; + + /* No pages, we're done... */ + if (!data_len) + break; + + npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT; + skb->truesize += data_len; + skb_shinfo(skb)->nr_frags = npages; + for (i = 0; i < npages; i++) { + struct page *page; + skb_frag_t *frag; + + page = alloc_pages(sk->allocation, 0); + if (!page) { + err = -ENOBUFS; + kfree_skb(skb); + goto failure; + } + + frag = &skb_shinfo(skb)->frags[i]; + frag->page = page; + frag->page_offset = 0; + frag->size = (data_len >= PAGE_SIZE ? + PAGE_SIZE : + data_len); + data_len -= PAGE_SIZE; + } + + /* Full success... */ break; + } err = -ENOBUFS; goto failure; } - - /* - * This means we have too many buffers for this socket already. - */ - set_bit(SOCK_ASYNC_NOSPACE, &sk->socket->flags); set_bit(SOCK_NOSPACE, &sk->socket->flags); err = -EAGAIN; @@ -819,6 +829,12 @@ failure: *errcode = err; return NULL; +} + +struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, + int noblock, int *errcode) +{ + return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); } void __lock_sock(struct sock *sk) |