Commit d7b6b0a5 authored by Jukka Rissanen's avatar Jukka Rissanen Committed by Johan Hedberg

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: default avatarJukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent a7807d73
...@@ -509,21 +509,16 @@ static int header_create(struct sk_buff *skb, struct net_device *netdev, ...@@ -509,21 +509,16 @@ static int header_create(struct sk_buff *skb, struct net_device *netdev,
/* Packet to BT LE device */ /* Packet to BT LE device */
static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb, static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb,
struct net_device *netdev, bool is_mcast) struct net_device *netdev)
{ {
struct msghdr msg; struct msghdr msg;
struct kvec iv; struct kvec iv;
int err; int err;
/* Remember the skb so that we can send EAGAIN to the caller if /* Remember the skb so that we can send EAGAIN to the caller if
* we run out of credits. This is not done for multicast packets * we run out of credits.
* because we generate mcast packet in this module and are not
* really able to remember the skb after this packet is sent.
*/ */
if (is_mcast) chan->data = skb;
chan->data = NULL;
else
chan->data = skb;
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
msg.msg_iov = (struct iovec *) &iv; msg.msg_iov = (struct iovec *) &iv;
...@@ -575,7 +570,7 @@ static void send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev) ...@@ -575,7 +570,7 @@ static void send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev)
netdev->name, netdev->name,
&pentry->chan->dst, pentry->chan->dst_type, &pentry->chan->dst, pentry->chan->dst_type,
&pentry->peer_addr, pentry->chan); &pentry->peer_addr, pentry->chan);
send_pkt(pentry->chan, local_skb, netdev, true); send_pkt(pentry->chan, local_skb, netdev);
kfree_skb(local_skb); kfree_skb(local_skb);
} }
...@@ -617,8 +612,7 @@ static netdev_tx_t bt_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -617,8 +612,7 @@ static netdev_tx_t bt_xmit(struct sk_buff *skb, struct net_device *netdev)
BT_DBG("xmit %s to %pMR type %d IP %pI6c chan %p", BT_DBG("xmit %s to %pMR type %d IP %pI6c chan %p",
netdev->name, &addr, addr_type, netdev->name, &addr, addr_type,
&lowpan_cb(skb)->addr, lowpan_cb(skb)->chan); &lowpan_cb(skb)->addr, lowpan_cb(skb)->chan);
err = send_pkt(lowpan_cb(skb)->chan, skb, netdev, err = send_pkt(lowpan_cb(skb)->chan, skb, netdev);
false);
} else { } else {
err = -ENOENT; err = -ENOENT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment