~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/llc/llc_station.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/llc/llc_station.c (Architecture ppc) and /net/llc/llc_station.c (Architecture m68k)


  1 /*                                                  1 /*
  2  * llc_station.c - station component of LLC         2  * llc_station.c - station component of LLC
  3  *                                                  3  *
  4  * Copyright (c) 1997 by Procom Technology, In      4  * Copyright (c) 1997 by Procom Technology, Inc.
  5  *               2001-2003 by Arnaldo Carvalho      5  *               2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  6  *                                                  6  *
  7  * This program can be redistributed or modifi      7  * This program can be redistributed or modified under the terms of the
  8  * GNU General Public License as published by       8  * GNU General Public License as published by the Free Software Foundation.
  9  * This program is distributed without any war      9  * This program is distributed without any warranty or implied warranty
 10  * of merchantability or fitness for a particu     10  * of merchantability or fitness for a particular purpose.
 11  *                                                 11  *
 12  * See the GNU General Public License for more     12  * See the GNU General Public License for more details.
 13  */                                                13  */
 14 #include <linux/init.h>                            14 #include <linux/init.h>
 15 #include <linux/module.h>                          15 #include <linux/module.h>
 16 #include <linux/slab.h>                            16 #include <linux/slab.h>
 17 #include <net/llc.h>                               17 #include <net/llc.h>
 18 #include <net/llc_sap.h>                           18 #include <net/llc_sap.h>
 19 #include <net/llc_conn.h>                          19 #include <net/llc_conn.h>
 20 #include <net/llc_c_ac.h>                          20 #include <net/llc_c_ac.h>
 21 #include <net/llc_s_ac.h>                          21 #include <net/llc_s_ac.h>
 22 #include <net/llc_c_ev.h>                          22 #include <net/llc_c_ev.h>
 23 #include <net/llc_c_st.h>                          23 #include <net/llc_c_st.h>
 24 #include <net/llc_s_ev.h>                          24 #include <net/llc_s_ev.h>
 25 #include <net/llc_s_st.h>                          25 #include <net/llc_s_st.h>
 26 #include <net/llc_pdu.h>                           26 #include <net/llc_pdu.h>
 27                                                    27 
 28 static int llc_stat_ev_rx_null_dsap_xid_c(stru     28 static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb)
 29 {                                                  29 {
 30         struct llc_pdu_un *pdu = llc_pdu_un_hd     30         struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
 31                                                    31 
 32         return LLC_PDU_IS_CMD(pdu) &&              32         return LLC_PDU_IS_CMD(pdu) &&                   /* command PDU */
 33                LLC_PDU_TYPE_IS_U(pdu) &&           33                LLC_PDU_TYPE_IS_U(pdu) &&                /* U type PDU */
 34                LLC_U_PDU_CMD(pdu) == LLC_1_PDU     34                LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_XID &&
 35                !pdu->dsap;                         35                !pdu->dsap;                              /* NULL DSAP value */
 36 }                                                  36 }
 37                                                    37 
 38 static int llc_stat_ev_rx_null_dsap_test_c(str     38 static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb)
 39 {                                                  39 {
 40         struct llc_pdu_un *pdu = llc_pdu_un_hd     40         struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
 41                                                    41 
 42         return LLC_PDU_IS_CMD(pdu) &&              42         return LLC_PDU_IS_CMD(pdu) &&                   /* command PDU */
 43                LLC_PDU_TYPE_IS_U(pdu) &&           43                LLC_PDU_TYPE_IS_U(pdu) &&                /* U type PDU */
 44                LLC_U_PDU_CMD(pdu) == LLC_1_PDU     44                LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_TEST &&
 45                !pdu->dsap;                         45                !pdu->dsap;                              /* NULL DSAP */
 46 }                                                  46 }
 47                                                    47 
 48 static int llc_station_ac_send_xid_r(struct sk     48 static int llc_station_ac_send_xid_r(struct sk_buff *skb)
 49 {                                                  49 {
 50         u8 mac_da[ETH_ALEN], dsap;                 50         u8 mac_da[ETH_ALEN], dsap;
 51         int rc = 1;                                51         int rc = 1;
 52         struct sk_buff *nskb = llc_alloc_frame     52         struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U,
 53                                                    53                                                sizeof(struct llc_xid_info));
 54                                                    54 
 55         if (!nskb)                                 55         if (!nskb)
 56                 goto out;                          56                 goto out;
 57         llc_pdu_decode_sa(skb, mac_da);            57         llc_pdu_decode_sa(skb, mac_da);
 58         llc_pdu_decode_ssap(skb, &dsap);           58         llc_pdu_decode_ssap(skb, &dsap);
 59         llc_pdu_header_init(nskb, LLC_PDU_TYPE     59         llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP);
 60         llc_pdu_init_as_xid_rsp(nskb, LLC_XID_     60         llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 127);
 61         rc = llc_mac_hdr_init(nskb, skb->dev->     61         rc = llc_mac_hdr_init(nskb, skb->dev->dev_addr, mac_da);
 62         if (unlikely(rc))                          62         if (unlikely(rc))
 63                 goto free;                         63                 goto free;
 64         dev_queue_xmit(nskb);                      64         dev_queue_xmit(nskb);
 65 out:                                               65 out:
 66         return rc;                                 66         return rc;
 67 free:                                              67 free:
 68         kfree_skb(nskb);                           68         kfree_skb(nskb);
 69         goto out;                                  69         goto out;
 70 }                                                  70 }
 71                                                    71 
 72 static int llc_station_ac_send_test_r(struct s     72 static int llc_station_ac_send_test_r(struct sk_buff *skb)
 73 {                                                  73 {
 74         u8 mac_da[ETH_ALEN], dsap;                 74         u8 mac_da[ETH_ALEN], dsap;
 75         int rc = 1;                                75         int rc = 1;
 76         u32 data_size;                             76         u32 data_size;
 77         struct sk_buff *nskb;                      77         struct sk_buff *nskb;
 78                                                    78 
 79         if (skb->mac_len < ETH_HLEN)               79         if (skb->mac_len < ETH_HLEN)
 80                 goto out;                          80                 goto out;
 81                                                    81 
 82         /* The test request command is type U      82         /* The test request command is type U (llc_len = 3) */
 83         data_size = ntohs(eth_hdr(skb)->h_prot     83         data_size = ntohs(eth_hdr(skb)->h_proto) - 3;
 84         nskb = llc_alloc_frame(NULL, skb->dev,     84         nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U, data_size);
 85                                                    85 
 86         if (!nskb)                                 86         if (!nskb)
 87                 goto out;                          87                 goto out;
 88         llc_pdu_decode_sa(skb, mac_da);            88         llc_pdu_decode_sa(skb, mac_da);
 89         llc_pdu_decode_ssap(skb, &dsap);           89         llc_pdu_decode_ssap(skb, &dsap);
 90         llc_pdu_header_init(nskb, LLC_PDU_TYPE     90         llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP);
 91         llc_pdu_init_as_test_rsp(nskb, skb);       91         llc_pdu_init_as_test_rsp(nskb, skb);
 92         rc = llc_mac_hdr_init(nskb, skb->dev->     92         rc = llc_mac_hdr_init(nskb, skb->dev->dev_addr, mac_da);
 93         if (unlikely(rc))                          93         if (unlikely(rc))
 94                 goto free;                         94                 goto free;
 95         dev_queue_xmit(nskb);                      95         dev_queue_xmit(nskb);
 96 out:                                               96 out:
 97         return rc;                                 97         return rc;
 98 free:                                              98 free:
 99         kfree_skb(nskb);                           99         kfree_skb(nskb);
100         goto out;                                 100         goto out;
101 }                                                 101 }
102                                                   102 
103 /**                                               103 /**
104  *      llc_station_rcv - send received pdu to    104  *      llc_station_rcv - send received pdu to the station state machine
105  *      @skb: received frame.                     105  *      @skb: received frame.
106  *                                                106  *
107  *      Sends data unit to station state machi    107  *      Sends data unit to station state machine.
108  */                                               108  */
109 static void llc_station_rcv(struct sk_buff *sk    109 static void llc_station_rcv(struct sk_buff *skb)
110 {                                                 110 {
111         if (llc_stat_ev_rx_null_dsap_xid_c(skb    111         if (llc_stat_ev_rx_null_dsap_xid_c(skb))
112                 llc_station_ac_send_xid_r(skb)    112                 llc_station_ac_send_xid_r(skb);
113         else if (llc_stat_ev_rx_null_dsap_test    113         else if (llc_stat_ev_rx_null_dsap_test_c(skb))
114                 llc_station_ac_send_test_r(skb    114                 llc_station_ac_send_test_r(skb);
115         kfree_skb(skb);                           115         kfree_skb(skb);
116 }                                                 116 }
117                                                   117 
118 void __init llc_station_init(void)                118 void __init llc_station_init(void)
119 {                                                 119 {
120         llc_set_station_handler(llc_station_rc    120         llc_set_station_handler(llc_station_rcv);
121 }                                                 121 }
122                                                   122 
123 void llc_station_exit(void)                       123 void llc_station_exit(void)
124 {                                                 124 {
125         llc_set_station_handler(NULL);            125         llc_set_station_handler(NULL);
126 }                                                 126 }
127                                                   127 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php