Gentoo Archives: gentoo-commits

From: "Jim Ramsay (lack)" <lack@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-wireless/ipw3945/files: ipw3945-1.2.2-kernel-2.6.27.patch ipw3945-1.0.5-linux-2.6.19.patch ipw3945-1.2.0-Makefile.patch
Date: Thu, 26 Feb 2009 23:52:07
Message-Id: E1Lcq1M-00012B-Jl@stork.gentoo.org
1 lack 09/02/26 23:52:04
2
3 Added: ipw3945-1.2.2-kernel-2.6.27.patch
4 Removed: ipw3945-1.0.5-linux-2.6.19.patch
5 ipw3945-1.2.0-Makefile.patch
6 Log:
7 Version cleanup, plus added patch for 2.6.27 compatibility (Bug #244756)
8 (Portage version: 2.1.6.7/cvs/Linux i686)
9
10 Revision Changes Path
11 1.1 net-wireless/ipw3945/files/ipw3945-1.2.2-kernel-2.6.27.patch
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-wireless/ipw3945/files/ipw3945-1.2.2-kernel-2.6.27.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-wireless/ipw3945/files/ipw3945-1.2.2-kernel-2.6.27.patch?rev=1.1&content-type=text/plain
15
16 Index: ipw3945-1.2.2-kernel-2.6.27.patch
17 ===================================================================
18 --- ipw3945-1.2.2/ipw3945.c.old 2008-10-19 23:03:47.000000000 +0200
19 +++ ipw3945-1.2.2/ipw3945.c 2008-10-19 23:25:43.000000000 +0200
20 @@ -108,6 +108,8 @@
21 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation"
22 #define DRV_VERSION IPW3945_VERSION
23
24 +#define IPW3945_COMPAT 2
25 +
26 MODULE_DESCRIPTION(DRV_DESCRIPTION);
27 MODULE_VERSION(DRV_VERSION);
28 MODULE_AUTHOR(DRV_COPYRIGHT);
29 @@ -141,6 +143,153 @@ static int from_priority_to_tx_queue[] =
30 IPW_TX_QUEUE_3, IPW_TX_QUEUE_3, IPW_TX_QUEUE_4, IPW_TX_QUEUE_4
31 };
32
33 +static int ieee80211_encrypt_fragment(struct ieee80211_device *ieee,
34 + struct sk_buff *frag, int hdr_len)
35 +{
36 + struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx];
37 + int res;
38 +
39 + if (crypt == NULL)
40 + return -1;
41 +
42 + /* To encrypt, frame format is:
43 + * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */
44 + atomic_inc(&crypt->refcnt);
45 + res = 0;
46 + if (crypt->ops && crypt->ops->encrypt_mpdu)
47 + res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv);
48 +
49 + atomic_dec(&crypt->refcnt);
50 + if (res < 0) {
51 + printk(KERN_INFO "%s: Encryption failed: len=%d.\n",
52 + ieee->dev->name, frag->len);
53 + ieee->ieee_stats.tx_discards++;
54 + return -1;
55 + }
56 +
57 + return 0;
58 +}
59 +
60 +static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
61 + int headroom, gfp_t gfp_mask)
62 +{
63 + struct ieee80211_txb *txb;
64 + int i;
65 + txb = kmalloc(sizeof(struct ieee80211_txb) + (sizeof(u8 *) * nr_frags),
66 + gfp_mask);
67 + if (!txb)
68 + return NULL;
69 +
70 + memset(txb, 0, sizeof(struct ieee80211_txb));
71 + txb->nr_frags = nr_frags;
72 + txb->frag_size = txb_size;
73 +
74 + for (i = 0; i < nr_frags; i++) {
75 + txb->fragments[i] = __dev_alloc_skb(txb_size + headroom,
76 + gfp_mask);
77 + if (unlikely(!txb->fragments[i])) {
78 + i--;
79 + break;
80 + }
81 + skb_reserve(txb->fragments[i], headroom);
82 + }
83 + if (unlikely(i != nr_frags)) {
84 + while (i >= 0)
85 + dev_kfree_skb_any(txb->fragments[i--]);
86 + kfree(txb);
87 + return NULL;
88 + }
89 + return txb;
90 +}
91 +
92 +
93 +/* Incoming 802.11 strucure is converted to a TXB
94 + * a block of 802.11 fragment packets (stored as skbs) */
95 +int ieee80211_tx_frame(struct ieee80211_device *ieee,
96 + struct ieee80211_hdr *frame, int hdr_len, int total_len,
97 + int encrypt_mpdu)
98 +{
99 + struct ieee80211_txb *txb = NULL;
100 + unsigned long flags;
101 + struct net_device_stats *stats = &ieee->stats;
102 + struct sk_buff *skb_frag;
103 + int priority = -1;
104 + int fraglen = total_len;
105 + int headroom = ieee->tx_headroom;
106 + struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx];
107 +
108 + spin_lock_irqsave(&ieee->lock, flags);
109 +
110 + if (encrypt_mpdu && (!ieee->sec.encrypt || !crypt))
111 + encrypt_mpdu = 0;
112 +
113 + /* If there is no driver handler to take the TXB, dont' bother
114 + * creating it... */
115 + if (!ieee->hard_start_xmit) {
116 + printk(KERN_WARNING "%s: No xmit handler.\n", ieee->dev->name);
117 + goto success;
118 + }
119 +
120 + if (unlikely(total_len < 24)) {
121 + printk(KERN_WARNING "%s: skb too small (%d).\n",
122 + ieee->dev->name, total_len);
123 + goto success;
124 + }
125 +
126 + if (encrypt_mpdu) {
127 + frame->frame_ctl |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
128 + fraglen += crypt->ops->extra_mpdu_prefix_len +
129 + crypt->ops->extra_mpdu_postfix_len;
130 + headroom += crypt->ops->extra_mpdu_prefix_len;
131 + }
132 +
133 + /* When we allocate the TXB we allocate enough space for the reserve
134 + * and full fragment bytes (bytes_per_frag doesn't include prefix,
135 + * postfix, header, FCS, etc.) */
136 + txb = ieee80211_alloc_txb(1, fraglen, headroom, GFP_ATOMIC);
137 + if (unlikely(!txb)) {
138 + printk(KERN_WARNING "%s: Could not allocate TXB\n",
139 + ieee->dev->name);
140 + goto failed;
141 + }
142 + txb->encrypted = 0;
143 + txb->payload_size = fraglen;
144 +
145 + skb_frag = txb->fragments[0];
146 +
147 + memcpy(skb_put(skb_frag, total_len), frame, total_len);
148 +
149 + if (ieee->config &
150 + (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
151 + skb_put(skb_frag, 4);
152 +
153 + /* To avoid overcomplicating things, we do the corner-case frame
154 + * encryption in software. The only real situation where encryption is
155 + * needed here is during software-based shared key authentication. */
156 + if (encrypt_mpdu)
157 + ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
158 +
159 + success:
160 + spin_unlock_irqrestore(&ieee->lock, flags);
161 +
162 + if (txb) {
163 + if ((*ieee->hard_start_xmit) (txb, ieee->dev, priority) == 0) {
164 + stats->tx_packets++;
165 + stats->tx_bytes += txb->payload_size;
166 + return 0;
167 + }
168 + ieee80211_txb_free(txb);
169 + }
170 + return 0;
171 +
172 + failed:
173 + spin_unlock_irqrestore(&ieee->lock, flags);
174 + stats->tx_errors++;
175 + return 1;
176 +}
177 +
178 +
179 +
180 static int ipw_rate_scale_init_handle(struct ipw_priv *priv, s32 window_size);
181
182 static int ipw_update_power_cmd(struct ipw_priv *priv,