aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-10-26 04:37:04 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-10-26 12:24:03 -0400
commitdc67c6b30f36d57b70b70547a30e7a8432540c6f (patch)
treed02fdb8add9928c61584a1e17233ac6ba60aaefd /net/mac802154
parente89e45f22a382d14d5e2362cd4f4d12d77ee4935 (diff)
mac802154: tx: remove xmit channel context switch
This patch removes the channel hopping feature before xmit. There are several issues to provide a real channel hopping (timing requirements, etc...). We don't have any known kernelspace protocol which really use this feature. And I don't know an real user of this feature. We simply drop this feature now. This patch removes also the hold of pib lock which isn't needed by any real driver xmit callback implementation. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/tx.c58
1 files changed, 4 insertions, 54 deletions
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index d0ceb46134d9..be8deae19386 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -34,8 +34,6 @@ struct wpan_xmit_cb {
34 struct sk_buff *skb; 34 struct sk_buff *skb;
35 struct work_struct work; 35 struct work_struct work;
36 struct ieee802154_local *local; 36 struct ieee802154_local *local;
37 u8 chan;
38 u8 page;
39}; 37};
40 38
41static inline struct wpan_xmit_cb *wpan_xmit_cb(const struct sk_buff *skb) 39static inline struct wpan_xmit_cb *wpan_xmit_cb(const struct sk_buff *skb)
@@ -53,26 +51,10 @@ static void mac802154_xmit_worker(struct work_struct *work)
53 struct sk_buff *skb = cb->skb; 51 struct sk_buff *skb = cb->skb;
54 int res; 52 int res;
55 53
56 mutex_lock(&local->phy->pib_lock);
57 if (local->phy->current_channel != cb->chan ||
58 local->phy->current_page != cb->page) {
59 res = local->ops->set_channel(&local->hw, cb->page, cb->chan);
60 if (res) {
61 pr_debug("set_channel failed\n");
62 goto out;
63 }
64
65 local->phy->current_channel = cb->chan;
66 local->phy->current_page = cb->page;
67 }
68
69 res = local->ops->xmit(&local->hw, skb); 54 res = local->ops->xmit(&local->hw, skb);
70 if (res) 55 if (res)
71 pr_debug("transmission failed\n"); 56 pr_debug("transmission failed\n");
72 57
73out:
74 mutex_unlock(&local->phy->pib_lock);
75
76 /* Restart the netif queue on each sub_if_data object. */ 58 /* Restart the netif queue on each sub_if_data object. */
77 rcu_read_lock(); 59 rcu_read_lock();
78 list_for_each_entry_rcu(sdata, &local->interfaces, list) 60 list_for_each_entry_rcu(sdata, &local->interfaces, list)
@@ -82,17 +64,12 @@ out:
82 dev_kfree_skb(skb); 64 dev_kfree_skb(skb);
83} 65}
84 66
85static netdev_tx_t mac802154_tx(struct ieee802154_local *local, 67static netdev_tx_t
86 struct sk_buff *skb, u8 page, u8 chan) 68mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
87{ 69{
88 struct ieee802154_sub_if_data *sdata; 70 struct ieee802154_sub_if_data *sdata;
89 struct wpan_xmit_cb *cb = wpan_xmit_cb(skb); 71 struct wpan_xmit_cb *cb = wpan_xmit_cb(skb);
90 72
91 if (!(local->phy->channels_supported[page] & (1 << chan))) {
92 WARN_ON(1);
93 goto err_tx;
94 }
95
96 mac802154_monitors_rx(local, skb); 73 mac802154_monitors_rx(local, skb);
97 74
98 if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { 75 if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
@@ -115,8 +92,6 @@ static netdev_tx_t mac802154_tx(struct ieee802154_local *local,
115 INIT_WORK(&cb->work, mac802154_xmit_worker); 92 INIT_WORK(&cb->work, mac802154_xmit_worker);
116 cb->skb = skb; 93 cb->skb = skb;
117 cb->local = local; 94 cb->local = local;
118 cb->page = page;
119 cb->chan = chan;
120 95
121 queue_work(local->workqueue, &cb->work); 96 queue_work(local->workqueue, &cb->work);
122 97
@@ -130,44 +105,19 @@ err_tx:
130netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, struct net_device *dev) 105netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, struct net_device *dev)
131{ 106{
132 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); 107 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
133 u8 chan, page;
134
135 /* FIXME: locking */
136 chan = sdata->local->phy->current_channel;
137 page = sdata->local->phy->current_page;
138
139 if (chan == MAC802154_CHAN_NONE) /* not initialized */
140 return NETDEV_TX_OK;
141
142 if (WARN_ON(page >= WPAN_NUM_PAGES) ||
143 WARN_ON(chan >= WPAN_NUM_CHANNELS))
144 return NETDEV_TX_OK;
145 108
146 skb->skb_iif = dev->ifindex; 109 skb->skb_iif = dev->ifindex;
147 dev->stats.tx_packets++; 110 dev->stats.tx_packets++;
148 dev->stats.tx_bytes += skb->len; 111 dev->stats.tx_bytes += skb->len;
149 112
150 return mac802154_tx(sdata->local, skb, page, chan); 113 return mac802154_tx(sdata->local, skb);
151} 114}
152 115
153netdev_tx_t mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev) 116netdev_tx_t mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
154{ 117{
155 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); 118 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
156 u8 chan, page;
157 int rc; 119 int rc;
158 120
159 spin_lock_bh(&sdata->mib_lock);
160 chan = sdata->chan;
161 page = sdata->page;
162 spin_unlock_bh(&sdata->mib_lock);
163
164 if (chan == MAC802154_CHAN_NONE ||
165 page >= WPAN_NUM_PAGES ||
166 chan >= WPAN_NUM_CHANNELS) {
167 kfree_skb(skb);
168 return NETDEV_TX_OK;
169 }
170
171 rc = mac802154_llsec_encrypt(&sdata->sec, skb); 121 rc = mac802154_llsec_encrypt(&sdata->sec, skb);
172 if (rc) { 122 if (rc) {
173 pr_warn("encryption failed: %i\n", rc); 123 pr_warn("encryption failed: %i\n", rc);
@@ -179,5 +129,5 @@ netdev_tx_t mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
179 dev->stats.tx_packets++; 129 dev->stats.tx_packets++;
180 dev->stats.tx_bytes += skb->len; 130 dev->stats.tx_bytes += skb->len;
181 131
182 return mac802154_tx(sdata->local, skb, page, chan); 132 return mac802154_tx(sdata->local, skb);
183} 133}