aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/6lowpan.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2014-10-01 08:59:14 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2014-10-02 06:41:39 -0400
commitd7b6b0a532da7de25e16deed610658cfa1969fe9 (patch)
tree27847fc8c5f0d29c39821b176f60c0f2593bdf96 /net/bluetooth/6lowpan.c
parenta7807d73a0fa9b33dbdfd5f1cb97970ccc91d77e (diff)
Bluetooth: 6lowpan: Return EAGAIN error also for multicast packets
Make sure that we are able to return EAGAIN from l2cap_chan_send() even for multicast packets. The error code was ignored unncessarily. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/6lowpan.c')
-rw-r--r--net/bluetooth/6lowpan.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 44eaad77e70c..fcfaa7006b28 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -509,21 +509,16 @@ static int header_create(struct sk_buff *skb, struct net_device *netdev,
509 509
510/* Packet to BT LE device */ 510/* Packet to BT LE device */
511static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb, 511static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb,
512 struct net_device *netdev, bool is_mcast) 512 struct net_device *netdev)
513{ 513{
514 struct msghdr msg; 514 struct msghdr msg;
515 struct kvec iv; 515 struct kvec iv;
516 int err; 516 int err;
517 517
518 /* Remember the skb so that we can send EAGAIN to the caller if 518 /* Remember the skb so that we can send EAGAIN to the caller if
519 * we run out of credits. This is not done for multicast packets 519 * we run out of credits.
520 * because we generate mcast packet in this module and are not
521 * really able to remember the skb after this packet is sent.
522 */ 520 */
523 if (is_mcast) 521 chan->data = skb;
524 chan->data = NULL;
525 else
526 chan->data = skb;
527 522
528 memset(&msg, 0, sizeof(msg)); 523 memset(&msg, 0, sizeof(msg));
529 msg.msg_iov = (struct iovec *) &iv; 524 msg.msg_iov = (struct iovec *) &iv;
@@ -575,7 +570,7 @@ static void send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev)
575 netdev->name, 570 netdev->name,
576 &pentry->chan->dst, pentry->chan->dst_type, 571 &pentry->chan->dst, pentry->chan->dst_type,
577 &pentry->peer_addr, pentry->chan); 572 &pentry->peer_addr, pentry->chan);
578 send_pkt(pentry->chan, local_skb, netdev, true); 573 send_pkt(pentry->chan, local_skb, netdev);
579 574
580 kfree_skb(local_skb); 575 kfree_skb(local_skb);
581 } 576 }
@@ -617,8 +612,7 @@ static netdev_tx_t bt_xmit(struct sk_buff *skb, struct net_device *netdev)
617 BT_DBG("xmit %s to %pMR type %d IP %pI6c chan %p", 612 BT_DBG("xmit %s to %pMR type %d IP %pI6c chan %p",
618 netdev->name, &addr, addr_type, 613 netdev->name, &addr, addr_type,
619 &lowpan_cb(skb)->addr, lowpan_cb(skb)->chan); 614 &lowpan_cb(skb)->addr, lowpan_cb(skb)->chan);
620 err = send_pkt(lowpan_cb(skb)->chan, skb, netdev, 615 err = send_pkt(lowpan_cb(skb)->chan, skb, netdev);
621 false);
622 } else { 616 } else {
623 err = -ENOENT; 617 err = -ENOENT;
624 } 618 }