linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 6lowpan: consider checksum bytes in fragmentation threshold
       [not found] <504EA95C.9010003@signal11.us>
@ 2012-11-30  1:55 ` Alan Ott
  2012-11-30  1:58   ` Alan Ott
  2012-11-30 17:19   ` David Miller
  2012-11-30  4:25 ` [PATCH 1/2] mac802154: fix memory leaks Alan Ott
  1 sibling, 2 replies; 7+ messages in thread
From: Alan Ott @ 2012-11-30  1:55 UTC (permalink / raw)
  To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller
  Cc: linux-zigbee-devel, netdev, linux-kernel, Alan Ott

Change the threshold for framentation of a lowpan packet from
using the MTU size to now use the MTU size minus the checksum length,
which is added by the hardware. For IEEE 802.15.4, this effectively
changes it from 127 bytes to 125 bytes.

Signed-off-by: Alan Ott <alan@signal11.us>
---
 net/ieee802154/6lowpan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 6d42c17..f651da6 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -1047,7 +1047,8 @@ static netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev)
 		goto error;
 	}
 
-	if (skb->len <= IEEE802154_MTU) {
+	/* Send directly if less than the MTU minus the 2 checksum bytes. */
+	if (skb->len <= IEEE802154_MTU - IEEE802154_MFR_SIZE) {
 		err = dev_queue_xmit(skb);
 		goto out;
 	}
-- 
1.7.11.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] 6lowpan: consider checksum bytes in fragmentation threshold
  2012-11-30  1:55 ` [PATCH] 6lowpan: consider checksum bytes in fragmentation threshold Alan Ott
@ 2012-11-30  1:58   ` Alan Ott
  2012-11-30 17:19   ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Ott @ 2012-11-30  1:58 UTC (permalink / raw)
  To: Alan Ott
  Cc: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller,
	linux-zigbee-devel, netdev, linux-kernel

On 11/29/2012 08:55 PM, Alan Ott wrote:
> Change the threshold for framentation of a lowpan packet from
> using the MTU size to now use the MTU size minus the checksum length,
> which is added by the hardware. For IEEE 802.15.4, this effectively
> changes it from 127 bytes to 125 bytes.
>

Sorry, this was put in the wrong thread. One day I'll get one of these
first-try. :(

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] mac802154: fix memory leaks
       [not found] <504EA95C.9010003@signal11.us>
  2012-11-30  1:55 ` [PATCH] 6lowpan: consider checksum bytes in fragmentation threshold Alan Ott
@ 2012-11-30  4:25 ` Alan Ott
  2012-11-30  4:25   ` [PATCH 2/2] mac802154: use kfree_skb() instead of dev_kfree_skb() Alan Ott
  2012-11-30 17:19   ` [PATCH 1/2] mac802154: fix memory leaks David Miller
  1 sibling, 2 replies; 7+ messages in thread
From: Alan Ott @ 2012-11-30  4:25 UTC (permalink / raw)
  To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller,
	Eric Dumazet
  Cc: linux-zigbee-devel, netdev, linux-kernel, Alan Ott

kfree_skb() was not getting called in the case of some failures.
This was pointed out by Eric Dumazet.

Signed-off-by: Alan Ott <alan@signal11.us>
---
 net/mac802154/tx.c   | 5 ++++-
 net/mac802154/wpan.c | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 1a4df39..db63914 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -85,6 +85,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
 
 	if (!(priv->phy->channels_supported[page] & (1 << chan))) {
 		WARN_ON(1);
+		kfree_skb(skb);
 		return NETDEV_TX_OK;
 	}
 
@@ -103,8 +104,10 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
 	}
 
 	work = kzalloc(sizeof(struct xmit_work), GFP_ATOMIC);
-	if (!work)
+	if (!work) {
+		kfree_skb(skb);
 		return NETDEV_TX_BUSY;
+	}
 
 	INIT_WORK(&work->work, mac802154_xmit_worker);
 	work->skb = skb;
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index f30f6d4..1191039 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -327,8 +327,10 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	if (chan == MAC802154_CHAN_NONE ||
 	    page >= WPAN_NUM_PAGES ||
-	    chan >= WPAN_NUM_CHANNELS)
+	    chan >= WPAN_NUM_CHANNELS) {
+		kfree_skb(skb);
 		return NETDEV_TX_OK;
+	}
 
 	skb->skb_iif = dev->ifindex;
 	dev->stats.tx_packets++;
-- 
1.7.11.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] mac802154: use kfree_skb() instead of dev_kfree_skb()
  2012-11-30  4:25 ` [PATCH 1/2] mac802154: fix memory leaks Alan Ott
@ 2012-11-30  4:25   ` Alan Ott
  2012-11-30 17:19     ` David Miller
  2012-11-30 17:19   ` [PATCH 1/2] mac802154: fix memory leaks David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Ott @ 2012-11-30  4:25 UTC (permalink / raw)
  To: Alexander Smirnov, Dmitry Eremin-Solenikov, David S. Miller,
	Eric Dumazet
  Cc: linux-zigbee-devel, netdev, linux-kernel, Alan Ott

kfree_skb() indicates failure, which is where this is being used.

Signed-off-by: Alan Ott <alan@signal11.us>
---
 net/mac802154/tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index db63914..4e09d07 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -99,7 +99,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
 	}
 
 	if (skb_cow_head(skb, priv->hw.extra_tx_headroom)) {
-		dev_kfree_skb(skb);
+		kfree_skb(skb);
 		return NETDEV_TX_OK;
 	}
 
-- 
1.7.11.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] 6lowpan: consider checksum bytes in fragmentation threshold
  2012-11-30  1:55 ` [PATCH] 6lowpan: consider checksum bytes in fragmentation threshold Alan Ott
  2012-11-30  1:58   ` Alan Ott
@ 2012-11-30 17:19   ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2012-11-30 17:19 UTC (permalink / raw)
  To: alan
  Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, netdev,
	linux-kernel

From: Alan Ott <alan@signal11.us>
Date: Thu, 29 Nov 2012 20:55:44 -0500

> Change the threshold for framentation of a lowpan packet from
> using the MTU size to now use the MTU size minus the checksum length,
> which is added by the hardware. For IEEE 802.15.4, this effectively
> changes it from 127 bytes to 125 bytes.
> 
> Signed-off-by: Alan Ott <alan@signal11.us>

Applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mac802154: fix memory leaks
  2012-11-30  4:25 ` [PATCH 1/2] mac802154: fix memory leaks Alan Ott
  2012-11-30  4:25   ` [PATCH 2/2] mac802154: use kfree_skb() instead of dev_kfree_skb() Alan Ott
@ 2012-11-30 17:19   ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2012-11-30 17:19 UTC (permalink / raw)
  To: alan
  Cc: alex.bluesman.smirnov, dbaryshkov, eric.dumazet,
	linux-zigbee-devel, netdev, linux-kernel

From: Alan Ott <alan@signal11.us>
Date: Thu, 29 Nov 2012 23:25:10 -0500

> kfree_skb() was not getting called in the case of some failures.
> This was pointed out by Eric Dumazet.
> 
> Signed-off-by: Alan Ott <alan@signal11.us>

Applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] mac802154: use kfree_skb() instead of dev_kfree_skb()
  2012-11-30  4:25   ` [PATCH 2/2] mac802154: use kfree_skb() instead of dev_kfree_skb() Alan Ott
@ 2012-11-30 17:19     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2012-11-30 17:19 UTC (permalink / raw)
  To: alan
  Cc: alex.bluesman.smirnov, dbaryshkov, eric.dumazet,
	linux-zigbee-devel, netdev, linux-kernel

From: Alan Ott <alan@signal11.us>
Date: Thu, 29 Nov 2012 23:25:11 -0500

> kfree_skb() indicates failure, which is where this is being used.
> 
> Signed-off-by: Alan Ott <alan@signal11.us>

Applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-30 17:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <504EA95C.9010003@signal11.us>
2012-11-30  1:55 ` [PATCH] 6lowpan: consider checksum bytes in fragmentation threshold Alan Ott
2012-11-30  1:58   ` Alan Ott
2012-11-30 17:19   ` David Miller
2012-11-30  4:25 ` [PATCH 1/2] mac802154: fix memory leaks Alan Ott
2012-11-30  4:25   ` [PATCH 2/2] mac802154: use kfree_skb() instead of dev_kfree_skb() Alan Ott
2012-11-30 17:19     ` David Miller
2012-11-30 17:19   ` [PATCH 1/2] mac802154: fix memory leaks David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).