@@ -20,94 +20,111 @@ static int iwl_mvm_link_cmd_send(struct iwl_mvm *mvm,
20
20
return ret ;
21
21
}
22
22
23
- int iwl_mvm_add_link (struct iwl_mvm * mvm , struct ieee80211_vif * vif )
23
+ int iwl_mvm_add_link (struct iwl_mvm * mvm , struct ieee80211_vif * vif ,
24
+ struct ieee80211_bss_conf * link_conf )
24
25
{
25
26
struct iwl_mvm_vif * mvmvif = iwl_mvm_vif_from_mac80211 (vif );
26
- struct iwl_mvm_phy_ctxt * phyctxt = mvmvif -> deflink . phy_ctxt ;
27
+ unsigned int link_id = link_conf -> link_id ;
27
28
struct iwl_link_config_cmd cmd = {};
29
+ struct iwl_mvm_phy_ctxt * phyctxt ;
30
+
31
+ if (WARN_ON_ONCE (!mvmvif -> link [link_id ]))
32
+ return - EINVAL ;
28
33
29
34
/* Update SF - Disable if needed. if this fails, SF might still be on
30
35
* while many macs are bound, which is forbidden - so fail the binding.
31
36
*/
32
37
if (iwl_mvm_sf_update (mvm , vif , false))
33
38
return - EINVAL ;
34
39
40
+ /* FIXME: add proper link id allocation */
35
41
cmd .link_id = cpu_to_le32 (mvmvif -> id );
36
42
cmd .mac_id = cpu_to_le32 (mvmvif -> id );
37
43
/* P2P-Device already has a valid PHY context during add */
44
+ phyctxt = mvmvif -> link [link_id ]-> phy_ctxt ;
38
45
if (phyctxt )
39
46
cmd .phy_id = cpu_to_le32 (phyctxt -> id );
40
47
else
41
48
cmd .phy_id = cpu_to_le32 (FW_CTXT_INVALID );
42
49
43
- memcpy (cmd .local_link_addr , vif -> addr , ETH_ALEN );
50
+ memcpy (cmd .local_link_addr , link_conf -> addr , ETH_ALEN );
44
51
45
- if (vif -> type == NL80211_IFTYPE_ADHOC && vif -> bss_conf . bssid )
46
- memcpy (cmd .ibss_bssid_addr , vif -> bss_conf . bssid , ETH_ALEN );
52
+ if (vif -> type == NL80211_IFTYPE_ADHOC && link_conf -> bssid )
53
+ memcpy (cmd .ibss_bssid_addr , link_conf -> bssid , ETH_ALEN );
47
54
48
55
return iwl_mvm_link_cmd_send (mvm , & cmd , FW_CTXT_ACTION_ADD );
49
56
}
50
57
51
58
int iwl_mvm_link_changed (struct iwl_mvm * mvm , struct ieee80211_vif * vif ,
59
+ struct ieee80211_bss_conf * link_conf ,
52
60
u32 changes , bool active )
53
61
{
54
62
struct iwl_mvm_vif * mvmvif = iwl_mvm_vif_from_mac80211 (vif );
55
- struct iwl_mvm_phy_ctxt * phyctxt = mvmvif -> deflink .phy_ctxt ;
63
+ unsigned int link_id = link_conf -> link_id ;
64
+ struct iwl_mvm_phy_ctxt * phyctxt ;
56
65
struct iwl_link_config_cmd cmd = {};
57
66
u32 ht_flag , flags = 0 , flags_mask = 0 ;
58
67
68
+ if (WARN_ON_ONCE (!mvmvif -> link [link_id ]))
69
+ return - EINVAL ;
70
+
71
+ /* FIXME: add proper link id allocation */
59
72
cmd .link_id = cpu_to_le32 (mvmvif -> id );
60
73
61
74
/* The phy_id, link address and listen_lmac can be modified only until
62
75
* the link becomes active, otherwise they will be ignored.
63
76
*/
77
+ phyctxt = mvmvif -> link [link_id ]-> phy_ctxt ;
64
78
if (phyctxt )
65
79
cmd .phy_id = cpu_to_le32 (phyctxt -> id );
66
80
else
67
81
cmd .phy_id = cpu_to_le32 (FW_CTXT_INVALID );
68
82
cmd .mac_id = cpu_to_le32 (mvmvif -> id );
69
83
70
- memcpy (cmd .local_link_addr , vif -> addr , ETH_ALEN );
84
+ memcpy (cmd .local_link_addr , link_conf -> addr , ETH_ALEN );
71
85
72
86
cmd .active = cpu_to_le32 (active );
73
87
74
- if (vif -> type == NL80211_IFTYPE_ADHOC && vif -> bss_conf . bssid )
75
- memcpy (cmd .ibss_bssid_addr , vif -> bss_conf . bssid , ETH_ALEN );
88
+ if (vif -> type == NL80211_IFTYPE_ADHOC && link_conf -> bssid )
89
+ memcpy (cmd .ibss_bssid_addr , link_conf -> bssid , ETH_ALEN );
76
90
77
91
/* TODO: set a value to cmd.listen_lmac when system requiremens
78
92
* will define it
79
93
*/
80
94
81
- iwl_mvm_set_fw_basic_rates (mvm , vif , & cmd .cck_rates , & cmd .ofdm_rates );
95
+ iwl_mvm_set_fw_basic_rates (mvm , vif , link_conf ,
96
+ & cmd .cck_rates , & cmd .ofdm_rates );
82
97
83
- cmd .cck_short_preamble = cpu_to_le32 (vif -> bss_conf . use_short_preamble );
84
- cmd .short_slot = cpu_to_le32 (vif -> bss_conf . use_short_slot );
98
+ cmd .cck_short_preamble = cpu_to_le32 (link_conf -> use_short_preamble );
99
+ cmd .short_slot = cpu_to_le32 (link_conf -> use_short_slot );
85
100
86
101
/* The fw does not distinguish between ht and fat */
87
102
ht_flag = LINK_PROT_FLG_HT_PROT | LINK_PROT_FLG_FAT_PROT ;
88
- iwl_mvm_set_fw_protection_flags (mvm , vif , & cmd .protection_flags ,
103
+ iwl_mvm_set_fw_protection_flags (mvm , vif , link_conf ,
104
+ & cmd .protection_flags ,
89
105
ht_flag , LINK_PROT_FLG_TGG_PROTECT );
90
106
91
- iwl_mvm_set_fw_qos_params (mvm , vif , & cmd .ac [0 ], & cmd .qos_flags );
107
+ iwl_mvm_set_fw_qos_params (mvm , vif , link_conf , & cmd .ac [0 ],
108
+ & cmd .qos_flags );
92
109
93
110
94
- cmd .bi = cpu_to_le32 (vif -> bss_conf . beacon_int );
95
- cmd .dtim_interval = cpu_to_le32 (vif -> bss_conf . beacon_int *
96
- vif -> bss_conf . dtim_period );
111
+ cmd .bi = cpu_to_le32 (link_conf -> beacon_int );
112
+ cmd .dtim_interval = cpu_to_le32 (link_conf -> beacon_int *
113
+ link_conf -> dtim_period );
97
114
98
- if (!vif -> bss_conf . he_support || iwlwifi_mod_params .disable_11ax ||
115
+ if (!link_conf -> he_support || iwlwifi_mod_params .disable_11ax ||
99
116
!vif -> cfg .assoc ) {
100
117
changes &= ~LINK_CONTEXT_MODIFY_HE_PARAMS ;
101
118
goto send_cmd ;
102
119
}
103
120
104
- cmd .htc_trig_based_pkt_ext = vif -> bss_conf . htc_trig_based_pkt_ext ;
121
+ cmd .htc_trig_based_pkt_ext = link_conf -> htc_trig_based_pkt_ext ;
105
122
106
- if (vif -> bss_conf . uora_exists ) {
123
+ if (link_conf -> uora_exists ) {
107
124
cmd .rand_alloc_ecwmin =
108
- vif -> bss_conf . uora_ocw_range & 0x7 ;
125
+ link_conf -> uora_ocw_range & 0x7 ;
109
126
cmd .rand_alloc_ecwmax =
110
- (vif -> bss_conf . uora_ocw_range >> 3 ) & 0x7 ;
127
+ (link_conf -> uora_ocw_range >> 3 ) & 0x7 ;
111
128
}
112
129
113
130
/* TODO how to set ndp_fdbk_buff_th_exp? */
@@ -118,31 +135,31 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
118
135
flags_mask |= LINK_FLG_MU_EDCA_CW ;
119
136
}
120
137
121
- if (vif -> bss_conf . eht_puncturing && !iwlwifi_mod_params .disable_11be )
122
- cmd .puncture_mask = cpu_to_le16 (vif -> bss_conf . eht_puncturing );
138
+ if (link_conf -> eht_puncturing && !iwlwifi_mod_params .disable_11be )
139
+ cmd .puncture_mask = cpu_to_le16 (link_conf -> eht_puncturing );
123
140
else
124
141
/* This flag can be set only if the MAC has eht support */
125
142
changes &= ~LINK_CONTEXT_MODIFY_EHT_PARAMS ;
126
143
127
- cmd .bss_color = vif -> bss_conf . he_bss_color .color ;
144
+ cmd .bss_color = link_conf -> he_bss_color .color ;
128
145
129
- if (!vif -> bss_conf . he_bss_color .enabled ) {
146
+ if (!link_conf -> he_bss_color .enabled ) {
130
147
flags |= LINK_FLG_BSS_COLOR_DIS ;
131
148
flags_mask |= LINK_FLG_BSS_COLOR_DIS ;
132
149
}
133
150
134
- cmd .frame_time_rts_th = cpu_to_le16 (vif -> bss_conf . frame_time_rts_th );
151
+ cmd .frame_time_rts_th = cpu_to_le16 (link_conf -> frame_time_rts_th );
135
152
136
153
/* Block 26-tone RU OFDMA transmissions */
137
154
if (mvmvif -> deflink .he_ru_2mhz_block ) {
138
155
flags |= LINK_FLG_RU_2MHZ_BLOCK ;
139
156
flags_mask |= LINK_FLG_RU_2MHZ_BLOCK ;
140
157
}
141
158
142
- if (vif -> bss_conf . nontransmitted ) {
159
+ if (link_conf -> nontransmitted ) {
143
160
ether_addr_copy (cmd .ref_bssid_addr ,
144
- vif -> bss_conf . transmitter_bssid );
145
- cmd .bssid_index = vif -> bss_conf . bssid_index ;
161
+ link_conf -> transmitter_bssid );
162
+ cmd .bssid_index = link_conf -> bssid_index ;
146
163
}
147
164
148
165
send_cmd :
@@ -153,12 +170,14 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
153
170
return iwl_mvm_link_cmd_send (mvm , & cmd , FW_CTXT_ACTION_MODIFY );
154
171
}
155
172
156
- int iwl_mvm_remove_link (struct iwl_mvm * mvm , struct ieee80211_vif * vif )
173
+ int iwl_mvm_remove_link (struct iwl_mvm * mvm , struct ieee80211_vif * vif ,
174
+ struct ieee80211_bss_conf * link_conf )
157
175
{
158
176
struct iwl_mvm_vif * mvmvif = iwl_mvm_vif_from_mac80211 (vif );
159
177
struct iwl_link_config_cmd cmd = {};
160
178
int ret ;
161
179
180
+ /* FIXME: add proper link id allocation */
162
181
cmd .link_id = cpu_to_le32 (mvmvif -> id );
163
182
ret = iwl_mvm_link_cmd_send (mvm , & cmd , FW_CTXT_ACTION_REMOVE );
164
183
0 commit comments