Skip to contentSkip to conversation

Bluetooth: 6lowpan: remove unnecessary codes in give_skb_to_upper

PATCH In review [email protected] 4 participants 6 messages Oct 16, 2014 – Oct 17, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: 6lowpan: remove unnecessary codes in give_skb_to_upper

From: Li RongQing <[email protected]>

netif_rx() only returns NET_RX_DROP and NET_RX_SUCCESS, not returns negative value

---
 net/bluetooth/6lowpan.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
net/bluetooth/6lowpan.c +1 -8
index c2e0d14..9b5c89b 100644
@@ -249,19 +249,12 @@ static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn)
 static int give_skb_to_upper(struct sk_buff *skb, struct net_device *dev)
 {
 	struct sk_buff *skb_cp;
-	int ret;
 
 	skb_cp = skb_copy(skb, GFP_ATOMIC);
 	if (!skb_cp)
 		return -ENOMEM;
 
-	ret = netif_rx(skb_cp);
-	if (ret < 0) {
-		BT_DBG("receive skb %d", ret);
-		return NET_RX_DROP;
-	}
-
-	return ret;
+	return netif_rx(skb_cp);
 }
 
 static int process_data(struct sk_buff *skb, struct net_device *netdev,
Signature · 1 line
1.7.10.4
#1 lore raw

Hi,

Quoted 25 lines · On to, 2014-10-16 at 10:21 +0800, [email protected] wrote:

From: Li RongQing <[email protected]>

netif_rx() only returns NET_RX_DROP and NET_RX_SUCCESS, not returns negative value

---
 net/bluetooth/6lowpan.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
net/bluetooth/6lowpan.c +0 -2
index c2e0d14..9b5c89b 100644
@@ -249,19 +249,12 @@ static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn)
 static int give_skb_to_upper(struct sk_buff *skb, struct net_device *dev)
 {
 	struct sk_buff *skb_cp;
-	int ret;
 
 	skb_cp = skb_copy(skb, GFP_ATOMIC);
 	if (!skb_cp)
 		return -ENOMEM;
 
-	ret = netif_rx(skb_cp);

net/bluetooth/6lowpan.c static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn) · line 260

Quoted 10 lines
net/bluetooth/6lowpan.c +1 -6
-	if (ret < 0) {
-		BT_DBG("receive skb %d", ret);
-		return NET_RX_DROP;
-	}
-
-	return ret;
+	return netif_rx(skb_cp);
 }
 
 static int process_data(struct sk_buff *skb, struct net_device *netdev,

Ack to this.

Cheers,
Jukka

maintainer
#2 lore raw

Hi Jukka,

Quoted 34 lines
Quoted 34 lines

From: Li RongQing <[email protected]>

netif_rx() only returns NET_RX_DROP and NET_RX_SUCCESS, not returns negative value

---
net/bluetooth/6lowpan.c | 9 +--------

1 file changed, 1 insertion(+), 8 deletions(-)
net/bluetooth/6lowpan.c +1 -8
index c2e0d14..9b5c89b 100644
@@ -249,19 +249,12 @@ static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn)
 static int give_skb_to_upper(struct sk_buff *skb, struct net_device *dev)
 {
 	struct sk_buff *skb_cp;
-	int ret;
 
 	skb_cp = skb_copy(skb, GFP_ATOMIC);
 	if (!skb_cp)
 		return -ENOMEM;
 
-	ret = netif_rx(skb_cp);
-	if (ret < 0) {
-		BT_DBG("receive skb %d", ret);
-		return NET_RX_DROP;
-	}
-
-	return ret;
+	return netif_rx(skb_cp);
 }
 
Quoted 5 lines

net/bluetooth/6lowpan.c static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn) · line 260

Quoted 1 line
net/bluetooth/6lowpan.c +0 -0
 static int process_data(struct sk_buff *skb, struct net_device *netdev,

Ack to this.

this should be acked-by or reviewed-by and not signed-off-by. The signed-off-by is only if you would send Roy's original patch on his behalf or you would be in the chain of sending patches along the maintainer trees.

Regards

Marcel

#3 lore raw
Quoted 36 lines · Marcel Holtmann

Hi Jukka,

Quoted 34 lines
Quoted 34 lines

From: Li RongQing <[email protected]>

netif_rx() only returns NET_RX_DROP and NET_RX_SUCCESS, not returns negative value

---
net/bluetooth/6lowpan.c | 9 +--------

1 file changed, 1 insertion(+), 8 deletions(-)
net/bluetooth/6lowpan.c +1 -8
index c2e0d14..9b5c89b 100644
@@ -249,19 +249,12 @@ static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn)
 static int give_skb_to_upper(struct sk_buff *skb, struct net_device *dev)
 {
 	struct sk_buff *skb_cp;
-	int ret;
 
 	skb_cp = skb_copy(skb, GFP_ATOMIC);
 	if (!skb_cp)
 		return -ENOMEM;
 
-	ret = netif_rx(skb_cp);
-	if (ret < 0) {
-		BT_DBG("receive skb %d", ret);
-		return NET_RX_DROP;
-	}
-
-	return ret;
+	return netif_rx(skb_cp);
 }
 
Quoted 7 lines
Quoted 5 lines

net/bluetooth/6lowpan.c static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn) · line 260

Quoted 1 line
net/bluetooth/6lowpan.c +0 -0
 static int process_data(struct sk_buff *skb, struct net_device *netdev,

Ack to this.

this should be acked-by or reviewed-by and not signed-off-by. The signed-off-by is only if you would send Roy's original patch on his behalf or you would be in the chain of sending patches along the maintainer trees.

Do'h! Yep, I meant to say Acked-by (too many things going on same time :)

Quoted 5 lines

Regards

Marcel

Cheers,
Jukka

#4 lore raw
In reply to Jukka Rissanen

Hi Jukka,

Quoted 37 lines · Jukka Rissanen

Hi,

Quoted 34 lines · On to, 2014-10-16 at 10:21 +0800, [email protected] wrote:

From: Li RongQing <[email protected]>

netif_rx() only returns NET_RX_DROP and NET_RX_SUCCESS, not returns negative value

---
 net/bluetooth/6lowpan.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
net/bluetooth/6lowpan.c +1 -8
index c2e0d14..9b5c89b 100644
@@ -249,19 +249,12 @@ static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn)
 static int give_skb_to_upper(struct sk_buff *skb, struct net_device *dev)
 {
 	struct sk_buff *skb_cp;
-	int ret;
 
 	skb_cp = skb_copy(skb, GFP_ATOMIC);
 	if (!skb_cp)
 		return -ENOMEM;
 
-	ret = netif_rx(skb_cp);
-	if (ret < 0) {
-		BT_DBG("receive skb %d", ret);
-		return NET_RX_DROP;
-	}
-
-	return ret;
+	return netif_rx(skb_cp);
 }
 
Quoted 4 lines

net/bluetooth/6lowpan.c static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn) · line 260

Quoted 1 line
net/bluetooth/6lowpan.c +0 -0
 static int process_data(struct sk_buff *skb, struct net_device *netdev,

Ack to this.

Just for notice: this doesn't fix anything, because it's currently broken.

This is part of issue that lowpan_process_data returns sometimes errno and (NET_RX_DROP or NET_RX_SUCCESS).

Martin tries to fix this issue, but it seems that this isn't easy.

The lowpan_process_data function still returns sometimes a errno or NET_RX_DROP. So a check on (ret < 0) or (ret == NET_RX_DROP) doesn't work. I mean this patch is okay for me, but there still are some problems around. :-)

Simple we can't return errno or NET_RX_FOO in lowpan_process_data, but I am sure Martin still working on a fix for this issue. We need to change everything to returning errno's only.

- Alex