diff mbox

mac802154: Keep track of the channel when changed

Message ID 1365194201-2635-1-git-send-email-alan@signal11.us
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Alan Ott April 5, 2013, 8:36 p.m. UTC
Prevent set_channel() from getting called every time a packet is sent. This
looks like it was an oversight.

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

Comments

Werner Almesberger April 5, 2013, 9:05 p.m. UTC | #1
Alan Ott wrote:
> Prevent set_channel() from getting called every time a packet is sent. This
> looks like it was an oversight.

at86rf230.c and derivatives avoid this problem by setting
phy->current_* in the *_channel function.

But I'd agree that it's nicer to do this in one place, not in
every driver.

In case a driver had a weird failure mode in which it leaves the
original channel but only makes it halfway to the new channel, it
could still set phy->current_* and return an error. So there's no
loss of functionality with your change.

- Werner
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Ott April 5, 2013, 9:20 p.m. UTC | #2
On 04/05/2013 05:05 PM, Werner Almesberger wrote:
> Alan Ott wrote:
>> Prevent set_channel() from getting called every time a packet is sent. This
>> looks like it was an oversight.
> at86rf230.c and derivatives avoid this problem by setting
> phy->current_* in the *_channel function.
>
> But I'd agree that it's nicer to do this in one place, not in
> every driver.
>
> In case a driver had a weird failure mode in which it leaves the
> original channel but only makes it halfway to the new channel, it
> could still set phy->current_* and return an error. So there's no
> loss of functionality with your change.

Hmm... I just noticed that mib.c does the same thing (and doesn't set
phy->current_*). I'll need to fix that one too (and resubmit). :(

Alan.



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 3fd3e07..6d16473 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -58,6 +58,9 @@  static void mac802154_xmit_worker(struct work_struct *work)
 			pr_debug("set_channel failed\n");
 			goto out;
 		}
+
+		xw->priv->phy->current_channel = xw->chan;
+		xw->priv->phy->current_page = xw->page;
 	}
 
 	res = xw->priv->ops->xmit(&xw->priv->hw, xw->skb);