Skip to content

Commit

Permalink
mac80211: split ieee80211_txrx_result
Browse files Browse the repository at this point in the history
The _DROP result will need to be split in the RX path but not
in the TX path, so for preparation split up the type into two
types, one for RX and one for TX. Also make sure (via sparse)
that they cannot be confused.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Feb 29, 2008
1 parent 78330fd commit 9ae54c8
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 197 deletions.
23 changes: 15 additions & 8 deletions net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,16 @@ struct ieee80211_sta_bss {
};


typedef enum {
TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED
} ieee80211_txrx_result;
typedef unsigned __bitwise__ ieee80211_tx_result;
#define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
#define TX_DROP ((__force ieee80211_tx_result) 1u)
#define TX_QUEUED ((__force ieee80211_tx_result) 2u)

typedef unsigned __bitwise__ ieee80211_rx_result;
#define RX_CONTINUE ((__force ieee80211_rx_result) 0u)
#define RX_DROP ((__force ieee80211_rx_result) 1u)
#define RX_QUEUED ((__force ieee80211_rx_result) 2u)


/* flags used in struct ieee80211_txrx_data.flags */
/* whether the MSDU was fragmented */
Expand Down Expand Up @@ -182,10 +189,10 @@ struct ieee80211_tx_stored_packet {
unsigned int last_frag_rate_ctrl_probe;
};

typedef ieee80211_txrx_result (*ieee80211_tx_handler)
typedef ieee80211_tx_result (*ieee80211_tx_handler)
(struct ieee80211_txrx_data *tx);

typedef ieee80211_txrx_result (*ieee80211_rx_handler)
typedef ieee80211_rx_result (*ieee80211_rx_handler)
(struct ieee80211_txrx_data *rx);

struct beacon_data {
Expand Down Expand Up @@ -729,9 +736,9 @@ int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len);
void ieee80211_sta_req_auth(struct net_device *dev,
struct ieee80211_if_sta *ifsta);
int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len);
ieee80211_txrx_result ieee80211_sta_rx_scan(struct net_device *dev,
struct sk_buff *skb,
struct ieee80211_rx_status *rx_status);
ieee80211_rx_result ieee80211_sta_rx_scan(
struct net_device *dev, struct sk_buff *skb,
struct ieee80211_rx_status *rx_status);
void ieee80211_rx_bss_list_init(struct net_device *dev);
void ieee80211_rx_bss_list_deinit(struct net_device *dev);
int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
Expand Down
14 changes: 7 additions & 7 deletions net/mac80211/ieee80211_sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -2559,39 +2559,39 @@ static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev,
}


ieee80211_txrx_result
ieee80211_rx_result
ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb,
struct ieee80211_rx_status *rx_status)
{
struct ieee80211_mgmt *mgmt;
u16 fc;

if (skb->len < 2)
return TXRX_DROP;
return RX_DROP;

mgmt = (struct ieee80211_mgmt *) skb->data;
fc = le16_to_cpu(mgmt->frame_control);

if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL)
return TXRX_CONTINUE;
return RX_CONTINUE;

if (skb->len < 24)
return TXRX_DROP;
return RX_DROP;

if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) {
if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP) {
ieee80211_rx_mgmt_probe_resp(dev, mgmt,
skb->len, rx_status);
dev_kfree_skb(skb);
return TXRX_QUEUED;
return RX_QUEUED;
} else if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) {
ieee80211_rx_mgmt_beacon(dev, mgmt, skb->len,
rx_status);
dev_kfree_skb(skb);
return TXRX_QUEUED;
return RX_QUEUED;
}
}
return TXRX_CONTINUE;
return RX_CONTINUE;
}


Expand Down
Loading

0 comments on commit 9ae54c8

Please sign in to comment.