All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mac80211: fix network header location when adding encryption headers
@ 2012-05-08 19:53 Arik Nemtsov
  2012-05-08 19:53 ` [PATCH 2/2] mac80211: allow low-level drivers to set netdev feature bits Arik Nemtsov
  0 siblings, 1 reply; 6+ messages in thread
From: Arik Nemtsov @ 2012-05-08 19:53 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Arik Nemtsov

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 <arik@wizery.com>
---
 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


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

* [PATCH 2/2] mac80211: allow low-level drivers to set netdev feature bits
  2012-05-08 19:53 [PATCH 1/2] mac80211: fix network header location when adding encryption headers Arik Nemtsov
@ 2012-05-08 19:53 ` Arik Nemtsov
  2012-05-08 20:15   ` Ben Greear
  2012-05-09  6:11   ` Johannes Berg
  0 siblings, 2 replies; 6+ messages in thread
From: Arik Nemtsov @ 2012-05-08 19:53 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Arik Nemtsov

Allow low-level drivers to change the feature bit for a vif's underlying
net_device struct.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
---
 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


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

* Re: [PATCH 2/2] mac80211: allow low-level drivers to set netdev feature bits
  2012-05-08 19:53 ` [PATCH 2/2] mac80211: allow low-level drivers to set netdev feature bits Arik Nemtsov
@ 2012-05-08 20:15   ` Ben Greear
  2012-05-09  6:11   ` Johannes Berg
  1 sibling, 0 replies; 6+ messages in thread
From: Ben Greear @ 2012-05-08 20:15 UTC (permalink / raw)
  To: Arik Nemtsov; +Cc: linux-wireless, Johannes Berg

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<arik@wizery.com>
> ---
>   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 <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

* Re: [PATCH 2/2] mac80211: allow low-level drivers to set netdev feature bits
  2012-05-08 19:53 ` [PATCH 2/2] mac80211: allow low-level drivers to set netdev feature bits Arik Nemtsov
  2012-05-08 20:15   ` Ben Greear
@ 2012-05-09  6:11   ` Johannes Berg
  2012-05-09 14:19     ` Ben Greear
  1 sibling, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2012-05-09  6:11 UTC (permalink / raw)
  To: Arik Nemtsov; +Cc: linux-wireless

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



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

* Re: [PATCH 2/2] mac80211: allow low-level drivers to set netdev feature bits
  2012-05-09  6:11   ` Johannes Berg
@ 2012-05-09 14:19     ` Ben Greear
  2012-05-09 15:02       ` Arik Nemtsov
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Greear @ 2012-05-09 14:19 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Arik Nemtsov, linux-wireless

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 <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

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

* Re: [PATCH 2/2] mac80211: allow low-level drivers to set netdev feature bits
  2012-05-09 14:19     ` Ben Greear
@ 2012-05-09 15:02       ` Arik Nemtsov
  0 siblings, 0 replies; 6+ messages in thread
From: Arik Nemtsov @ 2012-05-09 15:02 UTC (permalink / raw)
  To: Ben Greear; +Cc: Johannes Berg, linux-wireless

On Wed, May 9, 2012 at 5:19 PM, Ben Greear <greearb@candelatech.com> 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

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

end of thread, other threads:[~2012-05-09 15:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-08 19:53 [PATCH 1/2] mac80211: fix network header location when adding encryption headers Arik Nemtsov
2012-05-08 19:53 ` [PATCH 2/2] mac80211: allow low-level drivers to set netdev feature bits Arik Nemtsov
2012-05-08 20:15   ` Ben Greear
2012-05-09  6:11   ` Johannes Berg
2012-05-09 14:19     ` Ben Greear
2012-05-09 15:02       ` Arik Nemtsov

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.