Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

+42 -283
+2 -1
drivers/atm/Makefile
··· 39 39 fore_200e-objs += fore200e_pca_fw.o 40 40 # guess the target endianess to choose the right PCA-200E firmware image 41 41 ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y) 42 - CONFIG_ATM_FORE200E_PCA_FW = $(shell if test -n "`$(CC) -E -dM $(src)/../../include/asm/byteorder.h | grep ' __LITTLE_ENDIAN '`"; then echo $(obj)/pca200e.bin; else echo $(obj)/pca200e_ecd.bin2; fi) 42 + byteorder.h := include$(if $(patsubst $(srctree),,$(objtree)),2)/asm/byteorder.h 43 + CONFIG_ATM_FORE200E_PCA_FW := $(obj)/pca200e$(if $(shell $(CC) -E -dM $(byteorder.h) | grep ' __LITTLE_ENDIAN '),.bin,_ecd.bin2) 43 44 endif 44 45 endif 45 46
+2 -4
drivers/atm/fore200e.c
··· 383 383 switch(fore200e->state) { 384 384 385 385 case FORE200E_STATE_COMPLETE: 386 - if (fore200e->stats) 387 - kfree(fore200e->stats); 386 + kfree(fore200e->stats); 388 387 389 388 case FORE200E_STATE_IRQ: 390 389 free_irq(fore200e->irq, fore200e->atm_dev); ··· 962 963 entry, txq->tail, entry->vc_map, entry->skb); 963 964 964 965 /* free copy of misaligned data */ 965 - if (entry->data) 966 - kfree(entry->data); 966 + kfree(entry->data); 967 967 968 968 /* remove DMA mapping */ 969 969 fore200e->bus->dma_unmap(fore200e, entry->tpd->tsd[ 0 ].buffer, entry->tpd->tsd[ 0 ].length,
+2 -4
drivers/atm/he.c
··· 412 412 init_one_failure: 413 413 if (atm_dev) 414 414 atm_dev_deregister(atm_dev); 415 - if (he_dev) 416 - kfree(he_dev); 415 + kfree(he_dev); 417 416 pci_disable_device(pci_dev); 418 417 return err; 419 418 } ··· 2533 2534 open_failed: 2534 2535 2535 2536 if (err) { 2536 - if (he_vcc) 2537 - kfree(he_vcc); 2537 + kfree(he_vcc); 2538 2538 clear_bit(ATM_VF_ADDR, &vcc->flags); 2539 2539 } 2540 2540 else
+10 -10
drivers/atm/nicstar.c
··· 676 676 PRINTK("nicstar%d: RSQ base at 0x%x.\n", i, (u32) card->rsq.base); 677 677 678 678 /* Initialize SCQ0, the only VBR SCQ used */ 679 - card->scq1 = (scq_info *) NULL; 680 - card->scq2 = (scq_info *) NULL; 679 + card->scq1 = NULL; 680 + card->scq2 = NULL; 681 681 card->scq0 = get_scq(VBR_SCQSIZE, NS_VRSCD0); 682 - if (card->scq0 == (scq_info *) NULL) 682 + if (card->scq0 == NULL) 683 683 { 684 684 printk("nicstar%d: can't get SCQ0.\n", i); 685 685 error = 12; ··· 993 993 int i; 994 994 995 995 if (size != VBR_SCQSIZE && size != CBR_SCQSIZE) 996 - return (scq_info *) NULL; 996 + return NULL; 997 997 998 998 scq = (scq_info *) kmalloc(sizeof(scq_info), GFP_KERNEL); 999 - if (scq == (scq_info *) NULL) 1000 - return (scq_info *) NULL; 999 + if (scq == NULL) 1000 + return NULL; 1001 1001 scq->org = kmalloc(2 * size, GFP_KERNEL); 1002 1002 if (scq->org == NULL) 1003 1003 { 1004 1004 kfree(scq); 1005 - return (scq_info *) NULL; 1005 + return NULL; 1006 1006 } 1007 1007 scq->skb = (struct sk_buff **) kmalloc(sizeof(struct sk_buff *) * 1008 1008 (size / NS_SCQE_SIZE), GFP_KERNEL); 1009 - if (scq->skb == (struct sk_buff **) NULL) 1009 + if (scq->skb == NULL) 1010 1010 { 1011 1011 kfree(scq->org); 1012 1012 kfree(scq); 1013 - return (scq_info *) NULL; 1013 + return NULL; 1014 1014 } 1015 1015 scq->num_entries = size / NS_SCQE_SIZE; 1016 1016 scq->base = (ns_scqe *) ALIGN_ADDRESS(scq->org, size); ··· 1498 1498 vc->cbr_scd = NS_FRSCD + frscdi * NS_FRSCD_SIZE; 1499 1499 1500 1500 scq = get_scq(CBR_SCQSIZE, vc->cbr_scd); 1501 - if (scq == (scq_info *) NULL) 1501 + if (scq == NULL) 1502 1502 { 1503 1503 PRINTK("nicstar%d: can't get fixed rate SCQ.\n", card->index); 1504 1504 card->scd2vc[frscdi] = NULL;
+4 -7
drivers/atm/zatm.c
··· 902 902 zatm_dev->tx_bw += vcc->qos.txtp.min_pcr; 903 903 dealloc_shaper(vcc->dev,zatm_vcc->shaper); 904 904 } 905 - if (zatm_vcc->ring) kfree(zatm_vcc->ring); 905 + kfree(zatm_vcc->ring); 906 906 } 907 907 908 908 ··· 1339 1339 return 0; 1340 1340 out: 1341 1341 for (i = 0; i < NR_MBX; i++) 1342 - if (zatm_dev->mbx_start[i] != 0) 1343 - kfree((void *) zatm_dev->mbx_start[i]); 1344 - if (zatm_dev->rx_map != NULL) 1345 - kfree(zatm_dev->rx_map); 1346 - if (zatm_dev->tx_map != NULL) 1347 - kfree(zatm_dev->tx_map); 1342 + kfree(zatm_dev->mbx_start[i]); 1343 + kfree(zatm_dev->rx_map); 1344 + kfree(zatm_dev->tx_map); 1348 1345 free_irq(zatm_dev->irq, dev); 1349 1346 return error; 1350 1347 }
+19 -67
drivers/net/shaper.c
··· 100 100 101 101 #define SHAPER_BANNER "CymruNet Traffic Shaper BETA 0.04 for Linux 2.1\n" 102 102 103 - /* 104 - * Locking 105 - */ 106 - 107 - static int shaper_lock(struct shaper *sh) 108 - { 109 - /* 110 - * Lock in an interrupt must fail 111 - */ 112 - while (test_and_set_bit(0, &sh->locked)) 113 - { 114 - if (!in_interrupt()) 115 - sleep_on(&sh->wait_queue); 116 - else 117 - return 0; 118 - 119 - } 120 - return 1; 121 - } 122 - 123 103 static void shaper_kick(struct shaper *sh); 124 - 125 - static void shaper_unlock(struct shaper *sh) 126 - { 127 - clear_bit(0, &sh->locked); 128 - wake_up(&sh->wait_queue); 129 - shaper_kick(sh); 130 - } 131 104 132 105 /* 133 106 * Compute clocks on a buffer ··· 130 157 * Throw a frame at a shaper. 131 158 */ 132 159 133 - static int shaper_qframe(struct shaper *shaper, struct sk_buff *skb) 160 + 161 + static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev) 134 162 { 163 + struct shaper *shaper = dev->priv; 135 164 struct sk_buff *ptr; 136 165 137 - /* 138 - * Get ready to work on this shaper. Lock may fail if its 139 - * an interrupt and locked. 140 - */ 141 - 142 - if(!shaper_lock(shaper)) 143 - return -1; 166 + if (down_trylock(&shaper->sem)) 167 + return -1; 168 + 144 169 ptr=shaper->sendq.prev; 145 170 146 171 /* ··· 231 260 dev_kfree_skb(ptr); 232 261 shaper->stats.collisions++; 233 262 } 234 - shaper_unlock(shaper); 263 + shaper_kick(shaper); 264 + up(&shaper->sem); 235 265 return 0; 236 266 } 237 267 ··· 269 297 270 298 static void shaper_timer(unsigned long data) 271 299 { 272 - struct shaper *sh=(struct shaper *)data; 273 - shaper_kick(sh); 300 + struct shaper *shaper = (struct shaper *)data; 301 + 302 + if (!down_trylock(&shaper->sem)) { 303 + shaper_kick(shaper); 304 + up(&shaper->sem); 305 + } else 306 + mod_timer(&shaper->timer, jiffies); 274 307 } 275 308 276 309 /* ··· 287 310 { 288 311 struct sk_buff *skb; 289 312 290 - /* 291 - * Shaper unlock will kick 292 - */ 293 - 294 - if (test_and_set_bit(0, &shaper->locked)) 295 - { 296 - if(sh_debug) 297 - printk("Shaper locked.\n"); 298 - mod_timer(&shaper->timer, jiffies); 299 - return; 300 - } 301 - 302 - 303 313 /* 304 314 * Walk the list (may be empty) 305 315 */ ··· 328 364 329 365 if(skb!=NULL) 330 366 mod_timer(&shaper->timer, SHAPERCB(skb)->shapeclock); 331 - 332 - clear_bit(0, &shaper->locked); 333 367 } 334 368 335 369 ··· 338 376 static void shaper_flush(struct shaper *shaper) 339 377 { 340 378 struct sk_buff *skb; 341 - if(!shaper_lock(shaper)) 342 - { 343 - printk(KERN_ERR "shaper: shaper_flush() called by an irq!\n"); 344 - return; 345 - } 379 + 380 + down(&shaper->sem); 346 381 while((skb=skb_dequeue(&shaper->sendq))!=NULL) 347 382 dev_kfree_skb(skb); 348 - shaper_unlock(shaper); 383 + shaper_kick(shaper); 384 + up(&shaper->sem); 349 385 } 350 386 351 387 /* ··· 385 425 * for our attached device. This enables us to bandwidth allocate after 386 426 * ARP and other resolutions and not before. 387 427 */ 388 - 389 - 390 - static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev) 391 - { 392 - struct shaper *sh=dev->priv; 393 - return shaper_qframe(sh, skb); 394 - } 395 428 396 429 static struct net_device_stats *shaper_get_stats(struct net_device *dev) 397 430 { ··· 576 623 init_timer(&sh->timer); 577 624 sh->timer.function=shaper_timer; 578 625 sh->timer.data=(unsigned long)sh; 579 - init_waitqueue_head(&sh->wait_queue); 580 626 } 581 627 582 628 /*
+1 -2
include/linux/if_shaper.h
··· 23 23 __u32 shapeclock; 24 24 unsigned long recovery; /* Time we can next clock a packet out on 25 25 an empty queue */ 26 - unsigned long locked; 26 + struct semaphore sem; 27 27 struct net_device_stats stats; 28 28 struct net_device *dev; 29 29 int (*hard_start_xmit) (struct sk_buff *skb, ··· 38 38 int (*hard_header_cache)(struct neighbour *neigh, struct hh_cache *hh); 39 39 void (*header_cache_update)(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr); 40 40 struct net_device_stats* (*get_stats)(struct net_device *dev); 41 - wait_queue_head_t wait_queue; 42 41 struct timer_list timer; 43 42 }; 44 43
+1 -1
include/linux/netdevice.h
··· 204 204 /* cached hardware header; allow for machine alignment needs. */ 205 205 #define HH_DATA_MOD 16 206 206 #define HH_DATA_OFF(__len) \ 207 - (HH_DATA_MOD - ((__len) & (HH_DATA_MOD - 1))) 207 + (HH_DATA_MOD - (((__len - 1) & (HH_DATA_MOD - 1)) + 1)) 208 208 #define HH_DATA_ALIGN(__len) \ 209 209 (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1)) 210 210 unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)];
+1 -1
net/ipv4/ipvs/Makefile
··· 11 11 12 12 ip_vs-objs := ip_vs_conn.o ip_vs_core.o ip_vs_ctl.o ip_vs_sched.o \ 13 13 ip_vs_xmit.o ip_vs_app.o ip_vs_sync.o \ 14 - ip_vs_est.o ip_vs_proto.o ip_vs_proto_icmp.o \ 14 + ip_vs_est.o ip_vs_proto.o \ 15 15 $(ip_vs_proto-objs-y) 16 16 17 17
-3
net/ipv4/ipvs/ip_vs_proto.c
··· 216 216 #ifdef CONFIG_IP_VS_PROTO_UDP 217 217 REGISTER_PROTOCOL(&ip_vs_protocol_udp); 218 218 #endif 219 - #ifdef CONFIG_IP_VS_PROTO_ICMP 220 - REGISTER_PROTOCOL(&ip_vs_protocol_icmp); 221 - #endif 222 219 #ifdef CONFIG_IP_VS_PROTO_AH 223 220 REGISTER_PROTOCOL(&ip_vs_protocol_ah); 224 221 #endif
-182
net/ipv4/ipvs/ip_vs_proto_icmp.c
··· 1 - /* 2 - * ip_vs_proto_icmp.c: ICMP load balancing support for IP Virtual Server 3 - * 4 - * Authors: Julian Anastasov <ja@ssi.bg>, March 2002 5 - * 6 - * This program is free software; you can redistribute it and/or 7 - * modify it under the terms of the GNU General Public License 8 - * version 2 as published by the Free Software Foundation; 9 - * 10 - */ 11 - 12 - #include <linux/module.h> 13 - #include <linux/kernel.h> 14 - #include <linux/icmp.h> 15 - #include <linux/netfilter.h> 16 - #include <linux/netfilter_ipv4.h> 17 - 18 - #include <net/ip_vs.h> 19 - 20 - 21 - static int icmp_timeouts[1] = { 1*60*HZ }; 22 - 23 - static char * icmp_state_name_table[1] = { "ICMP" }; 24 - 25 - static struct ip_vs_conn * 26 - icmp_conn_in_get(const struct sk_buff *skb, 27 - struct ip_vs_protocol *pp, 28 - const struct iphdr *iph, 29 - unsigned int proto_off, 30 - int inverse) 31 - { 32 - #if 0 33 - struct ip_vs_conn *cp; 34 - 35 - if (likely(!inverse)) { 36 - cp = ip_vs_conn_in_get(iph->protocol, 37 - iph->saddr, 0, 38 - iph->daddr, 0); 39 - } else { 40 - cp = ip_vs_conn_in_get(iph->protocol, 41 - iph->daddr, 0, 42 - iph->saddr, 0); 43 - } 44 - 45 - return cp; 46 - 47 - #else 48 - return NULL; 49 - #endif 50 - } 51 - 52 - static struct ip_vs_conn * 53 - icmp_conn_out_get(const struct sk_buff *skb, 54 - struct ip_vs_protocol *pp, 55 - const struct iphdr *iph, 56 - unsigned int proto_off, 57 - int inverse) 58 - { 59 - #if 0 60 - struct ip_vs_conn *cp; 61 - 62 - if (likely(!inverse)) { 63 - cp = ip_vs_conn_out_get(iph->protocol, 64 - iph->saddr, 0, 65 - iph->daddr, 0); 66 - } else { 67 - cp = ip_vs_conn_out_get(IPPROTO_UDP, 68 - iph->daddr, 0, 69 - iph->saddr, 0); 70 - } 71 - 72 - return cp; 73 - #else 74 - return NULL; 75 - #endif 76 - } 77 - 78 - static int 79 - icmp_conn_schedule(struct sk_buff *skb, struct ip_vs_protocol *pp, 80 - int *verdict, struct ip_vs_conn **cpp) 81 - { 82 - *verdict = NF_ACCEPT; 83 - return 0; 84 - } 85 - 86 - static int 87 - icmp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp) 88 - { 89 - if (!(skb->nh.iph->frag_off & __constant_htons(IP_OFFSET))) { 90 - if (skb->ip_summed != CHECKSUM_UNNECESSARY) { 91 - if (ip_vs_checksum_complete(skb, skb->nh.iph->ihl * 4)) { 92 - IP_VS_DBG_RL_PKT(0, pp, skb, 0, "Failed checksum for"); 93 - return 0; 94 - } 95 - } 96 - } 97 - return 1; 98 - } 99 - 100 - static void 101 - icmp_debug_packet(struct ip_vs_protocol *pp, 102 - const struct sk_buff *skb, 103 - int offset, 104 - const char *msg) 105 - { 106 - char buf[256]; 107 - struct iphdr _iph, *ih; 108 - 109 - ih = skb_header_pointer(skb, offset, sizeof(_iph), &_iph); 110 - if (ih == NULL) 111 - sprintf(buf, "%s TRUNCATED", pp->name); 112 - else if (ih->frag_off & __constant_htons(IP_OFFSET)) 113 - sprintf(buf, "%s %u.%u.%u.%u->%u.%u.%u.%u frag", 114 - pp->name, NIPQUAD(ih->saddr), 115 - NIPQUAD(ih->daddr)); 116 - else { 117 - struct icmphdr _icmph, *ic; 118 - 119 - ic = skb_header_pointer(skb, offset + ih->ihl*4, 120 - sizeof(_icmph), &_icmph); 121 - if (ic == NULL) 122 - sprintf(buf, "%s TRUNCATED to %u bytes\n", 123 - pp->name, skb->len - offset); 124 - else 125 - sprintf(buf, "%s %u.%u.%u.%u->%u.%u.%u.%u T:%d C:%d", 126 - pp->name, NIPQUAD(ih->saddr), 127 - NIPQUAD(ih->daddr), 128 - ic->type, ic->code); 129 - } 130 - printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); 131 - } 132 - 133 - static int 134 - icmp_state_transition(struct ip_vs_conn *cp, int direction, 135 - const struct sk_buff *skb, 136 - struct ip_vs_protocol *pp) 137 - { 138 - cp->timeout = pp->timeout_table[IP_VS_ICMP_S_NORMAL]; 139 - return 1; 140 - } 141 - 142 - static int 143 - icmp_set_state_timeout(struct ip_vs_protocol *pp, char *sname, int to) 144 - { 145 - int num; 146 - char **names; 147 - 148 - num = IP_VS_ICMP_S_LAST; 149 - names = icmp_state_name_table; 150 - return ip_vs_set_state_timeout(pp->timeout_table, num, names, sname, to); 151 - } 152 - 153 - 154 - static void icmp_init(struct ip_vs_protocol *pp) 155 - { 156 - pp->timeout_table = icmp_timeouts; 157 - } 158 - 159 - static void icmp_exit(struct ip_vs_protocol *pp) 160 - { 161 - } 162 - 163 - struct ip_vs_protocol ip_vs_protocol_icmp = { 164 - .name = "ICMP", 165 - .protocol = IPPROTO_ICMP, 166 - .dont_defrag = 0, 167 - .init = icmp_init, 168 - .exit = icmp_exit, 169 - .conn_schedule = icmp_conn_schedule, 170 - .conn_in_get = icmp_conn_in_get, 171 - .conn_out_get = icmp_conn_out_get, 172 - .snat_handler = NULL, 173 - .dnat_handler = NULL, 174 - .csum_check = icmp_csum_check, 175 - .state_transition = icmp_state_transition, 176 - .register_app = NULL, 177 - .unregister_app = NULL, 178 - .app_conn_bind = NULL, 179 - .debug_packet = icmp_debug_packet, 180 - .timeout_change = NULL, 181 - .set_state_timeout = icmp_set_state_timeout, 182 - };
-1
net/ipv6/ipv6_syms.c
··· 37 37 EXPORT_SYMBOL(xfrm6_rcv); 38 38 #endif 39 39 EXPORT_SYMBOL(rt6_lookup); 40 - EXPORT_SYMBOL(fl6_sock_lookup); 41 40 EXPORT_SYMBOL(ipv6_push_nfrag_opts);