Update the location of the network header when adding encryption
specific headers to a skb. This allows low-level drivers to use the
(now correct) location of the network header.
Signed-off-by: Arik Nemtsov <[email protected]>
---
net/mac80211/wep.c | 1 +
net/mac80211/wpa.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 7aa31bb..7cb8d83 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -104,6 +104,7 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
hdrlen = ieee80211_hdrlen(hdr->frame_control);
newhdr = skb_push(skb, WEP_IV_LEN);
memmove(newhdr, newhdr + WEP_IV_LEN, hdrlen);
+ skb_set_network_header(skb, skb_network_offset(skb) + WEP_IV_LEN);
ieee80211_wep_get_iv(local, keylen, keyidx, newhdr + hdrlen);
return newhdr + hdrlen;
}
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 0ae23c6..9aef9f8 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -202,6 +202,7 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
pos = skb_push(skb, TKIP_IV_LEN);
memmove(pos, pos + TKIP_IV_LEN, hdrlen);
+ skb_set_network_header(skb, skb_network_offset(skb) + TKIP_IV_LEN);
pos += hdrlen;
/* Increase IV for the frame */
@@ -422,6 +423,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
pos = skb_push(skb, CCMP_HDR_LEN);
memmove(pos, pos + CCMP_HDR_LEN, hdrlen);
+ skb_set_network_header(skb, skb_network_offset(skb) + CCMP_HDR_LEN);
/* the HW only needs room for the IV, but not the actual IV */
if (info->control.hw_key &&
--
1.7.9.5
On Tue, 2012-05-08 at 22:53 +0300, Arik Nemtsov wrote:
> Allow low-level drivers to change the feature bit for a vif's underlying
> net_device struct.
What are you planning to use this for? I'm not really sure I see the
need for an exported function? Is it not going to just be set the same
for all interfaces?
Out of the many netdev feature bits, we can handle maybe a handful in
mac80211, so I'm worried this API will suggest to people they can look
at netdev_features.h...
johannes
On 05/08/2012 12:53 PM, Arik Nemtsov wrote:
> Allow low-level drivers to change the feature bit for a vif's underlying
> net_device struct.
>
> Signed-off-by: Arik Nemtsov<[email protected]>
> ---
> include/net/mac80211.h | 10 ++++++++++
> net/mac80211/tx.c | 9 +++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index 4d6e6c6..acc46b2 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -2992,6 +2992,16 @@ struct sk_buff *
> ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
>
> /**
> + * ieee80211_set_netdev_features - set netdev feature bits for vif
> + * @vif: virtual interface to set netdev flags on
> + * @features: feature bits (see&struct net_device for details)
> + *
> + * This function sets netdev feature bit for the device associated with the
> + * specified vif.
> + */
> +void ieee80211_set_netdev_features(struct ieee80211_vif *vif, int features);
Features are uint64 now I think. In fact, there is a type-def
for them..probably should use that instead.
> +
> +/**
> * ieee80211_get_tkip_p1k_iv - get a TKIP phase 1 key for IV32
> *
> * This function returns the TKIP phase 1 key for the given IV32.
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index d67d36f..d9f94a6 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -2754,3 +2754,12 @@ void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
> ieee80211_xmit(sdata, skb);
> local_bh_enable();
> }
> +
> +void ieee80211_set_netdev_features(struct ieee80211_vif *vif, int features)
> +{
> + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
> +
> + if (sdata->dev)
> + sdata->dev->features |= features;
And how to turn off features?? I think you could
just implement the ethtool api, and then have your drivers
call that? That way you get two features at once!
Ben
--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com
Allow low-level drivers to change the feature bit for a vif's underlying
net_device struct.
Signed-off-by: Arik Nemtsov <[email protected]>
---
include/net/mac80211.h | 10 ++++++++++
net/mac80211/tx.c | 9 +++++++++
2 files changed, 19 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4d6e6c6..acc46b2 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2992,6 +2992,16 @@ struct sk_buff *
ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
/**
+ * ieee80211_set_netdev_features - set netdev feature bits for vif
+ * @vif: virtual interface to set netdev flags on
+ * @features: feature bits (see &struct net_device for details)
+ *
+ * This function sets netdev feature bit for the device associated with the
+ * specified vif.
+ */
+void ieee80211_set_netdev_features(struct ieee80211_vif *vif, int features);
+
+/**
* ieee80211_get_tkip_p1k_iv - get a TKIP phase 1 key for IV32
*
* This function returns the TKIP phase 1 key for the given IV32.
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d67d36f..d9f94a6 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2754,3 +2754,12 @@ void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
ieee80211_xmit(sdata, skb);
local_bh_enable();
}
+
+void ieee80211_set_netdev_features(struct ieee80211_vif *vif, int features)
+{
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+
+ if (sdata->dev)
+ sdata->dev->features |= features;
+}
+EXPORT_SYMBOL(ieee80211_set_netdev_features);
--
1.7.9.5
On 05/08/2012 11:11 PM, Johannes Berg wrote:
> On Tue, 2012-05-08 at 22:53 +0300, Arik Nemtsov wrote:
>> Allow low-level drivers to change the feature bit for a vif's underlying
>> net_device struct.
>
> What are you planning to use this for? I'm not really sure I see the
> need for an exported function? Is it not going to just be set the same
> for all interfaces?
>
> Out of the many netdev feature bits, we can handle maybe a handful in
> mac80211, so I'm worried this API will suggest to people they can look
> at netdev_features.h...
If the regular ethtool api is implemented, we might could support
some of the features like 'rx-all' that instruct the driver to
pass (more) errored frames up the stack...
But, I have no idea what the original poster was trying to accomplish.
Thanks,
Ben
--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com
On Wed, May 9, 2012 at 5:19 PM, Ben Greear <[email protected]> wrote:
> On 05/08/2012 11:11 PM, Johannes Berg wrote:
>>
>> On Tue, 2012-05-08 at 22:53 +0300, Arik Nemtsov wrote:
>>>
>>> Allow low-level drivers to change the feature bit for a vif's underlying
>>> net_device struct.
>>
>>
>> What are you planning to use this for? I'm not really sure I see the
>> need for an exported function? Is it not going to just be set the same
>> for all interfaces?
>>
>> Out of the many netdev feature bits, we can handle maybe a handful in
>> mac80211, so I'm worried this API will suggest to people they can look
>> at netdev_features.h...
>
>
> If the regular ethtool api is implemented, we might could support
> some of the features like 'rx-all' that instruct the driver to
> pass (more) errored frames up the stack...
>
> But, I have no idea what the original poster was trying to accomplish.
>
We're trying to add support for HW checksum for a mac80211 based
driver. Johannes suggested to instead implement this as a field in
mac80211 that will be filled out by the lower driver. This values will
be checked against a white list and then propagated to all netdevs
belonging to this HW.
Arik