aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/llc_sap.h3
-rw-r--r--net/llc/llc_c_ac.c105
-rw-r--r--net/llc/llc_s_ac.c6
-rw-r--r--net/llc/llc_sap.c5
-rw-r--r--net/llc/llc_station.c8
5 files changed, 52 insertions, 75 deletions
diff --git a/include/net/llc_sap.h b/include/net/llc_sap.h
index 353baaa627f3..6dd4cdccca42 100644
--- a/include/net/llc_sap.h
+++ b/include/net/llc_sap.h
@@ -13,10 +13,11 @@
13 */ 13 */
14struct llc_sap; 14struct llc_sap;
15struct sk_buff; 15struct sk_buff;
16struct net_device;
16 17
17extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb); 18extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb);
18extern void llc_save_primitive(struct sk_buff* skb, unsigned char prim); 19extern void llc_save_primitive(struct sk_buff* skb, unsigned char prim);
19extern struct sk_buff *llc_alloc_frame(void); 20extern struct sk_buff *llc_alloc_frame(struct net_device *dev);
20 21
21extern void llc_build_and_send_test_pkt(struct llc_sap *sap, 22extern void llc_build_and_send_test_pkt(struct llc_sap *sap,
22 struct sk_buff *skb, 23 struct sk_buff *skb,
diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c
index b218be4c10ec..db98ea2113a5 100644
--- a/net/llc/llc_c_ac.c
+++ b/net/llc/llc_c_ac.c
@@ -217,13 +217,12 @@ int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock *sk,
217int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) 217int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb)
218{ 218{
219 int rc = -ENOBUFS; 219 int rc = -ENOBUFS;
220 struct sk_buff *nskb = llc_alloc_frame(); 220 struct llc_sock *llc = llc_sk(sk);
221 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
221 222
222 if (nskb) { 223 if (nskb) {
223 struct llc_sock *llc = llc_sk(sk);
224 struct llc_sap *sap = llc->sap; 224 struct llc_sap *sap = llc->sap;
225 225
226 nskb->dev = llc->dev;
227 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, 226 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap,
228 llc->daddr.lsap, LLC_PDU_CMD); 227 llc->daddr.lsap, LLC_PDU_CMD);
229 llc_pdu_init_as_disc_cmd(nskb, 1); 228 llc_pdu_init_as_disc_cmd(nskb, 1);
@@ -243,14 +242,13 @@ free:
243int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) 242int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb)
244{ 243{
245 int rc = -ENOBUFS; 244 int rc = -ENOBUFS;
246 struct sk_buff *nskb = llc_alloc_frame(); 245 struct llc_sock *llc = llc_sk(sk);
246 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
247 247
248 if (nskb) { 248 if (nskb) {
249 struct llc_sock *llc = llc_sk(sk);
250 struct llc_sap *sap = llc->sap; 249 struct llc_sap *sap = llc->sap;
251 u8 f_bit; 250 u8 f_bit;
252 251
253 nskb->dev = llc->dev;
254 llc_pdu_decode_pf_bit(skb, &f_bit); 252 llc_pdu_decode_pf_bit(skb, &f_bit);
255 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, 253 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap,
256 llc->daddr.lsap, LLC_PDU_RSP); 254 llc->daddr.lsap, LLC_PDU_RSP);
@@ -270,14 +268,13 @@ free:
270int llc_conn_ac_send_dm_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) 268int llc_conn_ac_send_dm_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
271{ 269{
272 int rc = -ENOBUFS; 270 int rc = -ENOBUFS;
273 struct sk_buff *nskb = llc_alloc_frame(); 271 struct llc_sock *llc = llc_sk(sk);
272 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
274 273
275 if (nskb) { 274 if (nskb) {
276 struct llc_sock *llc = llc_sk(sk);
277 struct llc_sap *sap = llc->sap; 275 struct llc_sap *sap = llc->sap;
278 u8 f_bit = 1; 276 u8 f_bit = 1;
279 277
280 nskb->dev = llc->dev;
281 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, 278 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap,
282 llc->daddr.lsap, LLC_PDU_RSP); 279 llc->daddr.lsap, LLC_PDU_RSP);
283 llc_pdu_init_as_dm_rsp(nskb, f_bit); 280 llc_pdu_init_as_dm_rsp(nskb, f_bit);
@@ -306,11 +303,10 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, struct sk_buff *skb)
306 llc_pdu_decode_pf_bit(skb, &f_bit); 303 llc_pdu_decode_pf_bit(skb, &f_bit);
307 else 304 else
308 f_bit = 0; 305 f_bit = 0;
309 nskb = llc_alloc_frame(); 306 nskb = llc_alloc_frame(llc->dev);
310 if (nskb) { 307 if (nskb) {
311 struct llc_sap *sap = llc->sap; 308 struct llc_sap *sap = llc->sap;
312 309
313 nskb->dev = llc->dev;
314 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, 310 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap,
315 llc->daddr.lsap, LLC_PDU_RSP); 311 llc->daddr.lsap, LLC_PDU_RSP);
316 llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS, 312 llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS,
@@ -330,15 +326,14 @@ free:
330int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk, struct sk_buff *skb) 326int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk, struct sk_buff *skb)
331{ 327{
332 int rc = -ENOBUFS; 328 int rc = -ENOBUFS;
333 struct sk_buff *nskb = llc_alloc_frame(); 329 struct llc_sock *llc = llc_sk(sk);
330 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
334 331
335 if (nskb) { 332 if (nskb) {
336 u8 f_bit = 0; 333 u8 f_bit = 0;
337 struct llc_sock *llc = llc_sk(sk);
338 struct llc_sap *sap = llc->sap; 334 struct llc_sap *sap = llc->sap;
339 struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)&llc->rx_pdu_hdr; 335 struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)&llc->rx_pdu_hdr;
340 336
341 nskb->dev = llc->dev;
342 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, 337 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap,
343 llc->daddr.lsap, LLC_PDU_RSP); 338 llc->daddr.lsap, LLC_PDU_RSP);
344 llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS, 339 llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS,
@@ -360,15 +355,14 @@ int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock *sk, struct sk_buff *skb)
360 u8 f_bit; 355 u8 f_bit;
361 int rc = -ENOBUFS; 356 int rc = -ENOBUFS;
362 struct sk_buff *nskb; 357 struct sk_buff *nskb;
358 struct llc_sock *llc = llc_sk(sk);
363 359
364 llc_pdu_decode_pf_bit(skb, &f_bit); 360 llc_pdu_decode_pf_bit(skb, &f_bit);
365 nskb = llc_alloc_frame(); 361 nskb = llc_alloc_frame(llc->dev);
366 if (nskb) { 362 if (nskb) {
367 struct llc_sock *llc = llc_sk(sk);
368 struct llc_sap *sap = llc->sap; 363 struct llc_sap *sap = llc->sap;
369 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 364 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
370 365
371 nskb->dev = llc->dev;
372 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, 366 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap,
373 llc->daddr.lsap, LLC_PDU_RSP); 367 llc->daddr.lsap, LLC_PDU_RSP);
374 llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS, 368 llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS,
@@ -451,13 +445,12 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk,
451 u8 nr; 445 u8 nr;
452 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 446 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
453 int rc = -ENOBUFS; 447 int rc = -ENOBUFS;
454 struct sk_buff *nskb = llc_alloc_frame(); 448 struct llc_sock *llc = llc_sk(sk);
449 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
455 450
456 if (nskb) { 451 if (nskb) {
457 struct llc_sock *llc = llc_sk(sk);
458 struct llc_sap *sap = llc->sap; 452 struct llc_sap *sap = llc->sap;
459 453
460 nskb->dev = llc->dev;
461 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, 454 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap,
462 llc->daddr.lsap, LLC_PDU_RSP); 455 llc->daddr.lsap, LLC_PDU_RSP);
463 llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR); 456 llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR);
@@ -487,13 +480,12 @@ int llc_conn_ac_resend_i_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
487int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) 480int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb)
488{ 481{
489 int rc = -ENOBUFS; 482 int rc = -ENOBUFS;
490 struct sk_buff *nskb = llc_alloc_frame(); 483 struct llc_sock *llc = llc_sk(sk);
484 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
491 485
492 if (nskb) { 486 if (nskb) {
493 struct llc_sock *llc = llc_sk(sk);
494 struct llc_sap *sap = llc->sap; 487 struct llc_sap *sap = llc->sap;
495 488
496 nskb->dev = llc->dev;
497 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 489 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
498 llc->daddr.lsap, LLC_PDU_CMD); 490 llc->daddr.lsap, LLC_PDU_CMD);
499 llc_pdu_init_as_rej_cmd(nskb, 1, llc->vR); 491 llc_pdu_init_as_rej_cmd(nskb, 1, llc->vR);
@@ -512,14 +504,13 @@ free:
512int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) 504int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
513{ 505{
514 int rc = -ENOBUFS; 506 int rc = -ENOBUFS;
515 struct sk_buff *nskb = llc_alloc_frame(); 507 struct llc_sock *llc = llc_sk(sk);
508 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
516 509
517 if (nskb) { 510 if (nskb) {
518 u8 f_bit = 1; 511 u8 f_bit = 1;
519 struct llc_sock *llc = llc_sk(sk);
520 struct llc_sap *sap = llc->sap; 512 struct llc_sap *sap = llc->sap;
521 513
522 nskb->dev = llc->dev;
523 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 514 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
524 llc->daddr.lsap, LLC_PDU_RSP); 515 llc->daddr.lsap, LLC_PDU_RSP);
525 llc_pdu_init_as_rej_rsp(nskb, f_bit, llc->vR); 516 llc_pdu_init_as_rej_rsp(nskb, f_bit, llc->vR);
@@ -538,14 +529,13 @@ free:
538int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) 529int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
539{ 530{
540 int rc = -ENOBUFS; 531 int rc = -ENOBUFS;
541 struct sk_buff *nskb = llc_alloc_frame(); 532 struct llc_sock *llc = llc_sk(sk);
533 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
542 534
543 if (nskb) { 535 if (nskb) {
544 struct llc_sock *llc = llc_sk(sk);
545 struct llc_sap *sap = llc->sap; 536 struct llc_sap *sap = llc->sap;
546 u8 f_bit = 0; 537 u8 f_bit = 0;
547 538
548 nskb->dev = llc->dev;
549 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 539 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
550 llc->daddr.lsap, LLC_PDU_RSP); 540 llc->daddr.lsap, LLC_PDU_RSP);
551 llc_pdu_init_as_rej_rsp(nskb, f_bit, llc->vR); 541 llc_pdu_init_as_rej_rsp(nskb, f_bit, llc->vR);
@@ -564,13 +554,12 @@ free:
564int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) 554int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb)
565{ 555{
566 int rc = -ENOBUFS; 556 int rc = -ENOBUFS;
567 struct sk_buff *nskb = llc_alloc_frame(); 557 struct llc_sock *llc = llc_sk(sk);
558 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
568 559
569 if (nskb) { 560 if (nskb) {
570 struct llc_sock *llc = llc_sk(sk);
571 struct llc_sap *sap = llc->sap; 561 struct llc_sap *sap = llc->sap;
572 562
573 nskb->dev = llc->dev;
574 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 563 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
575 llc->daddr.lsap, LLC_PDU_CMD); 564 llc->daddr.lsap, LLC_PDU_CMD);
576 llc_pdu_init_as_rnr_cmd(nskb, 1, llc->vR); 565 llc_pdu_init_as_rnr_cmd(nskb, 1, llc->vR);
@@ -589,14 +578,13 @@ free:
589int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) 578int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
590{ 579{
591 int rc = -ENOBUFS; 580 int rc = -ENOBUFS;
592 struct sk_buff *nskb = llc_alloc_frame(); 581 struct llc_sock *llc = llc_sk(sk);
582 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
593 583
594 if (nskb) { 584 if (nskb) {
595 struct llc_sock *llc = llc_sk(sk);
596 struct llc_sap *sap = llc->sap; 585 struct llc_sap *sap = llc->sap;
597 u8 f_bit = 1; 586 u8 f_bit = 1;
598 587
599 nskb->dev = llc->dev;
600 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 588 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
601 llc->daddr.lsap, LLC_PDU_RSP); 589 llc->daddr.lsap, LLC_PDU_RSP);
602 llc_pdu_init_as_rnr_rsp(nskb, f_bit, llc->vR); 590 llc_pdu_init_as_rnr_rsp(nskb, f_bit, llc->vR);
@@ -615,14 +603,13 @@ free:
615int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) 603int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
616{ 604{
617 int rc = -ENOBUFS; 605 int rc = -ENOBUFS;
618 struct sk_buff *nskb = llc_alloc_frame(); 606 struct llc_sock *llc = llc_sk(sk);
607 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
619 608
620 if (nskb) { 609 if (nskb) {
621 u8 f_bit = 0; 610 u8 f_bit = 0;
622 struct llc_sock *llc = llc_sk(sk);
623 struct llc_sap *sap = llc->sap; 611 struct llc_sap *sap = llc->sap;
624 612
625 nskb->dev = llc->dev;
626 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 613 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
627 llc->daddr.lsap, LLC_PDU_RSP); 614 llc->daddr.lsap, LLC_PDU_RSP);
628 llc_pdu_init_as_rnr_rsp(nskb, f_bit, llc->vR); 615 llc_pdu_init_as_rnr_rsp(nskb, f_bit, llc->vR);
@@ -653,13 +640,12 @@ int llc_conn_ac_set_remote_busy(struct sock *sk, struct sk_buff *skb)
653int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) 640int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
654{ 641{
655 int rc = -ENOBUFS; 642 int rc = -ENOBUFS;
656 struct sk_buff *nskb = llc_alloc_frame(); 643 struct llc_sock *llc = llc_sk(sk);
644 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
657 645
658 if (nskb) { 646 if (nskb) {
659 struct llc_sock *llc = llc_sk(sk);
660 struct llc_sap *sap = llc->sap; 647 struct llc_sap *sap = llc->sap;
661 648
662 nskb->dev = llc->dev;
663 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 649 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
664 llc->daddr.lsap, LLC_PDU_RSP); 650 llc->daddr.lsap, LLC_PDU_RSP);
665 llc_pdu_init_as_rnr_rsp(nskb, 0, llc->vR); 651 llc_pdu_init_as_rnr_rsp(nskb, 0, llc->vR);
@@ -678,13 +664,12 @@ free:
678int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) 664int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb)
679{ 665{
680 int rc = -ENOBUFS; 666 int rc = -ENOBUFS;
681 struct sk_buff *nskb = llc_alloc_frame(); 667 struct llc_sock *llc = llc_sk(sk);
668 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
682 669
683 if (nskb) { 670 if (nskb) {
684 struct llc_sock *llc = llc_sk(sk);
685 struct llc_sap *sap = llc->sap; 671 struct llc_sap *sap = llc->sap;
686 672
687 nskb->dev = llc->dev;
688 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 673 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
689 llc->daddr.lsap, LLC_PDU_CMD); 674 llc->daddr.lsap, LLC_PDU_CMD);
690 llc_pdu_init_as_rr_cmd(nskb, 1, llc->vR); 675 llc_pdu_init_as_rr_cmd(nskb, 1, llc->vR);
@@ -703,14 +688,13 @@ free:
703int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) 688int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
704{ 689{
705 int rc = -ENOBUFS; 690 int rc = -ENOBUFS;
706 struct sk_buff *nskb = llc_alloc_frame(); 691 struct llc_sock *llc = llc_sk(sk);
692 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
707 693
708 if (nskb) { 694 if (nskb) {
709 struct llc_sock *llc = llc_sk(sk);
710 struct llc_sap *sap = llc->sap; 695 struct llc_sap *sap = llc->sap;
711 u8 f_bit = 1; 696 u8 f_bit = 1;
712 697
713 nskb->dev = llc->dev;
714 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 698 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
715 llc->daddr.lsap, LLC_PDU_RSP); 699 llc->daddr.lsap, LLC_PDU_RSP);
716 llc_pdu_init_as_rr_rsp(nskb, f_bit, llc->vR); 700 llc_pdu_init_as_rr_rsp(nskb, f_bit, llc->vR);
@@ -729,14 +713,13 @@ free:
729int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) 713int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
730{ 714{
731 int rc = -ENOBUFS; 715 int rc = -ENOBUFS;
732 struct sk_buff *nskb = llc_alloc_frame(); 716 struct llc_sock *llc = llc_sk(sk);
717 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
733 718
734 if (nskb) { 719 if (nskb) {
735 struct llc_sock *llc = llc_sk(sk);
736 struct llc_sap *sap = llc->sap; 720 struct llc_sap *sap = llc->sap;
737 u8 f_bit = 1; 721 u8 f_bit = 1;
738 722
739 nskb->dev = llc->dev;
740 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 723 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
741 llc->daddr.lsap, LLC_PDU_RSP); 724 llc->daddr.lsap, LLC_PDU_RSP);
742 llc_pdu_init_as_rr_rsp(nskb, f_bit, llc->vR); 725 llc_pdu_init_as_rr_rsp(nskb, f_bit, llc->vR);
@@ -755,13 +738,12 @@ free:
755int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) 738int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
756{ 739{
757 int rc = -ENOBUFS; 740 int rc = -ENOBUFS;
758 struct sk_buff *nskb = llc_alloc_frame(); 741 struct llc_sock *llc = llc_sk(sk);
742 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
759 743
760 if (nskb) { 744 if (nskb) {
761 struct llc_sock *llc = llc_sk(sk);
762 struct llc_sap *sap = llc->sap; 745 struct llc_sap *sap = llc->sap;
763 746
764 nskb->dev = llc->dev;
765 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 747 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
766 llc->daddr.lsap, LLC_PDU_RSP); 748 llc->daddr.lsap, LLC_PDU_RSP);
767 llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR); 749 llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR);
@@ -780,13 +762,12 @@ free:
780int llc_conn_ac_send_ack_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) 762int llc_conn_ac_send_ack_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
781{ 763{
782 int rc = -ENOBUFS; 764 int rc = -ENOBUFS;
783 struct sk_buff *nskb = llc_alloc_frame(); 765 struct llc_sock *llc = llc_sk(sk);
766 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
784 767
785 if (nskb) { 768 if (nskb) {
786 struct llc_sock *llc = llc_sk(sk);
787 struct llc_sap *sap = llc->sap; 769 struct llc_sap *sap = llc->sap;
788 770
789 nskb->dev = llc->dev;
790 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 771 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
791 llc->daddr.lsap, LLC_PDU_RSP); 772 llc->daddr.lsap, LLC_PDU_RSP);
792 llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR); 773 llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR);
@@ -815,8 +796,8 @@ void llc_conn_set_p_flag(struct sock *sk, u8 value)
815int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) 796int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb)
816{ 797{
817 int rc = -ENOBUFS; 798 int rc = -ENOBUFS;
818 struct sk_buff *nskb = llc_alloc_frame();
819 struct llc_sock *llc = llc_sk(sk); 799 struct llc_sock *llc = llc_sk(sk);
800 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
820 801
821 if (nskb) { 802 if (nskb) {
822 struct llc_sap *sap = llc->sap; 803 struct llc_sap *sap = llc->sap;
@@ -824,7 +805,6 @@ int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb)
824 805
825 if (llc->dev->flags & IFF_LOOPBACK) 806 if (llc->dev->flags & IFF_LOOPBACK)
826 dmac = llc->dev->dev_addr; 807 dmac = llc->dev->dev_addr;
827 nskb->dev = llc->dev;
828 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, 808 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap,
829 llc->daddr.lsap, LLC_PDU_CMD); 809 llc->daddr.lsap, LLC_PDU_CMD);
830 llc_pdu_init_as_sabme_cmd(nskb, 1); 810 llc_pdu_init_as_sabme_cmd(nskb, 1);
@@ -845,11 +825,11 @@ int llc_conn_ac_send_ua_rsp_f_set_p(struct sock *sk, struct sk_buff *skb)
845{ 825{
846 u8 f_bit; 826 u8 f_bit;
847 int rc = -ENOBUFS; 827 int rc = -ENOBUFS;
848 struct sk_buff *nskb = llc_alloc_frame(); 828 struct llc_sock *llc = llc_sk(sk);
829 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
849 830
850 llc_pdu_decode_pf_bit(skb, &f_bit); 831 llc_pdu_decode_pf_bit(skb, &f_bit);
851 if (nskb) { 832 if (nskb) {
852 struct llc_sock *llc = llc_sk(sk);
853 struct llc_sap *sap = llc->sap; 833 struct llc_sap *sap = llc->sap;
854 834
855 nskb->dev = llc->dev; 835 nskb->dev = llc->dev;
@@ -1001,13 +981,12 @@ static int llc_conn_ac_send_rr_rsp_f_set_ackpf(struct sock *sk,
1001 struct sk_buff *skb) 981 struct sk_buff *skb)
1002{ 982{
1003 int rc = -ENOBUFS; 983 int rc = -ENOBUFS;
1004 struct sk_buff *nskb = llc_alloc_frame(); 984 struct llc_sock *llc = llc_sk(sk);
985 struct sk_buff *nskb = llc_alloc_frame(llc->dev);
1005 986
1006 if (nskb) { 987 if (nskb) {
1007 struct llc_sock *llc = llc_sk(sk);
1008 struct llc_sap *sap = llc->sap; 988 struct llc_sap *sap = llc->sap;
1009 989
1010 nskb->dev = llc->dev;
1011 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, 990 llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap,
1012 llc->daddr.lsap, LLC_PDU_RSP); 991 llc->daddr.lsap, LLC_PDU_RSP);
1013 llc_pdu_init_as_rr_rsp(nskb, llc->ack_pf, llc->vR); 992 llc_pdu_init_as_rr_rsp(nskb, llc->ack_pf, llc->vR);
diff --git a/net/llc/llc_s_ac.c b/net/llc/llc_s_ac.c
index ed8ba7de6122..270b2f2030cd 100644
--- a/net/llc/llc_s_ac.c
+++ b/net/llc/llc_s_ac.c
@@ -103,10 +103,9 @@ int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb)
103 llc_pdu_decode_sa(skb, mac_da); 103 llc_pdu_decode_sa(skb, mac_da);
104 llc_pdu_decode_da(skb, mac_sa); 104 llc_pdu_decode_da(skb, mac_sa);
105 llc_pdu_decode_ssap(skb, &dsap); 105 llc_pdu_decode_ssap(skb, &dsap);
106 nskb = llc_alloc_frame(); 106 nskb = llc_alloc_frame(skb->dev);
107 if (!nskb) 107 if (!nskb)
108 goto out; 108 goto out;
109 nskb->dev = skb->dev;
110 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap, 109 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap,
111 LLC_PDU_RSP); 110 LLC_PDU_RSP);
112 llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 0); 111 llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 0);
@@ -149,10 +148,9 @@ int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb)
149 llc_pdu_decode_sa(skb, mac_da); 148 llc_pdu_decode_sa(skb, mac_da);
150 llc_pdu_decode_da(skb, mac_sa); 149 llc_pdu_decode_da(skb, mac_sa);
151 llc_pdu_decode_ssap(skb, &dsap); 150 llc_pdu_decode_ssap(skb, &dsap);
152 nskb = llc_alloc_frame(); 151 nskb = llc_alloc_frame(skb->dev);
153 if (!nskb) 152 if (!nskb)
154 goto out; 153 goto out;
155 nskb->dev = skb->dev;
156 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap, 154 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap,
157 LLC_PDU_RSP); 155 LLC_PDU_RSP);
158 llc_pdu_init_as_test_rsp(nskb, skb); 156 llc_pdu_init_as_test_rsp(nskb, skb);
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index 34228ef14985..0adaa289bf0a 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -26,11 +26,12 @@
26 26
27/** 27/**
28 * llc_alloc_frame - allocates sk_buff for frame 28 * llc_alloc_frame - allocates sk_buff for frame
29 * @dev: network device this skb will be sent over
29 * 30 *
30 * Allocates an sk_buff for frame and initializes sk_buff fields. 31 * Allocates an sk_buff for frame and initializes sk_buff fields.
31 * Returns allocated skb or %NULL when out of memory. 32 * Returns allocated skb or %NULL when out of memory.
32 */ 33 */
33struct sk_buff *llc_alloc_frame(void) 34struct sk_buff *llc_alloc_frame(struct net_device *dev)
34{ 35{
35 struct sk_buff *skb = alloc_skb(128, GFP_ATOMIC); 36 struct sk_buff *skb = alloc_skb(128, GFP_ATOMIC);
36 37
@@ -38,7 +39,7 @@ struct sk_buff *llc_alloc_frame(void)
38 skb_reserve(skb, 50); 39 skb_reserve(skb, 50);
39 skb->nh.raw = skb->h.raw = skb->data; 40 skb->nh.raw = skb->h.raw = skb->data;
40 skb->protocol = htons(ETH_P_802_2); 41 skb->protocol = htons(ETH_P_802_2);
41 skb->dev = dev_base->next; 42 skb->dev = dev;
42 skb->mac.raw = skb->head; 43 skb->mac.raw = skb->head;
43 } 44 }
44 return skb; 45 return skb;
diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c
index 8fe48a24bad5..85a7ac276141 100644
--- a/net/llc/llc_station.c
+++ b/net/llc/llc_station.c
@@ -249,7 +249,7 @@ static int llc_station_ac_inc_xid_r_cnt_by_1(struct sk_buff *skb)
249static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb) 249static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb)
250{ 250{
251 int rc = 1; 251 int rc = 1;
252 struct sk_buff *nskb = llc_alloc_frame(); 252 struct sk_buff *nskb = llc_alloc_frame(skb->dev);
253 253
254 if (!nskb) 254 if (!nskb)
255 goto out; 255 goto out;
@@ -270,12 +270,11 @@ static int llc_station_ac_send_xid_r(struct sk_buff *skb)
270{ 270{
271 u8 mac_da[ETH_ALEN], dsap; 271 u8 mac_da[ETH_ALEN], dsap;
272 int rc = 1; 272 int rc = 1;
273 struct sk_buff* nskb = llc_alloc_frame(); 273 struct sk_buff* nskb = llc_alloc_frame(skb->dev);
274 274
275 if (!nskb) 275 if (!nskb)
276 goto out; 276 goto out;
277 rc = 0; 277 rc = 0;
278 nskb->dev = skb->dev;
279 llc_pdu_decode_sa(skb, mac_da); 278 llc_pdu_decode_sa(skb, mac_da);
280 llc_pdu_decode_ssap(skb, &dsap); 279 llc_pdu_decode_ssap(skb, &dsap);
281 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); 280 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP);
@@ -295,12 +294,11 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb)
295{ 294{
296 u8 mac_da[ETH_ALEN], dsap; 295 u8 mac_da[ETH_ALEN], dsap;
297 int rc = 1; 296 int rc = 1;
298 struct sk_buff *nskb = llc_alloc_frame(); 297 struct sk_buff *nskb = llc_alloc_frame(skb->dev);
299 298
300 if (!nskb) 299 if (!nskb)
301 goto out; 300 goto out;
302 rc = 0; 301 rc = 0;
303 nskb->dev = skb->dev;
304 llc_pdu_decode_sa(skb, mac_da); 302 llc_pdu_decode_sa(skb, mac_da);
305 llc_pdu_decode_ssap(skb, &dsap); 303 llc_pdu_decode_ssap(skb, &dsap);
306 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); 304 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP);