All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Benc <jbenc@suse.cz>
To: netdev@vger.kernel.org
Cc: "John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH 3/6] d80211: drop packets from nonexisting interfaces in PS mode
Date: Mon, 29 Jan 2007 18:48:08 +0100 (CET)	[thread overview]
Message-ID: <20070129174808.54F4648498@silver.suse.cz> (raw)
In-Reply-To: <20070129184707.885764375.midnight@suse.cz>

In a power saving mode, packets queued by devices that meanwhile disappeared
has to be discarded.

Signed-off-by: Jiri Benc <jbenc@suse.cz>

---
 net/d80211/ieee80211.c |   46 +++++++++++++++++++++++++---------------------
 1 files changed, 25 insertions(+), 21 deletions(-)

--- dscape.orig/net/d80211/ieee80211.c
+++ dscape/net/d80211/ieee80211.c
@@ -1104,10 +1104,10 @@ static int inline is_ieee80211_device(st
 
 /* Device in tx->dev has a reference added; use dev_put(tx->dev) when
  * finished with it. */
-static void inline ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
-					struct sk_buff *skb,
-					struct net_device *mdev,
-					struct ieee80211_tx_control *control)
+static int inline ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
+				       struct sk_buff *skb,
+				       struct net_device *mdev,
+				       struct ieee80211_tx_control *control)
 {
 	struct ieee80211_tx_packet_data *pkt_data;
 	struct net_device *dev;
@@ -1118,13 +1118,10 @@ static void inline ieee80211_tx_prepare(
 		dev_put(dev);
 		dev = NULL;
 	}
-	if (unlikely(!dev)) {
-		printk(KERN_WARNING "%s: NULL ifindex in pkt_data\n",
-		       mdev->name);
-		dev = mdev;
-		dev_hold(dev);
-	}
+	if (unlikely(!dev))
+		return -ENODEV;
 	__ieee80211_tx_prepare(tx, skb, dev, control);
+	return 0;
 }
 
 static inline int __ieee80211_queue_stopped(struct ieee80211_local *local,
@@ -1815,20 +1812,27 @@ ieee80211_get_buffered_bc(struct ieee802
 
 	if (bss->dtim_count != 0)
 		return NULL; /* send buffered bc/mc only after DTIM beacon */
-	skb = skb_dequeue(&bss->ps_bc_buf);
 	memset(control, 0, sizeof(*control));
-	if (!skb)
-		return NULL;
-	local->total_ps_buffered--;
+	while (1) {
+		skb = skb_dequeue(&bss->ps_bc_buf);
+		if (!skb)
+			return NULL;
+		local->total_ps_buffered--;
 
-	if (!skb_queue_empty(&bss->ps_bc_buf) && skb->len >= 2) {
-		struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
-		/* more buffered multicast/broadcast frames ==> set MoreData
-		 * flag in IEEE 802.11 header to inform PS STAs */
-		hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
-	}
+		if (!skb_queue_empty(&bss->ps_bc_buf) && skb->len >= 2) {
+			struct ieee80211_hdr *hdr =
+				(struct ieee80211_hdr *) skb->data;
+			/* more buffered multicast/broadcast frames ==> set
+			 * MoreData flag in IEEE 802.11 header to inform PS
+			 * STAs */
+			hdr->frame_control |=
+				cpu_to_le16(IEEE80211_FCTL_MOREDATA);
+		}
 
-	ieee80211_tx_prepare(&tx, skb, local->mdev, control);
+		if (ieee80211_tx_prepare(&tx, skb, local->mdev, control) == 0)
+			break;
+		dev_kfree_skb_any(skb);
+	}
 	sta = tx.sta;
 	tx.u.tx.ps_buffered = 1;
 

  parent reply	other threads:[~2007-01-29 17:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-29 17:48 [RFC PATCH 1/6] invisible network devices Jiri Benc
2007-01-29 17:48 ` [PATCH 2/6] d80211: use invisible network device for wmaster Jiri Benc
2007-01-29 17:48 ` Jiri Benc [this message]
2007-01-29 17:48 ` [PATCH 4/6] d80211: don't display name of invisible network device Jiri Benc
2007-01-30 13:47   ` Johannes Berg
2007-01-30 14:00     ` Jan Kiszka
2007-01-31 18:58       ` Johannes Berg
2007-02-01 15:17         ` Jiri Benc
2007-02-01 15:19           ` Johannes Berg
2007-01-29 17:48 ` [PATCH 5/6] d80211: remove useless callbacks from wmaster Jiri Benc
2007-01-29 17:48 ` [PATCH 6/6] d80211: fix rtnl locking in ieee80211_register_hw Jiri Benc
2007-01-29 17:48 ` d80211: a patch for standalone d80211 tarball Jiri Benc
2007-01-29 18:34   ` Ivo Van Doorn
2007-01-29 20:23   ` Pavel Roskin
2007-01-31 18:06     ` Jiri Benc
2007-01-29 18:28 ` [RFC PATCH 1/6] invisible network devices Stephen Hemminger
2007-01-29 22:09   ` [RFC] Alternative hidden netwirk device interface Stephen Hemminger
2007-01-30 10:09     ` Christoph Hellwig
2007-01-31 18:26     ` Jiri Benc
2007-01-31 18:40       ` Stephen Hemminger
2007-02-21  8:04     ` David Miller
2007-01-30 10:08   ` [RFC PATCH 1/6] invisible network devices Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070129174808.54F4648498@silver.suse.cz \
    --to=jbenc@suse.cz \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.