···548548 Support for the Sun GEM chip, aka Sun GigabitEthernet/P 2.0. See also549549 <http://www.sun.com/products-n-solutions/hardware/docs/pdf/806-3985-10.pdf>.550550551551+config CASSINI552552+ tristate "Sun Cassini support"553553+ depends on NET_ETHERNET && PCI554554+ select CRC32555555+ help556556+ Support for the Sun Cassini chip, aka Sun GigaSwift Ethernet. See also557557+ <http://www.sun.com/products-n-solutions/hardware/docs/pdf/817-4341-10.pdf>558558+551559config NET_VENDOR_3COM552560 bool "3COM cards"553561 depends on NET_ETHERNET && (ISA || EISA || MCA || PCI)
···265265 * the interface.266266 */267267 char name[IFNAMSIZ];268268+ /* device name hash chain */269269+ struct hlist_node name_hlist;268270269271 /*270272 * I/O specific fields···294292295293 /* ------- Fields preinitialized in Space.c finish here ------- */296294295295+ /* Net device features */296296+ unsigned long features;297297+#define NETIF_F_SG 1 /* Scatter/gather IO. */298298+#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */299299+#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */300300+#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */301301+#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */302302+#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */303303+#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */304304+#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */305305+#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */306306+#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */307307+#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */308308+#define NETIF_F_LLTX 4096 /* LockLess TX */309309+297310 struct net_device *next_sched;298311299312 /* Interface index. Unique device identifier */···333316 * will (read: may be cleaned up at will).334317 */335318336336- /* These may be needed for future network-power-down code. */337337- unsigned long trans_start; /* Time (in jiffies) of last Tx */338338- unsigned long last_rx; /* Time of last Rx */339319340320 unsigned short flags; /* interface flags (a la BSD) */341321 unsigned short gflags;···342328 unsigned mtu; /* interface MTU value */343329 unsigned short type; /* interface hardware type */344330 unsigned short hard_header_len; /* hardware hdr length */345345- void *priv; /* pointer to private data */346331347332 struct net_device *master; /* Pointer to master device of a group,348333 * which this device is member of.349334 */350335351336 /* Interface address info. */352352- unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */353353- unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */354337 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */355338 unsigned char addr_len; /* hardware address length */356339 unsigned short dev_id; /* for shared network cards */···357346 int promiscuity;358347 int allmulti;359348360360- int watchdog_timeo;361361- struct timer_list watchdog_timer;362349363350 /* Protocol specific pointers */364351···367358 void *ec_ptr; /* Econet specific data */368359 void *ax25_ptr; /* AX.25 specific data */369360370370- struct list_head poll_list; /* Link to poll list */361361+/*362362+ * Cache line mostly used on receive path (including eth_type_trans())363363+ */364364+ struct list_head poll_list ____cacheline_aligned_in_smp;365365+ /* Link to poll list */366366+367367+ int (*poll) (struct net_device *dev, int *quota);371368 int quota;372369 int weight;370370+ unsigned long last_rx; /* Time of last Rx */371371+ /* Interface address info used in eth_type_trans() */372372+ unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 373373+ because most packets are unicast) */373374375375+ unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */376376+377377+/*378378+ * Cache line mostly used on queue transmit path (qdisc)379379+ */380380+ /* device queue lock */381381+ spinlock_t queue_lock ____cacheline_aligned_in_smp;374382 struct Qdisc *qdisc;375383 struct Qdisc *qdisc_sleeping;376376- struct Qdisc *qdisc_ingress;377384 struct list_head qdisc_list;378385 unsigned long tx_queue_len; /* Max frames per queue allowed */379386380387 /* ingress path synchronizer */381388 spinlock_t ingress_lock;389389+ struct Qdisc *qdisc_ingress;390390+391391+/*392392+ * One part is mostly used on xmit path (device)393393+ */382394 /* hard_start_xmit synchronizer */383383- spinlock_t xmit_lock;395395+ spinlock_t xmit_lock ____cacheline_aligned_in_smp;384396 /* cpu id of processor entered to hard_start_xmit or -1,385397 if nobody entered there.386398 */387399 int xmit_lock_owner;388388- /* device queue lock */389389- spinlock_t queue_lock;400400+ void *priv; /* pointer to private data */401401+ int (*hard_start_xmit) (struct sk_buff *skb,402402+ struct net_device *dev);403403+ /* These may be needed for future network-power-down code. */404404+ unsigned long trans_start; /* Time (in jiffies) of last Tx */405405+406406+ int watchdog_timeo; /* used by dev_watchdog() */407407+ struct timer_list watchdog_timer;408408+409409+/*410410+ * refcnt is a very hot point, so align it on SMP411411+ */390412 /* Number of references to this device */391391- atomic_t refcnt;413413+ atomic_t refcnt ____cacheline_aligned_in_smp;414414+392415 /* delayed register/unregister */393416 struct list_head todo_list;394394- /* device name hash chain */395395- struct hlist_node name_hlist;396417 /* device index hash chain */397418 struct hlist_node index_hlist;398419···435396 NETREG_RELEASED, /* called free_netdev */436397 } reg_state;437398438438- /* Net device features */439439- unsigned long features;440440-#define NETIF_F_SG 1 /* Scatter/gather IO. */441441-#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */442442-#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */443443-#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */444444-#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */445445-#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */446446-#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */447447-#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */448448-#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */449449-#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */450450-#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */451451-#define NETIF_F_LLTX 4096 /* LockLess TX */452452-453399 /* Called after device is detached from network. */454400 void (*uninit)(struct net_device *dev);455401 /* Called after last user reference disappears. */···443419 /* Pointers to interface service routines. */444420 int (*open)(struct net_device *dev);445421 int (*stop)(struct net_device *dev);446446- int (*hard_start_xmit) (struct sk_buff *skb,447447- struct net_device *dev);448422#define HAVE_NETDEV_POLL449449- int (*poll) (struct net_device *dev, int *quota);450423 int (*hard_header) (struct sk_buff *skb,451424 struct net_device *dev,452425 unsigned short type,
···178178 if (vcc->push)179179 vcc->push(vcc, NULL); /* atmarpd has no push */180180181181- vcc_remove_socket(sk); /* no more receive */182182-183181 while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {184182 atm_return(vcc,skb->truesize);185183 kfree_skb(skb);···186188 module_put(vcc->dev->ops->owner);187189 atm_dev_put(vcc->dev);188190 }191191+192192+ vcc_remove_socket(sk);189193}190194191195
+26-8
net/atm/ioctl.c
···105105 if (!error)106106 sock->state = SS_CONNECTED;107107 goto done;108108- default:108108+ case ATM_SETBACKEND:109109+ case ATM_NEWBACKENDIF:110110+ {111111+ atm_backend_t backend;112112+ error = get_user(backend, (atm_backend_t __user *) argp);113113+ if (error)114114+ goto done;115115+ switch (backend) {116116+ case ATM_BACKEND_PPP:117117+ request_module("pppoatm");118118+ break;119119+ case ATM_BACKEND_BR2684:120120+ request_module("br2684");121121+ break;122122+ }123123+ }124124+ break;125125+ case ATMMPC_CTRL:126126+ case ATMMPC_DATA:127127+ request_module("mpoa");128128+ break;129129+ case ATMARPD_CTRL:130130+ request_module("clip");131131+ break;132132+ case ATMLEC_CTRL:133133+ request_module("lec");109134 break;110135 }111111-112112- if (cmd == ATMMPC_CTRL || cmd == ATMMPC_DATA)113113- request_module("mpoa");114114- if (cmd == ATMARPD_CTRL)115115- request_module("clip");116116- if (cmd == ATMLEC_CTRL)117117- request_module("lec");118136119137 error = -ENOIOCTLCMD;120138
···211211int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset,212212 struct iovec *to, int len)213213{214214- int start = skb_headlen(skb);215215- int i, copy = start - offset;214214+ int i, err, fraglen, end = 0;215215+ struct sk_buff *next = skb_shinfo(skb)->frag_list;216216+next_skb:217217+ fraglen = skb_headlen(skb);218218+ i = -1;216219217217- /* Copy header. */218218- if (copy > 0) {219219- if (copy > len)220220- copy = len;221221- if (memcpy_toiovec(to, skb->data + offset, copy))222222- goto fault;223223- if ((len -= copy) == 0)224224- return 0;225225- offset += copy;226226- }220220+ while (1) {221221+ int start = end;227222228228- /* Copy paged appendix. Hmm... why does this look so complicated? */229229- for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {230230- int end;231231-232232- BUG_TRAP(start <= offset + len);233233-234234- end = start + skb_shinfo(skb)->frags[i].size;235235- if ((copy = end - offset) > 0) {236236- int err;237237- u8 *vaddr;238238- skb_frag_t *frag = &skb_shinfo(skb)->frags[i];239239- struct page *page = frag->page;223223+ if ((end += fraglen) > offset) {224224+ int copy = end - offset, o = offset - start;240225241226 if (copy > len)242227 copy = len;243243- vaddr = kmap(page);244244- err = memcpy_toiovec(to, vaddr + frag->page_offset +245245- offset - start, copy);246246- kunmap(page);228228+ if (i == -1)229229+ err = memcpy_toiovec(to, skb->data + o, copy);230230+ else {231231+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];232232+ struct page *page = frag->page;233233+ void *p = kmap(page) + frag->page_offset + o;234234+ err = memcpy_toiovec(to, p, copy);235235+ kunmap(page);236236+ }247237 if (err)248238 goto fault;249239 if (!(len -= copy))250240 return 0;251241 offset += copy;252242 }253253- start = end;243243+ if (++i >= skb_shinfo(skb)->nr_frags)244244+ break;245245+ fraglen = skb_shinfo(skb)->frags[i].size;254246 }255255-256256- if (skb_shinfo(skb)->frag_list) {257257- struct sk_buff *list = skb_shinfo(skb)->frag_list;258258-259259- for (; list; list = list->next) {260260- int end;261261-262262- BUG_TRAP(start <= offset + len);263263-264264- end = start + list->len;265265- if ((copy = end - offset) > 0) {266266- if (copy > len)267267- copy = len;268268- if (skb_copy_datagram_iovec(list,269269- offset - start,270270- to, copy))271271- goto fault;272272- if ((len -= copy) == 0)273273- return 0;274274- offset += copy;275275- }276276- start = end;277277- }247247+ if (next) {248248+ skb = next;249249+ BUG_ON(skb_shinfo(skb)->frag_list);250250+ next = skb->next;251251+ goto next_skb;278252 }279279- if (!len)280280- return 0;281281-282253fault:283254 return -EFAULT;284255}
+2
net/core/dev.c
···12591259 if (skb_checksum_help(skb, 0))12601260 goto out_kfree_skb;1261126112621262+ spin_lock_prefetch(&dev->queue_lock);12631263+12621264 /* Disable soft irqs for various locks below. Also 12631265 * stops preemption for RCU. 12641266 */
+12-8
net/core/sock.c
···660660 sock_lock_init(sk);661661 }662662663663- if (security_sk_alloc(sk, family, priority)) {664664- if (slab != NULL)665665- kmem_cache_free(slab, sk);666666- else667667- kfree(sk);668668- sk = NULL;669669- } else670670- __module_get(prot->owner);663663+ if (security_sk_alloc(sk, family, priority))664664+ goto out_free;665665+666666+ if (!try_module_get(prot->owner))667667+ goto out_free;671668 }672669 return sk;670670+671671+out_free:672672+ if (slab != NULL)673673+ kmem_cache_free(slab, sk);674674+ else675675+ kfree(sk);676676+ return NULL;673677}674678675679void sk_free(struct sock *sk)
+21-10
net/ethernet/eth.c
···146146 return 0;147147}148148149149+static inline unsigned int compare_eth_addr(const unsigned char *__a, const unsigned char *__b)150150+{151151+ const unsigned short *dest = (unsigned short *) __a;152152+ const unsigned short *devaddr = (unsigned short *) __b;153153+ unsigned int res;154154+155155+ BUILD_BUG_ON(ETH_ALEN != 6);156156+ res = ((dest[0] ^ devaddr[0]) |157157+ (dest[1] ^ devaddr[1]) |158158+ (dest[2] ^ devaddr[2])) != 0;159159+160160+ return res;161161+}149162150163/*151164 * Determine the packet's protocol ID. The rule here is that we ···171158 struct ethhdr *eth;172159 unsigned char *rawp;173160174174- skb->mac.raw=skb->data;161161+ skb->mac.raw = skb->data;175162 skb_pull(skb,ETH_HLEN);176163 eth = eth_hdr(skb);177164178178- if(*eth->h_dest&1)179179- {180180- if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)181181- skb->pkt_type=PACKET_BROADCAST;165165+ if (*eth->h_dest&1) {166166+ if (!compare_eth_addr(eth->h_dest, dev->broadcast))167167+ skb->pkt_type = PACKET_BROADCAST;182168 else183183- skb->pkt_type=PACKET_MULTICAST;169169+ skb->pkt_type = PACKET_MULTICAST;184170 }185171186172 /*···190178 * seems to set IFF_PROMISC.191179 */192180193193- else if(1 /*dev->flags&IFF_PROMISC*/)194194- {195195- if(memcmp(eth->h_dest,dev->dev_addr, ETH_ALEN))196196- skb->pkt_type=PACKET_OTHERHOST;181181+ else if(1 /*dev->flags&IFF_PROMISC*/) {182182+ if (unlikely(compare_eth_addr(eth->h_dest, dev->dev_addr)))183183+ skb->pkt_type = PACKET_OTHERHOST;197184 }198185199186 if (ntohs(eth->h_proto) >= 1536)
+6-5
net/ipv4/tcp_output.c
···190190 }191191192192 /* Set initial window to value enough for senders,193193- * following RFC1414. Senders, not following this RFC,193193+ * following RFC2414. Senders, not following this RFC,194194 * will be satisfied with 2.195195 */196196 if (mss > (1<<*rcv_wscale)) {197197- int init_cwnd = 4;198198- if (mss > 1460*3)197197+ int init_cwnd;198198+199199+ if (mss > 1460)199200 init_cwnd = 2;200200- else if (mss > 1460)201201- init_cwnd = 3;201201+ else202202+ init_cwnd = (mss > 1095) ? 3 : 4;202203 if (*rcv_wnd > init_cwnd*mss)203204 *rcv_wnd = init_cwnd*mss;204205 }
···11451145 if (!try_module_get(net_families[family]->owner))11461146 goto out_release;1147114711481148- if ((err = net_families[family]->create(sock, protocol)) < 0)11481148+ if ((err = net_families[family]->create(sock, protocol)) < 0) {11491149+ sock->ops = NULL;11491150 goto out_module_put;11511151+ }11521152+11501153 /*11511154 * Now to bump the refcnt of the [loadable] module that owns this11521155 * socket at sock_release time we decrement its refcnt.···13631360 newsock->type = sock->type;13641361 newsock->ops = sock->ops;1365136213661366- err = security_socket_accept(sock, newsock);13671367- if (err)13681368- goto out_release;13691369-13701363 /*13711364 * We don't need try_module_get here, as the listening socket (sock)13721365 * has the protocol module (sock->ops->owner) held.13731366 */13741367 __module_get(newsock->ops->owner);13681368+13691369+ err = security_socket_accept(sock, newsock);13701370+ if (err)13711371+ goto out_release;1375137213761373 err = sock->ops->accept(sock, newsock, sock->file->f_flags);13771374 if (err < 0)