diff options
Diffstat (limited to 'drivers')
35 files changed, 615 insertions, 372 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 6f907ebed2d5..6d34f405a2f3 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/wait.h> | 37 | #include <linux/wait.h> |
38 | 38 | ||
39 | #include <linux/skbuff.h> | 39 | #include <linux/skbuff.h> |
40 | #include <asm/io.h> | 40 | #include <linux/io.h> |
41 | 41 | ||
42 | #include <pcmcia/cs_types.h> | 42 | #include <pcmcia/cs_types.h> |
43 | #include <pcmcia/cs.h> | 43 | #include <pcmcia/cs.h> |
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index 40aec0fb8596..42d69d4de05c 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c | |||
@@ -244,7 +244,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data, | |||
244 | if (rel) { | 244 | if (rel) { |
245 | hdr[0] |= 0x80 + bcsp->msgq_txseq; | 245 | hdr[0] |= 0x80 + bcsp->msgq_txseq; |
246 | BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq); | 246 | BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq); |
247 | bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07; | 247 | bcsp->msgq_txseq = (bcsp->msgq_txseq + 1) & 0x07; |
248 | } | 248 | } |
249 | 249 | ||
250 | if (bcsp->use_crc) | 250 | if (bcsp->use_crc) |
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c index c5016bd2d94f..c3b1dc3a13a0 100644 --- a/drivers/isdn/gigaset/asyncdata.c +++ b/drivers/isdn/gigaset/asyncdata.c | |||
@@ -126,26 +126,6 @@ static unsigned lock_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
126 | return numbytes; | 126 | return numbytes; |
127 | } | 127 | } |
128 | 128 | ||
129 | /* set up next receive skb for data mode | ||
130 | */ | ||
131 | static void new_rcv_skb(struct bc_state *bcs) | ||
132 | { | ||
133 | struct cardstate *cs = bcs->cs; | ||
134 | unsigned short hw_hdr_len = cs->hw_hdr_len; | ||
135 | |||
136 | if (bcs->ignore) { | ||
137 | bcs->skb = NULL; | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | bcs->skb = dev_alloc_skb(SBUFSIZE + hw_hdr_len); | ||
142 | if (bcs->skb == NULL) { | ||
143 | dev_warn(cs->dev, "could not allocate new skb\n"); | ||
144 | return; | ||
145 | } | ||
146 | skb_reserve(bcs->skb, hw_hdr_len); | ||
147 | } | ||
148 | |||
149 | /* process a block of received bytes in HDLC data mode | 129 | /* process a block of received bytes in HDLC data mode |
150 | * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 == L2_HDLC) | 130 | * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 == L2_HDLC) |
151 | * Collect HDLC frames, undoing byte stuffing and watching for DLE escapes. | 131 | * Collect HDLC frames, undoing byte stuffing and watching for DLE escapes. |
@@ -159,8 +139,8 @@ static unsigned hdlc_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
159 | struct cardstate *cs = inbuf->cs; | 139 | struct cardstate *cs = inbuf->cs; |
160 | struct bc_state *bcs = cs->bcs; | 140 | struct bc_state *bcs = cs->bcs; |
161 | int inputstate = bcs->inputstate; | 141 | int inputstate = bcs->inputstate; |
162 | __u16 fcs = bcs->fcs; | 142 | __u16 fcs = bcs->rx_fcs; |
163 | struct sk_buff *skb = bcs->skb; | 143 | struct sk_buff *skb = bcs->rx_skb; |
164 | unsigned char *src = inbuf->data + inbuf->head; | 144 | unsigned char *src = inbuf->data + inbuf->head; |
165 | unsigned procbytes = 0; | 145 | unsigned procbytes = 0; |
166 | unsigned char c; | 146 | unsigned char c; |
@@ -245,8 +225,7 @@ byte_stuff: | |||
245 | 225 | ||
246 | /* prepare reception of next frame */ | 226 | /* prepare reception of next frame */ |
247 | inputstate &= ~INS_have_data; | 227 | inputstate &= ~INS_have_data; |
248 | new_rcv_skb(bcs); | 228 | skb = gigaset_new_rx_skb(bcs); |
249 | skb = bcs->skb; | ||
250 | } else { | 229 | } else { |
251 | /* empty frame (7E 7E) */ | 230 | /* empty frame (7E 7E) */ |
252 | #ifdef CONFIG_GIGASET_DEBUG | 231 | #ifdef CONFIG_GIGASET_DEBUG |
@@ -255,8 +234,7 @@ byte_stuff: | |||
255 | if (!skb) { | 234 | if (!skb) { |
256 | /* skipped (?) */ | 235 | /* skipped (?) */ |
257 | gigaset_isdn_rcv_err(bcs); | 236 | gigaset_isdn_rcv_err(bcs); |
258 | new_rcv_skb(bcs); | 237 | skb = gigaset_new_rx_skb(bcs); |
259 | skb = bcs->skb; | ||
260 | } | 238 | } |
261 | } | 239 | } |
262 | 240 | ||
@@ -279,11 +257,11 @@ byte_stuff: | |||
279 | #endif | 257 | #endif |
280 | inputstate |= INS_have_data; | 258 | inputstate |= INS_have_data; |
281 | if (skb) { | 259 | if (skb) { |
282 | if (skb->len == SBUFSIZE) { | 260 | if (skb->len >= bcs->rx_bufsize) { |
283 | dev_warn(cs->dev, "received packet too long\n"); | 261 | dev_warn(cs->dev, "received packet too long\n"); |
284 | dev_kfree_skb_any(skb); | 262 | dev_kfree_skb_any(skb); |
285 | /* skip remainder of packet */ | 263 | /* skip remainder of packet */ |
286 | bcs->skb = skb = NULL; | 264 | bcs->rx_skb = skb = NULL; |
287 | } else { | 265 | } else { |
288 | *__skb_put(skb, 1) = c; | 266 | *__skb_put(skb, 1) = c; |
289 | fcs = crc_ccitt_byte(fcs, c); | 267 | fcs = crc_ccitt_byte(fcs, c); |
@@ -292,7 +270,7 @@ byte_stuff: | |||
292 | } | 270 | } |
293 | 271 | ||
294 | bcs->inputstate = inputstate; | 272 | bcs->inputstate = inputstate; |
295 | bcs->fcs = fcs; | 273 | bcs->rx_fcs = fcs; |
296 | return procbytes; | 274 | return procbytes; |
297 | } | 275 | } |
298 | 276 | ||
@@ -308,18 +286,18 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
308 | struct cardstate *cs = inbuf->cs; | 286 | struct cardstate *cs = inbuf->cs; |
309 | struct bc_state *bcs = cs->bcs; | 287 | struct bc_state *bcs = cs->bcs; |
310 | int inputstate = bcs->inputstate; | 288 | int inputstate = bcs->inputstate; |
311 | struct sk_buff *skb = bcs->skb; | 289 | struct sk_buff *skb = bcs->rx_skb; |
312 | unsigned char *src = inbuf->data + inbuf->head; | 290 | unsigned char *src = inbuf->data + inbuf->head; |
313 | unsigned procbytes = 0; | 291 | unsigned procbytes = 0; |
314 | unsigned char c; | 292 | unsigned char c; |
315 | 293 | ||
316 | if (!skb) { | 294 | if (!skb) { |
317 | /* skip this block */ | 295 | /* skip this block */ |
318 | new_rcv_skb(bcs); | 296 | gigaset_new_rx_skb(bcs); |
319 | return numbytes; | 297 | return numbytes; |
320 | } | 298 | } |
321 | 299 | ||
322 | while (procbytes < numbytes && skb->len < SBUFSIZE) { | 300 | while (procbytes < numbytes && skb->len < bcs->rx_bufsize) { |
323 | c = *src++; | 301 | c = *src++; |
324 | procbytes++; | 302 | procbytes++; |
325 | 303 | ||
@@ -343,7 +321,7 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
343 | if (inputstate & INS_have_data) { | 321 | if (inputstate & INS_have_data) { |
344 | gigaset_skb_rcvd(bcs, skb); | 322 | gigaset_skb_rcvd(bcs, skb); |
345 | inputstate &= ~INS_have_data; | 323 | inputstate &= ~INS_have_data; |
346 | new_rcv_skb(bcs); | 324 | gigaset_new_rx_skb(bcs); |
347 | } | 325 | } |
348 | 326 | ||
349 | bcs->inputstate = inputstate; | 327 | bcs->inputstate = inputstate; |
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c index 8f78f15c8ef7..6fbe8999c419 100644 --- a/drivers/isdn/gigaset/capi.c +++ b/drivers/isdn/gigaset/capi.c | |||
@@ -70,7 +70,7 @@ | |||
70 | #define MAX_NUMBER_DIGITS 20 | 70 | #define MAX_NUMBER_DIGITS 20 |
71 | #define MAX_FMT_IE_LEN 20 | 71 | #define MAX_FMT_IE_LEN 20 |
72 | 72 | ||
73 | /* values for gigaset_capi_appl.connected */ | 73 | /* values for bcs->apconnstate */ |
74 | #define APCONN_NONE 0 /* inactive/listening */ | 74 | #define APCONN_NONE 0 /* inactive/listening */ |
75 | #define APCONN_SETUP 1 /* connecting */ | 75 | #define APCONN_SETUP 1 /* connecting */ |
76 | #define APCONN_ACTIVE 2 /* B channel up */ | 76 | #define APCONN_ACTIVE 2 /* B channel up */ |
@@ -80,10 +80,10 @@ struct gigaset_capi_appl { | |||
80 | struct list_head ctrlist; | 80 | struct list_head ctrlist; |
81 | struct gigaset_capi_appl *bcnext; | 81 | struct gigaset_capi_appl *bcnext; |
82 | u16 id; | 82 | u16 id; |
83 | struct capi_register_params rp; | ||
83 | u16 nextMessageNumber; | 84 | u16 nextMessageNumber; |
84 | u32 listenInfoMask; | 85 | u32 listenInfoMask; |
85 | u32 listenCIPmask; | 86 | u32 listenCIPmask; |
86 | int connected; | ||
87 | }; | 87 | }; |
88 | 88 | ||
89 | /* CAPI specific controller data structure */ | 89 | /* CAPI specific controller data structure */ |
@@ -319,6 +319,39 @@ static const char *format_ie(const char *ie) | |||
319 | return result; | 319 | return result; |
320 | } | 320 | } |
321 | 321 | ||
322 | /* | ||
323 | * emit DATA_B3_CONF message | ||
324 | */ | ||
325 | static void send_data_b3_conf(struct cardstate *cs, struct capi_ctr *ctr, | ||
326 | u16 appl, u16 msgid, int channel, | ||
327 | u16 handle, u16 info) | ||
328 | { | ||
329 | struct sk_buff *cskb; | ||
330 | u8 *msg; | ||
331 | |||
332 | cskb = alloc_skb(CAPI_DATA_B3_CONF_LEN, GFP_ATOMIC); | ||
333 | if (!cskb) { | ||
334 | dev_err(cs->dev, "%s: out of memory\n", __func__); | ||
335 | return; | ||
336 | } | ||
337 | /* frequent message, avoid _cmsg overhead */ | ||
338 | msg = __skb_put(cskb, CAPI_DATA_B3_CONF_LEN); | ||
339 | CAPIMSG_SETLEN(msg, CAPI_DATA_B3_CONF_LEN); | ||
340 | CAPIMSG_SETAPPID(msg, appl); | ||
341 | CAPIMSG_SETCOMMAND(msg, CAPI_DATA_B3); | ||
342 | CAPIMSG_SETSUBCOMMAND(msg, CAPI_CONF); | ||
343 | CAPIMSG_SETMSGID(msg, msgid); | ||
344 | CAPIMSG_SETCONTROLLER(msg, ctr->cnr); | ||
345 | CAPIMSG_SETPLCI_PART(msg, channel); | ||
346 | CAPIMSG_SETNCCI_PART(msg, 1); | ||
347 | CAPIMSG_SETHANDLE_CONF(msg, handle); | ||
348 | CAPIMSG_SETINFO_CONF(msg, info); | ||
349 | |||
350 | /* emit message */ | ||
351 | dump_rawmsg(DEBUG_MCMD, __func__, msg); | ||
352 | capi_ctr_handle_message(ctr, appl, cskb); | ||
353 | } | ||
354 | |||
322 | 355 | ||
323 | /* | 356 | /* |
324 | * driver interface functions | 357 | * driver interface functions |
@@ -339,7 +372,6 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb) | |||
339 | struct gigaset_capi_ctr *iif = cs->iif; | 372 | struct gigaset_capi_ctr *iif = cs->iif; |
340 | struct gigaset_capi_appl *ap = bcs->ap; | 373 | struct gigaset_capi_appl *ap = bcs->ap; |
341 | unsigned char *req = skb_mac_header(dskb); | 374 | unsigned char *req = skb_mac_header(dskb); |
342 | struct sk_buff *cskb; | ||
343 | u16 flags; | 375 | u16 flags; |
344 | 376 | ||
345 | /* update statistics */ | 377 | /* update statistics */ |
@@ -351,39 +383,22 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb) | |||
351 | } | 383 | } |
352 | 384 | ||
353 | /* don't send further B3 messages if disconnected */ | 385 | /* don't send further B3 messages if disconnected */ |
354 | if (ap->connected < APCONN_ACTIVE) { | 386 | if (bcs->apconnstate < APCONN_ACTIVE) { |
355 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding ack"); | 387 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding ack"); |
356 | return; | 388 | return; |
357 | } | 389 | } |
358 | 390 | ||
359 | /* ToDo: honor unset "delivery confirmation" bit */ | 391 | /* |
392 | * send DATA_B3_CONF if "delivery confirmation" bit was set in request; | ||
393 | * otherwise it has already been sent by do_data_b3_req() | ||
394 | */ | ||
360 | flags = CAPIMSG_FLAGS(req); | 395 | flags = CAPIMSG_FLAGS(req); |
361 | 396 | if (flags & CAPI_FLAGS_DELIVERY_CONFIRMATION) | |
362 | /* build DATA_B3_CONF message */ | 397 | send_data_b3_conf(cs, &iif->ctr, ap->id, CAPIMSG_MSGID(req), |
363 | cskb = alloc_skb(CAPI_DATA_B3_CONF_LEN, GFP_ATOMIC); | 398 | bcs->channel + 1, CAPIMSG_HANDLE_REQ(req), |
364 | if (!cskb) { | 399 | (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) ? |
365 | dev_err(cs->dev, "%s: out of memory\n", __func__); | 400 | CapiFlagsNotSupportedByProtocol : |
366 | return; | 401 | CAPI_NOERROR); |
367 | } | ||
368 | /* frequent message, avoid _cmsg overhead */ | ||
369 | CAPIMSG_SETLEN(cskb->data, CAPI_DATA_B3_CONF_LEN); | ||
370 | CAPIMSG_SETAPPID(cskb->data, ap->id); | ||
371 | CAPIMSG_SETCOMMAND(cskb->data, CAPI_DATA_B3); | ||
372 | CAPIMSG_SETSUBCOMMAND(cskb->data, CAPI_CONF); | ||
373 | CAPIMSG_SETMSGID(cskb->data, CAPIMSG_MSGID(req)); | ||
374 | CAPIMSG_SETCONTROLLER(cskb->data, iif->ctr.cnr); | ||
375 | CAPIMSG_SETPLCI_PART(cskb->data, bcs->channel + 1); | ||
376 | CAPIMSG_SETNCCI_PART(cskb->data, 1); | ||
377 | CAPIMSG_SETHANDLE_CONF(cskb->data, CAPIMSG_HANDLE_REQ(req)); | ||
378 | if (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) | ||
379 | CAPIMSG_SETINFO_CONF(cskb->data, | ||
380 | CapiFlagsNotSupportedByProtocol); | ||
381 | else | ||
382 | CAPIMSG_SETINFO_CONF(cskb->data, CAPI_NOERROR); | ||
383 | |||
384 | /* emit message */ | ||
385 | dump_rawmsg(DEBUG_LLDATA, "DATA_B3_CONF", cskb->data); | ||
386 | capi_ctr_handle_message(&iif->ctr, ap->id, cskb); | ||
387 | } | 402 | } |
388 | EXPORT_SYMBOL_GPL(gigaset_skb_sent); | 403 | EXPORT_SYMBOL_GPL(gigaset_skb_sent); |
389 | 404 | ||
@@ -412,7 +427,7 @@ void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb) | |||
412 | } | 427 | } |
413 | 428 | ||
414 | /* don't send further B3 messages if disconnected */ | 429 | /* don't send further B3 messages if disconnected */ |
415 | if (ap->connected < APCONN_ACTIVE) { | 430 | if (bcs->apconnstate < APCONN_ACTIVE) { |
416 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding data"); | 431 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding data"); |
417 | dev_kfree_skb_any(skb); | 432 | dev_kfree_skb_any(skb); |
418 | return; | 433 | return; |
@@ -484,6 +499,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
484 | u32 actCIPmask; | 499 | u32 actCIPmask; |
485 | struct sk_buff *skb; | 500 | struct sk_buff *skb; |
486 | unsigned int msgsize; | 501 | unsigned int msgsize; |
502 | unsigned long flags; | ||
487 | int i; | 503 | int i; |
488 | 504 | ||
489 | /* | 505 | /* |
@@ -608,7 +624,14 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
608 | format_ie(iif->hcmsg.CalledPartyNumber)); | 624 | format_ie(iif->hcmsg.CalledPartyNumber)); |
609 | 625 | ||
610 | /* scan application list for matching listeners */ | 626 | /* scan application list for matching listeners */ |
611 | bcs->ap = NULL; | 627 | spin_lock_irqsave(&bcs->aplock, flags); |
628 | if (bcs->ap != NULL || bcs->apconnstate != APCONN_NONE) { | ||
629 | dev_warn(cs->dev, "%s: channel not properly cleared (%p/%d)\n", | ||
630 | __func__, bcs->ap, bcs->apconnstate); | ||
631 | bcs->ap = NULL; | ||
632 | bcs->apconnstate = APCONN_NONE; | ||
633 | } | ||
634 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
612 | actCIPmask = 1 | (1 << iif->hcmsg.CIPValue); | 635 | actCIPmask = 1 | (1 << iif->hcmsg.CIPValue); |
613 | list_for_each_entry(ap, &iif->appls, ctrlist) | 636 | list_for_each_entry(ap, &iif->appls, ctrlist) |
614 | if (actCIPmask & ap->listenCIPmask) { | 637 | if (actCIPmask & ap->listenCIPmask) { |
@@ -626,10 +649,12 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
626 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); | 649 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); |
627 | 650 | ||
628 | /* add to listeners on this B channel, update state */ | 651 | /* add to listeners on this B channel, update state */ |
652 | spin_lock_irqsave(&bcs->aplock, flags); | ||
629 | ap->bcnext = bcs->ap; | 653 | ap->bcnext = bcs->ap; |
630 | bcs->ap = ap; | 654 | bcs->ap = ap; |
631 | bcs->chstate |= CHS_NOTIFY_LL; | 655 | bcs->chstate |= CHS_NOTIFY_LL; |
632 | ap->connected = APCONN_SETUP; | 656 | bcs->apconnstate = APCONN_SETUP; |
657 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
633 | 658 | ||
634 | /* emit message */ | 659 | /* emit message */ |
635 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 660 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
@@ -654,7 +679,7 @@ static void send_disconnect_ind(struct bc_state *bcs, | |||
654 | struct gigaset_capi_ctr *iif = cs->iif; | 679 | struct gigaset_capi_ctr *iif = cs->iif; |
655 | struct sk_buff *skb; | 680 | struct sk_buff *skb; |
656 | 681 | ||
657 | if (ap->connected == APCONN_NONE) | 682 | if (bcs->apconnstate == APCONN_NONE) |
658 | return; | 683 | return; |
659 | 684 | ||
660 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT, CAPI_IND, | 685 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT, CAPI_IND, |
@@ -668,7 +693,6 @@ static void send_disconnect_ind(struct bc_state *bcs, | |||
668 | } | 693 | } |
669 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, CAPI_DISCONNECT_IND_LEN)); | 694 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, CAPI_DISCONNECT_IND_LEN)); |
670 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); | 695 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); |
671 | ap->connected = APCONN_NONE; | ||
672 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 696 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
673 | } | 697 | } |
674 | 698 | ||
@@ -685,9 +709,9 @@ static void send_disconnect_b3_ind(struct bc_state *bcs, | |||
685 | struct sk_buff *skb; | 709 | struct sk_buff *skb; |
686 | 710 | ||
687 | /* nothing to do if no logical connection active */ | 711 | /* nothing to do if no logical connection active */ |
688 | if (ap->connected < APCONN_ACTIVE) | 712 | if (bcs->apconnstate < APCONN_ACTIVE) |
689 | return; | 713 | return; |
690 | ap->connected = APCONN_SETUP; | 714 | bcs->apconnstate = APCONN_SETUP; |
691 | 715 | ||
692 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT_B3, CAPI_IND, | 716 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT_B3, CAPI_IND, |
693 | ap->nextMessageNumber++, | 717 | ap->nextMessageNumber++, |
@@ -714,14 +738,25 @@ void gigaset_isdn_connD(struct bc_state *bcs) | |||
714 | { | 738 | { |
715 | struct cardstate *cs = bcs->cs; | 739 | struct cardstate *cs = bcs->cs; |
716 | struct gigaset_capi_ctr *iif = cs->iif; | 740 | struct gigaset_capi_ctr *iif = cs->iif; |
717 | struct gigaset_capi_appl *ap = bcs->ap; | 741 | struct gigaset_capi_appl *ap; |
718 | struct sk_buff *skb; | 742 | struct sk_buff *skb; |
719 | unsigned int msgsize; | 743 | unsigned int msgsize; |
744 | unsigned long flags; | ||
720 | 745 | ||
746 | spin_lock_irqsave(&bcs->aplock, flags); | ||
747 | ap = bcs->ap; | ||
721 | if (!ap) { | 748 | if (!ap) { |
749 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
722 | dev_err(cs->dev, "%s: no application\n", __func__); | 750 | dev_err(cs->dev, "%s: no application\n", __func__); |
723 | return; | 751 | return; |
724 | } | 752 | } |
753 | if (bcs->apconnstate == APCONN_NONE) { | ||
754 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
755 | dev_warn(cs->dev, "%s: application %u not connected\n", | ||
756 | __func__, ap->id); | ||
757 | return; | ||
758 | } | ||
759 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
725 | while (ap->bcnext) { | 760 | while (ap->bcnext) { |
726 | /* this should never happen */ | 761 | /* this should never happen */ |
727 | dev_warn(cs->dev, "%s: dropping extra application %u\n", | 762 | dev_warn(cs->dev, "%s: dropping extra application %u\n", |
@@ -730,11 +765,6 @@ void gigaset_isdn_connD(struct bc_state *bcs) | |||
730 | CapiCallGivenToOtherApplication); | 765 | CapiCallGivenToOtherApplication); |
731 | ap->bcnext = ap->bcnext->bcnext; | 766 | ap->bcnext = ap->bcnext->bcnext; |
732 | } | 767 | } |
733 | if (ap->connected == APCONN_NONE) { | ||
734 | dev_warn(cs->dev, "%s: application %u not connected\n", | ||
735 | __func__, ap->id); | ||
736 | return; | ||
737 | } | ||
738 | 768 | ||
739 | /* prepare CONNECT_ACTIVE_IND message | 769 | /* prepare CONNECT_ACTIVE_IND message |
740 | * Note: LLC not supported by device | 770 | * Note: LLC not supported by device |
@@ -772,17 +802,24 @@ void gigaset_isdn_connD(struct bc_state *bcs) | |||
772 | void gigaset_isdn_hupD(struct bc_state *bcs) | 802 | void gigaset_isdn_hupD(struct bc_state *bcs) |
773 | { | 803 | { |
774 | struct gigaset_capi_appl *ap; | 804 | struct gigaset_capi_appl *ap; |
805 | unsigned long flags; | ||
775 | 806 | ||
776 | /* | 807 | /* |
777 | * ToDo: pass on reason code reported by device | 808 | * ToDo: pass on reason code reported by device |
778 | * (requires ev-layer state machine extension to collect | 809 | * (requires ev-layer state machine extension to collect |
779 | * ZCAU device reply) | 810 | * ZCAU device reply) |
780 | */ | 811 | */ |
781 | for (ap = bcs->ap; ap != NULL; ap = ap->bcnext) { | 812 | spin_lock_irqsave(&bcs->aplock, flags); |
813 | while (bcs->ap != NULL) { | ||
814 | ap = bcs->ap; | ||
815 | bcs->ap = ap->bcnext; | ||
816 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
782 | send_disconnect_b3_ind(bcs, ap); | 817 | send_disconnect_b3_ind(bcs, ap); |
783 | send_disconnect_ind(bcs, ap, 0); | 818 | send_disconnect_ind(bcs, ap, 0); |
819 | spin_lock_irqsave(&bcs->aplock, flags); | ||
784 | } | 820 | } |
785 | bcs->ap = NULL; | 821 | bcs->apconnstate = APCONN_NONE; |
822 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
786 | } | 823 | } |
787 | 824 | ||
788 | /** | 825 | /** |
@@ -796,24 +833,21 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
796 | { | 833 | { |
797 | struct cardstate *cs = bcs->cs; | 834 | struct cardstate *cs = bcs->cs; |
798 | struct gigaset_capi_ctr *iif = cs->iif; | 835 | struct gigaset_capi_ctr *iif = cs->iif; |
799 | struct gigaset_capi_appl *ap = bcs->ap; | 836 | struct gigaset_capi_appl *ap; |
800 | struct sk_buff *skb; | 837 | struct sk_buff *skb; |
838 | unsigned long flags; | ||
801 | unsigned int msgsize; | 839 | unsigned int msgsize; |
802 | u8 command; | 840 | u8 command; |
803 | 841 | ||
842 | spin_lock_irqsave(&bcs->aplock, flags); | ||
843 | ap = bcs->ap; | ||
804 | if (!ap) { | 844 | if (!ap) { |
845 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
805 | dev_err(cs->dev, "%s: no application\n", __func__); | 846 | dev_err(cs->dev, "%s: no application\n", __func__); |
806 | return; | 847 | return; |
807 | } | 848 | } |
808 | while (ap->bcnext) { | 849 | if (!bcs->apconnstate) { |
809 | /* this should never happen */ | 850 | spin_unlock_irqrestore(&bcs->aplock, flags); |
810 | dev_warn(cs->dev, "%s: dropping extra application %u\n", | ||
811 | __func__, ap->bcnext->id); | ||
812 | send_disconnect_ind(bcs, ap->bcnext, | ||
813 | CapiCallGivenToOtherApplication); | ||
814 | ap->bcnext = ap->bcnext->bcnext; | ||
815 | } | ||
816 | if (!ap->connected) { | ||
817 | dev_warn(cs->dev, "%s: application %u not connected\n", | 851 | dev_warn(cs->dev, "%s: application %u not connected\n", |
818 | __func__, ap->id); | 852 | __func__, ap->id); |
819 | return; | 853 | return; |
@@ -825,13 +859,26 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
825 | * CONNECT_B3_ACTIVE_IND in reply to CONNECT_B3_RESP | 859 | * CONNECT_B3_ACTIVE_IND in reply to CONNECT_B3_RESP |
826 | * Parameters in both cases always: NCCI = 1, NCPI empty | 860 | * Parameters in both cases always: NCCI = 1, NCPI empty |
827 | */ | 861 | */ |
828 | if (ap->connected >= APCONN_ACTIVE) { | 862 | if (bcs->apconnstate >= APCONN_ACTIVE) { |
829 | command = CAPI_CONNECT_B3_ACTIVE; | 863 | command = CAPI_CONNECT_B3_ACTIVE; |
830 | msgsize = CAPI_CONNECT_B3_ACTIVE_IND_BASELEN; | 864 | msgsize = CAPI_CONNECT_B3_ACTIVE_IND_BASELEN; |
831 | } else { | 865 | } else { |
832 | command = CAPI_CONNECT_B3; | 866 | command = CAPI_CONNECT_B3; |
833 | msgsize = CAPI_CONNECT_B3_IND_BASELEN; | 867 | msgsize = CAPI_CONNECT_B3_IND_BASELEN; |
834 | } | 868 | } |
869 | bcs->apconnstate = APCONN_ACTIVE; | ||
870 | |||
871 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
872 | |||
873 | while (ap->bcnext) { | ||
874 | /* this should never happen */ | ||
875 | dev_warn(cs->dev, "%s: dropping extra application %u\n", | ||
876 | __func__, ap->bcnext->id); | ||
877 | send_disconnect_ind(bcs, ap->bcnext, | ||
878 | CapiCallGivenToOtherApplication); | ||
879 | ap->bcnext = ap->bcnext->bcnext; | ||
880 | } | ||
881 | |||
835 | capi_cmsg_header(&iif->hcmsg, ap->id, command, CAPI_IND, | 882 | capi_cmsg_header(&iif->hcmsg, ap->id, command, CAPI_IND, |
836 | ap->nextMessageNumber++, | 883 | ap->nextMessageNumber++, |
837 | iif->ctr.cnr | ((bcs->channel + 1) << 8) | (1 << 16)); | 884 | iif->ctr.cnr | ((bcs->channel + 1) << 8) | (1 << 16)); |
@@ -842,7 +889,6 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
842 | } | 889 | } |
843 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, msgsize)); | 890 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, msgsize)); |
844 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); | 891 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); |
845 | ap->connected = APCONN_ACTIVE; | ||
846 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 892 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
847 | } | 893 | } |
848 | 894 | ||
@@ -945,8 +991,64 @@ static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl, | |||
945 | return; | 991 | return; |
946 | } | 992 | } |
947 | ap->id = appl; | 993 | ap->id = appl; |
994 | ap->rp = *rp; | ||
948 | 995 | ||
949 | list_add(&ap->ctrlist, &iif->appls); | 996 | list_add(&ap->ctrlist, &iif->appls); |
997 | dev_info(cs->dev, "application %u registered\n", ap->id); | ||
998 | } | ||
999 | |||
1000 | /* | ||
1001 | * remove CAPI application from channel | ||
1002 | * helper function to keep indentation levels down and stay in 80 columns | ||
1003 | */ | ||
1004 | |||
1005 | static inline void remove_appl_from_channel(struct bc_state *bcs, | ||
1006 | struct gigaset_capi_appl *ap) | ||
1007 | { | ||
1008 | struct cardstate *cs = bcs->cs; | ||
1009 | struct gigaset_capi_appl *bcap; | ||
1010 | unsigned long flags; | ||
1011 | int prevconnstate; | ||
1012 | |||
1013 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1014 | bcap = bcs->ap; | ||
1015 | if (bcap == NULL) { | ||
1016 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1017 | return; | ||
1018 | } | ||
1019 | |||
1020 | /* check first application on channel */ | ||
1021 | if (bcap == ap) { | ||
1022 | bcs->ap = ap->bcnext; | ||
1023 | if (bcs->ap != NULL) { | ||
1024 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1025 | return; | ||
1026 | } | ||
1027 | |||
1028 | /* none left, clear channel state */ | ||
1029 | prevconnstate = bcs->apconnstate; | ||
1030 | bcs->apconnstate = APCONN_NONE; | ||
1031 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1032 | |||
1033 | if (prevconnstate == APCONN_ACTIVE) { | ||
1034 | dev_notice(cs->dev, "%s: hanging up channel %u\n", | ||
1035 | __func__, bcs->channel); | ||
1036 | gigaset_add_event(cs, &bcs->at_state, | ||
1037 | EV_HUP, NULL, 0, NULL); | ||
1038 | gigaset_schedule_event(cs); | ||
1039 | } | ||
1040 | return; | ||
1041 | } | ||
1042 | |||
1043 | /* check remaining list */ | ||
1044 | do { | ||
1045 | if (bcap->bcnext == ap) { | ||
1046 | bcap->bcnext = bcap->bcnext->bcnext; | ||
1047 | return; | ||
1048 | } | ||
1049 | bcap = bcap->bcnext; | ||
1050 | } while (bcap != NULL); | ||
1051 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
950 | } | 1052 | } |
951 | 1053 | ||
952 | /* | 1054 | /* |
@@ -958,19 +1060,19 @@ static void gigaset_release_appl(struct capi_ctr *ctr, u16 appl) | |||
958 | = container_of(ctr, struct gigaset_capi_ctr, ctr); | 1060 | = container_of(ctr, struct gigaset_capi_ctr, ctr); |
959 | struct cardstate *cs = iif->ctr.driverdata; | 1061 | struct cardstate *cs = iif->ctr.driverdata; |
960 | struct gigaset_capi_appl *ap, *tmp; | 1062 | struct gigaset_capi_appl *ap, *tmp; |
1063 | unsigned ch; | ||
961 | 1064 | ||
962 | list_for_each_entry_safe(ap, tmp, &iif->appls, ctrlist) | 1065 | list_for_each_entry_safe(ap, tmp, &iif->appls, ctrlist) |
963 | if (ap->id == appl) { | 1066 | if (ap->id == appl) { |
964 | if (ap->connected != APCONN_NONE) { | 1067 | /* remove from any channels */ |
965 | dev_err(cs->dev, | 1068 | for (ch = 0; ch < cs->channels; ch++) |
966 | "%s: application %u still connected\n", | 1069 | remove_appl_from_channel(&cs->bcs[ch], ap); |
967 | __func__, ap->id); | 1070 | |
968 | /* ToDo: clear active connection */ | 1071 | /* remove from registration list */ |
969 | } | ||
970 | list_del(&ap->ctrlist); | 1072 | list_del(&ap->ctrlist); |
971 | kfree(ap); | 1073 | kfree(ap); |
1074 | dev_info(cs->dev, "application %u released\n", appl); | ||
972 | } | 1075 | } |
973 | |||
974 | } | 1076 | } |
975 | 1077 | ||
976 | /* | 1078 | /* |
@@ -1149,7 +1251,8 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1149 | char **commands; | 1251 | char **commands; |
1150 | char *s; | 1252 | char *s; |
1151 | u8 *pp; | 1253 | u8 *pp; |
1152 | int i, l; | 1254 | unsigned long flags; |
1255 | int i, l, lbc, lhlc; | ||
1153 | u16 info; | 1256 | u16 info; |
1154 | 1257 | ||
1155 | /* decode message */ | 1258 | /* decode message */ |
@@ -1164,8 +1267,18 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1164 | send_conf(iif, ap, skb, CapiNoPlciAvailable); | 1267 | send_conf(iif, ap, skb, CapiNoPlciAvailable); |
1165 | return; | 1268 | return; |
1166 | } | 1269 | } |
1270 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1271 | if (bcs->ap != NULL || bcs->apconnstate != APCONN_NONE) | ||
1272 | dev_warn(cs->dev, "%s: channel not properly cleared (%p/%d)\n", | ||
1273 | __func__, bcs->ap, bcs->apconnstate); | ||
1167 | ap->bcnext = NULL; | 1274 | ap->bcnext = NULL; |
1168 | bcs->ap = ap; | 1275 | bcs->ap = ap; |
1276 | bcs->apconnstate = APCONN_SETUP; | ||
1277 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1278 | |||
1279 | bcs->rx_bufsize = ap->rp.datablklen; | ||
1280 | dev_kfree_skb(bcs->rx_skb); | ||
1281 | gigaset_new_rx_skb(bcs); | ||
1169 | cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; | 1282 | cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; |
1170 | 1283 | ||
1171 | /* build command table */ | 1284 | /* build command table */ |
@@ -1273,42 +1386,59 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1273 | goto error; | 1386 | goto error; |
1274 | } | 1387 | } |
1275 | 1388 | ||
1276 | /* check/encode parameter: BC */ | 1389 | /* |
1277 | if (cmsg->BC && cmsg->BC[0]) { | 1390 | * check/encode parameters: BC & HLC |
1278 | /* explicit BC overrides CIP */ | 1391 | * must be encoded together as device doesn't accept HLC separately |
1279 | l = 2*cmsg->BC[0] + 7; | 1392 | * explicit parameters override values derived from CIP |
1393 | */ | ||
1394 | |||
1395 | /* determine lengths */ | ||
1396 | if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */ | ||
1397 | lbc = 2*cmsg->BC[0]; | ||
1398 | else if (cip2bchlc[cmsg->CIPValue].bc) /* BC derived from CIP */ | ||
1399 | lbc = strlen(cip2bchlc[cmsg->CIPValue].bc); | ||
1400 | else /* no BC */ | ||
1401 | lbc = 0; | ||
1402 | if (cmsg->HLC && cmsg->HLC[0]) /* HLC specified explicitly */ | ||
1403 | lhlc = 2*cmsg->HLC[0]; | ||
1404 | else if (cip2bchlc[cmsg->CIPValue].hlc) /* HLC derived from CIP */ | ||
1405 | lhlc = strlen(cip2bchlc[cmsg->CIPValue].hlc); | ||
1406 | else /* no HLC */ | ||
1407 | lhlc = 0; | ||
1408 | |||
1409 | if (lbc) { | ||
1410 | /* have BC: allocate and assemble command string */ | ||
1411 | l = lbc + 7; /* "^SBC=" + value + "\r" + null byte */ | ||
1412 | if (lhlc) | ||
1413 | l += lhlc + 7; /* ";^SHLC=" + value */ | ||
1280 | commands[AT_BC] = kmalloc(l, GFP_KERNEL); | 1414 | commands[AT_BC] = kmalloc(l, GFP_KERNEL); |
1281 | if (!commands[AT_BC]) | 1415 | if (!commands[AT_BC]) |
1282 | goto oom; | 1416 | goto oom; |
1283 | strcpy(commands[AT_BC], "^SBC="); | 1417 | strcpy(commands[AT_BC], "^SBC="); |
1284 | decode_ie(cmsg->BC, commands[AT_BC]+5); | 1418 | if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */ |
1419 | decode_ie(cmsg->BC, commands[AT_BC] + 5); | ||
1420 | else /* BC derived from CIP */ | ||
1421 | strcpy(commands[AT_BC] + 5, | ||
1422 | cip2bchlc[cmsg->CIPValue].bc); | ||
1423 | if (lhlc) { | ||
1424 | strcpy(commands[AT_BC] + lbc + 5, ";^SHLC="); | ||
1425 | if (cmsg->HLC && cmsg->HLC[0]) | ||
1426 | /* HLC specified explicitly */ | ||
1427 | decode_ie(cmsg->HLC, | ||
1428 | commands[AT_BC] + lbc + 12); | ||
1429 | else /* HLC derived from CIP */ | ||
1430 | strcpy(commands[AT_BC] + lbc + 12, | ||
1431 | cip2bchlc[cmsg->CIPValue].hlc); | ||
1432 | } | ||
1285 | strcpy(commands[AT_BC] + l - 2, "\r"); | 1433 | strcpy(commands[AT_BC] + l - 2, "\r"); |
1286 | } else if (cip2bchlc[cmsg->CIPValue].bc) { | 1434 | } else { |
1287 | l = strlen(cip2bchlc[cmsg->CIPValue].bc) + 7; | 1435 | /* no BC */ |
1288 | commands[AT_BC] = kmalloc(l, GFP_KERNEL); | 1436 | if (lhlc) { |
1289 | if (!commands[AT_BC]) | 1437 | dev_notice(cs->dev, "%s: cannot set HLC without BC\n", |
1290 | goto oom; | 1438 | "CONNECT_REQ"); |
1291 | snprintf(commands[AT_BC], l, "^SBC=%s\r", | 1439 | info = CapiIllMessageParmCoding; /* ? */ |
1292 | cip2bchlc[cmsg->CIPValue].bc); | 1440 | goto error; |
1293 | } | 1441 | } |
1294 | |||
1295 | /* check/encode parameter: HLC */ | ||
1296 | if (cmsg->HLC && cmsg->HLC[0]) { | ||
1297 | /* explicit HLC overrides CIP */ | ||
1298 | l = 2*cmsg->HLC[0] + 7; | ||
1299 | commands[AT_HLC] = kmalloc(l, GFP_KERNEL); | ||
1300 | if (!commands[AT_HLC]) | ||
1301 | goto oom; | ||
1302 | strcpy(commands[AT_HLC], "^SHLC="); | ||
1303 | decode_ie(cmsg->HLC, commands[AT_HLC]+5); | ||
1304 | strcpy(commands[AT_HLC] + l - 2, "\r"); | ||
1305 | } else if (cip2bchlc[cmsg->CIPValue].hlc) { | ||
1306 | l = strlen(cip2bchlc[cmsg->CIPValue].hlc) + 7; | ||
1307 | commands[AT_HLC] = kmalloc(l, GFP_KERNEL); | ||
1308 | if (!commands[AT_HLC]) | ||
1309 | goto oom; | ||
1310 | snprintf(commands[AT_HLC], l, "^SHLC=%s\r", | ||
1311 | cip2bchlc[cmsg->CIPValue].hlc); | ||
1312 | } | 1442 | } |
1313 | 1443 | ||
1314 | /* check/encode parameter: B Protocol */ | 1444 | /* check/encode parameter: B Protocol */ |
@@ -1322,13 +1452,13 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1322 | bcs->proto2 = L2_HDLC; | 1452 | bcs->proto2 = L2_HDLC; |
1323 | break; | 1453 | break; |
1324 | case 1: | 1454 | case 1: |
1325 | bcs->proto2 = L2_BITSYNC; | 1455 | bcs->proto2 = L2_VOICE; |
1326 | break; | 1456 | break; |
1327 | default: | 1457 | default: |
1328 | dev_warn(cs->dev, | 1458 | dev_warn(cs->dev, |
1329 | "B1 Protocol %u unsupported, using Transparent\n", | 1459 | "B1 Protocol %u unsupported, using Transparent\n", |
1330 | cmsg->B1protocol); | 1460 | cmsg->B1protocol); |
1331 | bcs->proto2 = L2_BITSYNC; | 1461 | bcs->proto2 = L2_VOICE; |
1332 | } | 1462 | } |
1333 | if (cmsg->B2protocol != 1) | 1463 | if (cmsg->B2protocol != 1) |
1334 | dev_warn(cs->dev, | 1464 | dev_warn(cs->dev, |
@@ -1382,7 +1512,6 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1382 | goto error; | 1512 | goto error; |
1383 | } | 1513 | } |
1384 | gigaset_schedule_event(cs); | 1514 | gigaset_schedule_event(cs); |
1385 | ap->connected = APCONN_SETUP; | ||
1386 | send_conf(iif, ap, skb, CapiSuccess); | 1515 | send_conf(iif, ap, skb, CapiSuccess); |
1387 | return; | 1516 | return; |
1388 | 1517 | ||
@@ -1410,6 +1539,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1410 | _cmsg *cmsg = &iif->acmsg; | 1539 | _cmsg *cmsg = &iif->acmsg; |
1411 | struct bc_state *bcs; | 1540 | struct bc_state *bcs; |
1412 | struct gigaset_capi_appl *oap; | 1541 | struct gigaset_capi_appl *oap; |
1542 | unsigned long flags; | ||
1413 | int channel; | 1543 | int channel; |
1414 | 1544 | ||
1415 | /* decode message */ | 1545 | /* decode message */ |
@@ -1429,12 +1559,24 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1429 | switch (cmsg->Reject) { | 1559 | switch (cmsg->Reject) { |
1430 | case 0: /* Accept */ | 1560 | case 0: /* Accept */ |
1431 | /* drop all competing applications, keep only this one */ | 1561 | /* drop all competing applications, keep only this one */ |
1432 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) | 1562 | spin_lock_irqsave(&bcs->aplock, flags); |
1433 | if (oap != ap) | 1563 | while (bcs->ap != NULL) { |
1564 | oap = bcs->ap; | ||
1565 | bcs->ap = oap->bcnext; | ||
1566 | if (oap != ap) { | ||
1567 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1434 | send_disconnect_ind(bcs, oap, | 1568 | send_disconnect_ind(bcs, oap, |
1435 | CapiCallGivenToOtherApplication); | 1569 | CapiCallGivenToOtherApplication); |
1570 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1571 | } | ||
1572 | } | ||
1436 | ap->bcnext = NULL; | 1573 | ap->bcnext = NULL; |
1437 | bcs->ap = ap; | 1574 | bcs->ap = ap; |
1575 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1576 | |||
1577 | bcs->rx_bufsize = ap->rp.datablklen; | ||
1578 | dev_kfree_skb(bcs->rx_skb); | ||
1579 | gigaset_new_rx_skb(bcs); | ||
1438 | bcs->chstate |= CHS_NOTIFY_LL; | 1580 | bcs->chstate |= CHS_NOTIFY_LL; |
1439 | 1581 | ||
1440 | /* check/encode B channel protocol */ | 1582 | /* check/encode B channel protocol */ |
@@ -1448,13 +1590,13 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1448 | bcs->proto2 = L2_HDLC; | 1590 | bcs->proto2 = L2_HDLC; |
1449 | break; | 1591 | break; |
1450 | case 1: | 1592 | case 1: |
1451 | bcs->proto2 = L2_BITSYNC; | 1593 | bcs->proto2 = L2_VOICE; |
1452 | break; | 1594 | break; |
1453 | default: | 1595 | default: |
1454 | dev_warn(cs->dev, | 1596 | dev_warn(cs->dev, |
1455 | "B1 Protocol %u unsupported, using Transparent\n", | 1597 | "B1 Protocol %u unsupported, using Transparent\n", |
1456 | cmsg->B1protocol); | 1598 | cmsg->B1protocol); |
1457 | bcs->proto2 = L2_BITSYNC; | 1599 | bcs->proto2 = L2_VOICE; |
1458 | } | 1600 | } |
1459 | if (cmsg->B2protocol != 1) | 1601 | if (cmsg->B2protocol != 1) |
1460 | dev_warn(cs->dev, | 1602 | dev_warn(cs->dev, |
@@ -1502,31 +1644,45 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1502 | send_disconnect_ind(bcs, ap, 0); | 1644 | send_disconnect_ind(bcs, ap, 0); |
1503 | 1645 | ||
1504 | /* remove it from the list of listening apps */ | 1646 | /* remove it from the list of listening apps */ |
1647 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1505 | if (bcs->ap == ap) { | 1648 | if (bcs->ap == ap) { |
1506 | bcs->ap = ap->bcnext; | 1649 | bcs->ap = ap->bcnext; |
1507 | if (bcs->ap == NULL) | 1650 | if (bcs->ap == NULL) { |
1508 | /* last one: stop ev-layer hupD notifications */ | 1651 | /* last one: stop ev-layer hupD notifications */ |
1652 | bcs->apconnstate = APCONN_NONE; | ||
1509 | bcs->chstate &= ~CHS_NOTIFY_LL; | 1653 | bcs->chstate &= ~CHS_NOTIFY_LL; |
1654 | } | ||
1655 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1510 | return; | 1656 | return; |
1511 | } | 1657 | } |
1512 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) { | 1658 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) { |
1513 | if (oap->bcnext == ap) { | 1659 | if (oap->bcnext == ap) { |
1514 | oap->bcnext = oap->bcnext->bcnext; | 1660 | oap->bcnext = oap->bcnext->bcnext; |
1661 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1515 | return; | 1662 | return; |
1516 | } | 1663 | } |
1517 | } | 1664 | } |
1665 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1518 | dev_err(cs->dev, "%s: application %u not found\n", | 1666 | dev_err(cs->dev, "%s: application %u not found\n", |
1519 | __func__, ap->id); | 1667 | __func__, ap->id); |
1520 | return; | 1668 | return; |
1521 | 1669 | ||
1522 | default: /* Reject */ | 1670 | default: /* Reject */ |
1523 | /* drop all competing applications, keep only this one */ | 1671 | /* drop all competing applications, keep only this one */ |
1524 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) | 1672 | spin_lock_irqsave(&bcs->aplock, flags); |
1525 | if (oap != ap) | 1673 | while (bcs->ap != NULL) { |
1674 | oap = bcs->ap; | ||
1675 | bcs->ap = oap->bcnext; | ||
1676 | if (oap != ap) { | ||
1677 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1526 | send_disconnect_ind(bcs, oap, | 1678 | send_disconnect_ind(bcs, oap, |
1527 | CapiCallGivenToOtherApplication); | 1679 | CapiCallGivenToOtherApplication); |
1680 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1681 | } | ||
1682 | } | ||
1528 | ap->bcnext = NULL; | 1683 | ap->bcnext = NULL; |
1529 | bcs->ap = ap; | 1684 | bcs->ap = ap; |
1685 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1530 | 1686 | ||
1531 | /* reject call - will trigger DISCONNECT_IND for this app */ | 1687 | /* reject call - will trigger DISCONNECT_IND for this app */ |
1532 | dev_info(cs->dev, "%s: Reject=%x\n", | 1688 | dev_info(cs->dev, "%s: Reject=%x\n", |
@@ -1549,6 +1705,7 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif, | |||
1549 | { | 1705 | { |
1550 | struct cardstate *cs = iif->ctr.driverdata; | 1706 | struct cardstate *cs = iif->ctr.driverdata; |
1551 | _cmsg *cmsg = &iif->acmsg; | 1707 | _cmsg *cmsg = &iif->acmsg; |
1708 | struct bc_state *bcs; | ||
1552 | int channel; | 1709 | int channel; |
1553 | 1710 | ||
1554 | /* decode message */ | 1711 | /* decode message */ |
@@ -1563,9 +1720,10 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif, | |||
1563 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1720 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
1564 | return; | 1721 | return; |
1565 | } | 1722 | } |
1723 | bcs = &cs->bcs[channel-1]; | ||
1566 | 1724 | ||
1567 | /* mark logical connection active */ | 1725 | /* mark logical connection active */ |
1568 | ap->connected = APCONN_ACTIVE; | 1726 | bcs->apconnstate = APCONN_ACTIVE; |
1569 | 1727 | ||
1570 | /* build NCCI: always 1 (one B3 connection only) */ | 1728 | /* build NCCI: always 1 (one B3 connection only) */ |
1571 | cmsg->adr.adrNCCI |= 1 << 16; | 1729 | cmsg->adr.adrNCCI |= 1 << 16; |
@@ -1611,7 +1769,7 @@ static void do_connect_b3_resp(struct gigaset_capi_ctr *iif, | |||
1611 | 1769 | ||
1612 | if (cmsg->Reject) { | 1770 | if (cmsg->Reject) { |
1613 | /* Reject: clear B3 connect received flag */ | 1771 | /* Reject: clear B3 connect received flag */ |
1614 | ap->connected = APCONN_SETUP; | 1772 | bcs->apconnstate = APCONN_SETUP; |
1615 | 1773 | ||
1616 | /* trigger hangup, causing eventual DISCONNECT_IND */ | 1774 | /* trigger hangup, causing eventual DISCONNECT_IND */ |
1617 | if (!gigaset_add_event(cs, &bcs->at_state, | 1775 | if (!gigaset_add_event(cs, &bcs->at_state, |
@@ -1683,11 +1841,11 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif, | |||
1683 | } | 1841 | } |
1684 | 1842 | ||
1685 | /* skip if DISCONNECT_IND already sent */ | 1843 | /* skip if DISCONNECT_IND already sent */ |
1686 | if (!ap->connected) | 1844 | if (!bcs->apconnstate) |
1687 | return; | 1845 | return; |
1688 | 1846 | ||
1689 | /* check for active logical connection */ | 1847 | /* check for active logical connection */ |
1690 | if (ap->connected >= APCONN_ACTIVE) { | 1848 | if (bcs->apconnstate >= APCONN_ACTIVE) { |
1691 | /* | 1849 | /* |
1692 | * emit DISCONNECT_B3_IND with cause 0x3301 | 1850 | * emit DISCONNECT_B3_IND with cause 0x3301 |
1693 | * use separate cmsg structure, as the content of iif->acmsg | 1851 | * use separate cmsg structure, as the content of iif->acmsg |
@@ -1736,6 +1894,7 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif, | |||
1736 | { | 1894 | { |
1737 | struct cardstate *cs = iif->ctr.driverdata; | 1895 | struct cardstate *cs = iif->ctr.driverdata; |
1738 | _cmsg *cmsg = &iif->acmsg; | 1896 | _cmsg *cmsg = &iif->acmsg; |
1897 | struct bc_state *bcs; | ||
1739 | int channel; | 1898 | int channel; |
1740 | 1899 | ||
1741 | /* decode message */ | 1900 | /* decode message */ |
@@ -1751,17 +1910,17 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif, | |||
1751 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1910 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
1752 | return; | 1911 | return; |
1753 | } | 1912 | } |
1913 | bcs = &cs->bcs[channel-1]; | ||
1754 | 1914 | ||
1755 | /* reject if logical connection not active */ | 1915 | /* reject if logical connection not active */ |
1756 | if (ap->connected < APCONN_ACTIVE) { | 1916 | if (bcs->apconnstate < APCONN_ACTIVE) { |
1757 | send_conf(iif, ap, skb, | 1917 | send_conf(iif, ap, skb, |
1758 | CapiMessageNotSupportedInCurrentState); | 1918 | CapiMessageNotSupportedInCurrentState); |
1759 | return; | 1919 | return; |
1760 | } | 1920 | } |
1761 | 1921 | ||
1762 | /* trigger hangup, causing eventual DISCONNECT_B3_IND */ | 1922 | /* trigger hangup, causing eventual DISCONNECT_B3_IND */ |
1763 | if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state, | 1923 | if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) { |
1764 | EV_HUP, NULL, 0, NULL)) { | ||
1765 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); | 1924 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); |
1766 | return; | 1925 | return; |
1767 | } | 1926 | } |
@@ -1782,11 +1941,14 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1782 | struct sk_buff *skb) | 1941 | struct sk_buff *skb) |
1783 | { | 1942 | { |
1784 | struct cardstate *cs = iif->ctr.driverdata; | 1943 | struct cardstate *cs = iif->ctr.driverdata; |
1944 | struct bc_state *bcs; | ||
1785 | int channel = CAPIMSG_PLCI_PART(skb->data); | 1945 | int channel = CAPIMSG_PLCI_PART(skb->data); |
1786 | u16 ncci = CAPIMSG_NCCI_PART(skb->data); | 1946 | u16 ncci = CAPIMSG_NCCI_PART(skb->data); |
1787 | u16 msglen = CAPIMSG_LEN(skb->data); | 1947 | u16 msglen = CAPIMSG_LEN(skb->data); |
1788 | u16 datalen = CAPIMSG_DATALEN(skb->data); | 1948 | u16 datalen = CAPIMSG_DATALEN(skb->data); |
1789 | u16 flags = CAPIMSG_FLAGS(skb->data); | 1949 | u16 flags = CAPIMSG_FLAGS(skb->data); |
1950 | u16 msgid = CAPIMSG_MSGID(skb->data); | ||
1951 | u16 handle = CAPIMSG_HANDLE_REQ(skb->data); | ||
1790 | 1952 | ||
1791 | /* frequent message, avoid _cmsg overhead */ | 1953 | /* frequent message, avoid _cmsg overhead */ |
1792 | dump_rawmsg(DEBUG_LLDATA, "DATA_B3_REQ", skb->data); | 1954 | dump_rawmsg(DEBUG_LLDATA, "DATA_B3_REQ", skb->data); |
@@ -1802,6 +1964,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1802 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1964 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
1803 | return; | 1965 | return; |
1804 | } | 1966 | } |
1967 | bcs = &cs->bcs[channel-1]; | ||
1805 | if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64) | 1968 | if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64) |
1806 | dev_notice(cs->dev, "%s: unexpected length %d\n", | 1969 | dev_notice(cs->dev, "%s: unexpected length %d\n", |
1807 | "DATA_B3_REQ", msglen); | 1970 | "DATA_B3_REQ", msglen); |
@@ -1821,7 +1984,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1821 | } | 1984 | } |
1822 | 1985 | ||
1823 | /* reject if logical connection not active */ | 1986 | /* reject if logical connection not active */ |
1824 | if (ap->connected < APCONN_ACTIVE) { | 1987 | if (bcs->apconnstate < APCONN_ACTIVE) { |
1825 | send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState); | 1988 | send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState); |
1826 | return; | 1989 | return; |
1827 | } | 1990 | } |
@@ -1832,17 +1995,19 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1832 | skb_pull(skb, msglen); | 1995 | skb_pull(skb, msglen); |
1833 | 1996 | ||
1834 | /* pass to device-specific module */ | 1997 | /* pass to device-specific module */ |
1835 | if (cs->ops->send_skb(&cs->bcs[channel-1], skb) < 0) { | 1998 | if (cs->ops->send_skb(bcs, skb) < 0) { |
1836 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); | 1999 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); |
1837 | return; | 2000 | return; |
1838 | } | 2001 | } |
1839 | 2002 | ||
1840 | /* DATA_B3_CONF reply will be sent by gigaset_skb_sent() */ | ||
1841 | |||
1842 | /* | 2003 | /* |
1843 | * ToDo: honor unset "delivery confirmation" bit | 2004 | * DATA_B3_CONF will be sent by gigaset_skb_sent() only if "delivery |
1844 | * (send DATA_B3_CONF immediately?) | 2005 | * confirmation" bit is set; otherwise we have to send it now |
1845 | */ | 2006 | */ |
2007 | if (!(flags & CAPI_FLAGS_DELIVERY_CONFIRMATION)) | ||
2008 | send_data_b3_conf(cs, &iif->ctr, ap->id, msgid, channel, handle, | ||
2009 | flags ? CapiFlagsNotSupportedByProtocol | ||
2010 | : CAPI_NOERROR); | ||
1846 | } | 2011 | } |
1847 | 2012 | ||
1848 | /* | 2013 | /* |
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index f6f45f221920..5d4befb81057 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
@@ -399,8 +399,8 @@ static void gigaset_freebcs(struct bc_state *bcs) | |||
399 | gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel); | 399 | gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel); |
400 | clear_at_state(&bcs->at_state); | 400 | clear_at_state(&bcs->at_state); |
401 | gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel); | 401 | gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel); |
402 | dev_kfree_skb(bcs->skb); | 402 | dev_kfree_skb(bcs->rx_skb); |
403 | bcs->skb = NULL; | 403 | bcs->rx_skb = NULL; |
404 | 404 | ||
405 | for (i = 0; i < AT_NUM; ++i) { | 405 | for (i = 0; i < AT_NUM; ++i) { |
406 | kfree(bcs->commands[i]); | 406 | kfree(bcs->commands[i]); |
@@ -634,19 +634,10 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs, | |||
634 | bcs->emptycount = 0; | 634 | bcs->emptycount = 0; |
635 | #endif | 635 | #endif |
636 | 636 | ||
637 | gig_dbg(DEBUG_INIT, "allocating bcs[%d]->skb", channel); | 637 | bcs->rx_bufsize = 0; |
638 | bcs->fcs = PPP_INITFCS; | 638 | bcs->rx_skb = NULL; |
639 | bcs->rx_fcs = PPP_INITFCS; | ||
639 | bcs->inputstate = 0; | 640 | bcs->inputstate = 0; |
640 | if (cs->ignoreframes) { | ||
641 | bcs->skb = NULL; | ||
642 | } else { | ||
643 | bcs->skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | ||
644 | if (bcs->skb != NULL) | ||
645 | skb_reserve(bcs->skb, cs->hw_hdr_len); | ||
646 | else | ||
647 | pr_err("out of memory\n"); | ||
648 | } | ||
649 | |||
650 | bcs->channel = channel; | 641 | bcs->channel = channel; |
651 | bcs->cs = cs; | 642 | bcs->cs = cs; |
652 | 643 | ||
@@ -658,16 +649,15 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs, | |||
658 | for (i = 0; i < AT_NUM; ++i) | 649 | for (i = 0; i < AT_NUM; ++i) |
659 | bcs->commands[i] = NULL; | 650 | bcs->commands[i] = NULL; |
660 | 651 | ||
652 | spin_lock_init(&bcs->aplock); | ||
653 | bcs->ap = NULL; | ||
654 | bcs->apconnstate = 0; | ||
655 | |||
661 | gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel); | 656 | gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel); |
662 | if (cs->ops->initbcshw(bcs)) | 657 | if (cs->ops->initbcshw(bcs)) |
663 | return bcs; | 658 | return bcs; |
664 | 659 | ||
665 | gig_dbg(DEBUG_INIT, " failed"); | 660 | gig_dbg(DEBUG_INIT, " failed"); |
666 | |||
667 | gig_dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel); | ||
668 | dev_kfree_skb(bcs->skb); | ||
669 | bcs->skb = NULL; | ||
670 | |||
671 | return NULL; | 661 | return NULL; |
672 | } | 662 | } |
673 | 663 | ||
@@ -839,14 +829,12 @@ void gigaset_bcs_reinit(struct bc_state *bcs) | |||
839 | bcs->emptycount = 0; | 829 | bcs->emptycount = 0; |
840 | #endif | 830 | #endif |
841 | 831 | ||
842 | bcs->fcs = PPP_INITFCS; | 832 | bcs->rx_fcs = PPP_INITFCS; |
843 | bcs->chstate = 0; | 833 | bcs->chstate = 0; |
844 | 834 | ||
845 | bcs->ignore = cs->ignoreframes; | 835 | bcs->ignore = cs->ignoreframes; |
846 | if (bcs->ignore) { | 836 | dev_kfree_skb(bcs->rx_skb); |
847 | dev_kfree_skb(bcs->skb); | 837 | bcs->rx_skb = NULL; |
848 | bcs->skb = NULL; | ||
849 | } | ||
850 | 838 | ||
851 | cs->ops->reinitbcshw(bcs); | 839 | cs->ops->reinitbcshw(bcs); |
852 | } | 840 | } |
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index 206c380c5235..ceaef9a04a42 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
@@ -282,9 +282,7 @@ struct reply_t gigaset_tab_cid[] = | |||
282 | /* dial */ | 282 | /* dial */ |
283 | {EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} }, | 283 | {EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} }, |
284 | {RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} }, | 284 | {RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} }, |
285 | {RSP_OK, 601, 601, -1, 602, 5, {ACT_CMD+AT_HLC} }, | 285 | {RSP_OK, 601, 601, -1, 603, 5, {ACT_CMD+AT_PROTO} }, |
286 | {RSP_NULL, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} }, | ||
287 | {RSP_OK, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} }, | ||
288 | {RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} }, | 286 | {RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} }, |
289 | {RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} }, | 287 | {RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} }, |
290 | {RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, | 288 | {RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, |
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 05947f9c1849..8738b0821fc9 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -45,10 +45,6 @@ | |||
45 | #define MAX_EVENTS 64 /* size of event queue */ | 45 | #define MAX_EVENTS 64 /* size of event queue */ |
46 | 46 | ||
47 | #define RBUFSIZE 8192 | 47 | #define RBUFSIZE 8192 |
48 | #define SBUFSIZE 4096 /* sk_buff payload size */ | ||
49 | |||
50 | #define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */ | ||
51 | #define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */ | ||
52 | 48 | ||
53 | /* compile time options */ | 49 | /* compile time options */ |
54 | #define GIG_MAJOR 0 | 50 | #define GIG_MAJOR 0 |
@@ -190,10 +186,9 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, | |||
190 | #define AT_BC 3 | 186 | #define AT_BC 3 |
191 | #define AT_PROTO 4 | 187 | #define AT_PROTO 4 |
192 | #define AT_TYPE 5 | 188 | #define AT_TYPE 5 |
193 | #define AT_HLC 6 | 189 | #define AT_CLIP 6 |
194 | #define AT_CLIP 7 | ||
195 | /* total number */ | 190 | /* total number */ |
196 | #define AT_NUM 8 | 191 | #define AT_NUM 7 |
197 | 192 | ||
198 | /* variables in struct at_state_t */ | 193 | /* variables in struct at_state_t */ |
199 | #define VAR_ZSAU 0 | 194 | #define VAR_ZSAU 0 |
@@ -380,8 +375,10 @@ struct bc_state { | |||
380 | 375 | ||
381 | struct at_state_t at_state; | 376 | struct at_state_t at_state; |
382 | 377 | ||
383 | __u16 fcs; | 378 | /* receive buffer */ |
384 | struct sk_buff *skb; | 379 | unsigned rx_bufsize; /* max size accepted by application */ |
380 | struct sk_buff *rx_skb; | ||
381 | __u16 rx_fcs; | ||
385 | int inputstate; /* see INS_XXXX */ | 382 | int inputstate; /* see INS_XXXX */ |
386 | 383 | ||
387 | int channel; | 384 | int channel; |
@@ -406,7 +403,9 @@ struct bc_state { | |||
406 | struct bas_bc_state *bas; /* usb hardware driver (base) */ | 403 | struct bas_bc_state *bas; /* usb hardware driver (base) */ |
407 | } hw; | 404 | } hw; |
408 | 405 | ||
409 | void *ap; /* LL application structure */ | 406 | void *ap; /* associated LL application */ |
407 | int apconnstate; /* LL application connection state */ | ||
408 | spinlock_t aplock; | ||
410 | }; | 409 | }; |
411 | 410 | ||
412 | struct cardstate { | 411 | struct cardstate { |
@@ -801,8 +800,23 @@ static inline void gigaset_bchannel_up(struct bc_state *bcs) | |||
801 | gigaset_schedule_event(bcs->cs); | 800 | gigaset_schedule_event(bcs->cs); |
802 | } | 801 | } |
803 | 802 | ||
804 | /* handling routines for sk_buff */ | 803 | /* set up next receive skb for data mode */ |
805 | /* ============================= */ | 804 | static inline struct sk_buff *gigaset_new_rx_skb(struct bc_state *bcs) |
805 | { | ||
806 | struct cardstate *cs = bcs->cs; | ||
807 | unsigned short hw_hdr_len = cs->hw_hdr_len; | ||
808 | |||
809 | if (bcs->ignore) { | ||
810 | bcs->rx_skb = NULL; | ||
811 | } else { | ||
812 | bcs->rx_skb = dev_alloc_skb(bcs->rx_bufsize + hw_hdr_len); | ||
813 | if (bcs->rx_skb == NULL) | ||
814 | dev_warn(cs->dev, "could not allocate skb\n"); | ||
815 | else | ||
816 | skb_reserve(bcs->rx_skb, hw_hdr_len); | ||
817 | } | ||
818 | return bcs->rx_skb; | ||
819 | } | ||
806 | 820 | ||
807 | /* append received bytes to inbuf */ | 821 | /* append received bytes to inbuf */ |
808 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, | 822 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, |
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c index c22e5ace8276..f01c3c2e2e46 100644 --- a/drivers/isdn/gigaset/i4l.c +++ b/drivers/isdn/gigaset/i4l.c | |||
@@ -16,7 +16,10 @@ | |||
16 | #include "gigaset.h" | 16 | #include "gigaset.h" |
17 | #include <linux/isdnif.h> | 17 | #include <linux/isdnif.h> |
18 | 18 | ||
19 | #define SBUFSIZE 4096 /* sk_buff payload size */ | ||
20 | #define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */ | ||
19 | #define HW_HDR_LEN 2 /* Header size used to store ack info */ | 21 | #define HW_HDR_LEN 2 /* Header size used to store ack info */ |
22 | #define MAX_BUF_SIZE (SBUFSIZE - HW_HDR_LEN) /* max data packet from LL */ | ||
20 | 23 | ||
21 | /* == Handling of I4L IO =====================================================*/ | 24 | /* == Handling of I4L IO =====================================================*/ |
22 | 25 | ||
@@ -231,6 +234,15 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
231 | dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n"); | 234 | dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n"); |
232 | return -EBUSY; | 235 | return -EBUSY; |
233 | } | 236 | } |
237 | switch (bcs->proto2) { | ||
238 | case L2_HDLC: | ||
239 | bcs->rx_bufsize = SBUFSIZE; | ||
240 | break; | ||
241 | default: /* assume transparent */ | ||
242 | bcs->rx_bufsize = TRANSBUFSIZE; | ||
243 | } | ||
244 | dev_kfree_skb(bcs->rx_skb); | ||
245 | gigaset_new_rx_skb(bcs); | ||
234 | 246 | ||
235 | commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC); | 247 | commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC); |
236 | if (!commands) { | 248 | if (!commands) { |
@@ -314,6 +326,15 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
314 | return -EINVAL; | 326 | return -EINVAL; |
315 | } | 327 | } |
316 | bcs = cs->bcs + ch; | 328 | bcs = cs->bcs + ch; |
329 | switch (bcs->proto2) { | ||
330 | case L2_HDLC: | ||
331 | bcs->rx_bufsize = SBUFSIZE; | ||
332 | break; | ||
333 | default: /* assume transparent */ | ||
334 | bcs->rx_bufsize = TRANSBUFSIZE; | ||
335 | } | ||
336 | dev_kfree_skb(bcs->rx_skb); | ||
337 | gigaset_new_rx_skb(bcs); | ||
317 | if (!gigaset_add_event(cs, &bcs->at_state, | 338 | if (!gigaset_add_event(cs, &bcs->at_state, |
318 | EV_ACCEPT, NULL, 0, NULL)) | 339 | EV_ACCEPT, NULL, 0, NULL)) |
319 | return -ENOMEM; | 340 | return -ENOMEM; |
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index 16fd3bd48883..2dfd346fc889 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -500,19 +500,18 @@ int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len) | |||
500 | */ | 500 | */ |
501 | static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) | 501 | static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) |
502 | { | 502 | { |
503 | bcs->fcs = crc_ccitt_byte(bcs->fcs, c); | 503 | bcs->rx_fcs = crc_ccitt_byte(bcs->rx_fcs, c); |
504 | if (unlikely(bcs->skb == NULL)) { | 504 | if (bcs->rx_skb == NULL) |
505 | /* skipping */ | 505 | /* skipping */ |
506 | return; | 506 | return; |
507 | } | 507 | if (bcs->rx_skb->len >= bcs->rx_bufsize) { |
508 | if (unlikely(bcs->skb->len == SBUFSIZE)) { | ||
509 | dev_warn(bcs->cs->dev, "received oversized packet discarded\n"); | 508 | dev_warn(bcs->cs->dev, "received oversized packet discarded\n"); |
510 | bcs->hw.bas->giants++; | 509 | bcs->hw.bas->giants++; |
511 | dev_kfree_skb_any(bcs->skb); | 510 | dev_kfree_skb_any(bcs->rx_skb); |
512 | bcs->skb = NULL; | 511 | bcs->rx_skb = NULL; |
513 | return; | 512 | return; |
514 | } | 513 | } |
515 | *__skb_put(bcs->skb, 1) = c; | 514 | *__skb_put(bcs->rx_skb, 1) = c; |
516 | } | 515 | } |
517 | 516 | ||
518 | /* hdlc_flush | 517 | /* hdlc_flush |
@@ -521,18 +520,13 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) | |||
521 | static inline void hdlc_flush(struct bc_state *bcs) | 520 | static inline void hdlc_flush(struct bc_state *bcs) |
522 | { | 521 | { |
523 | /* clear skb or allocate new if not skipping */ | 522 | /* clear skb or allocate new if not skipping */ |
524 | if (likely(bcs->skb != NULL)) | 523 | if (bcs->rx_skb != NULL) |
525 | skb_trim(bcs->skb, 0); | 524 | skb_trim(bcs->rx_skb, 0); |
526 | else if (!bcs->ignore) { | 525 | else |
527 | bcs->skb = dev_alloc_skb(SBUFSIZE + bcs->cs->hw_hdr_len); | 526 | gigaset_new_rx_skb(bcs); |
528 | if (bcs->skb) | ||
529 | skb_reserve(bcs->skb, bcs->cs->hw_hdr_len); | ||
530 | else | ||
531 | dev_err(bcs->cs->dev, "could not allocate skb\n"); | ||
532 | } | ||
533 | 527 | ||
534 | /* reset packet state */ | 528 | /* reset packet state */ |
535 | bcs->fcs = PPP_INITFCS; | 529 | bcs->rx_fcs = PPP_INITFCS; |
536 | } | 530 | } |
537 | 531 | ||
538 | /* hdlc_done | 532 | /* hdlc_done |
@@ -549,7 +543,7 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
549 | hdlc_flush(bcs); | 543 | hdlc_flush(bcs); |
550 | return; | 544 | return; |
551 | } | 545 | } |
552 | procskb = bcs->skb; | 546 | procskb = bcs->rx_skb; |
553 | if (procskb == NULL) { | 547 | if (procskb == NULL) { |
554 | /* previous error */ | 548 | /* previous error */ |
555 | gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__); | 549 | gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__); |
@@ -560,8 +554,8 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
560 | bcs->hw.bas->runts++; | 554 | bcs->hw.bas->runts++; |
561 | dev_kfree_skb_any(procskb); | 555 | dev_kfree_skb_any(procskb); |
562 | gigaset_isdn_rcv_err(bcs); | 556 | gigaset_isdn_rcv_err(bcs); |
563 | } else if (bcs->fcs != PPP_GOODFCS) { | 557 | } else if (bcs->rx_fcs != PPP_GOODFCS) { |
564 | dev_notice(cs->dev, "frame check error (0x%04x)\n", bcs->fcs); | 558 | dev_notice(cs->dev, "frame check error\n"); |
565 | bcs->hw.bas->fcserrs++; | 559 | bcs->hw.bas->fcserrs++; |
566 | dev_kfree_skb_any(procskb); | 560 | dev_kfree_skb_any(procskb); |
567 | gigaset_isdn_rcv_err(bcs); | 561 | gigaset_isdn_rcv_err(bcs); |
@@ -574,13 +568,8 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
574 | bcs->hw.bas->goodbytes += len; | 568 | bcs->hw.bas->goodbytes += len; |
575 | gigaset_skb_rcvd(bcs, procskb); | 569 | gigaset_skb_rcvd(bcs, procskb); |
576 | } | 570 | } |
577 | 571 | gigaset_new_rx_skb(bcs); | |
578 | bcs->skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 572 | bcs->rx_fcs = PPP_INITFCS; |
579 | if (bcs->skb) | ||
580 | skb_reserve(bcs->skb, cs->hw_hdr_len); | ||
581 | else | ||
582 | dev_err(cs->dev, "could not allocate skb\n"); | ||
583 | bcs->fcs = PPP_INITFCS; | ||
584 | } | 573 | } |
585 | 574 | ||
586 | /* hdlc_frag | 575 | /* hdlc_frag |
@@ -597,8 +586,8 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits) | |||
597 | dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits); | 586 | dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits); |
598 | bcs->hw.bas->alignerrs++; | 587 | bcs->hw.bas->alignerrs++; |
599 | gigaset_isdn_rcv_err(bcs); | 588 | gigaset_isdn_rcv_err(bcs); |
600 | __skb_trim(bcs->skb, 0); | 589 | __skb_trim(bcs->rx_skb, 0); |
601 | bcs->fcs = PPP_INITFCS; | 590 | bcs->rx_fcs = PPP_INITFCS; |
602 | } | 591 | } |
603 | 592 | ||
604 | /* bit counts lookup table for HDLC bit unstuffing | 593 | /* bit counts lookup table for HDLC bit unstuffing |
@@ -847,7 +836,6 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
847 | static inline void trans_receive(unsigned char *src, unsigned count, | 836 | static inline void trans_receive(unsigned char *src, unsigned count, |
848 | struct bc_state *bcs) | 837 | struct bc_state *bcs) |
849 | { | 838 | { |
850 | struct cardstate *cs = bcs->cs; | ||
851 | struct sk_buff *skb; | 839 | struct sk_buff *skb; |
852 | int dobytes; | 840 | int dobytes; |
853 | unsigned char *dst; | 841 | unsigned char *dst; |
@@ -857,17 +845,11 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
857 | hdlc_flush(bcs); | 845 | hdlc_flush(bcs); |
858 | return; | 846 | return; |
859 | } | 847 | } |
860 | skb = bcs->skb; | 848 | skb = bcs->rx_skb; |
861 | if (unlikely(skb == NULL)) { | 849 | if (skb == NULL) |
862 | bcs->skb = skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 850 | skb = gigaset_new_rx_skb(bcs); |
863 | if (!skb) { | ||
864 | dev_err(cs->dev, "could not allocate skb\n"); | ||
865 | return; | ||
866 | } | ||
867 | skb_reserve(skb, cs->hw_hdr_len); | ||
868 | } | ||
869 | bcs->hw.bas->goodbytes += skb->len; | 851 | bcs->hw.bas->goodbytes += skb->len; |
870 | dobytes = TRANSBUFSIZE - skb->len; | 852 | dobytes = bcs->rx_bufsize - skb->len; |
871 | while (count > 0) { | 853 | while (count > 0) { |
872 | dst = skb_put(skb, count < dobytes ? count : dobytes); | 854 | dst = skb_put(skb, count < dobytes ? count : dobytes); |
873 | while (count > 0 && dobytes > 0) { | 855 | while (count > 0 && dobytes > 0) { |
@@ -879,14 +861,10 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
879 | dump_bytes(DEBUG_STREAM_DUMP, | 861 | dump_bytes(DEBUG_STREAM_DUMP, |
880 | "rcv data", skb->data, skb->len); | 862 | "rcv data", skb->data, skb->len); |
881 | gigaset_skb_rcvd(bcs, skb); | 863 | gigaset_skb_rcvd(bcs, skb); |
882 | bcs->skb = skb = | 864 | skb = gigaset_new_rx_skb(bcs); |
883 | dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 865 | if (skb == NULL) |
884 | if (!skb) { | ||
885 | dev_err(cs->dev, "could not allocate skb\n"); | ||
886 | return; | 866 | return; |
887 | } | 867 | dobytes = bcs->rx_bufsize; |
888 | skb_reserve(skb, cs->hw_hdr_len); | ||
889 | dobytes = TRANSBUFSIZE; | ||
890 | } | 868 | } |
891 | } | 869 | } |
892 | } | 870 | } |
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index 72eb92647c1b..feec8d89d719 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c | |||
@@ -187,12 +187,13 @@ void | |||
187 | hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) | 187 | hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) |
188 | { | 188 | { |
189 | struct net_local *lp = card->netif; | 189 | struct net_local *lp = card->netif; |
190 | struct net_device *dev = lp->dev; | 190 | struct net_device *dev; |
191 | struct sk_buff *skb; | 191 | struct sk_buff *skb; |
192 | 192 | ||
193 | if (!lp) | 193 | if (!lp) |
194 | return; /* non existing device */ | 194 | return; /* non existing device */ |
195 | 195 | ||
196 | dev = lp->dev; | ||
196 | dev->stats.rx_bytes += len; | 197 | dev->stats.rx_bytes += len; |
197 | 198 | ||
198 | skb = dev_alloc_skb(len); | 199 | skb = dev_alloc_skb(len); |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 40fdc41446cc..df483076eda6 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -340,7 +340,8 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp) | |||
340 | 340 | ||
341 | if ((client_info->assigned) && | 341 | if ((client_info->assigned) && |
342 | (client_info->ip_src == arp->ip_dst) && | 342 | (client_info->ip_src == arp->ip_dst) && |
343 | (client_info->ip_dst == arp->ip_src)) { | 343 | (client_info->ip_dst == arp->ip_src) && |
344 | (compare_ether_addr_64bits(client_info->mac_dst, arp->mac_src))) { | ||
344 | /* update the clients MAC address */ | 345 | /* update the clients MAC address */ |
345 | memcpy(client_info->mac_dst, arp->mac_src, ETH_ALEN); | 346 | memcpy(client_info->mac_dst, arp->mac_src, ETH_ALEN); |
346 | client_info->ntt = 1; | 347 | client_info->ntt = 1; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 5e12462a9d5e..c3d98dde2f86 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -168,7 +168,7 @@ static int arp_ip_count; | |||
168 | static int bond_mode = BOND_MODE_ROUNDROBIN; | 168 | static int bond_mode = BOND_MODE_ROUNDROBIN; |
169 | static int xmit_hashtype = BOND_XMIT_POLICY_LAYER2; | 169 | static int xmit_hashtype = BOND_XMIT_POLICY_LAYER2; |
170 | static int lacp_fast; | 170 | static int lacp_fast; |
171 | 171 | static int disable_netpoll = 1; | |
172 | 172 | ||
173 | const struct bond_parm_tbl bond_lacp_tbl[] = { | 173 | const struct bond_parm_tbl bond_lacp_tbl[] = { |
174 | { "slow", AD_LACP_SLOW}, | 174 | { "slow", AD_LACP_SLOW}, |
@@ -1742,15 +1742,23 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1742 | bond_set_carrier(bond); | 1742 | bond_set_carrier(bond); |
1743 | 1743 | ||
1744 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1744 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1745 | if (slaves_support_netpoll(bond_dev)) { | 1745 | /* |
1746 | bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL; | 1746 | * Netpoll and bonding is broken, make sure it is not initialized |
1747 | if (bond_dev->npinfo) | 1747 | * until it is fixed. |
1748 | slave_dev->npinfo = bond_dev->npinfo; | 1748 | */ |
1749 | } else if (!(bond_dev->priv_flags & IFF_DISABLE_NETPOLL)) { | 1749 | if (disable_netpoll) { |
1750 | bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; | 1750 | bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; |
1751 | pr_info("New slave device %s does not support netpoll\n", | 1751 | } else { |
1752 | slave_dev->name); | 1752 | if (slaves_support_netpoll(bond_dev)) { |
1753 | pr_info("Disabling netpoll support for %s\n", bond_dev->name); | 1753 | bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL; |
1754 | if (bond_dev->npinfo) | ||
1755 | slave_dev->npinfo = bond_dev->npinfo; | ||
1756 | } else if (!(bond_dev->priv_flags & IFF_DISABLE_NETPOLL)) { | ||
1757 | bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; | ||
1758 | pr_info("New slave device %s does not support netpoll\n", | ||
1759 | slave_dev->name); | ||
1760 | pr_info("Disabling netpoll support for %s\n", bond_dev->name); | ||
1761 | } | ||
1754 | } | 1762 | } |
1755 | #endif | 1763 | #endif |
1756 | read_unlock(&bond->lock); | 1764 | read_unlock(&bond->lock); |
@@ -1950,8 +1958,11 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1950 | 1958 | ||
1951 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1959 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1952 | read_lock_bh(&bond->lock); | 1960 | read_lock_bh(&bond->lock); |
1953 | if (slaves_support_netpoll(bond_dev)) | 1961 | |
1954 | bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL; | 1962 | /* Make sure netpoll over stays disabled until fixed. */ |
1963 | if (!disable_netpoll) | ||
1964 | if (slaves_support_netpoll(bond_dev)) | ||
1965 | bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL; | ||
1955 | read_unlock_bh(&bond->lock); | 1966 | read_unlock_bh(&bond->lock); |
1956 | if (slave_dev->netdev_ops->ndo_netpoll_cleanup) | 1967 | if (slave_dev->netdev_ops->ndo_netpoll_cleanup) |
1957 | slave_dev->netdev_ops->ndo_netpoll_cleanup(slave_dev); | 1968 | slave_dev->netdev_ops->ndo_netpoll_cleanup(slave_dev); |
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 3c58db595285..23786ee34bed 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
@@ -1181,7 +1181,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev) | |||
1181 | if (netif_msg_drv(priv)) | 1181 | if (netif_msg_drv(priv)) |
1182 | printk(KERN_ERR "%s: Could not attach to PHY\n", | 1182 | printk(KERN_ERR "%s: Could not attach to PHY\n", |
1183 | dev->name); | 1183 | dev->name); |
1184 | return PTR_ERR(priv->phy); | 1184 | rc = PTR_ERR(priv->phy); |
1185 | goto fail; | ||
1185 | } | 1186 | } |
1186 | 1187 | ||
1187 | if ((rc = register_netdev(dev))) { | 1188 | if ((rc = register_netdev(dev))) { |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index ce30c62a97f7..7b5d9764f317 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -3684,10 +3684,6 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
3684 | /* signal that we are down to the interrupt handler */ | 3684 | /* signal that we are down to the interrupt handler */ |
3685 | set_bit(__IXGBE_DOWN, &adapter->state); | 3685 | set_bit(__IXGBE_DOWN, &adapter->state); |
3686 | 3686 | ||
3687 | /* power down the optics */ | ||
3688 | if (hw->phy.multispeed_fiber) | ||
3689 | hw->mac.ops.disable_tx_laser(hw); | ||
3690 | |||
3691 | /* disable receive for all VFs and wait one second */ | 3687 | /* disable receive for all VFs and wait one second */ |
3692 | if (adapter->num_vfs) { | 3688 | if (adapter->num_vfs) { |
3693 | /* ping all the active vfs to let them know we are going down */ | 3689 | /* ping all the active vfs to let them know we are going down */ |
@@ -3742,6 +3738,10 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
3742 | (IXGBE_READ_REG(hw, IXGBE_DMATXCTL) & | 3738 | (IXGBE_READ_REG(hw, IXGBE_DMATXCTL) & |
3743 | ~IXGBE_DMATXCTL_TE)); | 3739 | ~IXGBE_DMATXCTL_TE)); |
3744 | 3740 | ||
3741 | /* power down the optics */ | ||
3742 | if (hw->phy.multispeed_fiber) | ||
3743 | hw->mac.ops.disable_tx_laser(hw); | ||
3744 | |||
3745 | /* clear n-tuple filters that are cached */ | 3745 | /* clear n-tuple filters that are cached */ |
3746 | ethtool_ntuple_flush(netdev); | 3746 | ethtool_ntuple_flush(netdev); |
3747 | 3747 | ||
@@ -4001,7 +4001,7 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter) | |||
4001 | 4001 | ||
4002 | done: | 4002 | done: |
4003 | /* Notify the stack of the (possibly) reduced Tx Queue count. */ | 4003 | /* Notify the stack of the (possibly) reduced Tx Queue count. */ |
4004 | adapter->netdev->real_num_tx_queues = adapter->num_tx_queues; | 4004 | netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues); |
4005 | } | 4005 | } |
4006 | 4006 | ||
4007 | static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, | 4007 | static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, |
@@ -5195,7 +5195,6 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
5195 | ixgbe_free_all_tx_resources(adapter); | 5195 | ixgbe_free_all_tx_resources(adapter); |
5196 | ixgbe_free_all_rx_resources(adapter); | 5196 | ixgbe_free_all_rx_resources(adapter); |
5197 | } | 5197 | } |
5198 | ixgbe_clear_interrupt_scheme(adapter); | ||
5199 | 5198 | ||
5200 | #ifdef CONFIG_PM | 5199 | #ifdef CONFIG_PM |
5201 | retval = pci_save_state(pdev); | 5200 | retval = pci_save_state(pdev); |
@@ -5230,6 +5229,8 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
5230 | 5229 | ||
5231 | *enable_wake = !!wufc; | 5230 | *enable_wake = !!wufc; |
5232 | 5231 | ||
5232 | ixgbe_clear_interrupt_scheme(adapter); | ||
5233 | |||
5233 | ixgbe_release_hw_control(adapter); | 5234 | ixgbe_release_hw_control(adapter); |
5234 | 5235 | ||
5235 | pci_disable_device(pdev); | 5236 | pci_disable_device(pdev); |
@@ -6023,7 +6024,6 @@ static void ixgbe_tx_queue(struct ixgbe_adapter *adapter, | |||
6023 | static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, | 6024 | static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, |
6024 | int queue, u32 tx_flags) | 6025 | int queue, u32 tx_flags) |
6025 | { | 6026 | { |
6026 | /* Right now, we support IPv4 only */ | ||
6027 | struct ixgbe_atr_input atr_input; | 6027 | struct ixgbe_atr_input atr_input; |
6028 | struct tcphdr *th; | 6028 | struct tcphdr *th; |
6029 | struct iphdr *iph = ip_hdr(skb); | 6029 | struct iphdr *iph = ip_hdr(skb); |
@@ -6032,6 +6032,9 @@ static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, | |||
6032 | u32 src_ipv4_addr, dst_ipv4_addr; | 6032 | u32 src_ipv4_addr, dst_ipv4_addr; |
6033 | u8 l4type = 0; | 6033 | u8 l4type = 0; |
6034 | 6034 | ||
6035 | /* Right now, we support IPv4 only */ | ||
6036 | if (skb->protocol != htons(ETH_P_IP)) | ||
6037 | return; | ||
6035 | /* check if we're UDP or TCP */ | 6038 | /* check if we're UDP or TCP */ |
6036 | if (iph->protocol == IPPROTO_TCP) { | 6039 | if (iph->protocol == IPPROTO_TCP) { |
6037 | th = tcp_hdr(skb); | 6040 | th = tcp_hdr(skb); |
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c index 52dcc8495647..6474c4973d3a 100644 --- a/drivers/net/ll_temac_main.c +++ b/drivers/net/ll_temac_main.c | |||
@@ -964,7 +964,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
964 | np = of_parse_phandle(op->dev.of_node, "llink-connected", 0); | 964 | np = of_parse_phandle(op->dev.of_node, "llink-connected", 0); |
965 | if (!np) { | 965 | if (!np) { |
966 | dev_err(&op->dev, "could not find DMA node\n"); | 966 | dev_err(&op->dev, "could not find DMA node\n"); |
967 | goto nodev; | 967 | goto err_iounmap; |
968 | } | 968 | } |
969 | 969 | ||
970 | /* Setup the DMA register accesses, could be DCR or memory mapped */ | 970 | /* Setup the DMA register accesses, could be DCR or memory mapped */ |
@@ -978,7 +978,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
978 | dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs); | 978 | dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs); |
979 | } else { | 979 | } else { |
980 | dev_err(&op->dev, "unable to map DMA registers\n"); | 980 | dev_err(&op->dev, "unable to map DMA registers\n"); |
981 | goto nodev; | 981 | goto err_iounmap; |
982 | } | 982 | } |
983 | } | 983 | } |
984 | 984 | ||
@@ -987,7 +987,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
987 | if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) { | 987 | if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) { |
988 | dev_err(&op->dev, "could not determine irqs\n"); | 988 | dev_err(&op->dev, "could not determine irqs\n"); |
989 | rc = -ENOMEM; | 989 | rc = -ENOMEM; |
990 | goto nodev; | 990 | goto err_iounmap_2; |
991 | } | 991 | } |
992 | 992 | ||
993 | of_node_put(np); /* Finished with the DMA node; drop the reference */ | 993 | of_node_put(np); /* Finished with the DMA node; drop the reference */ |
@@ -997,7 +997,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
997 | if ((!addr) || (size != 6)) { | 997 | if ((!addr) || (size != 6)) { |
998 | dev_err(&op->dev, "could not find MAC address\n"); | 998 | dev_err(&op->dev, "could not find MAC address\n"); |
999 | rc = -ENODEV; | 999 | rc = -ENODEV; |
1000 | goto nodev; | 1000 | goto err_iounmap_2; |
1001 | } | 1001 | } |
1002 | temac_set_mac_address(ndev, (void *)addr); | 1002 | temac_set_mac_address(ndev, (void *)addr); |
1003 | 1003 | ||
@@ -1013,7 +1013,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
1013 | rc = sysfs_create_group(&lp->dev->kobj, &temac_attr_group); | 1013 | rc = sysfs_create_group(&lp->dev->kobj, &temac_attr_group); |
1014 | if (rc) { | 1014 | if (rc) { |
1015 | dev_err(lp->dev, "Error creating sysfs files\n"); | 1015 | dev_err(lp->dev, "Error creating sysfs files\n"); |
1016 | goto nodev; | 1016 | goto err_iounmap_2; |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | rc = register_netdev(lp->ndev); | 1019 | rc = register_netdev(lp->ndev); |
@@ -1026,6 +1026,11 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
1026 | 1026 | ||
1027 | err_register_ndev: | 1027 | err_register_ndev: |
1028 | sysfs_remove_group(&lp->dev->kobj, &temac_attr_group); | 1028 | sysfs_remove_group(&lp->dev->kobj, &temac_attr_group); |
1029 | err_iounmap_2: | ||
1030 | if (lp->sdma_regs) | ||
1031 | iounmap(lp->sdma_regs); | ||
1032 | err_iounmap: | ||
1033 | iounmap(lp->regs); | ||
1029 | nodev: | 1034 | nodev: |
1030 | free_netdev(ndev); | 1035 | free_netdev(ndev); |
1031 | ndev = NULL; | 1036 | ndev = NULL; |
@@ -1044,6 +1049,9 @@ static int __devexit temac_of_remove(struct of_device *op) | |||
1044 | of_node_put(lp->phy_node); | 1049 | of_node_put(lp->phy_node); |
1045 | lp->phy_node = NULL; | 1050 | lp->phy_node = NULL; |
1046 | dev_set_drvdata(&op->dev, NULL); | 1051 | dev_set_drvdata(&op->dev, NULL); |
1052 | iounmap(lp->regs); | ||
1053 | if (lp->sdma_regs) | ||
1054 | iounmap(lp->sdma_regs); | ||
1047 | free_netdev(ndev); | 1055 | free_netdev(ndev); |
1048 | return 0; | 1056 | return 0; |
1049 | } | 1057 | } |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index e345ec8cb473..73bb8ea6f54a 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -289,6 +289,7 @@ struct mv643xx_eth_shared_private { | |||
289 | unsigned int t_clk; | 289 | unsigned int t_clk; |
290 | int extended_rx_coal_limit; | 290 | int extended_rx_coal_limit; |
291 | int tx_bw_control; | 291 | int tx_bw_control; |
292 | int tx_csum_limit; | ||
292 | }; | 293 | }; |
293 | 294 | ||
294 | #define TX_BW_CONTROL_ABSENT 0 | 295 | #define TX_BW_CONTROL_ABSENT 0 |
@@ -776,13 +777,16 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb) | |||
776 | l4i_chk = 0; | 777 | l4i_chk = 0; |
777 | 778 | ||
778 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 779 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
780 | int hdr_len; | ||
779 | int tag_bytes; | 781 | int tag_bytes; |
780 | 782 | ||
781 | BUG_ON(skb->protocol != htons(ETH_P_IP) && | 783 | BUG_ON(skb->protocol != htons(ETH_P_IP) && |
782 | skb->protocol != htons(ETH_P_8021Q)); | 784 | skb->protocol != htons(ETH_P_8021Q)); |
783 | 785 | ||
784 | tag_bytes = (void *)ip_hdr(skb) - (void *)skb->data - ETH_HLEN; | 786 | hdr_len = (void *)ip_hdr(skb) - (void *)skb->data; |
785 | if (unlikely(tag_bytes & ~12)) { | 787 | tag_bytes = hdr_len - ETH_HLEN; |
788 | if (skb->len - hdr_len > mp->shared->tx_csum_limit || | ||
789 | unlikely(tag_bytes & ~12)) { | ||
786 | if (skb_checksum_help(skb) == 0) | 790 | if (skb_checksum_help(skb) == 0) |
787 | goto no_csum; | 791 | goto no_csum; |
788 | kfree_skb(skb); | 792 | kfree_skb(skb); |
@@ -2666,6 +2670,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) | |||
2666 | * Detect hardware parameters. | 2670 | * Detect hardware parameters. |
2667 | */ | 2671 | */ |
2668 | msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000; | 2672 | msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000; |
2673 | msp->tx_csum_limit = pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024; | ||
2669 | infer_hw_params(msp); | 2674 | infer_hw_params(msp); |
2670 | 2675 | ||
2671 | platform_set_drvdata(pdev, msp); | 2676 | platform_set_drvdata(pdev, msp); |
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index b8e2923a1d69..1063093b3afc 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -806,8 +806,10 @@ static int __init ne_drv_probe(struct platform_device *pdev) | |||
806 | dev->base_addr = res->start; | 806 | dev->base_addr = res->start; |
807 | dev->irq = platform_get_irq(pdev, 0); | 807 | dev->irq = platform_get_irq(pdev, 0); |
808 | } else { | 808 | } else { |
809 | if (this_dev < 0 || this_dev >= MAX_NE_CARDS) | 809 | if (this_dev < 0 || this_dev >= MAX_NE_CARDS) { |
810 | free_netdev(dev); | ||
810 | return -EINVAL; | 811 | return -EINVAL; |
812 | } | ||
811 | dev->base_addr = io[this_dev]; | 813 | dev->base_addr = io[this_dev]; |
812 | dev->irq = irq[this_dev]; | 814 | dev->irq = irq[this_dev]; |
813 | dev->mem_end = bad[this_dev]; | 815 | dev->mem_end = bad[this_dev]; |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 5b3dfb4ab279..33525bf2a3d3 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -1168,6 +1168,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) | |||
1168 | int interrupts, nr_serviced = 0, i; | 1168 | int interrupts, nr_serviced = 0, i; |
1169 | struct ei_device *ei_local; | 1169 | struct ei_device *ei_local; |
1170 | int handled = 0; | 1170 | int handled = 0; |
1171 | unsigned long flags; | ||
1171 | 1172 | ||
1172 | e8390_base = dev->base_addr; | 1173 | e8390_base = dev->base_addr; |
1173 | ei_local = netdev_priv(dev); | 1174 | ei_local = netdev_priv(dev); |
@@ -1176,7 +1177,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) | |||
1176 | * Protect the irq test too. | 1177 | * Protect the irq test too. |
1177 | */ | 1178 | */ |
1178 | 1179 | ||
1179 | spin_lock(&ei_local->page_lock); | 1180 | spin_lock_irqsave(&ei_local->page_lock, flags); |
1180 | 1181 | ||
1181 | if (ei_local->irqlock) | 1182 | if (ei_local->irqlock) |
1182 | { | 1183 | { |
@@ -1188,7 +1189,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) | |||
1188 | dev->name, inb_p(e8390_base + EN0_ISR), | 1189 | dev->name, inb_p(e8390_base + EN0_ISR), |
1189 | inb_p(e8390_base + EN0_IMR)); | 1190 | inb_p(e8390_base + EN0_IMR)); |
1190 | #endif | 1191 | #endif |
1191 | spin_unlock(&ei_local->page_lock); | 1192 | spin_unlock_irqrestore(&ei_local->page_lock, flags); |
1192 | return IRQ_NONE; | 1193 | return IRQ_NONE; |
1193 | } | 1194 | } |
1194 | 1195 | ||
@@ -1261,7 +1262,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) | |||
1261 | ei_local->irqlock = 0; | 1262 | ei_local->irqlock = 0; |
1262 | outb_p(ENISR_ALL, e8390_base + EN0_IMR); | 1263 | outb_p(ENISR_ALL, e8390_base + EN0_IMR); |
1263 | 1264 | ||
1264 | spin_unlock(&ei_local->page_lock); | 1265 | spin_unlock_irqrestore(&ei_local->page_lock, flags); |
1265 | return IRQ_RETVAL(handled); | 1266 | return IRQ_RETVAL(handled); |
1266 | } | 1267 | } |
1267 | 1268 | ||
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 64e6a84bbbbe..307cd1721e91 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -1505,12 +1505,20 @@ irq_done: | |||
1505 | writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_LAN + CISREG_COR); | 1505 | writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_LAN + CISREG_COR); |
1506 | writeb(cor, smc->base + MOT_LAN + CISREG_COR); | 1506 | writeb(cor, smc->base + MOT_LAN + CISREG_COR); |
1507 | } | 1507 | } |
1508 | #ifdef DOES_NOT_WORK | 1508 | |
1509 | if (smc->base != NULL) { /* Megahertz MFC's */ | 1509 | if ((smc->base != NULL) && /* Megahertz MFC's */ |
1510 | readb(smc->base+MEGAHERTZ_ISR); | 1510 | (smc->manfid == MANFID_MEGAHERTZ) && |
1511 | readb(smc->base+MEGAHERTZ_ISR); | 1511 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) { |
1512 | |||
1513 | u_char tmp; | ||
1514 | tmp = readb(smc->base+MEGAHERTZ_ISR); | ||
1515 | tmp = readb(smc->base+MEGAHERTZ_ISR); | ||
1516 | |||
1517 | /* Retrigger interrupt if needed */ | ||
1518 | writeb(tmp, smc->base + MEGAHERTZ_ISR); | ||
1519 | writeb(tmp, smc->base + MEGAHERTZ_ISR); | ||
1512 | } | 1520 | } |
1513 | #endif | 1521 | |
1514 | spin_unlock(&smc->lock); | 1522 | spin_unlock(&smc->lock); |
1515 | return IRQ_RETVAL(handled); | 1523 | return IRQ_RETVAL(handled); |
1516 | } | 1524 | } |
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index dbd003453737..29c39ff85de5 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c | |||
@@ -226,6 +226,7 @@ module_exit(lxt_exit); | |||
226 | static struct mdio_device_id lxt_tbl[] = { | 226 | static struct mdio_device_id lxt_tbl[] = { |
227 | { 0x78100000, 0xfffffff0 }, | 227 | { 0x78100000, 0xfffffff0 }, |
228 | { 0x001378e0, 0xfffffff0 }, | 228 | { 0x001378e0, 0xfffffff0 }, |
229 | { 0x00137a10, 0xfffffff0 }, | ||
229 | { } | 230 | { } |
230 | }; | 231 | }; |
231 | 232 | ||
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index fa4b24c49f42..d10bcefc0e45 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -4611,8 +4611,7 @@ static void ql_timer(unsigned long data) | |||
4611 | return; | 4611 | return; |
4612 | } | 4612 | } |
4613 | 4613 | ||
4614 | qdev->timer.expires = jiffies + (5*HZ); | 4614 | mod_timer(&qdev->timer, jiffies + (5*HZ)); |
4615 | add_timer(&qdev->timer); | ||
4616 | } | 4615 | } |
4617 | 4616 | ||
4618 | static int __devinit qlge_probe(struct pci_dev *pdev, | 4617 | static int __devinit qlge_probe(struct pci_dev *pdev, |
@@ -4713,6 +4712,8 @@ static void ql_eeh_close(struct net_device *ndev) | |||
4713 | netif_stop_queue(ndev); | 4712 | netif_stop_queue(ndev); |
4714 | } | 4713 | } |
4715 | 4714 | ||
4715 | /* Disabling the timer */ | ||
4716 | del_timer_sync(&qdev->timer); | ||
4716 | if (test_bit(QL_ADAPTER_UP, &qdev->flags)) | 4717 | if (test_bit(QL_ADAPTER_UP, &qdev->flags)) |
4717 | cancel_delayed_work_sync(&qdev->asic_reset_work); | 4718 | cancel_delayed_work_sync(&qdev->asic_reset_work); |
4718 | cancel_delayed_work_sync(&qdev->mpi_reset_work); | 4719 | cancel_delayed_work_sync(&qdev->mpi_reset_work); |
@@ -4808,8 +4809,7 @@ static void qlge_io_resume(struct pci_dev *pdev) | |||
4808 | netif_err(qdev, ifup, qdev->ndev, | 4809 | netif_err(qdev, ifup, qdev->ndev, |
4809 | "Device was not running prior to EEH.\n"); | 4810 | "Device was not running prior to EEH.\n"); |
4810 | } | 4811 | } |
4811 | qdev->timer.expires = jiffies + (5*HZ); | 4812 | mod_timer(&qdev->timer, jiffies + (5*HZ)); |
4812 | add_timer(&qdev->timer); | ||
4813 | netif_device_attach(ndev); | 4813 | netif_device_attach(ndev); |
4814 | } | 4814 | } |
4815 | 4815 | ||
@@ -4871,8 +4871,7 @@ static int qlge_resume(struct pci_dev *pdev) | |||
4871 | return err; | 4871 | return err; |
4872 | } | 4872 | } |
4873 | 4873 | ||
4874 | qdev->timer.expires = jiffies + (5*HZ); | 4874 | mod_timer(&qdev->timer, jiffies + (5*HZ)); |
4875 | add_timer(&qdev->timer); | ||
4876 | netif_device_attach(ndev); | 4875 | netif_device_attach(ndev); |
4877 | 4876 | ||
4878 | return 0; | 4877 | return 0; |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 96b6cfbf0a3a..cdc6a5c2e70d 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1316,7 +1316,7 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp, | |||
1316 | { 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_26 }, | 1316 | { 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_26 }, |
1317 | 1317 | ||
1318 | /* 8168C family. */ | 1318 | /* 8168C family. */ |
1319 | { 0x7cf00000, 0x3ca00000, RTL_GIGA_MAC_VER_24 }, | 1319 | { 0x7cf00000, 0x3cb00000, RTL_GIGA_MAC_VER_24 }, |
1320 | { 0x7cf00000, 0x3c900000, RTL_GIGA_MAC_VER_23 }, | 1320 | { 0x7cf00000, 0x3c900000, RTL_GIGA_MAC_VER_23 }, |
1321 | { 0x7cf00000, 0x3c800000, RTL_GIGA_MAC_VER_18 }, | 1321 | { 0x7cf00000, 0x3c800000, RTL_GIGA_MAC_VER_18 }, |
1322 | { 0x7c800000, 0x3c800000, RTL_GIGA_MAC_VER_24 }, | 1322 | { 0x7c800000, 0x3c800000, RTL_GIGA_MAC_VER_24 }, |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 668327ccd8d0..1d37f0c310ca 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -3130,7 +3130,6 @@ static void tx_intr_handler(struct fifo_info *fifo_data) | |||
3130 | pkt_cnt++; | 3130 | pkt_cnt++; |
3131 | 3131 | ||
3132 | /* Updating the statistics block */ | 3132 | /* Updating the statistics block */ |
3133 | nic->dev->stats.tx_bytes += skb->len; | ||
3134 | swstats->mem_freed += skb->truesize; | 3133 | swstats->mem_freed += skb->truesize; |
3135 | dev_kfree_skb_irq(skb); | 3134 | dev_kfree_skb_irq(skb); |
3136 | 3135 | ||
@@ -4901,48 +4900,81 @@ static void s2io_updt_stats(struct s2io_nic *sp) | |||
4901 | * Return value: | 4900 | * Return value: |
4902 | * pointer to the updated net_device_stats structure. | 4901 | * pointer to the updated net_device_stats structure. |
4903 | */ | 4902 | */ |
4904 | |||
4905 | static struct net_device_stats *s2io_get_stats(struct net_device *dev) | 4903 | static struct net_device_stats *s2io_get_stats(struct net_device *dev) |
4906 | { | 4904 | { |
4907 | struct s2io_nic *sp = netdev_priv(dev); | 4905 | struct s2io_nic *sp = netdev_priv(dev); |
4908 | struct config_param *config = &sp->config; | ||
4909 | struct mac_info *mac_control = &sp->mac_control; | 4906 | struct mac_info *mac_control = &sp->mac_control; |
4910 | struct stat_block *stats = mac_control->stats_info; | 4907 | struct stat_block *stats = mac_control->stats_info; |
4911 | int i; | 4908 | u64 delta; |
4912 | 4909 | ||
4913 | /* Configure Stats for immediate updt */ | 4910 | /* Configure Stats for immediate updt */ |
4914 | s2io_updt_stats(sp); | 4911 | s2io_updt_stats(sp); |
4915 | 4912 | ||
4916 | /* Using sp->stats as a staging area, because reset (due to mtu | 4913 | /* A device reset will cause the on-adapter statistics to be zero'ed. |
4917 | change, for example) will clear some hardware counters */ | 4914 | * This can be done while running by changing the MTU. To prevent the |
4918 | dev->stats.tx_packets += le32_to_cpu(stats->tmac_frms) - | 4915 | * system from having the stats zero'ed, the driver keeps a copy of the |
4919 | sp->stats.tx_packets; | 4916 | * last update to the system (which is also zero'ed on reset). This |
4920 | sp->stats.tx_packets = le32_to_cpu(stats->tmac_frms); | 4917 | * enables the driver to accurately know the delta between the last |
4921 | 4918 | * update and the current update. | |
4922 | dev->stats.tx_errors += le32_to_cpu(stats->tmac_any_err_frms) - | 4919 | */ |
4923 | sp->stats.tx_errors; | 4920 | delta = ((u64) le32_to_cpu(stats->rmac_vld_frms_oflow) << 32 | |
4924 | sp->stats.tx_errors = le32_to_cpu(stats->tmac_any_err_frms); | 4921 | le32_to_cpu(stats->rmac_vld_frms)) - sp->stats.rx_packets; |
4925 | 4922 | sp->stats.rx_packets += delta; | |
4926 | dev->stats.rx_errors += le64_to_cpu(stats->rmac_drop_frms) - | 4923 | dev->stats.rx_packets += delta; |
4927 | sp->stats.rx_errors; | 4924 | |
4928 | sp->stats.rx_errors = le64_to_cpu(stats->rmac_drop_frms); | 4925 | delta = ((u64) le32_to_cpu(stats->tmac_frms_oflow) << 32 | |
4929 | 4926 | le32_to_cpu(stats->tmac_frms)) - sp->stats.tx_packets; | |
4930 | dev->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms) - | 4927 | sp->stats.tx_packets += delta; |
4931 | sp->stats.multicast; | 4928 | dev->stats.tx_packets += delta; |
4932 | sp->stats.multicast = le32_to_cpu(stats->rmac_vld_mcst_frms); | 4929 | |
4933 | 4930 | delta = ((u64) le32_to_cpu(stats->rmac_data_octets_oflow) << 32 | | |
4934 | dev->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms) - | 4931 | le32_to_cpu(stats->rmac_data_octets)) - sp->stats.rx_bytes; |
4935 | sp->stats.rx_length_errors; | 4932 | sp->stats.rx_bytes += delta; |
4936 | sp->stats.rx_length_errors = le64_to_cpu(stats->rmac_long_frms); | 4933 | dev->stats.rx_bytes += delta; |
4934 | |||
4935 | delta = ((u64) le32_to_cpu(stats->tmac_data_octets_oflow) << 32 | | ||
4936 | le32_to_cpu(stats->tmac_data_octets)) - sp->stats.tx_bytes; | ||
4937 | sp->stats.tx_bytes += delta; | ||
4938 | dev->stats.tx_bytes += delta; | ||
4939 | |||
4940 | delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_errors; | ||
4941 | sp->stats.rx_errors += delta; | ||
4942 | dev->stats.rx_errors += delta; | ||
4943 | |||
4944 | delta = ((u64) le32_to_cpu(stats->tmac_any_err_frms_oflow) << 32 | | ||
4945 | le32_to_cpu(stats->tmac_any_err_frms)) - sp->stats.tx_errors; | ||
4946 | sp->stats.tx_errors += delta; | ||
4947 | dev->stats.tx_errors += delta; | ||
4948 | |||
4949 | delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_dropped; | ||
4950 | sp->stats.rx_dropped += delta; | ||
4951 | dev->stats.rx_dropped += delta; | ||
4952 | |||
4953 | delta = le64_to_cpu(stats->tmac_drop_frms) - sp->stats.tx_dropped; | ||
4954 | sp->stats.tx_dropped += delta; | ||
4955 | dev->stats.tx_dropped += delta; | ||
4956 | |||
4957 | /* The adapter MAC interprets pause frames as multicast packets, but | ||
4958 | * does not pass them up. This erroneously increases the multicast | ||
4959 | * packet count and needs to be deducted when the multicast frame count | ||
4960 | * is queried. | ||
4961 | */ | ||
4962 | delta = (u64) le32_to_cpu(stats->rmac_vld_mcst_frms_oflow) << 32 | | ||
4963 | le32_to_cpu(stats->rmac_vld_mcst_frms); | ||
4964 | delta -= le64_to_cpu(stats->rmac_pause_ctrl_frms); | ||
4965 | delta -= sp->stats.multicast; | ||
4966 | sp->stats.multicast += delta; | ||
4967 | dev->stats.multicast += delta; | ||
4937 | 4968 | ||
4938 | /* collect per-ring rx_packets and rx_bytes */ | 4969 | delta = ((u64) le32_to_cpu(stats->rmac_usized_frms_oflow) << 32 | |
4939 | dev->stats.rx_packets = dev->stats.rx_bytes = 0; | 4970 | le32_to_cpu(stats->rmac_usized_frms)) + |
4940 | for (i = 0; i < config->rx_ring_num; i++) { | 4971 | le64_to_cpu(stats->rmac_long_frms) - sp->stats.rx_length_errors; |
4941 | struct ring_info *ring = &mac_control->rings[i]; | 4972 | sp->stats.rx_length_errors += delta; |
4973 | dev->stats.rx_length_errors += delta; | ||
4942 | 4974 | ||
4943 | dev->stats.rx_packets += ring->rx_packets; | 4975 | delta = le64_to_cpu(stats->rmac_fcs_err_frms) - sp->stats.rx_crc_errors; |
4944 | dev->stats.rx_bytes += ring->rx_bytes; | 4976 | sp->stats.rx_crc_errors += delta; |
4945 | } | 4977 | dev->stats.rx_crc_errors += delta; |
4946 | 4978 | ||
4947 | return &dev->stats; | 4979 | return &dev->stats; |
4948 | } | 4980 | } |
@@ -7455,15 +7487,11 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) | |||
7455 | } | 7487 | } |
7456 | } | 7488 | } |
7457 | 7489 | ||
7458 | /* Updating statistics */ | ||
7459 | ring_data->rx_packets++; | ||
7460 | rxdp->Host_Control = 0; | 7490 | rxdp->Host_Control = 0; |
7461 | if (sp->rxd_mode == RXD_MODE_1) { | 7491 | if (sp->rxd_mode == RXD_MODE_1) { |
7462 | int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2); | 7492 | int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2); |
7463 | 7493 | ||
7464 | ring_data->rx_bytes += len; | ||
7465 | skb_put(skb, len); | 7494 | skb_put(skb, len); |
7466 | |||
7467 | } else if (sp->rxd_mode == RXD_MODE_3B) { | 7495 | } else if (sp->rxd_mode == RXD_MODE_3B) { |
7468 | int get_block = ring_data->rx_curr_get_info.block_index; | 7496 | int get_block = ring_data->rx_curr_get_info.block_index; |
7469 | int get_off = ring_data->rx_curr_get_info.offset; | 7497 | int get_off = ring_data->rx_curr_get_info.offset; |
@@ -7472,7 +7500,6 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) | |||
7472 | unsigned char *buff = skb_push(skb, buf0_len); | 7500 | unsigned char *buff = skb_push(skb, buf0_len); |
7473 | 7501 | ||
7474 | struct buffAdd *ba = &ring_data->ba[get_block][get_off]; | 7502 | struct buffAdd *ba = &ring_data->ba[get_block][get_off]; |
7475 | ring_data->rx_bytes += buf0_len + buf2_len; | ||
7476 | memcpy(buff, ba->ba_0, buf0_len); | 7503 | memcpy(buff, ba->ba_0, buf0_len); |
7477 | skb_put(skb, buf2_len); | 7504 | skb_put(skb, buf2_len); |
7478 | } | 7505 | } |
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 47c36e0994f5..5e52c75892df 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -745,10 +745,6 @@ struct ring_info { | |||
745 | 745 | ||
746 | /* Buffer Address store. */ | 746 | /* Buffer Address store. */ |
747 | struct buffAdd **ba; | 747 | struct buffAdd **ba; |
748 | |||
749 | /* per-Ring statistics */ | ||
750 | unsigned long rx_packets; | ||
751 | unsigned long rx_bytes; | ||
752 | } ____cacheline_aligned; | 748 | } ____cacheline_aligned; |
753 | 749 | ||
754 | /* Fifo specific structure */ | 750 | /* Fifo specific structure */ |
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 1f3acc3a5dfd..79eee3062083 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c | |||
@@ -2671,6 +2671,7 @@ static struct platform_driver sbmac_driver = { | |||
2671 | .remove = __exit_p(sbmac_remove), | 2671 | .remove = __exit_p(sbmac_remove), |
2672 | .driver = { | 2672 | .driver = { |
2673 | .name = sbmac_string, | 2673 | .name = sbmac_string, |
2674 | .owner = THIS_MODULE, | ||
2674 | }, | 2675 | }, |
2675 | }; | 2676 | }; |
2676 | 2677 | ||
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 28d3ee175e7b..dd8a4adf48ca 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c | |||
@@ -104,10 +104,8 @@ static void rndis_msg_indicate(struct usbnet *dev, struct rndis_indicate *msg, | |||
104 | int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) | 104 | int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) |
105 | { | 105 | { |
106 | struct cdc_state *info = (void *) &dev->data; | 106 | struct cdc_state *info = (void *) &dev->data; |
107 | struct usb_cdc_notification notification; | ||
108 | int master_ifnum; | 107 | int master_ifnum; |
109 | int retval; | 108 | int retval; |
110 | int partial; | ||
111 | unsigned count; | 109 | unsigned count; |
112 | __le32 rsp; | 110 | __le32 rsp; |
113 | u32 xid = 0, msg_len, request_id; | 111 | u32 xid = 0, msg_len, request_id; |
@@ -135,17 +133,13 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) | |||
135 | if (unlikely(retval < 0 || xid == 0)) | 133 | if (unlikely(retval < 0 || xid == 0)) |
136 | return retval; | 134 | return retval; |
137 | 135 | ||
138 | /* Some devices don't respond on the control channel until | 136 | // FIXME Seems like some devices discard responses when |
139 | * polled on the status channel, so do that first. */ | 137 | // we time out and cancel our "get response" requests... |
140 | retval = usb_interrupt_msg( | 138 | // so, this is fragile. Probably need to poll for status. |
141 | dev->udev, | ||
142 | usb_rcvintpipe(dev->udev, dev->status->desc.bEndpointAddress), | ||
143 | ¬ification, sizeof(notification), &partial, | ||
144 | RNDIS_CONTROL_TIMEOUT_MS); | ||
145 | if (unlikely(retval < 0)) | ||
146 | return retval; | ||
147 | 139 | ||
148 | /* Poll the control channel; the request probably completed immediately */ | 140 | /* ignore status endpoint, just poll the control channel; |
141 | * the request probably completed immediately | ||
142 | */ | ||
149 | rsp = buf->msg_type | RNDIS_MSG_COMPLETION; | 143 | rsp = buf->msg_type | RNDIS_MSG_COMPLETION; |
150 | for (count = 0; count < 10; count++) { | 144 | for (count = 0; count < 10; count++) { |
151 | memset(buf, 0, CONTROL_BUFFER_SIZE); | 145 | memset(buf, 0, CONTROL_BUFFER_SIZE); |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index a95c73de5824..81c76ada8e56 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1293,6 +1293,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1293 | goto out; | 1293 | goto out; |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | /* netdev_printk() needs this so do it as early as possible */ | ||
1297 | SET_NETDEV_DEV(net, &udev->dev); | ||
1298 | |||
1296 | dev = netdev_priv(net); | 1299 | dev = netdev_priv(net); |
1297 | dev->udev = xdev; | 1300 | dev->udev = xdev; |
1298 | dev->intf = udev; | 1301 | dev->intf = udev; |
@@ -1377,8 +1380,6 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1377 | dev->rx_urb_size = dev->hard_mtu; | 1380 | dev->rx_urb_size = dev->hard_mtu; |
1378 | dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); | 1381 | dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); |
1379 | 1382 | ||
1380 | SET_NETDEV_DEV(net, &udev->dev); | ||
1381 | |||
1382 | if ((dev->driver_info->flags & FLAG_WLAN) != 0) | 1383 | if ((dev->driver_info->flags & FLAG_WLAN) != 0) |
1383 | SET_NETDEV_DEVTYPE(net, &wlan_type); | 1384 | SET_NETDEV_DEVTYPE(net, &wlan_type); |
1384 | if ((dev->driver_info->flags & FLAG_WWAN) != 0) | 1385 | if ((dev->driver_info->flags & FLAG_WWAN) != 0) |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 1edb7a61983c..bb6b67f6b0cc 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -415,7 +415,7 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi, gfp_t gfp) | |||
415 | static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) | 415 | static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) |
416 | { | 416 | { |
417 | int err; | 417 | int err; |
418 | bool oom = false; | 418 | bool oom; |
419 | 419 | ||
420 | do { | 420 | do { |
421 | if (vi->mergeable_rx_bufs) | 421 | if (vi->mergeable_rx_bufs) |
@@ -425,10 +425,9 @@ static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) | |||
425 | else | 425 | else |
426 | err = add_recvbuf_small(vi, gfp); | 426 | err = add_recvbuf_small(vi, gfp); |
427 | 427 | ||
428 | if (err < 0) { | 428 | oom = err == -ENOMEM; |
429 | oom = true; | 429 | if (err < 0) |
430 | break; | 430 | break; |
431 | } | ||
432 | ++vi->num; | 431 | ++vi->num; |
433 | } while (err > 0); | 432 | } while (err > 0); |
434 | if (unlikely(vi->num > vi->max)) | 433 | if (unlikely(vi->num > vi->max)) |
@@ -563,7 +562,6 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
563 | struct virtnet_info *vi = netdev_priv(dev); | 562 | struct virtnet_info *vi = netdev_priv(dev); |
564 | int capacity; | 563 | int capacity; |
565 | 564 | ||
566 | again: | ||
567 | /* Free up any pending old buffers before queueing new ones. */ | 565 | /* Free up any pending old buffers before queueing new ones. */ |
568 | free_old_xmit_skbs(vi); | 566 | free_old_xmit_skbs(vi); |
569 | 567 | ||
@@ -572,14 +570,20 @@ again: | |||
572 | 570 | ||
573 | /* This can happen with OOM and indirect buffers. */ | 571 | /* This can happen with OOM and indirect buffers. */ |
574 | if (unlikely(capacity < 0)) { | 572 | if (unlikely(capacity < 0)) { |
575 | netif_stop_queue(dev); | 573 | if (net_ratelimit()) { |
576 | dev_warn(&dev->dev, "Unexpected full queue\n"); | 574 | if (likely(capacity == -ENOMEM)) { |
577 | if (unlikely(!virtqueue_enable_cb(vi->svq))) { | 575 | dev_warn(&dev->dev, |
578 | virtqueue_disable_cb(vi->svq); | 576 | "TX queue failure: out of memory\n"); |
579 | netif_start_queue(dev); | 577 | } else { |
580 | goto again; | 578 | dev->stats.tx_fifo_errors++; |
579 | dev_warn(&dev->dev, | ||
580 | "Unexpected TX queue failure: %d\n", | ||
581 | capacity); | ||
582 | } | ||
581 | } | 583 | } |
582 | return NETDEV_TX_BUSY; | 584 | dev->stats.tx_dropped++; |
585 | kfree_skb(skb); | ||
586 | return NETDEV_TX_OK; | ||
583 | } | 587 | } |
584 | virtqueue_kick(vi->svq); | 588 | virtqueue_kick(vi->svq); |
585 | 589 | ||
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index b504bd561362..fc8b2d7a0919 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -2262,7 +2262,8 @@ start: | |||
2262 | vxge_debug_init(VXGE_ERR, | 2262 | vxge_debug_init(VXGE_ERR, |
2263 | "%s: memory allocation failed", | 2263 | "%s: memory allocation failed", |
2264 | VXGE_DRIVER_NAME); | 2264 | VXGE_DRIVER_NAME); |
2265 | return -ENOMEM; | 2265 | ret = -ENOMEM; |
2266 | goto alloc_entries_failed; | ||
2266 | } | 2267 | } |
2267 | 2268 | ||
2268 | vdev->vxge_entries = | 2269 | vdev->vxge_entries = |
@@ -2271,8 +2272,8 @@ start: | |||
2271 | if (!vdev->vxge_entries) { | 2272 | if (!vdev->vxge_entries) { |
2272 | vxge_debug_init(VXGE_ERR, "%s: memory allocation failed", | 2273 | vxge_debug_init(VXGE_ERR, "%s: memory allocation failed", |
2273 | VXGE_DRIVER_NAME); | 2274 | VXGE_DRIVER_NAME); |
2274 | kfree(vdev->entries); | 2275 | ret = -ENOMEM; |
2275 | return -ENOMEM; | 2276 | goto alloc_vxge_entries_failed; |
2276 | } | 2277 | } |
2277 | 2278 | ||
2278 | for (i = 0, j = 0; i < vdev->no_of_vpath; i++) { | 2279 | for (i = 0, j = 0; i < vdev->no_of_vpath; i++) { |
@@ -2303,22 +2304,32 @@ start: | |||
2303 | vxge_debug_init(VXGE_ERR, | 2304 | vxge_debug_init(VXGE_ERR, |
2304 | "%s: MSI-X enable failed for %d vectors, ret: %d", | 2305 | "%s: MSI-X enable failed for %d vectors, ret: %d", |
2305 | VXGE_DRIVER_NAME, vdev->intr_cnt, ret); | 2306 | VXGE_DRIVER_NAME, vdev->intr_cnt, ret); |
2307 | if ((max_config_vpath != VXGE_USE_DEFAULT) || (ret < 3)) { | ||
2308 | ret = -ENODEV; | ||
2309 | goto enable_msix_failed; | ||
2310 | } | ||
2311 | |||
2306 | kfree(vdev->entries); | 2312 | kfree(vdev->entries); |
2307 | kfree(vdev->vxge_entries); | 2313 | kfree(vdev->vxge_entries); |
2308 | vdev->entries = NULL; | 2314 | vdev->entries = NULL; |
2309 | vdev->vxge_entries = NULL; | 2315 | vdev->vxge_entries = NULL; |
2310 | |||
2311 | if ((max_config_vpath != VXGE_USE_DEFAULT) || (ret < 3)) | ||
2312 | return -ENODEV; | ||
2313 | /* Try with less no of vector by reducing no of vpaths count */ | 2316 | /* Try with less no of vector by reducing no of vpaths count */ |
2314 | temp = (ret - 1)/2; | 2317 | temp = (ret - 1)/2; |
2315 | vxge_close_vpaths(vdev, temp); | 2318 | vxge_close_vpaths(vdev, temp); |
2316 | vdev->no_of_vpath = temp; | 2319 | vdev->no_of_vpath = temp; |
2317 | goto start; | 2320 | goto start; |
2318 | } else if (ret < 0) | 2321 | } else if (ret < 0) { |
2319 | return -ENODEV; | 2322 | ret = -ENODEV; |
2320 | 2323 | goto enable_msix_failed; | |
2324 | } | ||
2321 | return 0; | 2325 | return 0; |
2326 | |||
2327 | enable_msix_failed: | ||
2328 | kfree(vdev->vxge_entries); | ||
2329 | alloc_vxge_entries_failed: | ||
2330 | kfree(vdev->entries); | ||
2331 | alloc_entries_failed: | ||
2332 | return ret; | ||
2322 | } | 2333 | } |
2323 | 2334 | ||
2324 | static int vxge_enable_msix(struct vxgedev *vdev) | 2335 | static int vxge_enable_msix(struct vxgedev *vdev) |
@@ -4506,9 +4517,9 @@ vxge_starter(void) | |||
4506 | char version[32]; | 4517 | char version[32]; |
4507 | snprintf(version, 32, "%s", DRV_VERSION); | 4518 | snprintf(version, 32, "%s", DRV_VERSION); |
4508 | 4519 | ||
4509 | printk(KERN_CRIT "%s: Copyright(c) 2002-2009 Neterion Inc\n", | 4520 | printk(KERN_INFO "%s: Copyright(c) 2002-2009 Neterion Inc\n", |
4510 | VXGE_DRIVER_NAME); | 4521 | VXGE_DRIVER_NAME); |
4511 | printk(KERN_CRIT "%s: Driver version: %s\n", | 4522 | printk(KERN_INFO "%s: Driver version: %s\n", |
4512 | VXGE_DRIVER_NAME, version); | 4523 | VXGE_DRIVER_NAME, version); |
4513 | 4524 | ||
4514 | verify_bandwidth(); | 4525 | verify_bandwidth(); |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index fbb7dec6ddeb..5ea87736a6ae 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -445,6 +445,7 @@ void ath_deinit_leds(struct ath_softc *sc); | |||
445 | #define SC_OP_TSF_RESET BIT(11) | 445 | #define SC_OP_TSF_RESET BIT(11) |
446 | #define SC_OP_BT_PRIORITY_DETECTED BIT(12) | 446 | #define SC_OP_BT_PRIORITY_DETECTED BIT(12) |
447 | #define SC_OP_BT_SCAN BIT(13) | 447 | #define SC_OP_BT_SCAN BIT(13) |
448 | #define SC_OP_ANI_RUN BIT(14) | ||
448 | 449 | ||
449 | /* Powersave flags */ | 450 | /* Powersave flags */ |
450 | #define PS_WAIT_FOR_BEACON BIT(0) | 451 | #define PS_WAIT_FOR_BEACON BIT(0) |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 77b359162d6c..23c15aa9fbd5 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -730,13 +730,17 @@ static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev) | |||
730 | 730 | ||
731 | /* RX */ | 731 | /* RX */ |
732 | if (ath9k_hif_usb_alloc_rx_urbs(hif_dev) < 0) | 732 | if (ath9k_hif_usb_alloc_rx_urbs(hif_dev) < 0) |
733 | goto err; | 733 | goto err_rx; |
734 | 734 | ||
735 | /* Register Read */ | 735 | /* Register Read */ |
736 | if (ath9k_hif_usb_alloc_reg_in_urb(hif_dev) < 0) | 736 | if (ath9k_hif_usb_alloc_reg_in_urb(hif_dev) < 0) |
737 | goto err; | 737 | goto err_reg; |
738 | 738 | ||
739 | return 0; | 739 | return 0; |
740 | err_reg: | ||
741 | ath9k_hif_usb_dealloc_rx_urbs(hif_dev); | ||
742 | err_rx: | ||
743 | ath9k_hif_usb_dealloc_tx_urbs(hif_dev); | ||
740 | err: | 744 | err: |
741 | return -ENOMEM; | 745 | return -ENOMEM; |
742 | } | 746 | } |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index abfa0493236f..1e2a68ea9355 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -336,6 +336,10 @@ set_timer: | |||
336 | static void ath_start_ani(struct ath_common *common) | 336 | static void ath_start_ani(struct ath_common *common) |
337 | { | 337 | { |
338 | unsigned long timestamp = jiffies_to_msecs(jiffies); | 338 | unsigned long timestamp = jiffies_to_msecs(jiffies); |
339 | struct ath_softc *sc = (struct ath_softc *) common->priv; | ||
340 | |||
341 | if (!(sc->sc_flags & SC_OP_ANI_RUN)) | ||
342 | return; | ||
339 | 343 | ||
340 | common->ani.longcal_timer = timestamp; | 344 | common->ani.longcal_timer = timestamp; |
341 | common->ani.shortcal_timer = timestamp; | 345 | common->ani.shortcal_timer = timestamp; |
@@ -872,11 +876,13 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc, | |||
872 | /* Reset rssi stats */ | 876 | /* Reset rssi stats */ |
873 | sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; | 877 | sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; |
874 | 878 | ||
879 | sc->sc_flags |= SC_OP_ANI_RUN; | ||
875 | ath_start_ani(common); | 880 | ath_start_ani(common); |
876 | } else { | 881 | } else { |
877 | ath_print(common, ATH_DBG_CONFIG, "Bss Info DISASSOC\n"); | 882 | ath_print(common, ATH_DBG_CONFIG, "Bss Info DISASSOC\n"); |
878 | common->curaid = 0; | 883 | common->curaid = 0; |
879 | /* Stop ANI */ | 884 | /* Stop ANI */ |
885 | sc->sc_flags &= ~SC_OP_ANI_RUN; | ||
880 | del_timer_sync(&common->ani.timer); | 886 | del_timer_sync(&common->ani.timer); |
881 | } | 887 | } |
882 | } | 888 | } |
@@ -1478,8 +1484,10 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
1478 | 1484 | ||
1479 | if (vif->type == NL80211_IFTYPE_AP || | 1485 | if (vif->type == NL80211_IFTYPE_AP || |
1480 | vif->type == NL80211_IFTYPE_ADHOC || | 1486 | vif->type == NL80211_IFTYPE_ADHOC || |
1481 | vif->type == NL80211_IFTYPE_MONITOR) | 1487 | vif->type == NL80211_IFTYPE_MONITOR) { |
1488 | sc->sc_flags |= SC_OP_ANI_RUN; | ||
1482 | ath_start_ani(common); | 1489 | ath_start_ani(common); |
1490 | } | ||
1483 | 1491 | ||
1484 | out: | 1492 | out: |
1485 | mutex_unlock(&sc->mutex); | 1493 | mutex_unlock(&sc->mutex); |
@@ -1500,6 +1508,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1500 | mutex_lock(&sc->mutex); | 1508 | mutex_lock(&sc->mutex); |
1501 | 1509 | ||
1502 | /* Stop ANI */ | 1510 | /* Stop ANI */ |
1511 | sc->sc_flags &= ~SC_OP_ANI_RUN; | ||
1503 | del_timer_sync(&common->ani.timer); | 1512 | del_timer_sync(&common->ani.timer); |
1504 | 1513 | ||
1505 | /* Reclaim beacon resources */ | 1514 | /* Reclaim beacon resources */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c index 44ef5d93befc..01658cf82d39 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c | |||
@@ -212,11 +212,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv) | |||
212 | static void iwlagn_rts_tx_cmd_flag(struct ieee80211_tx_info *info, | 212 | static void iwlagn_rts_tx_cmd_flag(struct ieee80211_tx_info *info, |
213 | __le32 *tx_flags) | 213 | __le32 *tx_flags) |
214 | { | 214 | { |
215 | if ((info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || | 215 | *tx_flags |= TX_CMD_FLG_RTS_CTS_MSK; |
216 | (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) | ||
217 | *tx_flags |= TX_CMD_FLG_RTS_CTS_MSK; | ||
218 | else | ||
219 | *tx_flags &= ~TX_CMD_FLG_RTS_CTS_MSK; | ||
220 | } | 216 | } |
221 | 217 | ||
222 | /* Calc max signal level (dBm) among 3 possible receivers */ | 218 | /* Calc max signal level (dBm) among 3 possible receivers */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 426e95567de3..5bbc5298ef96 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -1314,7 +1314,6 @@ void iwl_configure_filter(struct ieee80211_hw *hw, | |||
1314 | changed_flags, *total_flags); | 1314 | changed_flags, *total_flags); |
1315 | 1315 | ||
1316 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); | 1316 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); |
1317 | CHK(FIF_ALLMULTI, RXON_FILTER_ACCEPT_GRP_MSK); | ||
1318 | CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); | 1317 | CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); |
1319 | CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); | 1318 | CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); |
1320 | 1319 | ||
@@ -1329,6 +1328,12 @@ void iwl_configure_filter(struct ieee80211_hw *hw, | |||
1329 | 1328 | ||
1330 | mutex_unlock(&priv->mutex); | 1329 | mutex_unlock(&priv->mutex); |
1331 | 1330 | ||
1331 | /* | ||
1332 | * Receiving all multicast frames is always enabled by the | ||
1333 | * default flags setup in iwl_connection_init_rx_config() | ||
1334 | * since we currently do not support programming multicast | ||
1335 | * filters into the device. | ||
1336 | */ | ||
1332 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | | 1337 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | |
1333 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | 1338 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; |
1334 | } | 1339 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h index c2a453a1a991..dc43ebd1f1fd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.h +++ b/drivers/net/wireless/iwlwifi/iwl-sta.h | |||
@@ -97,6 +97,17 @@ static inline void iwl_clear_driver_stations(struct iwl_priv *priv) | |||
97 | spin_lock_irqsave(&priv->sta_lock, flags); | 97 | spin_lock_irqsave(&priv->sta_lock, flags); |
98 | memset(priv->stations, 0, sizeof(priv->stations)); | 98 | memset(priv->stations, 0, sizeof(priv->stations)); |
99 | priv->num_stations = 0; | 99 | priv->num_stations = 0; |
100 | |||
101 | /* | ||
102 | * Remove all key information that is not stored as part of station | ||
103 | * information since mac80211 may not have had a | ||
104 | * chance to remove all the keys. When device is reconfigured by | ||
105 | * mac80211 after an error all keys will be reconfigured. | ||
106 | */ | ||
107 | priv->ucode_key_table = 0; | ||
108 | priv->key_mapping_key = 0; | ||
109 | memset(priv->wep_keys, 0, sizeof(priv->wep_keys)); | ||
110 | |||
100 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 111 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
101 | } | 112 | } |
102 | 113 | ||