asyncdata.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /*
  2. * Common data handling layer for ser_gigaset and usb_gigaset
  3. *
  4. * Copyright (c) 2005 by Tilman Schmidt <tilman@imap.cc>,
  5. * Hansjoerg Lipp <hjlipp@web.de>,
  6. * Stefan Eilers.
  7. *
  8. * =====================================================================
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. * =====================================================================
  14. */
  15. #include "gigaset.h"
  16. #include <linux/crc-ccitt.h>
  17. #include <linux/bitrev.h>
  18. /* check if byte must be stuffed/escaped
  19. * I'm not sure which data should be encoded.
  20. * Therefore I will go the hard way and encode every value
  21. * less than 0x20, the flag sequence and the control escape char.
  22. */
  23. static inline int muststuff(unsigned char c)
  24. {
  25. if (c < PPP_TRANS) return 1;
  26. if (c == PPP_FLAG) return 1;
  27. if (c == PPP_ESCAPE) return 1;
  28. /* other possible candidates: */
  29. /* 0x91: XON with parity set */
  30. /* 0x93: XOFF with parity set */
  31. return 0;
  32. }
  33. /* == data input =========================================================== */
  34. /* process a block of received bytes in command mode
  35. * (mstate != MS_LOCKED && (inputstate & INS_command))
  36. * Append received bytes to the command response buffer and forward them
  37. * line by line to the response handler. Exit whenever a mode/state change
  38. * might have occurred.
  39. * Return value:
  40. * number of processed bytes
  41. */
  42. static unsigned cmd_loop(unsigned numbytes, struct inbuf_t *inbuf)
  43. {
  44. unsigned char *src = inbuf->data + inbuf->head;
  45. struct cardstate *cs = inbuf->cs;
  46. unsigned cbytes = cs->cbytes;
  47. unsigned procbytes = 0;
  48. unsigned char c;
  49. while (procbytes < numbytes) {
  50. c = *src++;
  51. procbytes++;
  52. switch (c) {
  53. case '\n':
  54. if (cbytes == 0 && cs->respdata[0] == '\r') {
  55. /* collapse LF with preceding CR */
  56. cs->respdata[0] = 0;
  57. break;
  58. }
  59. /* --v-- fall through --v-- */
  60. case '\r':
  61. /* end of message line, pass to response handler */
  62. gig_dbg(DEBUG_TRANSCMD, "%s: End of Message (%d Bytes)",
  63. __func__, cbytes);
  64. if (cbytes >= MAX_RESP_SIZE) {
  65. dev_warn(cs->dev, "response too large (%d)\n",
  66. cbytes);
  67. cbytes = MAX_RESP_SIZE;
  68. }
  69. cs->cbytes = cbytes;
  70. gigaset_handle_modem_response(cs);
  71. cbytes = 0;
  72. /* store EOL byte for CRLF collapsing */
  73. cs->respdata[0] = c;
  74. /* cs->dle may have changed */
  75. if (cs->dle && !(inbuf->inputstate & INS_DLE_command))
  76. inbuf->inputstate &= ~INS_command;
  77. /* return for reevaluating state */
  78. goto exit;
  79. case DLE_FLAG:
  80. if (inbuf->inputstate & INS_DLE_char) {
  81. /* quoted DLE: clear quote flag */
  82. inbuf->inputstate &= ~INS_DLE_char;
  83. } else if (cs->dle ||
  84. (inbuf->inputstate & INS_DLE_command)) {
  85. /* DLE escape, pass up for handling */
  86. inbuf->inputstate |= INS_DLE_char;
  87. goto exit;
  88. }
  89. /* quoted or not in DLE mode: treat as regular data */
  90. /* --v-- fall through --v-- */
  91. default:
  92. /* append to line buffer if possible */
  93. if (cbytes < MAX_RESP_SIZE)
  94. cs->respdata[cbytes] = c;
  95. cbytes++;
  96. }
  97. }
  98. exit:
  99. cs->cbytes = cbytes;
  100. return procbytes;
  101. }
  102. /* process a block of received bytes in lock mode
  103. * All received bytes are passed unmodified to the tty i/f.
  104. * Return value:
  105. * number of processed bytes
  106. */
  107. static unsigned lock_loop(unsigned numbytes, struct inbuf_t *inbuf)
  108. {
  109. unsigned char *src = inbuf->data + inbuf->head;
  110. gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response", numbytes, src);
  111. gigaset_if_receive(inbuf->cs, src, numbytes);
  112. return numbytes;
  113. }
  114. /* set up next receive skb for data mode
  115. */
  116. static void new_rcv_skb(struct bc_state *bcs)
  117. {
  118. struct cardstate *cs = bcs->cs;
  119. unsigned short hw_hdr_len = cs->hw_hdr_len;
  120. if (bcs->ignore) {
  121. bcs->skb = NULL;
  122. return;
  123. }
  124. bcs->skb = dev_alloc_skb(SBUFSIZE + hw_hdr_len);
  125. if (bcs->skb == NULL) {
  126. dev_warn(cs->dev, "could not allocate new skb\n");
  127. return;
  128. }
  129. skb_reserve(bcs->skb, hw_hdr_len);
  130. }
  131. /* process a block of received bytes in HDLC data mode
  132. * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 == L2_HDLC)
  133. * Collect HDLC frames, undoing byte stuffing and watching for DLE escapes.
  134. * When a frame is complete, check the FCS and pass valid frames to the LL.
  135. * If DLE is encountered, return immediately to let the caller handle it.
  136. * Return value:
  137. * number of processed bytes
  138. */
  139. static unsigned hdlc_loop(unsigned numbytes, struct inbuf_t *inbuf)
  140. {
  141. struct cardstate *cs = inbuf->cs;
  142. struct bc_state *bcs = cs->bcs;
  143. int inputstate = bcs->inputstate;
  144. __u16 fcs = bcs->fcs;
  145. struct sk_buff *skb = bcs->skb;
  146. unsigned char *src = inbuf->data + inbuf->head;
  147. unsigned procbytes = 0;
  148. unsigned char c;
  149. if (inputstate & INS_byte_stuff) {
  150. if (!numbytes)
  151. return 0;
  152. inputstate &= ~INS_byte_stuff;
  153. goto byte_stuff;
  154. }
  155. while (procbytes < numbytes) {
  156. c = *src++;
  157. procbytes++;
  158. if (c == DLE_FLAG) {
  159. if (inputstate & INS_DLE_char) {
  160. /* quoted DLE: clear quote flag */
  161. inputstate &= ~INS_DLE_char;
  162. } else if (cs->dle || (inputstate & INS_DLE_command)) {
  163. /* DLE escape, pass up for handling */
  164. inputstate |= INS_DLE_char;
  165. break;
  166. }
  167. }
  168. if (c == PPP_ESCAPE) {
  169. /* byte stuffing indicator: pull in next byte */
  170. if (procbytes >= numbytes) {
  171. /* end of buffer, save for later processing */
  172. inputstate |= INS_byte_stuff;
  173. break;
  174. }
  175. byte_stuff:
  176. c = *src++;
  177. procbytes++;
  178. if (c == DLE_FLAG) {
  179. if (inputstate & INS_DLE_char) {
  180. /* quoted DLE: clear quote flag */
  181. inputstate &= ~INS_DLE_char;
  182. } else if (cs->dle ||
  183. (inputstate & INS_DLE_command)) {
  184. /* DLE escape, pass up for handling */
  185. inputstate |=
  186. INS_DLE_char | INS_byte_stuff;
  187. break;
  188. }
  189. }
  190. c ^= PPP_TRANS;
  191. #ifdef CONFIG_GIGASET_DEBUG
  192. if (!muststuff(c))
  193. gig_dbg(DEBUG_HDLC, "byte stuffed: 0x%02x", c);
  194. #endif
  195. } else if (c == PPP_FLAG) {
  196. /* end of frame: process content if any */
  197. if (inputstate & INS_have_data) {
  198. gig_dbg(DEBUG_HDLC,
  199. "7e----------------------------");
  200. /* check and pass received frame */
  201. if (!skb) {
  202. /* skipped frame */
  203. gigaset_isdn_rcv_err(bcs);
  204. } else if (skb->len < 2) {
  205. /* frame too short for FCS */
  206. dev_warn(cs->dev,
  207. "short frame (%d)\n",
  208. skb->len);
  209. gigaset_isdn_rcv_err(bcs);
  210. dev_kfree_skb_any(skb);
  211. } else if (fcs != PPP_GOODFCS) {
  212. /* frame check error */
  213. dev_err(cs->dev,
  214. "Checksum failed, %u bytes corrupted!\n",
  215. skb->len);
  216. gigaset_isdn_rcv_err(bcs);
  217. dev_kfree_skb_any(skb);
  218. } else {
  219. /* good frame */
  220. __skb_trim(skb, skb->len - 2);
  221. gigaset_skb_rcvd(bcs, skb);
  222. }
  223. /* prepare reception of next frame */
  224. inputstate &= ~INS_have_data;
  225. new_rcv_skb(bcs);
  226. skb = bcs->skb;
  227. } else {
  228. /* empty frame (7E 7E) */
  229. #ifdef CONFIG_GIGASET_DEBUG
  230. ++bcs->emptycount;
  231. #endif
  232. if (!skb) {
  233. /* skipped (?) */
  234. gigaset_isdn_rcv_err(bcs);
  235. new_rcv_skb(bcs);
  236. skb = bcs->skb;
  237. }
  238. }
  239. fcs = PPP_INITFCS;
  240. continue;
  241. #ifdef CONFIG_GIGASET_DEBUG
  242. } else if (muststuff(c)) {
  243. /* Should not happen. Possible after ZDLE=1<CR><LF>. */
  244. gig_dbg(DEBUG_HDLC, "not byte stuffed: 0x%02x", c);
  245. #endif
  246. }
  247. /* regular data byte, append to skb */
  248. #ifdef CONFIG_GIGASET_DEBUG
  249. if (!(inputstate & INS_have_data)) {
  250. gig_dbg(DEBUG_HDLC, "7e (%d x) ================",
  251. bcs->emptycount);
  252. bcs->emptycount = 0;
  253. }
  254. #endif
  255. inputstate |= INS_have_data;
  256. if (skb) {
  257. if (skb->len == SBUFSIZE) {
  258. dev_warn(cs->dev, "received packet too long\n");
  259. dev_kfree_skb_any(skb);
  260. /* skip remainder of packet */
  261. bcs->skb = skb = NULL;
  262. } else {
  263. *__skb_put(skb, 1) = c;
  264. fcs = crc_ccitt_byte(fcs, c);
  265. }
  266. }
  267. }
  268. bcs->inputstate = inputstate;
  269. bcs->fcs = fcs;
  270. return procbytes;
  271. }
  272. /* process a block of received bytes in transparent data mode
  273. * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 != L2_HDLC)
  274. * Invert bytes, undoing byte stuffing and watching for DLE escapes.
  275. * If DLE is encountered, return immediately to let the caller handle it.
  276. * Return value:
  277. * number of processed bytes
  278. */
  279. static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf)
  280. {
  281. struct cardstate *cs = inbuf->cs;
  282. struct bc_state *bcs = cs->bcs;
  283. int inputstate = bcs->inputstate;
  284. struct sk_buff *skb = bcs->skb;
  285. unsigned char *src = inbuf->data + inbuf->head;
  286. unsigned procbytes = 0;
  287. unsigned char c;
  288. if (!skb) {
  289. /* skip this block */
  290. new_rcv_skb(bcs);
  291. return numbytes;
  292. }
  293. while (procbytes < numbytes && skb->len < SBUFSIZE) {
  294. c = *src++;
  295. procbytes++;
  296. if (c == DLE_FLAG) {
  297. if (inputstate & INS_DLE_char) {
  298. /* quoted DLE: clear quote flag */
  299. inputstate &= ~INS_DLE_char;
  300. } else if (cs->dle || (inputstate & INS_DLE_command)) {
  301. /* DLE escape, pass up for handling */
  302. inputstate |= INS_DLE_char;
  303. break;
  304. }
  305. }
  306. /* regular data byte: append to current skb */
  307. inputstate |= INS_have_data;
  308. *__skb_put(skb, 1) = bitrev8(c);
  309. }
  310. /* pass data up */
  311. if (inputstate & INS_have_data) {
  312. gigaset_skb_rcvd(bcs, skb);
  313. inputstate &= ~INS_have_data;
  314. new_rcv_skb(bcs);
  315. }
  316. bcs->inputstate = inputstate;
  317. return procbytes;
  318. }
  319. /* process DLE escapes
  320. * Called whenever a DLE sequence might be encountered in the input stream.
  321. * Either processes the entire DLE sequence or, if that isn't possible,
  322. * notes the fact that an initial DLE has been received in the INS_DLE_char
  323. * inputstate flag and resumes processing of the sequence on the next call.
  324. */
  325. static void handle_dle(struct inbuf_t *inbuf)
  326. {
  327. struct cardstate *cs = inbuf->cs;
  328. if (cs->mstate == MS_LOCKED)
  329. return; /* no DLE processing in lock mode */
  330. if (!(inbuf->inputstate & INS_DLE_char)) {
  331. /* no DLE pending */
  332. if (inbuf->data[inbuf->head] == DLE_FLAG &&
  333. (cs->dle || inbuf->inputstate & INS_DLE_command)) {
  334. /* start of DLE sequence */
  335. inbuf->head++;
  336. if (inbuf->head == inbuf->tail ||
  337. inbuf->head == RBUFSIZE) {
  338. /* end of buffer, save for later processing */
  339. inbuf->inputstate |= INS_DLE_char;
  340. return;
  341. }
  342. } else {
  343. /* regular data byte */
  344. return;
  345. }
  346. }
  347. /* consume pending DLE */
  348. inbuf->inputstate &= ~INS_DLE_char;
  349. switch (inbuf->data[inbuf->head]) {
  350. case 'X': /* begin of event message */
  351. if (inbuf->inputstate & INS_command)
  352. dev_notice(cs->dev,
  353. "received <DLE>X in command mode\n");
  354. inbuf->inputstate |= INS_command | INS_DLE_command;
  355. inbuf->head++; /* byte consumed */
  356. break;
  357. case '.': /* end of event message */
  358. if (!(inbuf->inputstate & INS_DLE_command))
  359. dev_notice(cs->dev,
  360. "received <DLE>. without <DLE>X\n");
  361. inbuf->inputstate &= ~INS_DLE_command;
  362. /* return to data mode if in DLE mode */
  363. if (cs->dle)
  364. inbuf->inputstate &= ~INS_command;
  365. inbuf->head++; /* byte consumed */
  366. break;
  367. case DLE_FLAG: /* DLE in data stream */
  368. /* mark as quoted */
  369. inbuf->inputstate |= INS_DLE_char;
  370. if (!(cs->dle || inbuf->inputstate & INS_DLE_command))
  371. dev_notice(cs->dev,
  372. "received <DLE><DLE> not in DLE mode\n");
  373. break; /* quoted byte left in buffer */
  374. default:
  375. dev_notice(cs->dev, "received <DLE><%02x>\n",
  376. inbuf->data[inbuf->head]);
  377. /* quoted byte left in buffer */
  378. }
  379. }
  380. /**
  381. * gigaset_m10x_input() - process a block of data received from the device
  382. * @inbuf: received data and device descriptor structure.
  383. *
  384. * Called by hardware module {ser,usb}_gigaset with a block of received
  385. * bytes. Separates the bytes received over the serial data channel into
  386. * user data and command replies (locked/unlocked) according to the
  387. * current state of the interface.
  388. */
  389. void gigaset_m10x_input(struct inbuf_t *inbuf)
  390. {
  391. struct cardstate *cs = inbuf->cs;
  392. unsigned numbytes, procbytes;
  393. gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", inbuf->head, inbuf->tail);
  394. while (inbuf->head != inbuf->tail) {
  395. /* check for DLE escape */
  396. handle_dle(inbuf);
  397. /* process a contiguous block of bytes */
  398. numbytes = (inbuf->head > inbuf->tail ?
  399. RBUFSIZE : inbuf->tail) - inbuf->head;
  400. gig_dbg(DEBUG_INTR, "processing %u bytes", numbytes);
  401. /*
  402. * numbytes may be 0 if handle_dle() ate the last byte.
  403. * This does no harm, *_loop() will just return 0 immediately.
  404. */
  405. if (cs->mstate == MS_LOCKED)
  406. procbytes = lock_loop(numbytes, inbuf);
  407. else if (inbuf->inputstate & INS_command)
  408. procbytes = cmd_loop(numbytes, inbuf);
  409. else if (cs->bcs->proto2 == L2_HDLC)
  410. procbytes = hdlc_loop(numbytes, inbuf);
  411. else
  412. procbytes = iraw_loop(numbytes, inbuf);
  413. inbuf->head += procbytes;
  414. /* check for buffer wraparound */
  415. if (inbuf->head >= RBUFSIZE)
  416. inbuf->head = 0;
  417. gig_dbg(DEBUG_INTR, "head set to %u", inbuf->head);
  418. }
  419. }
  420. EXPORT_SYMBOL_GPL(gigaset_m10x_input);
  421. /* == data output ========================================================== */
  422. /*
  423. * Encode a data packet into an octet stuffed HDLC frame with FCS,
  424. * opening and closing flags, preserving headroom data.
  425. * parameters:
  426. * skb skb containing original packet (freed upon return)
  427. * Return value:
  428. * pointer to newly allocated skb containing the result frame
  429. * and the original link layer header, NULL on error
  430. */
  431. static struct sk_buff *HDLC_Encode(struct sk_buff *skb)
  432. {
  433. struct sk_buff *hdlc_skb;
  434. __u16 fcs;
  435. unsigned char c;
  436. unsigned char *cp;
  437. int len;
  438. unsigned int stuf_cnt;
  439. stuf_cnt = 0;
  440. fcs = PPP_INITFCS;
  441. cp = skb->data;
  442. len = skb->len;
  443. while (len--) {
  444. if (muststuff(*cp))
  445. stuf_cnt++;
  446. fcs = crc_ccitt_byte(fcs, *cp++);
  447. }
  448. fcs ^= 0xffff; /* complement */
  449. /* size of new buffer: original size + number of stuffing bytes
  450. * + 2 bytes FCS + 2 stuffing bytes for FCS (if needed) + 2 flag bytes
  451. * + room for link layer header
  452. */
  453. hdlc_skb = dev_alloc_skb(skb->len + stuf_cnt + 6 + skb->mac_len);
  454. if (!hdlc_skb) {
  455. dev_kfree_skb_any(skb);
  456. return NULL;
  457. }
  458. /* Copy link layer header into new skb */
  459. skb_reset_mac_header(hdlc_skb);
  460. skb_reserve(hdlc_skb, skb->mac_len);
  461. memcpy(skb_mac_header(hdlc_skb), skb_mac_header(skb), skb->mac_len);
  462. hdlc_skb->mac_len = skb->mac_len;
  463. /* Add flag sequence in front of everything.. */
  464. *(skb_put(hdlc_skb, 1)) = PPP_FLAG;
  465. /* Perform byte stuffing while copying data. */
  466. while (skb->len--) {
  467. if (muststuff(*skb->data)) {
  468. *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE;
  469. *(skb_put(hdlc_skb, 1)) = (*skb->data++) ^ PPP_TRANS;
  470. } else
  471. *(skb_put(hdlc_skb, 1)) = *skb->data++;
  472. }
  473. /* Finally add FCS (byte stuffed) and flag sequence */
  474. c = (fcs & 0x00ff); /* least significant byte first */
  475. if (muststuff(c)) {
  476. *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE;
  477. c ^= PPP_TRANS;
  478. }
  479. *(skb_put(hdlc_skb, 1)) = c;
  480. c = ((fcs >> 8) & 0x00ff);
  481. if (muststuff(c)) {
  482. *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE;
  483. c ^= PPP_TRANS;
  484. }
  485. *(skb_put(hdlc_skb, 1)) = c;
  486. *(skb_put(hdlc_skb, 1)) = PPP_FLAG;
  487. dev_kfree_skb_any(skb);
  488. return hdlc_skb;
  489. }
  490. /*
  491. * Encode a data packet into an octet stuffed raw bit inverted frame,
  492. * preserving headroom data.
  493. * parameters:
  494. * skb skb containing original packet (freed upon return)
  495. * Return value:
  496. * pointer to newly allocated skb containing the result frame
  497. * and the original link layer header, NULL on error
  498. */
  499. static struct sk_buff *iraw_encode(struct sk_buff *skb)
  500. {
  501. struct sk_buff *iraw_skb;
  502. unsigned char c;
  503. unsigned char *cp;
  504. int len;
  505. /* size of new buffer (worst case = every byte must be stuffed):
  506. * 2 * original size + room for link layer header
  507. */
  508. iraw_skb = dev_alloc_skb(2*skb->len + skb->mac_len);
  509. if (!iraw_skb) {
  510. dev_kfree_skb_any(skb);
  511. return NULL;
  512. }
  513. /* copy link layer header into new skb */
  514. skb_reset_mac_header(iraw_skb);
  515. skb_reserve(iraw_skb, skb->mac_len);
  516. memcpy(skb_mac_header(iraw_skb), skb_mac_header(skb), skb->mac_len);
  517. iraw_skb->mac_len = skb->mac_len;
  518. /* copy and stuff data */
  519. cp = skb->data;
  520. len = skb->len;
  521. while (len--) {
  522. c = bitrev8(*cp++);
  523. if (c == DLE_FLAG)
  524. *(skb_put(iraw_skb, 1)) = c;
  525. *(skb_put(iraw_skb, 1)) = c;
  526. }
  527. dev_kfree_skb_any(skb);
  528. return iraw_skb;
  529. }
  530. /**
  531. * gigaset_m10x_send_skb() - queue an skb for sending
  532. * @bcs: B channel descriptor structure.
  533. * @skb: data to send.
  534. *
  535. * Called by LL to encode and queue an skb for sending, and start
  536. * transmission if necessary.
  537. * Once the payload data has been transmitted completely, gigaset_skb_sent()
  538. * will be called with the skb's link layer header preserved.
  539. *
  540. * Return value:
  541. * number of bytes accepted for sending (skb->len) if ok,
  542. * error code < 0 (eg. -ENOMEM) on error
  543. */
  544. int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
  545. {
  546. struct cardstate *cs = bcs->cs;
  547. unsigned len = skb->len;
  548. unsigned long flags;
  549. if (bcs->proto2 == L2_HDLC)
  550. skb = HDLC_Encode(skb);
  551. else
  552. skb = iraw_encode(skb);
  553. if (!skb) {
  554. dev_err(cs->dev,
  555. "unable to allocate memory for encoding!\n");
  556. return -ENOMEM;
  557. }
  558. skb_queue_tail(&bcs->squeue, skb);
  559. spin_lock_irqsave(&cs->lock, flags);
  560. if (cs->connected)
  561. tasklet_schedule(&cs->write_tasklet);
  562. spin_unlock_irqrestore(&cs->lock, flags);
  563. return len; /* ok so far */
  564. }
  565. EXPORT_SYMBOL_GPL(gigaset_m10x_send_skb);