[MAC80211]: Remove bitfields from struct ieee80211_tx_packet_data

remove bitfields from struct ieee80211_tx_packet_data

[Johannes: completely clear flags in ieee80211_remove_tx_extra]

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Slaby 2007-08-28 17:01:54 -04:00 committed by David S. Miller
parent cf966838cd
commit e8bf96495c
6 changed files with 36 additions and 26 deletions

View File

@ -876,10 +876,15 @@ static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
pkt_data->ifindex = control->ifindex; pkt_data->ifindex = control->ifindex;
pkt_data->mgmt_iface = (control->type == IEEE80211_IF_TYPE_MGMT); pkt_data->flags = 0;
pkt_data->req_tx_status = !!(control->flags & IEEE80211_TXCTL_REQ_TX_STATUS); if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS)
pkt_data->do_not_encrypt = !!(control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT); pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS;
pkt_data->requeue = !!(control->flags & IEEE80211_TXCTL_REQUEUE); if (control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)
pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
if (control->flags & IEEE80211_TXCTL_REQUEUE)
pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
if (control->type == IEEE80211_IF_TYPE_MGMT)
pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
pkt_data->queue = control->queue; pkt_data->queue = control->queue;
hdrlen = ieee80211_get_hdrlen_from_skb(skb); hdrlen = ieee80211_get_hdrlen_from_skb(skb);

View File

@ -155,15 +155,17 @@ struct ieee80211_txrx_data {
} u; } u;
}; };
/* flags used in struct ieee80211_tx_packet_data.flags */
#define IEEE80211_TXPD_REQ_TX_STATUS BIT(0)
#define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1)
#define IEEE80211_TXPD_REQUEUE BIT(2)
#define IEEE80211_TXPD_MGMT_IFACE BIT(3)
/* Stored in sk_buff->cb */ /* Stored in sk_buff->cb */
struct ieee80211_tx_packet_data { struct ieee80211_tx_packet_data {
int ifindex; int ifindex;
unsigned long jiffies; unsigned long jiffies;
unsigned int req_tx_status:1; unsigned int flags;
unsigned int do_not_encrypt:1; u8 queue;
unsigned int requeue:1;
unsigned int mgmt_iface:1;
unsigned int queue:4;
}; };
struct ieee80211_tx_stored_packet { struct ieee80211_tx_stored_packet {

View File

@ -465,8 +465,10 @@ static void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
pkt_data->ifindex = sdata->dev->ifindex; pkt_data->ifindex = sdata->dev->ifindex;
pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT); if (sdata->type == IEEE80211_IF_TYPE_MGMT)
pkt_data->do_not_encrypt = !encrypt; pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
if (!encrypt)
pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
dev_queue_xmit(skb); dev_queue_xmit(skb);
} }

View File

@ -434,7 +434,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) { while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) {
pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
sent++; sent++;
pkt_data->requeue = 1; pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
dev_queue_xmit(skb); dev_queue_xmit(skb);
} }
while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) { while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) {
@ -446,7 +446,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
"since STA not sleeping anymore\n", dev->name, "since STA not sleeping anymore\n", dev->name,
MAC_ARG(sta->addr), sta->aid); MAC_ARG(sta->addr), sta->aid);
#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
pkt_data->requeue = 1; pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
dev_queue_xmit(skb); dev_queue_xmit(skb);
} }

View File

@ -1245,11 +1245,11 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
control.ifindex = odev->ifindex; control.ifindex = odev->ifindex;
control.type = osdata->type; control.type = osdata->type;
if (pkt_data->req_tx_status) if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS)
control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS; control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS;
if (pkt_data->do_not_encrypt) if (pkt_data->flags & IEEE80211_TXPD_DO_NOT_ENCRYPT)
control.flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; control.flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
if (pkt_data->requeue) if (pkt_data->flags & IEEE80211_TXPD_REQUEUE)
control.flags |= IEEE80211_TXCTL_REQUEUE; control.flags |= IEEE80211_TXCTL_REQUEUE;
control.queue = pkt_data->queue; control.queue = pkt_data->queue;
@ -1291,8 +1291,7 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
/* needed because we set skb device to master */ /* needed because we set skb device to master */
pkt_data->ifindex = dev->ifindex; pkt_data->ifindex = dev->ifindex;
pkt_data->mgmt_iface = 0; pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
pkt_data->do_not_encrypt = 1;
/* /*
* fix up the pointers accounting for the radiotap * fix up the pointers accounting for the radiotap
@ -1343,7 +1342,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
struct ieee80211_hdr hdr; struct ieee80211_hdr hdr;
const u8 *encaps_data; const u8 *encaps_data;
int encaps_len, skip_header_bytes; int encaps_len, skip_header_bytes;
int nh_pos, h_pos, no_encrypt = 0; int nh_pos, h_pos;
struct sta_info *sta; struct sta_info *sta;
sdata = IEEE80211_DEV_TO_SUB_IF(dev); sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@ -1487,8 +1486,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
pkt_data->ifindex = dev->ifindex; pkt_data->ifindex = dev->ifindex;
pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT); if (sdata->type == IEEE80211_IF_TYPE_MGMT)
pkt_data->do_not_encrypt = no_encrypt; pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
skb->dev = local->mdev; skb->dev = local->mdev;
sdata->stats.tx_packets++; sdata->stats.tx_packets++;
@ -1546,7 +1545,8 @@ int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
pkt_data->ifindex = sdata->dev->ifindex; pkt_data->ifindex = sdata->dev->ifindex;
pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT); if (sdata->type == IEEE80211_IF_TYPE_MGMT)
pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
skb->priority = 20; /* use hardcoded priority for mgmt TX queue */ skb->priority = 20; /* use hardcoded priority for mgmt TX queue */
skb->dev = sdata->local->mdev; skb->dev = sdata->local->mdev;
@ -1556,12 +1556,13 @@ int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
* to request TX callback for hostapd. BIT(1) is checked. * to request TX callback for hostapd. BIT(1) is checked.
*/ */
if ((fc & BIT(1)) == BIT(1)) { if ((fc & BIT(1)) == BIT(1)) {
pkt_data->req_tx_status = 1; pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS;
fc &= ~BIT(1); fc &= ~BIT(1);
hdr->frame_control = cpu_to_le16(fc); hdr->frame_control = cpu_to_le16(fc);
} }
pkt_data->do_not_encrypt = !(fc & IEEE80211_FCTL_PROTECTED); if (!(fc & IEEE80211_FCTL_PROTECTED))
pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
sdata->stats.tx_packets++; sdata->stats.tx_packets++;
sdata->stats.tx_bytes += skb->len; sdata->stats.tx_bytes += skb->len;

View File

@ -108,7 +108,7 @@ static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
return IEEE80211_TX_QUEUE_DATA0; return IEEE80211_TX_QUEUE_DATA0;
} }
if (unlikely(pkt_data->mgmt_iface)) { if (unlikely(pkt_data->flags & IEEE80211_TXPD_MGMT_IFACE)) {
/* Data frames from hostapd (mainly, EAPOL) use AC_VO /* Data frames from hostapd (mainly, EAPOL) use AC_VO
* and they will include QoS control fields if * and they will include QoS control fields if
* the target STA is using WME. */ * the target STA is using WME. */
@ -153,7 +153,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
struct Qdisc *qdisc; struct Qdisc *qdisc;
int err, queue; int err, queue;
if (pkt_data->requeue) { if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) {
skb_queue_tail(&q->requeued[pkt_data->queue], skb); skb_queue_tail(&q->requeued[pkt_data->queue], skb);
qd->q.qlen++; qd->q.qlen++;
return 0; return 0;