···548 Support for the Sun GEM chip, aka Sun GigabitEthernet/P 2.0. See also549 <http://www.sun.com/products-n-solutions/hardware/docs/pdf/806-3985-10.pdf>.55000000000551config NET_VENDOR_3COM552 bool "3COM cards"553 depends on NET_ETHERNET && (ISA || EISA || MCA || PCI)
···548 Support for the Sun GEM chip, aka Sun GigabitEthernet/P 2.0. See also549 <http://www.sun.com/products-n-solutions/hardware/docs/pdf/806-3985-10.pdf>.550551+config CASSINI552+ tristate "Sun Cassini support"553+ depends on NET_ETHERNET && PCI554+ select CRC32555+ help556+ Support for the Sun Cassini chip, aka Sun GigaSwift Ethernet. See also557+ <http://www.sun.com/products-n-solutions/hardware/docs/pdf/817-4341-10.pdf>558+559config NET_VENDOR_3COM560 bool "3COM cards"561 depends on NET_ETHERNET && (ISA || EISA || MCA || PCI)
···265 * the interface.266 */267 char name[IFNAMSIZ];00268269 /*270 * I/O specific fields···294295 /* ------- Fields preinitialized in Space.c finish here ------- */296000000000000000297 struct net_device *next_sched;298299 /* Interface index. Unique device identifier */···333 * will (read: may be cleaned up at will).334 */335336- /* These may be needed for future network-power-down code. */337- unsigned long trans_start; /* Time (in jiffies) of last Tx */338- unsigned long last_rx; /* Time of last Rx */339340 unsigned short flags; /* interface flags (a la BSD) */341 unsigned short gflags;···342 unsigned mtu; /* interface MTU value */343 unsigned short type; /* interface hardware type */344 unsigned short hard_header_len; /* hardware hdr length */345- void *priv; /* pointer to private data */346347 struct net_device *master; /* Pointer to master device of a group,348 * which this device is member of.349 */350351 /* Interface address info. */352- unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */353- unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */354 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */355 unsigned char addr_len; /* hardware address length */356 unsigned short dev_id; /* for shared network cards */···357 int promiscuity;358 int allmulti;359360- int watchdog_timeo;361- struct timer_list watchdog_timer;362363 /* Protocol specific pointers */364···367 void *ec_ptr; /* Econet specific data */368 void *ax25_ptr; /* AX.25 specific data */369370- struct list_head poll_list; /* Link to poll list */000000371 int quota;372 int weight;00003730000000374 struct Qdisc *qdisc;375 struct Qdisc *qdisc_sleeping;376- struct Qdisc *qdisc_ingress;377 struct list_head qdisc_list;378 unsigned long tx_queue_len; /* Max frames per queue allowed */379380 /* ingress path synchronizer */381 spinlock_t ingress_lock;00000382 /* hard_start_xmit synchronizer */383- spinlock_t xmit_lock;384 /* cpu id of processor entered to hard_start_xmit or -1,385 if nobody entered there.386 */387 int xmit_lock_owner;388- /* device queue lock */389- spinlock_t queue_lock;0000000000390 /* Number of references to this device */391- atomic_t refcnt;0392 /* delayed register/unregister */393 struct list_head todo_list;394- /* device name hash chain */395- struct hlist_node name_hlist;396 /* device index hash chain */397 struct hlist_node index_hlist;398···435 NETREG_RELEASED, /* called free_netdev */436 } reg_state;437438- /* Net device features */439- unsigned long features;440-#define NETIF_F_SG 1 /* Scatter/gather IO. */441-#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */442-#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */443-#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */444-#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */445-#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */446-#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */447-#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */448-#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */449-#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */450-#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */451-#define NETIF_F_LLTX 4096 /* LockLess TX */452-453 /* Called after device is detached from network. */454 void (*uninit)(struct net_device *dev);455 /* Called after last user reference disappears. */···443 /* Pointers to interface service routines. */444 int (*open)(struct net_device *dev);445 int (*stop)(struct net_device *dev);446- int (*hard_start_xmit) (struct sk_buff *skb,447- struct net_device *dev);448#define HAVE_NETDEV_POLL449- int (*poll) (struct net_device *dev, int *quota);450 int (*hard_header) (struct sk_buff *skb,451 struct net_device *dev,452 unsigned short type,
···265 * the interface.266 */267 char name[IFNAMSIZ];268+ /* device name hash chain */269+ struct hlist_node name_hlist;270271 /*272 * I/O specific fields···292293 /* ------- Fields preinitialized in Space.c finish here ------- */294295+ /* Net device features */296+ unsigned long features;297+#define NETIF_F_SG 1 /* Scatter/gather IO. */298+#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */299+#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */300+#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */301+#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */302+#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */303+#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */304+#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */305+#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */306+#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */307+#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */308+#define NETIF_F_LLTX 4096 /* LockLess TX */309+310 struct net_device *next_sched;311312 /* Interface index. Unique device identifier */···316 * will (read: may be cleaned up at will).317 */318000319320 unsigned short flags; /* interface flags (a la BSD) */321 unsigned short gflags;···328 unsigned mtu; /* interface MTU value */329 unsigned short type; /* interface hardware type */330 unsigned short hard_header_len; /* hardware hdr length */0331332 struct net_device *master; /* Pointer to master device of a group,333 * which this device is member of.334 */335336 /* Interface address info. */00337 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */338 unsigned char addr_len; /* hardware address length */339 unsigned short dev_id; /* for shared network cards */···346 int promiscuity;347 int allmulti;34800349350 /* Protocol specific pointers */351···358 void *ec_ptr; /* Econet specific data */359 void *ax25_ptr; /* AX.25 specific data */360361+/*362+ * Cache line mostly used on receive path (including eth_type_trans())363+ */364+ struct list_head poll_list ____cacheline_aligned_in_smp;365+ /* Link to poll list */366+367+ int (*poll) (struct net_device *dev, int *quota);368 int quota;369 int weight;370+ unsigned long last_rx; /* Time of last Rx */371+ /* Interface address info used in eth_type_trans() */372+ unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 373+ because most packets are unicast) */374375+ unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */376+377+/*378+ * Cache line mostly used on queue transmit path (qdisc)379+ */380+ /* device queue lock */381+ spinlock_t queue_lock ____cacheline_aligned_in_smp;382 struct Qdisc *qdisc;383 struct Qdisc *qdisc_sleeping;0384 struct list_head qdisc_list;385 unsigned long tx_queue_len; /* Max frames per queue allowed */386387 /* ingress path synchronizer */388 spinlock_t ingress_lock;389+ struct Qdisc *qdisc_ingress;390+391+/*392+ * One part is mostly used on xmit path (device)393+ */394 /* hard_start_xmit synchronizer */395+ spinlock_t xmit_lock ____cacheline_aligned_in_smp;396 /* cpu id of processor entered to hard_start_xmit or -1,397 if nobody entered there.398 */399 int xmit_lock_owner;400+ void *priv; /* pointer to private data */401+ int (*hard_start_xmit) (struct sk_buff *skb,402+ struct net_device *dev);403+ /* These may be needed for future network-power-down code. */404+ unsigned long trans_start; /* Time (in jiffies) of last Tx */405+406+ int watchdog_timeo; /* used by dev_watchdog() */407+ struct timer_list watchdog_timer;408+409+/*410+ * refcnt is a very hot point, so align it on SMP411+ */412 /* Number of references to this device */413+ atomic_t refcnt ____cacheline_aligned_in_smp;414+415 /* delayed register/unregister */416 struct list_head todo_list;00417 /* device index hash chain */418 struct hlist_node index_hlist;419···396 NETREG_RELEASED, /* called free_netdev */397 } reg_state;398000000000000000399 /* Called after device is detached from network. */400 void (*uninit)(struct net_device *dev);401 /* Called after last user reference disappears. */···419 /* Pointers to interface service routines. */420 int (*open)(struct net_device *dev);421 int (*stop)(struct net_device *dev);00422#define HAVE_NETDEV_POLL0423 int (*hard_header) (struct sk_buff *skb,424 struct net_device *dev,425 unsigned short type,
···178 if (vcc->push)179 vcc->push(vcc, NULL); /* atmarpd has no push */180181- vcc_remove_socket(sk); /* no more receive */182-183 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {184 atm_return(vcc,skb->truesize);185 kfree_skb(skb);···186 module_put(vcc->dev->ops->owner);187 atm_dev_put(vcc->dev);188 }00189}190191
···178 if (vcc->push)179 vcc->push(vcc, NULL); /* atmarpd has no push */18000181 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {182 atm_return(vcc,skb->truesize);183 kfree_skb(skb);···188 module_put(vcc->dev->ops->owner);189 atm_dev_put(vcc->dev);190 }191+192+ vcc_remove_socket(sk);193}194195
+26-8
net/atm/ioctl.c
···105 if (!error)106 sock->state = SS_CONNECTED;107 goto done;108- default:0000000000000000000000000109 break;110 }111-112- if (cmd == ATMMPC_CTRL || cmd == ATMMPC_DATA)113- request_module("mpoa");114- if (cmd == ATMARPD_CTRL)115- request_module("clip");116- if (cmd == ATMLEC_CTRL)117- request_module("lec");118119 error = -ENOIOCTLCMD;120
···105 if (!error)106 sock->state = SS_CONNECTED;107 goto done;108+ case ATM_SETBACKEND:109+ case ATM_NEWBACKENDIF:110+ {111+ atm_backend_t backend;112+ error = get_user(backend, (atm_backend_t __user *) argp);113+ if (error)114+ goto done;115+ switch (backend) {116+ case ATM_BACKEND_PPP:117+ request_module("pppoatm");118+ break;119+ case ATM_BACKEND_BR2684:120+ request_module("br2684");121+ break;122+ }123+ }124+ break;125+ case ATMMPC_CTRL:126+ case ATMMPC_DATA:127+ request_module("mpoa");128+ break;129+ case ATMARPD_CTRL:130+ request_module("clip");131+ break;132+ case ATMLEC_CTRL:133+ request_module("lec");134 break;135 }0000000136137 error = -ENOIOCTLCMD;138
···211int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset,212 struct iovec *to, int len)213{214- int start = skb_headlen(skb);215- int i, copy = start - offset;000216217- /* Copy header. */218- if (copy > 0) {219- if (copy > len)220- copy = len;221- if (memcpy_toiovec(to, skb->data + offset, copy))222- goto fault;223- if ((len -= copy) == 0)224- return 0;225- offset += copy;226- }227228- /* Copy paged appendix. Hmm... why does this look so complicated? */229- for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {230- int end;231-232- BUG_TRAP(start <= offset + len);233-234- end = start + skb_shinfo(skb)->frags[i].size;235- if ((copy = end - offset) > 0) {236- int err;237- u8 *vaddr;238- skb_frag_t *frag = &skb_shinfo(skb)->frags[i];239- struct page *page = frag->page;240241 if (copy > len)242 copy = len;243- vaddr = kmap(page);244- err = memcpy_toiovec(to, vaddr + frag->page_offset +245- offset - start, copy);246- kunmap(page);00000247 if (err)248 goto fault;249 if (!(len -= copy))250 return 0;251 offset += copy;252 }253- start = end;00254 }255-256- if (skb_shinfo(skb)->frag_list) {257- struct sk_buff *list = skb_shinfo(skb)->frag_list;258-259- for (; list; list = list->next) {260- int end;261-262- BUG_TRAP(start <= offset + len);263-264- end = start + list->len;265- if ((copy = end - offset) > 0) {266- if (copy > len)267- copy = len;268- if (skb_copy_datagram_iovec(list,269- offset - start,270- to, copy))271- goto fault;272- if ((len -= copy) == 0)273- return 0;274- offset += copy;275- }276- start = end;277- }278 }279- if (!len)280- return 0;281-282fault:283 return -EFAULT;284}
···211int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset,212 struct iovec *to, int len)213{214+ int i, err, fraglen, end = 0;215+ struct sk_buff *next = skb_shinfo(skb)->frag_list;216+next_skb:217+ fraglen = skb_headlen(skb);218+ i = -1;219220+ while (1) {221+ int start = end;00000000222223+ if ((end += fraglen) > offset) {224+ int copy = end - offset, o = offset - start;0000000000225226 if (copy > len)227 copy = len;228+ if (i == -1)229+ err = memcpy_toiovec(to, skb->data + o, copy);230+ else {231+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];232+ struct page *page = frag->page;233+ void *p = kmap(page) + frag->page_offset + o;234+ err = memcpy_toiovec(to, p, copy);235+ kunmap(page);236+ }237 if (err)238 goto fault;239 if (!(len -= copy))240 return 0;241 offset += copy;242 }243+ if (++i >= skb_shinfo(skb)->nr_frags)244+ break;245+ fraglen = skb_shinfo(skb)->frags[i].size;246 }247+ if (next) {248+ skb = next;249+ BUG_ON(skb_shinfo(skb)->frag_list);250+ next = skb->next;251+ goto next_skb;000000000000000000252 }000253fault:254 return -EFAULT;255}
+2
net/core/dev.c
···1259 if (skb_checksum_help(skb, 0))1260 goto out_kfree_skb;1261001262 /* Disable soft irqs for various locks below. Also 1263 * stops preemption for RCU. 1264 */
···1259 if (skb_checksum_help(skb, 0))1260 goto out_kfree_skb;12611262+ spin_lock_prefetch(&dev->queue_lock);1263+1264 /* Disable soft irqs for various locks below. Also 1265 * stops preemption for RCU. 1266 */
+12-8
net/core/sock.c
···660 sock_lock_init(sk);661 }662663- if (security_sk_alloc(sk, family, priority)) {664- if (slab != NULL)665- kmem_cache_free(slab, sk);666- else667- kfree(sk);668- sk = NULL;669- } else670- __module_get(prot->owner);671 }672 return sk;0000000673}674675void sk_free(struct sock *sk)
···660 sock_lock_init(sk);661 }662663+ if (security_sk_alloc(sk, family, priority))664+ goto out_free;665+666+ if (!try_module_get(prot->owner))667+ goto out_free;000668 }669 return sk;670+671+out_free:672+ if (slab != NULL)673+ kmem_cache_free(slab, sk);674+ else675+ kfree(sk);676+ return NULL;677}678679void sk_free(struct sock *sk)
+21-10
net/ethernet/eth.c
···146 return 0;147}1480000000000000149150/*151 * Determine the packet's protocol ID. The rule here is that we ···171 struct ethhdr *eth;172 unsigned char *rawp;173174- skb->mac.raw=skb->data;175 skb_pull(skb,ETH_HLEN);176 eth = eth_hdr(skb);177178- if(*eth->h_dest&1)179- {180- if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)181- skb->pkt_type=PACKET_BROADCAST;182 else183- skb->pkt_type=PACKET_MULTICAST;184 }185186 /*···190 * seems to set IFF_PROMISC.191 */192193- else if(1 /*dev->flags&IFF_PROMISC*/)194- {195- if(memcmp(eth->h_dest,dev->dev_addr, ETH_ALEN))196- skb->pkt_type=PACKET_OTHERHOST;197 }198199 if (ntohs(eth->h_proto) >= 1536)
···146 return 0;147}148149+static inline unsigned int compare_eth_addr(const unsigned char *__a, const unsigned char *__b)150+{151+ const unsigned short *dest = (unsigned short *) __a;152+ const unsigned short *devaddr = (unsigned short *) __b;153+ unsigned int res;154+155+ BUILD_BUG_ON(ETH_ALEN != 6);156+ res = ((dest[0] ^ devaddr[0]) |157+ (dest[1] ^ devaddr[1]) |158+ (dest[2] ^ devaddr[2])) != 0;159+160+ return res;161+}162163/*164 * Determine the packet's protocol ID. The rule here is that we ···158 struct ethhdr *eth;159 unsigned char *rawp;160161+ skb->mac.raw = skb->data;162 skb_pull(skb,ETH_HLEN);163 eth = eth_hdr(skb);164165+ if (*eth->h_dest&1) {166+ if (!compare_eth_addr(eth->h_dest, dev->broadcast))167+ skb->pkt_type = PACKET_BROADCAST;0168 else169+ skb->pkt_type = PACKET_MULTICAST;170 }171172 /*···178 * seems to set IFF_PROMISC.179 */180181+ else if(1 /*dev->flags&IFF_PROMISC*/) {182+ if (unlikely(compare_eth_addr(eth->h_dest, dev->dev_addr)))183+ skb->pkt_type = PACKET_OTHERHOST;0184 }185186 if (ntohs(eth->h_proto) >= 1536)
+6-5
net/ipv4/tcp_output.c
···190 }191192 /* Set initial window to value enough for senders,193- * following RFC1414. Senders, not following this RFC,194 * will be satisfied with 2.195 */196 if (mss > (1<<*rcv_wscale)) {197- int init_cwnd = 4;198- if (mss > 1460*3)0199 init_cwnd = 2;200- else if (mss > 1460)201- init_cwnd = 3;202 if (*rcv_wnd > init_cwnd*mss)203 *rcv_wnd = init_cwnd*mss;204 }
···190 }191192 /* Set initial window to value enough for senders,193+ * following RFC2414. Senders, not following this RFC,194 * will be satisfied with 2.195 */196 if (mss > (1<<*rcv_wscale)) {197+ int init_cwnd;198+199+ if (mss > 1460)200 init_cwnd = 2;201+ else202+ init_cwnd = (mss > 1095) ? 3 : 4;203 if (*rcv_wnd > init_cwnd*mss)204 *rcv_wnd = init_cwnd*mss;205 }
+16-10
net/rose/af_rose.c
···1472static int __init rose_proto_init(void)1473{1474 int i;1475- int rc = proto_register(&rose_proto, 0);147600000001477 if (rc != 0)1478 goto out;14791480 rose_callsign = null_ax25_address;14811482- if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) {1483- printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n");1484- return -1;1485- }1486-1487 dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL);1488 if (dev_rose == NULL) {1489 printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n");1490- return -1;01491 }14921493 memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*));···1503 name, rose_setup);1504 if (!dev) {1505 printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n");01506 goto fail;1507 }1508- if (register_netdev(dev)) {1509- printk(KERN_ERR "ROSE: netdevice regeistration failed\n");01510 free_netdev(dev);1511 goto fail;1512 }···1541 free_netdev(dev_rose[i]);1542 }1543 kfree(dev_rose);01544 proto_unregister(&rose_proto);1545- return -ENOMEM;1546}1547module_init(rose_proto_init);1548
···1145 if (!try_module_get(net_families[family]->owner))1146 goto out_release;11471148- if ((err = net_families[family]->create(sock, protocol)) < 0)01149 goto out_module_put;001150 /*1151 * Now to bump the refcnt of the [loadable] module that owns this1152 * socket at sock_release time we decrement its refcnt.···1363 newsock->type = sock->type;1364 newsock->ops = sock->ops;13651366- err = security_socket_accept(sock, newsock);1367- if (err)1368- goto out_release;1369-1370 /*1371 * We don't need try_module_get here, as the listening socket (sock)1372 * has the protocol module (sock->ops->owner) held.1373 */1374 __module_get(newsock->ops->owner);000013751376 err = sock->ops->accept(sock, newsock, sock->file->f_flags);1377 if (err < 0)
···1145 if (!try_module_get(net_families[family]->owner))1146 goto out_release;11471148+ if ((err = net_families[family]->create(sock, protocol)) < 0) {1149+ sock->ops = NULL;1150 goto out_module_put;1151+ }1152+1153 /*1154 * Now to bump the refcnt of the [loadable] module that owns this1155 * socket at sock_release time we decrement its refcnt.···1360 newsock->type = sock->type;1361 newsock->ops = sock->ops;136200001363 /*1364 * We don't need try_module_get here, as the listening socket (sock)1365 * has the protocol module (sock->ops->owner) held.1366 */1367 __module_get(newsock->ops->owner);1368+1369+ err = security_socket_accept(sock, newsock);1370+ if (err)1371+ goto out_release;13721373 err = sock->ops->accept(sock, newsock, sock->file->f_flags);1374 if (err < 0)