Skip to content

Commit eac4eed

Browse files
Prameela Rani GarnepudiKalle Valo
authored andcommitted
rsi: tx and rx path enhancements for p2p mode
Data descriptor is updated to include vap_id. TX command frame key config also updated to include vap_id. Signed-off-by: Prameela Rani Garnepudi <[email protected]> Signed-off-by: Amitkumar Karwar <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 4671c20 commit eac4eed

File tree

5 files changed

+48
-17
lines changed

5 files changed

+48
-17
lines changed

drivers/net/wireless/rsi/rsi_91x_core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ static u32 rsi_get_num_pkts_dequeue(struct rsi_common *common, u8 q_num)
9595
s16 txop = common->tx_qinfo[q_num].txop * 32;
9696
__le16 r_txop;
9797
struct ieee80211_rate rate;
98+
struct ieee80211_hdr *wh;
99+
struct ieee80211_vif *vif;
98100

99101
rate.bitrate = RSI_RATE_MCS0 * 5 * 10; /* Convert to Kbps */
100102
if (q_num == VI_Q)
@@ -106,8 +108,10 @@ static u32 rsi_get_num_pkts_dequeue(struct rsi_common *common, u8 q_num)
106108
return 0;
107109

108110
do {
111+
wh = (struct ieee80211_hdr *)skb->data;
112+
vif = rsi_get_vif(adapter, wh->addr2);
109113
r_txop = ieee80211_generic_frame_duration(adapter->hw,
110-
adapter->vifs[0],
114+
vif,
111115
common->band,
112116
skb->len, &rate);
113117
txop -= le16_to_cpu(r_txop);
@@ -403,7 +407,8 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb)
403407
q_num = skb->priority;
404408
tx_params->tid = tid;
405409

406-
if ((vif->type == NL80211_IFTYPE_AP) &&
410+
if (((vif->type == NL80211_IFTYPE_AP) ||
411+
(vif->type == NL80211_IFTYPE_P2P_GO)) &&
407412
(!is_broadcast_ether_addr(wh->addr1)) &&
408413
(!is_multicast_ether_addr(wh->addr1))) {
409414
rsta = rsi_find_sta(common, wh->addr1);

drivers/net/wireless/rsi/rsi_91x_hal.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ static int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
157157
u16 seq_num;
158158

159159
info = IEEE80211_SKB_CB(skb);
160-
bss = &info->control.vif->bss_conf;
160+
vif = info->control.vif;
161+
bss = &vif->bss_conf;
161162
tx_params = (struct skb_info *)info->driver_data;
162163

163164
header_size = FRAME_DESC_SZ + sizeof(struct xtended_desc);
@@ -181,7 +182,6 @@ static int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
181182
xtend_desc = (struct xtended_desc *)&skb->data[FRAME_DESC_SZ];
182183
wh = (struct ieee80211_hdr *)&skb->data[header_size];
183184
seq_num = IEEE80211_SEQ_TO_SN(le16_to_cpu(wh->seq_ctrl));
184-
vif = adapter->vifs[0];
185185

186186
data_desc->xtend_desc_size = header_size - FRAME_DESC_SZ;
187187

@@ -190,7 +190,8 @@ static int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
190190
data_desc->mac_flags |= cpu_to_le16(RSI_QOS_ENABLE);
191191
}
192192

193-
if ((vif->type == NL80211_IFTYPE_STATION) &&
193+
if (((vif->type == NL80211_IFTYPE_STATION) ||
194+
(vif->type == NL80211_IFTYPE_P2P_CLIENT)) &&
194195
(adapter->ps_state == PS_ENABLED))
195196
wh->frame_control |= cpu_to_le16(RSI_SET_PS_ENABLE);
196197

@@ -246,25 +247,31 @@ static int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
246247
data_desc->frame_info |= cpu_to_le16(RSI_BROADCAST_PKT);
247248
data_desc->sta_id = vap_id;
248249

249-
if (vif->type == NL80211_IFTYPE_AP) {
250+
if ((vif->type == NL80211_IFTYPE_AP) ||
251+
(vif->type == NL80211_IFTYPE_P2P_GO)) {
250252
if (common->band == NL80211_BAND_5GHZ)
251253
data_desc->rate_info = cpu_to_le16(RSI_RATE_6);
252254
else
253255
data_desc->rate_info = cpu_to_le16(RSI_RATE_1);
254256
}
255257
}
256-
if ((vif->type == NL80211_IFTYPE_AP) &&
258+
if (((vif->type == NL80211_IFTYPE_AP) ||
259+
(vif->type == NL80211_IFTYPE_P2P_GO)) &&
257260
(ieee80211_has_moredata(wh->frame_control)))
258261
data_desc->frame_info |= cpu_to_le16(MORE_DATA_PRESENT);
259262

263+
data_desc->rate_info |=
264+
cpu_to_le16((tx_params->vap_id << RSI_DESC_VAP_ID_OFST) &
265+
RSI_DESC_VAP_ID_MASK);
266+
260267
return 0;
261268
}
262269

263270
/* This function sends received data packet from driver to device */
264271
int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb)
265272
{
266273
struct rsi_hw *adapter = common->priv;
267-
struct ieee80211_vif *vif = adapter->vifs[0];
274+
struct ieee80211_vif *vif;
268275
struct ieee80211_tx_info *info;
269276
struct ieee80211_bss_conf *bss;
270277
int status = -EINVAL;
@@ -277,9 +284,12 @@ int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb)
277284
info = IEEE80211_SKB_CB(skb);
278285
if (!info->control.vif)
279286
goto err;
280-
bss = &info->control.vif->bss_conf;
287+
vif = info->control.vif;
288+
bss = &vif->bss_conf;
281289

282-
if ((vif->type == NL80211_IFTYPE_STATION) && (!bss->assoc))
290+
if (((vif->type == NL80211_IFTYPE_STATION) ||
291+
(vif->type == NL80211_IFTYPE_P2P_CLIENT)) &&
292+
(!bss->assoc))
283293
goto err;
284294

285295
status = rsi_prepare_data_desc(common, skb);

drivers/net/wireless/rsi/rsi_91x_mac80211.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,8 @@ static int rsi_hal_key_config(struct ieee80211_hw *hw,
879879
RSI_PAIRWISE_KEY,
880880
key->keyidx,
881881
key->cipher,
882-
sta_id);
882+
sta_id,
883+
vif);
883884
if (status)
884885
return status;
885886
}
@@ -891,7 +892,8 @@ static int rsi_hal_key_config(struct ieee80211_hw *hw,
891892
key_type,
892893
key->keyidx,
893894
key->cipher,
894-
sta_id);
895+
sta_id,
896+
vif);
895897
}
896898

897899
/**
@@ -1165,14 +1167,17 @@ static void rsi_fill_rx_status(struct ieee80211_hw *hw,
11651167
struct rsi_common *common,
11661168
struct ieee80211_rx_status *rxs)
11671169
{
1168-
struct ieee80211_bss_conf *bss = &common->priv->vifs[0]->bss_conf;
1170+
struct rsi_hw *adapter = common->priv;
1171+
struct ieee80211_vif *vif;
1172+
struct ieee80211_bss_conf *bss = NULL;
11691173
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
11701174
struct skb_info *rx_params = (struct skb_info *)info->driver_data;
11711175
struct ieee80211_hdr *hdr;
11721176
char rssi = rx_params->rssi;
11731177
u8 hdrlen = 0;
11741178
u8 channel = rx_params->channel;
11751179
s32 freq;
1180+
int i;
11761181

11771182
hdr = ((struct ieee80211_hdr *)(skb->data));
11781183
hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -1201,6 +1206,15 @@ static void rsi_fill_rx_status(struct ieee80211_hw *hw,
12011206
rxs->flag |= RX_FLAG_IV_STRIPPED;
12021207
}
12031208

1209+
for (i = 0; i < RSI_MAX_VIFS; i++) {
1210+
vif = adapter->vifs[i];
1211+
if (!vif)
1212+
continue;
1213+
if (vif->type == NL80211_IFTYPE_STATION)
1214+
bss = &vif->bss_conf;
1215+
}
1216+
if (!bss)
1217+
return;
12041218
/* CQM only for connected AP beacons, the RSSI is a weighted avg */
12051219
if (bss->assoc && !(memcmp(bss->bssid, hdr->addr2, ETH_ALEN))) {
12061220
if (ieee80211_is_beacon(hdr->frame_control))
@@ -1363,7 +1377,8 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
13631377
RSI_PAIRWISE_KEY,
13641378
key->keyidx,
13651379
key->cipher,
1366-
sta_idx);
1380+
sta_idx,
1381+
vif);
13671382
}
13681383

13691384
common->num_stations++;

drivers/net/wireless/rsi/rsi_91x_mgmt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,9 @@ int rsi_hal_load_key(struct rsi_common *common,
716716
u8 key_type,
717717
u8 key_id,
718718
u32 cipher,
719-
s16 sta_id)
719+
s16 sta_id,
720+
struct ieee80211_vif *vif)
720721
{
721-
struct ieee80211_vif *vif = common->priv->vifs[0];
722722
struct sk_buff *skb = NULL;
723723
struct rsi_set_key *set_key;
724724
u16 key_descriptor = 0;

drivers/net/wireless/rsi/rsi_mgmt.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,8 @@ int rsi_send_aggregation_params_frame(struct rsi_common *common, u16 tid,
618618
u16 ssn, u8 buf_size, u8 event,
619619
u8 sta_id);
620620
int rsi_hal_load_key(struct rsi_common *common, u8 *data, u16 key_len,
621-
u8 key_type, u8 key_id, u32 cipher, s16 sta_id);
621+
u8 key_type, u8 key_id, u32 cipher, s16 sta_id,
622+
struct ieee80211_vif *vif);
622623
int rsi_set_channel(struct rsi_common *common,
623624
struct ieee80211_channel *channel);
624625
int rsi_send_vap_dynamic_update(struct rsi_common *common);

0 commit comments

Comments
 (0)