diff options
Diffstat (limited to 'net/llc/llc_station.c')
| -rw-r--r-- | net/llc/llc_station.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c index 8fe48a24bad5..f37dbf8ef126 100644 --- a/net/llc/llc_station.c +++ b/net/llc/llc_station.c | |||
| @@ -50,6 +50,10 @@ struct llc_station { | |||
| 50 | struct sk_buff_head mac_pdu_q; | 50 | struct sk_buff_head mac_pdu_q; |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | #define LLC_STATION_ACK_TIME (3 * HZ) | ||
| 54 | |||
| 55 | int sysctl_llc_station_ack_timeout = LLC_STATION_ACK_TIME; | ||
| 56 | |||
| 53 | /* Types of events (possible values in 'ev->type') */ | 57 | /* Types of events (possible values in 'ev->type') */ |
| 54 | #define LLC_STATION_EV_TYPE_SIMPLE 1 | 58 | #define LLC_STATION_EV_TYPE_SIMPLE 1 |
| 55 | #define LLC_STATION_EV_TYPE_CONDITION 2 | 59 | #define LLC_STATION_EV_TYPE_CONDITION 2 |
| @@ -218,7 +222,8 @@ static void llc_station_send_pdu(struct sk_buff *skb) | |||
| 218 | 222 | ||
| 219 | static int llc_station_ac_start_ack_timer(struct sk_buff *skb) | 223 | static int llc_station_ac_start_ack_timer(struct sk_buff *skb) |
| 220 | { | 224 | { |
| 221 | mod_timer(&llc_main_station.ack_timer, jiffies + LLC_ACK_TIME * HZ); | 225 | mod_timer(&llc_main_station.ack_timer, |
| 226 | jiffies + sysctl_llc_station_ack_timeout); | ||
| 222 | return 0; | 227 | return 0; |
| 223 | } | 228 | } |
| 224 | 229 | ||
| @@ -249,14 +254,14 @@ static int llc_station_ac_inc_xid_r_cnt_by_1(struct sk_buff *skb) | |||
| 249 | static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb) | 254 | static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb) |
| 250 | { | 255 | { |
| 251 | int rc = 1; | 256 | int rc = 1; |
| 252 | struct sk_buff *nskb = llc_alloc_frame(); | 257 | struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev); |
| 253 | 258 | ||
| 254 | if (!nskb) | 259 | if (!nskb) |
| 255 | goto out; | 260 | goto out; |
| 256 | llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, 0, LLC_PDU_CMD); | 261 | llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, 0, LLC_PDU_CMD); |
| 257 | llc_pdu_init_as_xid_cmd(nskb, LLC_XID_NULL_CLASS_2, 127); | 262 | llc_pdu_init_as_xid_cmd(nskb, LLC_XID_NULL_CLASS_2, 127); |
| 258 | rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, llc_station_mac_sa); | 263 | rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, llc_station_mac_sa); |
| 259 | if (rc) | 264 | if (unlikely(rc)) |
| 260 | goto free; | 265 | goto free; |
| 261 | llc_station_send_pdu(nskb); | 266 | llc_station_send_pdu(nskb); |
| 262 | out: | 267 | out: |
| @@ -270,18 +275,17 @@ static int llc_station_ac_send_xid_r(struct sk_buff *skb) | |||
| 270 | { | 275 | { |
| 271 | u8 mac_da[ETH_ALEN], dsap; | 276 | u8 mac_da[ETH_ALEN], dsap; |
| 272 | int rc = 1; | 277 | int rc = 1; |
| 273 | struct sk_buff* nskb = llc_alloc_frame(); | 278 | struct sk_buff* nskb = llc_alloc_frame(NULL, skb->dev); |
| 274 | 279 | ||
| 275 | if (!nskb) | 280 | if (!nskb) |
| 276 | goto out; | 281 | goto out; |
| 277 | rc = 0; | 282 | rc = 0; |
| 278 | nskb->dev = skb->dev; | ||
| 279 | llc_pdu_decode_sa(skb, mac_da); | 283 | llc_pdu_decode_sa(skb, mac_da); |
| 280 | llc_pdu_decode_ssap(skb, &dsap); | 284 | llc_pdu_decode_ssap(skb, &dsap); |
| 281 | llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); | 285 | llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); |
| 282 | llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 127); | 286 | llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 127); |
| 283 | rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); | 287 | rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); |
| 284 | if (rc) | 288 | if (unlikely(rc)) |
| 285 | goto free; | 289 | goto free; |
| 286 | llc_station_send_pdu(nskb); | 290 | llc_station_send_pdu(nskb); |
| 287 | out: | 291 | out: |
| @@ -295,18 +299,17 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb) | |||
| 295 | { | 299 | { |
| 296 | u8 mac_da[ETH_ALEN], dsap; | 300 | u8 mac_da[ETH_ALEN], dsap; |
| 297 | int rc = 1; | 301 | int rc = 1; |
| 298 | struct sk_buff *nskb = llc_alloc_frame(); | 302 | struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev); |
| 299 | 303 | ||
| 300 | if (!nskb) | 304 | if (!nskb) |
| 301 | goto out; | 305 | goto out; |
| 302 | rc = 0; | 306 | rc = 0; |
| 303 | nskb->dev = skb->dev; | ||
| 304 | llc_pdu_decode_sa(skb, mac_da); | 307 | llc_pdu_decode_sa(skb, mac_da); |
| 305 | llc_pdu_decode_ssap(skb, &dsap); | 308 | llc_pdu_decode_ssap(skb, &dsap); |
| 306 | llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); | 309 | llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); |
| 307 | llc_pdu_init_as_test_rsp(nskb, skb); | 310 | llc_pdu_init_as_test_rsp(nskb, skb); |
| 308 | rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); | 311 | rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); |
| 309 | if (rc) | 312 | if (unlikely(rc)) |
| 310 | goto free; | 313 | goto free; |
| 311 | llc_station_send_pdu(nskb); | 314 | llc_station_send_pdu(nskb); |
| 312 | out: | 315 | out: |
| @@ -689,7 +692,8 @@ int __init llc_station_init(void) | |||
| 689 | init_timer(&llc_main_station.ack_timer); | 692 | init_timer(&llc_main_station.ack_timer); |
| 690 | llc_main_station.ack_timer.data = (unsigned long)&llc_main_station; | 693 | llc_main_station.ack_timer.data = (unsigned long)&llc_main_station; |
| 691 | llc_main_station.ack_timer.function = llc_station_ack_tmr_cb; | 694 | llc_main_station.ack_timer.function = llc_station_ack_tmr_cb; |
| 692 | 695 | llc_main_station.ack_timer.expires = jiffies + | |
| 696 | sysctl_llc_station_ack_timeout; | ||
| 693 | skb = alloc_skb(0, GFP_ATOMIC); | 697 | skb = alloc_skb(0, GFP_ATOMIC); |
| 694 | if (!skb) | 698 | if (!skb) |
| 695 | goto out; | 699 | goto out; |
| @@ -697,7 +701,6 @@ int __init llc_station_init(void) | |||
| 697 | llc_set_station_handler(llc_station_rcv); | 701 | llc_set_station_handler(llc_station_rcv); |
| 698 | ev = llc_station_ev(skb); | 702 | ev = llc_station_ev(skb); |
| 699 | memset(ev, 0, sizeof(*ev)); | 703 | memset(ev, 0, sizeof(*ev)); |
| 700 | llc_main_station.ack_timer.expires = jiffies + 3 * HZ; | ||
| 701 | llc_main_station.maximum_retry = 1; | 704 | llc_main_station.maximum_retry = 1; |
| 702 | llc_main_station.state = LLC_STATION_STATE_DOWN; | 705 | llc_main_station.state = LLC_STATION_STATE_DOWN; |
| 703 | ev->type = LLC_STATION_EV_TYPE_SIMPLE; | 706 | ev->type = LLC_STATION_EV_TYPE_SIMPLE; |
