* [PATCH -next] mac80211: Use #define IEEE80211_CCMP_PN_LEN and bool
@ 2015-03-30 16:37 Joe Perches
2015-03-30 20:01 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2015-03-30 16:37 UTC (permalink / raw)
To: Johannes Berg; +Cc: David S. Miller, linux-wireless, netdev, linux-kernel
Use a #define constant instead of a hardcoded value
and use bool for an int used as a bool to reduce
structure size.
Miscellanea:
Neaten comments in structure definition.
Add #include of ieee80211.h
Signed-off-by: Joe Perches <joe@perches.com>
---
net/mac80211/ieee80211_i.h | 7 ++++---
net/mac80211/rx.c | 4 ++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 8d53d65..08f994d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -26,6 +26,7 @@
#include <linux/etherdevice.h>
#include <linux/leds.h>
#include <linux/idr.h>
+#include <linux/ieee80211.h>
#include <net/ieee80211_radiotap.h>
#include <net/cfg80211.h>
#include <net/mac80211.h>
@@ -89,11 +90,11 @@ struct ieee80211_fragment_entry {
unsigned int last_frag;
unsigned int extra_len;
struct sk_buff_head skb_list;
- int ccmp; /* Whether fragments were encrypted with CCMP */
- u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
+ /* for CCMP fragments */
+ bool ccmp; /* encrypted with CCMP */
+ u8 last_pn[IEEE80211_CCMP_PN_LEN]; /* PN of the last fragment */
};
-
struct ieee80211_bss {
u32 device_ts_beacon, device_ts_presp;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 944bdc0..367ed9c 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1711,7 +1711,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
entry->seq = seq;
entry->rx_queue = rx_queue;
entry->last_frag = frag;
- entry->ccmp = 0;
+ entry->ccmp = false;
entry->extra_len = 0;
return entry;
@@ -1812,7 +1812,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
int queue = rx->security_idx;
/* Store CCMP PN so that we can verify that the next
* fragment has a sequential PN value. */
- entry->ccmp = 1;
+ entry->ccmp = true;
memcpy(entry->last_pn,
rx->key->u.ccmp.rx_pn[queue],
IEEE80211_CCMP_PN_LEN);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] mac80211: Use #define IEEE80211_CCMP_PN_LEN and bool
2015-03-30 16:37 [PATCH -next] mac80211: Use #define IEEE80211_CCMP_PN_LEN and bool Joe Perches
@ 2015-03-30 20:01 ` Johannes Berg
2015-03-30 20:05 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2015-03-30 20:01 UTC (permalink / raw)
To: Joe Perches; +Cc: David S. Miller, linux-wireless, netdev, linux-kernel
On Mon, 2015-03-30 at 09:37 -0700, Joe Perches wrote:
> @@ -89,11 +90,11 @@ struct ieee80211_fragment_entry {
> unsigned int last_frag;
> unsigned int extra_len;
> struct sk_buff_head skb_list;
> - int ccmp; /* Whether fragments were encrypted with CCMP */
> - u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
> + /* for CCMP fragments */
> + bool ccmp; /* encrypted with CCMP */
> + u8 last_pn[IEEE80211_CCMP_PN_LEN]; /* PN of the last fragment */
I took your patch as an opportunity to check into this, and it turns out
all of this logic is also going to be needed for GCMP. As a result, I'm
not going to take this patch but instead we'll fix it up for GCMP (where
using CCMP_PN_LEN would not be appropriate anyway - perhaps we need a
union or just keep '8' which is the right size for both anyway, or we'll
go to a u64 value or something)
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] mac80211: Use #define IEEE80211_CCMP_PN_LEN and bool
2015-03-30 20:01 ` Johannes Berg
@ 2015-03-30 20:05 ` Joe Perches
0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2015-03-30 20:05 UTC (permalink / raw)
To: Johannes Berg; +Cc: David S. Miller, linux-wireless, netdev, linux-kernel
On Mon, 2015-03-30 at 22:01 +0200, Johannes Berg wrote:
> On Mon, 2015-03-30 at 09:37 -0700, Joe Perches wrote:
>
> > @@ -89,11 +90,11 @@ struct ieee80211_fragment_entry {
> > unsigned int last_frag;
> > unsigned int extra_len;
> > struct sk_buff_head skb_list;
> > - int ccmp; /* Whether fragments were encrypted with CCMP */
> > - u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
> > + /* for CCMP fragments */
> > + bool ccmp; /* encrypted with CCMP */
> > + u8 last_pn[IEEE80211_CCMP_PN_LEN]; /* PN of the last fragment */
>
> I took your patch as an opportunity to check into this, and it turns out
> all of this logic is also going to be needed for GCMP. As a result, I'm
> not going to take this patch but instead we'll fix it up for GCMP (where
> using CCMP_PN_LEN would not be appropriate anyway - perhaps we need a
> union or just keep '8' which is the right size for both anyway, or we'll
> go to a u64 value or something)
No worries. Whatever's right.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-30 20:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-30 16:37 [PATCH -next] mac80211: Use #define IEEE80211_CCMP_PN_LEN and bool Joe Perches
2015-03-30 20:01 ` Johannes Berg
2015-03-30 20:05 ` Joe Perches
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.