aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_tx.c
diff options
context:
space:
mode:
authorJames Ketrenos <jketreno@linux.intel.com>2005-09-21 12:54:47 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-21 23:02:31 -0400
commit3f552bbf8614d2d26f488ca0d3e188bdec484bf4 (patch)
tree9721d4dc2d53579d7c324fa0b98eddc964149ab4 /net/ieee80211/ieee80211_tx.c
parent3cdd00c5827621cd0b1bb0665aa62ef9a724297d (diff)
[PATCH] ieee82011: Added ieee80211_tx_frame to convert generic 802.11 data frames, and callbacks
tree 40adc78b623ae70d56074934ec6334eb4f0ae6a5 parent db43d847bcebaa3df6414e26d0008eb21690e8cf author James Ketrenos <jketreno@linux.intel.com> 1124445938 -0500 committer James Ketrenos <jketreno@linux.intel.com> 1127313102 -0500 Added ieee80211_tx_frame to convert generic 802.11 data frames into txbs for transmission. Added several purpose specific callbacks (handle_assoc, handle_auth, etc.) which the driver can register with for being notified on reception of variouf frame elements. Signed-off-by: James Ketrenos <jketreno@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'net/ieee80211/ieee80211_tx.c')
-rw-r--r--net/ieee80211/ieee80211_tx.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
index cdee41cefb26..f505aa127e21 100644
--- a/net/ieee80211/ieee80211_tx.c
+++ b/net/ieee80211/ieee80211_tx.c
@@ -459,7 +459,71 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
459 netif_stop_queue(dev); 459 netif_stop_queue(dev);
460 stats->tx_errors++; 460 stats->tx_errors++;
461 return 1; 461 return 1;
462}
463
464/* Incoming 802.11 strucure is converted to a TXB
465 * a block of 802.11 fragment packets (stored as skbs) */
466int ieee80211_tx_frame(struct ieee80211_device *ieee,
467 struct ieee80211_hdr *frame, int len)
468{
469 struct ieee80211_txb *txb = NULL;
470 unsigned long flags;
471 struct net_device_stats *stats = &ieee->stats;
472 struct sk_buff *skb_frag;
473
474 spin_lock_irqsave(&ieee->lock, flags);
475
476 /* If there is no driver handler to take the TXB, dont' bother
477 * creating it... */
478 if (!ieee->hard_start_xmit) {
479 printk(KERN_WARNING "%s: No xmit handler.\n", ieee->dev->name);
480 goto success;
481 }
462 482
483 if (unlikely(len < 24)) {
484 printk(KERN_WARNING "%s: skb too small (%d).\n",
485 ieee->dev->name, len);
486 goto success;
487 }
488
489 /* When we allocate the TXB we allocate enough space for the reserve
490 * and full fragment bytes (bytes_per_frag doesn't include prefix,
491 * postfix, header, FCS, etc.) */
492 txb = ieee80211_alloc_txb(1, len, GFP_ATOMIC);
493 if (unlikely(!txb)) {
494 printk(KERN_WARNING "%s: Could not allocate TXB\n",
495 ieee->dev->name);
496 goto failed;
497 }
498 txb->encrypted = 0;
499 txb->payload_size = len;
500
501 skb_frag = txb->fragments[0];
502
503 memcpy(skb_put(skb_frag, len), frame, len);
504
505 if (ieee->config &
506 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
507 skb_put(skb_frag, 4);
508
509 success:
510 spin_unlock_irqrestore(&ieee->lock, flags);
511
512 if (txb) {
513 if ((*ieee->hard_start_xmit) (txb, ieee->dev) == 0) {
514 stats->tx_packets++;
515 stats->tx_bytes += txb->payload_size;
516 return 0;
517 }
518 ieee80211_txb_free(txb);
519 }
520 return 0;
521
522 failed:
523 spin_unlock_irqrestore(&ieee->lock, flags);
524 stats->tx_errors++;
525 return 1;
463} 526}
464 527
528EXPORT_SYMBOL(ieee80211_tx_frame);
465EXPORT_SYMBOL(ieee80211_txb_free); 529EXPORT_SYMBOL(ieee80211_txb_free);