Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Sigma Control API DUT (station/AP) |
Jouni Malinen | 9d7e31d | 2017-12-22 18:55:04 +0200 | [diff] [blame] | 3 | * Copyright (c) 2014-2017, Qualcomm Atheros, Inc. |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 4 | * All Rights Reserved. |
| 5 | * Licensed under the Clear BSD license. See README for more details. |
| 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * This implementation in this file is based on source code released by |
| 10 | * Wi-Fi Alliance under the following terms: |
| 11 | * |
| 12 | * Copyright (c) 2014 Wi-Fi Alliance |
| 13 | * |
| 14 | * Permission to use, copy, modify, and/or distribute this software for any |
| 15 | * purpose with or without fee is hereby granted, provided that the above |
| 16 | * copyright notice and this permission notice appear in all copies. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 19 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 20 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 21 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER |
| 22 | * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
| 23 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE |
| 24 | * USE OR PERFORMANCE OF THIS SOFTWARE. |
| 25 | */ |
| 26 | |
| 27 | #include "sigma_dut.h" |
| 28 | |
| 29 | static void sigma_uapsd_reset(struct sigma_stream *s); |
| 30 | static void sigma_uapsd_stop(struct sigma_stream *s); |
| 31 | static void create_apts_hello_pkt(int msg, unsigned int *txbuf, |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 32 | size_t txbuf_len, int tx_hello_cnt); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 33 | |
| 34 | |
| 35 | /* WMM-PS Test Case IDs */ |
| 36 | #define B_D 1 |
| 37 | #define B_H 2 |
| 38 | #define B_B 3 |
| 39 | #define B_M 4 |
| 40 | #define M_D 5 |
| 41 | #define B_Z 6 |
| 42 | #define M_Y 7 |
| 43 | #define L_1 8 |
| 44 | #define A_Y 9 |
| 45 | #define B_W 10 |
| 46 | #define A_J 11 |
| 47 | #define M_V 12 |
| 48 | #define M_U 13 |
| 49 | #define A_U 14 |
| 50 | #define M_L 15 |
| 51 | #define B_K 16 |
| 52 | #define M_B 17 |
| 53 | #define M_K 18 |
| 54 | #define M_W 19 |
| 55 | |
| 56 | /* WMM-PS APTS Msg IDs */ |
| 57 | #define APTS_DEFAULT (M_W + 0x01) |
| 58 | #define APTS_HELLO (APTS_DEFAULT + 0x01) |
| 59 | #define APTS_BCST (APTS_HELLO + 0x01) |
| 60 | #define APTS_CONFIRM (APTS_BCST + 0x01) |
| 61 | #define APTS_STOP (APTS_CONFIRM + 0x01) |
| 62 | #define APTS_CK_BE (APTS_STOP + 0x01) |
| 63 | #define APTS_CK_BK (APTS_CK_BE + 0x01) |
| 64 | #define APTS_CK_VI (APTS_CK_BK + 0x01) |
| 65 | #define APTS_CK_VO (APTS_CK_VI + 0x01) |
| 66 | #define APTS_RESET (APTS_CK_VO + 0x01) |
| 67 | #define APTS_RESET_RESP (APTS_RESET + 0x01) |
| 68 | #define APTS_RESET_STOP (APTS_RESET_RESP + 0x01) |
| 69 | #define APTS_LAST 99 |
| 70 | |
| 71 | /* WMM-AC Test Case IDs */ |
| 72 | extern int sigma_wmm_ac; |
| 73 | #ifdef CONFIG_WFA_WMM_AC |
| 74 | #define WMMAC_422_T02B 20 |
| 75 | #define WMMAC_422_T03A 21 |
| 76 | #define WMMAC_422_T04B 22 |
| 77 | #define WMMAC_422_T05B 23 |
| 78 | #define WMMAC_422_T06B 24 |
| 79 | #define WMMAC_422_T07B 25 |
| 80 | #define WMMAC_422_T08B 26 |
| 81 | |
| 82 | #define WMMAC_423_T04 27 |
| 83 | #define WMMAC_424_T07t14 28 |
| 84 | #define WMMAC_425_T04t06 29 |
| 85 | |
| 86 | #define WMMAC_521_T03 30 |
| 87 | #define WMMAC_521_T05 31 |
| 88 | |
| 89 | #define WMMAC_522_T04 32 |
| 90 | #define WMMAC_522_T06 33 |
| 91 | #define WMMAC_522_T06o 34 |
| 92 | #define WMMAC_524_T03 35 |
| 93 | #define WMMAC_524_T03i 36 |
| 94 | #define WMMAC_525_T07t10 37 |
| 95 | #endif /* CONFIG_WFA_WMM_AC */ |
| 96 | |
| 97 | /* WMM-AC APTS Msg IDs */ |
| 98 | /* WMMAC_APTS_DEFAULT Msg Id would be WMM-AC last test case |
| 99 | * (WMMAC_525_T07t10) + 1 */ |
| 100 | #define WMMAC_APTS_DEFAULT 38 |
| 101 | #define WMMAC_APTS_HELLO (WMMAC_APTS_DEFAULT + 0x01) |
| 102 | #define WMMAC_APTS_BCST (WMMAC_APTS_HELLO + 0x01) |
| 103 | #define WMMAC_APTS_CONFIRM (WMMAC_APTS_BCST + 0x01) |
| 104 | #define WMMAC_APTS_STOP (WMMAC_APTS_CONFIRM + 0x01) |
| 105 | #define WMMAC_APTS_CK_BE (WMMAC_APTS_STOP + 0x01) |
| 106 | #define WMMAC_APTS_CK_BK (WMMAC_APTS_CK_BE + 0x01) |
| 107 | #define WMMAC_APTS_CK_VI (WMMAC_APTS_CK_BK + 0x01) |
| 108 | #define WMMAC_APTS_CK_VO (WMMAC_APTS_CK_VI + 0x01) |
| 109 | #define WMMAC_APTS_RESET (WMMAC_APTS_CK_VO + 0x01) |
| 110 | #define WMMAC_APTS_RESET_RESP (WMMAC_APTS_RESET + 0x01) |
| 111 | #define WMMAC_APTS_RESET_STOP (WMMAC_APTS_RESET_RESP + 0x01) |
| 112 | #define WMMAC_APTS_LAST 99 |
| 113 | |
| 114 | #ifdef CONFIG_WFA_WMM_AC |
| 115 | #define LAST_TC WMMAC_525_T07t10 |
| 116 | #else /* CONFIG_WFA_WMM_AC */ |
| 117 | #define LAST_TC M_W |
| 118 | #endif /* CONFIG_WFA_WMM_AC */ |
| 119 | |
| 120 | struct apts_pkt { |
| 121 | char *name; /* name of test */ |
| 122 | int cmd; /* msg num */ |
| 123 | int param0; /* number of packet exchanges */ |
| 124 | int param1; /* number of uplink frames */ |
| 125 | int param2; /* number of downlink frames */ |
| 126 | int param3; |
| 127 | }; |
| 128 | |
| 129 | /* WMM-PS APTS messages */ |
| 130 | struct apts_pkt apts_pkts[] = { |
| 131 | {0, -1, 0, 0, 0, 0}, |
| 132 | {"B.D", B_D, 0, 0, 0, 0}, |
| 133 | {"B.H", B_H, 0, 0, 0, 0}, |
| 134 | {"B.B", B_B, 0, 0, 0, 0}, |
| 135 | {"B.M", B_M, 0, 0, 0, 0}, |
| 136 | {"M.D", M_D, 0, 0, 0, 0}, |
| 137 | {"B.Z", B_Z, 0, 0, 0, 0}, |
| 138 | {"M.Y", M_Y, 0, 0, 0, 0}, |
| 139 | {"L.1", L_1, 0, 0, 0, 0}, |
| 140 | {"A.Y", A_Y, 0, 0, 0, 0}, |
| 141 | {"B.W", B_W, 0, 0, 0, 0}, |
| 142 | {"A.J", A_J, 0, 0, 0, 0}, |
| 143 | {"M.V", M_V, 0, 0, 0, 0}, |
| 144 | {"M.U", M_U, 0, 0, 0, 0}, |
| 145 | {"A.U", A_U, 0, 0, 0, 0}, |
| 146 | {"M.L", M_L, 0, 0, 0, 0}, |
| 147 | {"B.K", B_K, 0, 0, 0, 0}, |
| 148 | {"M.B", M_B, 0, 0, 0, 0}, |
| 149 | {"M.K", M_K, 0, 0, 0, 0}, |
| 150 | {"M.W", M_W, 0, 0, 0, 0}, |
| 151 | |
| 152 | {"APTS TX ", APTS_DEFAULT, 0, 0, 0, 0}, |
| 153 | {"APTS Hello ", APTS_HELLO, 0, 0, 0, 0}, |
| 154 | {"APTS Broadcast ", APTS_BCST, 0, 0, 0, 0}, |
| 155 | {"APTS Confirm ", APTS_CONFIRM, 0, 0, 0, 0}, |
| 156 | {"APTS STOP ", APTS_STOP, 0, 0, 0, 0}, |
| 157 | {"APTS CK BE ", APTS_CK_BE, 0, 0, 0, 0}, |
| 158 | {"APTS CK BK ", APTS_CK_BK, 0, 0, 0, 0}, |
| 159 | {"APTS CK VI ", APTS_CK_VI, 0, 0, 0, 0}, |
| 160 | {"APTS CK VO ", APTS_CK_VO, 0, 0, 0, 0}, |
| 161 | {"APTS RESET ", APTS_RESET, 0, 0, 0, 0}, |
| 162 | {"APTS RESET RESP ", APTS_RESET_RESP, 0, 0, 0, 0}, |
| 163 | {"APTS RESET STOP ", APTS_RESET_STOP, 0, 0, 0, 0}, |
| 164 | {0, 0, 0, 0, 0, 0} /* APTS_LAST */ |
| 165 | }; |
| 166 | |
| 167 | /* WMM-AC APTS messages */ |
| 168 | struct apts_pkt wmm_ac_apts_pkts[] = { |
| 169 | {0, -1, 0, 0, 0, 0}, |
| 170 | {"B.D", B_D, 0, 0, 0, 0}, |
| 171 | {"B.H", B_H, 0, 0, 0, 0}, |
| 172 | {"B.B", B_B, 0, 0, 0, 0}, |
| 173 | {"B.M", B_M, 0, 0, 0, 0}, |
| 174 | {"M.D", M_D, 0, 0, 0, 0}, |
| 175 | {"B.Z", B_Z, 0, 0, 0, 0}, |
| 176 | {"M.Y", M_Y, 0, 0, 0, 0}, |
| 177 | {"L.1", L_1, 0, 0, 0, 0}, |
| 178 | {"A.Y", A_Y, 0, 0, 0, 0}, |
| 179 | {"B.W", B_W, 0, 0, 0, 0}, |
| 180 | {"A.J", A_J, 0, 0, 0, 0}, |
| 181 | {"M.V", M_V, 0, 0, 0, 0}, |
| 182 | {"M.U", M_U, 0, 0, 0, 0}, |
| 183 | {"A.U", A_U, 0, 0, 0, 0}, |
| 184 | {"M.L", M_L, 0, 0, 0, 0}, |
| 185 | {"B.K", B_K, 0, 0, 0, 0}, |
| 186 | {"M.B", M_B, 0, 0, 0, 0}, |
| 187 | {"M.K", M_K, 0, 0, 0, 0}, |
| 188 | {"M.W", M_W, 0, 0, 0, 0}, |
| 189 | #ifdef CONFIG_WFA_WMM_AC |
| 190 | {"422.T02B", WMMAC_422_T02B, 0, 0, 0, 0}, |
| 191 | {"422.T03A", WMMAC_422_T03A, 0, 0, 0, 0}, |
| 192 | {"422.T04A", WMMAC_422_T04B, 0, 0, 0, 0}, |
| 193 | {"422.T05B", WMMAC_422_T05B, 0, 0, 0, 0}, |
| 194 | {"422.T06B", WMMAC_422_T06B, 0, 0, 0, 0}, |
| 195 | {"422.T07B", WMMAC_422_T07B, 0, 0, 0, 0}, |
| 196 | {"422.T08B", WMMAC_422_T08B, 0, 0, 0, 0}, |
| 197 | {"423.T04", WMMAC_423_T04, 0, 0, 0, 0}, |
| 198 | {"424.T07", WMMAC_424_T07t14, 0, 0, 0, 0}, |
| 199 | {"425.T04", WMMAC_425_T04t06, 0, 0, 0, 0}, |
| 200 | {"521.T03", WMMAC_521_T03, 0, 0, 0, 0}, |
| 201 | {"521.T05", WMMAC_521_T05, 0, 0, 0, 0}, |
| 202 | {"522.T04", WMMAC_522_T04, 0, 0, 0, 0}, |
| 203 | {"522.T06", WMMAC_522_T06, 0, 0, 0, 0}, |
| 204 | {"522.T06o", WMMAC_522_T06o, 0, 0, 0, 0}, |
| 205 | {"524.T03", WMMAC_524_T03, 0, 0, 0, 0}, |
| 206 | {"524.T03i", WMMAC_524_T03i, 0, 0, 0, 0}, |
| 207 | {"525.T07", WMMAC_525_T07t10, 0, 0, 0, 0}, |
| 208 | #endif /* CONFIG_WFA_WMM_AC */ |
| 209 | {"APTS TX ", WMMAC_APTS_DEFAULT, 0, 0, 0, 0}, |
| 210 | {"APTS Hello ", WMMAC_APTS_HELLO, 0, 0, 0, 0}, |
| 211 | {"APTS Broadcast ", WMMAC_APTS_BCST, 0, 0, 0, 0}, |
| 212 | {"APTS Confirm ", WMMAC_APTS_CONFIRM, 0, 0, 0, 0}, |
| 213 | {"APTS STOP ", WMMAC_APTS_STOP, 0, 0, 0, 0}, |
| 214 | {"APTS CK BE ", WMMAC_APTS_CK_BE, 0, 0, 0, 0}, |
| 215 | {"APTS CK BK ", WMMAC_APTS_CK_BK, 0, 0, 0, 0}, |
| 216 | {"APTS CK VI ", WMMAC_APTS_CK_VI, 0, 0, 0, 0}, |
| 217 | {"APTS CK VO ", WMMAC_APTS_CK_VO, 0, 0, 0, 0}, |
| 218 | {"APTS RESET ", WMMAC_APTS_RESET, 0, 0, 0, 0}, |
| 219 | {"APTS RESET RESP ", WMMAC_APTS_RESET_RESP, 0, 0, 0, 0}, |
| 220 | {"APTS RESET STOP ", WMMAC_APTS_RESET_STOP, 0, 0, 0, 0}, |
| 221 | {0, 0, 0, 0, 0, 0} /* WMMAC_APTS_LAST */ |
| 222 | }; |
| 223 | |
| 224 | /* WMM definitions */ |
| 225 | /* Atheros Madwifi use 0x88 for UPSD/Voice */ |
| 226 | #define TOS_VO7 0xE0 /* 111 0 0000 (7) AC_VO tos/dscp values default */ |
| 227 | #define TOS_VO 0xD0 /* AC_VO */ |
| 228 | #define TOS_VO6 0xC0 /* 110 0 0000 */ |
| 229 | /* console */ |
| 230 | #define TOS_VO2 0xB8 /* 101 1 1000 */ |
| 231 | /* DUT can set VO */ |
| 232 | |
| 233 | #define TOS_VI 0xA0 /* 101 0 0000 (5) AC_VI */ |
| 234 | #define TOS_VI4 0x80 /* 100 0 0000 (4) AC_VI */ |
| 235 | /* console */ |
| 236 | #define TOS_VI5 0x88 /* 100 0 1000 */ |
| 237 | |
| 238 | #define TOS_BE 0x00 /* 000 0 0000 (0) AC_BE */ |
| 239 | #define TOS_EE 0x60 /* 011 0 0000 (3) AC_BE */ |
| 240 | |
| 241 | #define TOS_BK 0x20 /* 001 0 0000 (1) AC_BK */ |
| 242 | #define TOS_LE 0x40 /* 010 0 0000 (2) AC_BK */ |
| 243 | |
| 244 | #define MAX_RETRY 3 |
| 245 | #define MAX_HELLO 20 |
| 246 | #define MAX_STOP 10 |
| 247 | #define LI_INT 2000000 |
| 248 | |
| 249 | enum uapsd_psave { |
| 250 | PS_OFF = 0, |
| 251 | PS_ON = 1 |
| 252 | }; |
| 253 | |
| 254 | typedef int (*uapsd_tx_state_func_ptr)(struct sigma_stream *, |
| 255 | u32, enum uapsd_psave, u32); |
| 256 | |
| 257 | struct uapsd_tx_state_table { |
| 258 | uapsd_tx_state_func_ptr state_func; |
| 259 | u32 usr_priority; |
| 260 | enum uapsd_psave ps; |
| 261 | u32 sleep_dur; |
| 262 | }; |
| 263 | |
| 264 | static int uapsd_tx_start(struct sigma_stream *s, |
| 265 | u32 usr_priority, enum uapsd_psave ps, |
| 266 | u32 sleep_duration); |
| 267 | static int uapsd_tx_confirm(struct sigma_stream *s, |
| 268 | u32 usr_priority, enum uapsd_psave ps, |
| 269 | u32 sleep_duration); |
| 270 | static int uapsd_tx_data(struct sigma_stream *s, |
| 271 | u32 usr_priority, enum uapsd_psave ps, |
| 272 | u32 sleep_duration); |
| 273 | static int uapsd_tx_stop(struct sigma_stream *s, |
| 274 | u32 usr_priority, enum uapsd_psave ps, |
| 275 | u32 sleep_duration); |
| 276 | static int uapsd_tx_cyclic(struct sigma_stream *s, |
| 277 | u32 usr_priority, enum uapsd_psave ps, |
| 278 | u32 sleep_duration); |
| 279 | static int uapsd_tx_data_twice(struct sigma_stream *s, |
| 280 | u32 usr_priority, enum uapsd_psave ps, |
| 281 | u32 sleep_duration); |
| 282 | |
| 283 | /* The DUT WMM send table for each of the test cases */ |
| 284 | struct uapsd_tx_state_table sta_uapsd_tx_tbl[LAST_TC + 1][11] = { |
| 285 | /* B.D */ |
| 286 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 287 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 288 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 289 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 290 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 291 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 292 | {NULL, 0, 0, 0}}, |
| 293 | |
| 294 | /* B.H */ |
| 295 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 296 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 297 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 298 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 299 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 300 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 301 | {NULL, 0, 0, 0}}, |
| 302 | |
| 303 | /* B.B */ |
| 304 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 305 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 306 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 307 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 308 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 309 | {uapsd_tx_data, TOS_BK, PS_ON, LI_INT / 2}, |
| 310 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 311 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 312 | |
| 313 | /* B.M */ |
| 314 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 315 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 316 | {uapsd_tx_data, TOS_VI, PS_ON, 30000000}, |
| 317 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 318 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 319 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 320 | |
| 321 | /* M.D */ |
| 322 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 323 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 324 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 325 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 326 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 327 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 328 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 329 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 330 | |
| 331 | /* B.Z */ |
| 332 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 333 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 334 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT /2}, |
| 335 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 336 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 337 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 338 | |
| 339 | /* M.Y */ |
| 340 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 341 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 342 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 343 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 344 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 345 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 346 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 347 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 348 | |
| 349 | /* L.1 */ |
| 350 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 351 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 352 | {uapsd_tx_cyclic, TOS_VO7, PS_ON, 20000}, |
| 353 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 354 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 355 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 356 | |
| 357 | /* A.Y */ |
| 358 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 359 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 360 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 361 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 362 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 363 | {uapsd_tx_data, TOS_BE, PS_OFF, LI_INT / 2}, |
| 364 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 365 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 366 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 367 | |
| 368 | /* B.W */ |
| 369 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 370 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 371 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 372 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 373 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 374 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 375 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 376 | |
| 377 | /* A.J */ |
| 378 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 379 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 380 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 381 | {uapsd_tx_data, TOS_VO7, PS_OFF, LI_INT / 2}, |
| 382 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 383 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 384 | {NULL, 0, 0, 0}}, |
| 385 | |
| 386 | /* M.V */ |
| 387 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 388 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 389 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 390 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 391 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 392 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 393 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 394 | |
| 395 | /* M.U */ |
| 396 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 397 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 398 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 399 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 400 | {uapsd_tx_data_twice, TOS_VO7, PS_ON, LI_INT / 2}, |
| 401 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 402 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 403 | |
| 404 | /* A.U */ |
| 405 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 406 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 407 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 408 | {uapsd_tx_data, TOS_BE, PS_OFF, LI_INT / 2}, |
| 409 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 410 | {uapsd_tx_data, TOS_BE, PS_OFF, LI_INT / 2}, |
| 411 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 412 | {uapsd_tx_data, TOS_VO7, PS_OFF, LI_INT / 2}, |
| 413 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 414 | {NULL, 0, 0, 0}}, |
| 415 | |
| 416 | /* M.L */ |
| 417 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 418 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 419 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT /2}, |
| 420 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 421 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 422 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 423 | |
| 424 | /* B.K */ |
| 425 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 426 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 427 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 428 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 429 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 430 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 431 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 432 | |
| 433 | /* M.B */ |
| 434 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 435 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 436 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 437 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 438 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 439 | {uapsd_tx_data, TOS_BK, PS_ON, LI_INT / 2}, |
| 440 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 441 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 442 | |
| 443 | /* M.K */ |
| 444 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 445 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 446 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 447 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 448 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 449 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 450 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 451 | |
| 452 | /* M.W */ |
| 453 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 454 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 455 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 456 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 457 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 458 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 459 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 460 | |
| 461 | #ifdef CONFIG_WFA_WMM_AC |
| 462 | /* WMMAC_422_T02B */ |
| 463 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 464 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 465 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 466 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 467 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 468 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 469 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 470 | |
| 471 | /* WMMAC_422_T03B or WMMAC_422_T03A */ |
| 472 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 473 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 474 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 20}, |
| 475 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 4}, |
| 476 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 20}, |
| 477 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 20}, |
| 478 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 479 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 480 | |
| 481 | /* WMMAC_422_T04B/ATC7 */ |
| 482 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 483 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 484 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 20}, |
| 485 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 4}, |
| 486 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 20}, |
| 487 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 20}, |
| 488 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 489 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 490 | |
| 491 | /* WMMAC_422_T05B/ATC8 */ |
| 492 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 493 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 494 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 4}, |
| 495 | {uapsd_tx_data, TOS_VI, PS_ON, 700000}, |
| 496 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 20}, |
| 497 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 498 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 499 | |
| 500 | /* WMMAC_422_T06B/ATC9 */ |
| 501 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 502 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 503 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 20}, |
| 504 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 4}, |
| 505 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 20}, |
| 506 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 20}, |
| 507 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 508 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 509 | |
| 510 | /* WMMAC_422_T07B/ATC10 */ |
| 511 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 512 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 513 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 20}, |
| 514 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 4}, |
| 515 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 20}, |
| 516 | {uapsd_tx_data, TOS_BK, PS_ON, LI_INT / 20}, |
| 517 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 518 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 519 | |
| 520 | /* WMMAC_422_T08B/ATC11 */ |
| 521 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 522 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 523 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 20}, |
| 524 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 4}, |
| 525 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 20}, |
| 526 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 4}, |
| 527 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 528 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 529 | |
| 530 | /* WMMAC_423_T04 */ |
| 531 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 532 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 533 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 534 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 535 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 536 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 537 | |
| 538 | /* WMMAC_424_T07t14 */ |
| 539 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 540 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 541 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 20}, |
| 542 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 4}, |
| 543 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 20}, |
| 544 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 545 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 546 | |
| 547 | /* WMMAC_425_T04t06 */ |
| 548 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 549 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 550 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 20}, |
| 551 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 552 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 553 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 554 | |
| 555 | /* WMMAC_521_T03 */ |
| 556 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 557 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 558 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 559 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 560 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 561 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 562 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 563 | |
| 564 | /* WMMAC_521_T05 */ |
| 565 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 566 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 567 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 568 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 569 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 570 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 571 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 572 | |
| 573 | /* WMMAC_522_T04 */ |
| 574 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 575 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 576 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 577 | {uapsd_tx_data, TOS_BE, PS_ON, LI_INT / 2}, |
| 578 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 579 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 580 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 581 | |
| 582 | /* WMMAC_522_T06 */ |
| 583 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 584 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 585 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 586 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 587 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 588 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 589 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 590 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 591 | |
| 592 | /* WMMAC_522_T06o */ |
| 593 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 594 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 595 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 596 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 597 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 598 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 599 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 600 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 601 | |
| 602 | /* WMMAC_524_T03 */ |
| 603 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 604 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 605 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 606 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 607 | {uapsd_tx_data, TOS_VO7, PS_ON, LI_INT / 2}, |
| 608 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 609 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 610 | |
| 611 | /* WMMAC_524_T03i */ |
| 612 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 613 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 614 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 615 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 616 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 617 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 618 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 619 | |
| 620 | /* WMMAC_525_T07t10 */ |
| 621 | {{uapsd_tx_start, TOS_BE, PS_OFF, LI_INT / 2}, |
| 622 | {uapsd_tx_confirm, TOS_BE, PS_ON, LI_INT / 2}, |
| 623 | {uapsd_tx_data, TOS_VI, PS_ON, LI_INT / 2}, |
| 624 | {uapsd_tx_stop, TOS_BE, PS_ON, LI_INT / 2}, |
| 625 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, |
| 626 | {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}}, |
| 627 | #endif /* CONFIG_WFA_WMM_AC */ |
| 628 | }; |
| 629 | |
| 630 | typedef int (*uapsd_recv_state_func_ptr)(struct sigma_stream *s, |
| 631 | unsigned int *, int); |
| 632 | |
| 633 | struct uapsd_rcv_state_table { |
| 634 | uapsd_recv_state_func_ptr state_func; |
| 635 | }; |
| 636 | |
| 637 | static int uapsd_rx_start(struct sigma_stream *s, |
| 638 | unsigned int *rxpkt, int rxpkt_len); |
| 639 | static int uapsd_rx_data(struct sigma_stream *s, |
| 640 | unsigned int *rxpkt, int rxpkt_len); |
| 641 | static int uapsd_rx_stop(struct sigma_stream *s, |
| 642 | unsigned int *rxpkt, int rxpkt_len); |
| 643 | static int uapsd_rx_cyclic_vo(struct sigma_stream *s, |
| 644 | unsigned int *rxpkt, int rxpkt_len); |
| 645 | |
| 646 | /* The DUT WMM send table for each of the test cases */ |
| 647 | struct uapsd_rcv_state_table sta_uapsd_recv_tbl[LAST_TC + 10][6] = { |
| 648 | /* B.D */ |
| 649 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_stop}, {NULL}, {NULL}, |
| 650 | {NULL}}, |
| 651 | /* B.H */ |
| 652 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 653 | {NULL}, {NULL}}, |
| 654 | /* B.B */ |
| 655 | {{uapsd_rx_start}, {uapsd_rx_stop}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 656 | /* B.M */ |
| 657 | {{uapsd_rx_start}, {uapsd_rx_stop}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 658 | /* M.D */ |
| 659 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 660 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 661 | /* B.Z */ |
| 662 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 663 | {NULL}, {NULL}}, |
| 664 | /* M.Y */ |
| 665 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 666 | {uapsd_rx_stop}, {NULL}}, |
| 667 | /* L.1 */ |
| 668 | {{uapsd_rx_start}, {uapsd_rx_cyclic_vo}, {NULL}, {NULL}, {NULL}, |
| 669 | {NULL}}, |
| 670 | /* A.Y */ |
| 671 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 672 | {uapsd_rx_stop}, {NULL}}, |
| 673 | /* B.W */ |
| 674 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 675 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 676 | /* A.J */ |
| 677 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 678 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 679 | /* M.V */ |
| 680 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 681 | {uapsd_rx_stop}, {NULL}}, |
| 682 | /* M.U */ |
| 683 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 684 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 685 | /* A.U */ |
| 686 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 687 | {uapsd_rx_stop}, {NULL}}, |
| 688 | /* M.L */ |
| 689 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_stop}, {NULL}, {NULL}, |
| 690 | {NULL}}, |
| 691 | /* B.K */ |
| 692 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 693 | {NULL}, {NULL}}, |
| 694 | /* M.B */ |
| 695 | {{uapsd_rx_start}, {uapsd_rx_stop}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 696 | /* M.K */ |
| 697 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 698 | {NULL}, {NULL}}, |
| 699 | /* M.W */ |
| 700 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 701 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 702 | |
| 703 | #ifdef CONFIG_WFA_WMM_AC |
| 704 | /* WMMAC_422_T02B */ |
| 705 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 706 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 707 | /* WMMAC_422_T03B or WMMAC_422_T03A */ |
| 708 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 709 | {uapsd_rx_stop}, {NULL}}, |
| 710 | /* WMMAC_422_T04B */ |
| 711 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 712 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 713 | /* WMMAC_422_T05B */ |
| 714 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 715 | {uapsd_rx_stop}, {NULL}}, |
| 716 | /* WMMAC_422_T06B */ |
| 717 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 718 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 719 | /* WMMAC_422_T07B */ |
| 720 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 721 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 722 | /* WMMAC_422_T08B */ |
| 723 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 724 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 725 | /* WMMAC_423_T04 */ |
| 726 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_stop}, {NULL}, {NULL}, |
| 727 | {NULL}}, |
| 728 | /* WMMAC_424_T07t14 */ |
| 729 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 730 | {NULL}, {NULL}}, |
| 731 | /* WMMAC_425_T04t06 */ |
| 732 | {{uapsd_rx_start}, {uapsd_rx_stop}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 733 | /* WMMAC_521_T03 */ |
| 734 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 735 | {NULL}, {NULL}}, |
| 736 | /* WMMAC_521_T05 */ |
| 737 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 738 | {NULL}, {NULL}}, |
| 739 | /* WMMAC_522_T04 */ |
| 740 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 741 | {NULL}, {NULL}}, |
| 742 | /* WMMAC_522_T06 */ |
| 743 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 744 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 745 | /* WMMAC_522_T06o */ |
| 746 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_data}, |
| 747 | {uapsd_rx_data}, {uapsd_rx_stop}}, |
| 748 | /* WMMAC_524_T03 */ |
| 749 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 750 | {NULL}, {NULL}}, |
| 751 | /* WMMAC_524_T03i */ |
| 752 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_data}, {uapsd_rx_stop}, |
| 753 | {NULL}, {NULL}}, |
| 754 | /* WMMAC_525_T07t10 */ |
| 755 | {{uapsd_rx_start}, {uapsd_rx_data}, {uapsd_rx_stop}, {NULL}, |
| 756 | {NULL}, {NULL}}, |
| 757 | #endif /* CONFIG_WFA_WMM_AC */ |
| 758 | }; |
| 759 | |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 760 | /* U-APSD console data */ |
| 761 | #define NETWORK_CLASS_C 0x00ffffff |
| 762 | #define UAPSD_CONSOLE_TIMER 200 |
| 763 | |
| 764 | typedef int (*uapsd_console_state_func_ptr)(struct sigma_stream *s, |
| 765 | unsigned int *rx_msg_buf, int len); |
| 766 | struct uapsd_console_state_table { |
| 767 | uapsd_console_state_func_ptr state_func; |
| 768 | }; |
| 769 | |
| 770 | static int console_rx_hello(struct sigma_stream *, unsigned int *, int); |
| 771 | static int console_rx_confirm(struct sigma_stream *, unsigned int *, int); |
| 772 | static int console_rx_confirm_tx_vi(struct sigma_stream *, unsigned int *, int); |
| 773 | static int console_rx_tx_stop(struct sigma_stream *, unsigned int *, int); |
| 774 | static int console_rx_vo_tx_stop(struct sigma_stream *, unsigned int *, int); |
| 775 | static int console_rx_vi_tx_stop(struct sigma_stream *, unsigned int *, int); |
| 776 | static int console_rx_vi_tx_vi(struct sigma_stream *, unsigned int *, int); |
| 777 | static int console_rx_vi_tx_bcst(struct sigma_stream *, unsigned int *, int); |
| 778 | static int console_rx_be_tx_bcst(struct sigma_stream *, unsigned int *, int); |
| 779 | static int console_rx_be_tx_be(struct sigma_stream *, unsigned int *, int); |
| 780 | static int console_rx_be_tx_be_tx_stop(struct sigma_stream *, unsigned int *, |
| 781 | int); |
| 782 | static int console_rx_bk_tx_stop(struct sigma_stream *, unsigned int *, int); |
| 783 | static int console_rx_vi_tx_vo_tx_stop(struct sigma_stream *, unsigned int *, |
| 784 | int); |
| 785 | static int console_rx_vo_tx_bcst_tx_stop(struct sigma_stream *, unsigned int *, |
| 786 | int); |
| 787 | static int console_rx_vi_tx_be(struct sigma_stream *, unsigned int *, int); |
| 788 | static int console_rx_vi_tx_bk(struct sigma_stream *, unsigned int *, int); |
| 789 | static int console_rx_vo_tx_vo_cyclic(struct sigma_stream *, unsigned int *, |
| 790 | int); |
| 791 | static int console_rx_vo_tx_vo(struct sigma_stream *, unsigned int *, int); |
| 792 | static int console_rx_vo_tx_vo_tx_stop(struct sigma_stream *, unsigned int *, |
| 793 | int); |
| 794 | static int console_rx_vo_tx_2vo(struct sigma_stream *, unsigned int *, int); |
| 795 | static int console_rx_be_tx_bcst_tx_stop(struct sigma_stream *, unsigned int *, |
| 796 | int); |
| 797 | static int console_rx_vo(struct sigma_stream *, unsigned int *, int); |
| 798 | static int console_rx_vi(struct sigma_stream *, unsigned int *, int); |
| 799 | static int console_rx_be(struct sigma_stream *, unsigned int *, int); |
| 800 | static int console_rx_vo_tx_all_tx_stop(struct sigma_stream *, unsigned int *, |
| 801 | int); |
| 802 | static int console_rx_vi_tx_vi_tx_stop(struct sigma_stream *, unsigned int *, |
| 803 | int); |
| 804 | |
| 805 | /* U-APSD console process table for each of the test cases */ |
| 806 | struct uapsd_console_state_table uapsd_console_state_tbl[LAST_TC + 1][10] = { |
| 807 | /* Ini */ |
| 808 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vo_tx_vo}, |
| 809 | {console_rx_tx_stop}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 810 | |
| 811 | /* B.D */ |
| 812 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vo_tx_vo}, |
| 813 | {console_rx_vo_tx_stop}, {console_rx_tx_stop}, {console_rx_tx_stop}, |
| 814 | {NULL}, {NULL}, {NULL}, {NULL}}, |
| 815 | |
| 816 | /* B.H */ |
| 817 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vo_tx_2vo}, |
| 818 | {console_rx_vo_tx_stop}, {console_rx_tx_stop}, {console_rx_tx_stop}, |
| 819 | {NULL}, {NULL}, {NULL}, {NULL}}, |
| 820 | |
| 821 | /* B.B */ |
| 822 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vo}, |
| 823 | {console_rx_vi}, {console_rx_be}, {console_rx_bk_tx_stop}, |
| 824 | {console_rx_tx_stop}, {NULL}, {NULL}, {NULL}}, |
| 825 | |
| 826 | /* B.M */ |
| 827 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_stop}, |
| 828 | {console_rx_tx_stop}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 829 | |
| 830 | /* M.D */ |
| 831 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_be}, |
| 832 | {console_rx_vi_tx_bk}, {console_rx_vi_tx_vi}, |
| 833 | {console_rx_vi_tx_vo_tx_stop}, {console_rx_tx_stop}, |
| 834 | {NULL}, {NULL}, {NULL}}, |
| 835 | |
| 836 | /* B.Z */ |
| 837 | {{console_rx_hello}, {console_rx_confirm_tx_vi}, |
| 838 | {console_rx_vo_tx_bcst_tx_stop}, {console_rx_tx_stop}, |
| 839 | {NULL}, {NULL}, {NULL}, {NULL}}, |
| 840 | |
| 841 | /* M.Y */ |
| 842 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_vi}, |
| 843 | {console_rx_vo}, {console_rx_be_tx_be}, |
| 844 | {console_rx_be_tx_bcst_tx_stop}, {console_rx_tx_stop}, |
| 845 | {NULL}, {NULL}, {NULL}}, |
| 846 | |
| 847 | /* L.1 */ |
| 848 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vo_tx_vo_cyclic}, |
| 849 | {console_rx_tx_stop}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 850 | |
| 851 | /* A.Y */ |
| 852 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_vi}, |
| 853 | {console_rx_vo}, {console_rx_be_tx_be}, {console_rx_be}, |
| 854 | {console_rx_be_tx_bcst_tx_stop}, {console_rx_tx_stop}, {NULL}, {NULL}}, |
| 855 | |
| 856 | /* B.W */ |
| 857 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_bcst}, |
| 858 | {console_rx_vi_tx_bcst}, {console_rx_vi_tx_stop}, {console_rx_tx_stop}, |
| 859 | {NULL}, {NULL}, {NULL}, {NULL}}, |
| 860 | |
| 861 | /* A.J */ |
| 862 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vo}, |
| 863 | {console_rx_vo_tx_all_tx_stop}, {console_rx_tx_stop}, |
| 864 | {NULL}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 865 | |
| 866 | /* M.V */ |
| 867 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_vi}, |
| 868 | {console_rx_be_tx_be}, {console_rx_vi_tx_vi_tx_stop}, |
| 869 | {console_rx_tx_stop}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 870 | |
| 871 | /* M.U */ |
| 872 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_vi}, |
| 873 | {console_rx_be_tx_be}, {console_rx_vo_tx_vo}, |
| 874 | {console_rx_vo_tx_vo_tx_stop}, {console_rx_tx_stop}, |
| 875 | {NULL}, {NULL}, {NULL}}, |
| 876 | |
| 877 | /* A.U */ |
| 878 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_vi}, |
| 879 | {console_rx_be}, {console_rx_be_tx_be}, {console_rx_be}, |
| 880 | {console_rx_vo_tx_vo}, {console_rx_vo_tx_stop}, {console_rx_tx_stop}, |
| 881 | {NULL}}, |
| 882 | |
| 883 | /* M.L */ |
| 884 | {{console_rx_hello}, {console_rx_confirm}, |
| 885 | {console_rx_be_tx_be_tx_stop}, {console_rx_tx_stop}, |
| 886 | {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}}, |
| 887 | |
| 888 | /* B.K */ |
| 889 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_vi}, |
| 890 | {console_rx_be_tx_be}, {console_rx_vi_tx_stop}, {console_rx_tx_stop}, |
| 891 | {NULL}, {NULL}, {NULL}, {NULL}}, |
| 892 | |
| 893 | /* M.B */ |
| 894 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vo}, |
| 895 | {console_rx_vi}, {console_rx_be}, {console_rx_bk_tx_stop}, |
| 896 | {console_rx_tx_stop}, {NULL}, {NULL}, {NULL}}, |
| 897 | |
| 898 | /* M.K */ |
| 899 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_vi}, |
| 900 | {console_rx_be_tx_be}, {console_rx_vi_tx_stop}, {console_rx_tx_stop}, |
| 901 | {NULL}, {NULL}, {NULL}, {NULL}}, |
| 902 | |
| 903 | /* M.W */ |
| 904 | {{console_rx_hello}, {console_rx_confirm}, {console_rx_vi_tx_bcst}, |
| 905 | {console_rx_be_tx_bcst}, {console_rx_vi_tx_stop}, {console_rx_tx_stop}, |
| 906 | {NULL}, {NULL}, {NULL}, {NULL}} |
| 907 | }; |
| 908 | |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 909 | |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 910 | static void create_apts_pkt(int msg, unsigned int txbuf[], size_t txbuf_len, |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 911 | u32 uapsd_dscp, struct sigma_stream *s) |
| 912 | { |
| 913 | struct apts_pkt *t; |
| 914 | |
| 915 | if (!sigma_wmm_ac) |
| 916 | t = &apts_pkts[msg]; |
| 917 | else |
| 918 | t = &wmm_ac_apts_pkts[msg]; |
| 919 | |
| 920 | txbuf[0] = s->rx_cookie; |
| 921 | txbuf[1] = uapsd_dscp; |
| 922 | txbuf[2] = 0; |
| 923 | txbuf[3] = 0; |
| 924 | txbuf[4] = 0; |
| 925 | txbuf[5] = 0; |
| 926 | txbuf[9] = s->sta_id; |
| 927 | txbuf[10] = t->cmd; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 928 | strlcpy((char *) &txbuf[11], t->name, |
| 929 | txbuf_len - sizeof(txbuf[0]) * 11); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 930 | } |
| 931 | |
| 932 | |
| 933 | static int uapsd_tx_start(struct sigma_stream *s, |
| 934 | u32 usr_priority, enum uapsd_psave ps, |
| 935 | u32 sleep_duration) |
| 936 | { |
| 937 | unsigned int *tpkt; |
| 938 | int pktlen = 256; |
| 939 | struct sigma_dut *dut = s->dut; |
| 940 | u32 msgid; |
| 941 | |
| 942 | sigma_dut_print(dut, DUT_MSG_INFO, "send_uapsd: Enter uapsd_tx_start"); |
| 943 | tpkt = malloc(s->payload_size); |
| 944 | if (tpkt == NULL) { |
| 945 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 946 | "send_uapsd: Send buffer allocation failed"); |
| 947 | return -1; |
| 948 | } |
| 949 | |
| 950 | /* check whether a test case is received */ |
| 951 | if (s->uapsd_rx_state > 0) { |
| 952 | s->uapsd_tx_state++; |
| 953 | } else { |
| 954 | set_ps(s->ifname, dut, 0); |
| 955 | if (s->tx_hello_cnt <= MAX_HELLO) { |
| 956 | memset(tpkt, 0, s->payload_size); |
| 957 | /* if test is for WMM-AC set APTS HELLO to 39 */ |
| 958 | msgid = sigma_wmm_ac ? WMMAC_APTS_HELLO : APTS_HELLO; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 959 | create_apts_hello_pkt(msgid, tpkt, s->payload_size, |
| 960 | s->tx_hello_cnt); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 961 | if (send(s->sock, tpkt, pktlen, 0) <= 0) { |
| 962 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 963 | "send_uapsd: Send failed"); |
| 964 | } |
| 965 | s->tx_hello_cnt++; |
| 966 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 967 | "send_uapsd: Hello Sent cnt %d", |
| 968 | s->tx_hello_cnt); |
| 969 | sleep(1); |
| 970 | } else { |
| 971 | printf("\n send_uapsd: Too many Hellos Sent... \n"); |
| 972 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 973 | "send_uapsd: Too many Hellos sent... "); |
| 974 | s->stop = 1; |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | free(tpkt); |
| 979 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 980 | "Exit uapsd_tx_start uapsd_sta_tc %d uapsd_tx_state %d", |
| 981 | s->uapsd_sta_tc, s->uapsd_tx_state); |
| 982 | |
| 983 | return 0; |
| 984 | } |
| 985 | |
| 986 | |
| 987 | static int uapsd_tx_confirm(struct sigma_stream *s, |
| 988 | u32 usr_priority, enum uapsd_psave ps, |
| 989 | u32 sleep_duration) |
| 990 | { |
| 991 | unsigned int *tpkt; |
| 992 | int pktlen = 256; |
| 993 | struct sigma_dut *dut = s->dut; |
| 994 | u32 msgid; |
| 995 | |
| 996 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 997 | "send_uapsd: Enter uapsd_tx_confirm"); |
| 998 | tpkt = malloc(s->payload_size); |
| 999 | if (tpkt == NULL) { |
| 1000 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1001 | "send_uapsd: Send buffer allocation failed"); |
| 1002 | return -1; |
| 1003 | } |
| 1004 | |
| 1005 | usleep(sleep_duration); |
| 1006 | set_ps(s->ifname, dut, ps); |
| 1007 | memset(tpkt, 0, s->payload_size); |
| 1008 | /* if test is for WMM-AC set APTS CONFIRM to 41 */ |
| 1009 | msgid = sigma_wmm_ac ? WMMAC_APTS_CONFIRM : APTS_CONFIRM; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1010 | create_apts_pkt(msgid, tpkt, s->payload_size, usr_priority, s); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1011 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &usr_priority, |
| 1012 | sizeof(usr_priority)); |
| 1013 | if (send(s->sock, tpkt, pktlen, 0) > 0) { |
| 1014 | s->uapsd_tx_state++; |
| 1015 | } else { |
| 1016 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1017 | "send_uapsd: Send failed"); |
| 1018 | } |
| 1019 | free(tpkt); |
| 1020 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1021 | "Exit uapsd_tx_confirm uapsd_sta_tc %d uapsd_tx_state %d", |
| 1022 | s->uapsd_sta_tc, s->uapsd_tx_state); |
| 1023 | |
| 1024 | return 0; |
| 1025 | } |
| 1026 | |
| 1027 | |
| 1028 | static int uapsd_tx_data(struct sigma_stream *s, |
| 1029 | u32 usr_priority, enum uapsd_psave ps, |
| 1030 | u32 sleep_duration) |
| 1031 | { |
| 1032 | unsigned int *tpkt; |
| 1033 | int pktlen = 256; |
| 1034 | struct sigma_dut *dut = s->dut; |
| 1035 | u32 msgid; |
| 1036 | |
| 1037 | sigma_dut_print(dut, DUT_MSG_INFO, "send_uapsd: Enter uapsd_tx_data"); |
| 1038 | |
| 1039 | tpkt = malloc(s->payload_size); |
| 1040 | if (tpkt == NULL) { |
| 1041 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1042 | "send_uapsd: Send buffer allocation failed"); |
| 1043 | return -1; |
| 1044 | } |
| 1045 | usleep(sleep_duration); |
| 1046 | set_ps(s->ifname, dut, ps); |
| 1047 | memset(tpkt, 0, s->payload_size); |
| 1048 | /* if test is for WMM-AC set APTS DEFAULT to 38 */ |
| 1049 | msgid = sigma_wmm_ac ? WMMAC_APTS_DEFAULT : APTS_DEFAULT; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1050 | create_apts_pkt(msgid, tpkt, s->payload_size, usr_priority, s); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1051 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &usr_priority, |
| 1052 | sizeof(usr_priority)); |
| 1053 | if (send(s->sock, tpkt, pktlen, 0) > 0) { |
| 1054 | s->uapsd_tx_state++; |
| 1055 | } else { |
| 1056 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1057 | "send_uapsd: Send failed"); |
| 1058 | } |
| 1059 | |
| 1060 | free(tpkt); |
| 1061 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1062 | "Exit uapsd_tx_data uapsd_sta_tc %d uapsd_tx_state %d", |
| 1063 | s->uapsd_sta_tc, s->uapsd_tx_state); |
| 1064 | |
| 1065 | return 0; |
| 1066 | } |
| 1067 | |
| 1068 | |
| 1069 | static int uapsd_tx_data_twice(struct sigma_stream *s, |
| 1070 | u32 usr_priority, enum uapsd_psave ps, |
| 1071 | u32 sleep_duration) |
| 1072 | { |
| 1073 | unsigned int *tpkt; |
| 1074 | int pktlen = 256, i = 0, tx_status = 0; |
| 1075 | struct sigma_dut *dut = s->dut; |
| 1076 | u32 msgid; |
| 1077 | |
| 1078 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1079 | "send_uapsd: Enter uapsd_tx_data_twice"); |
| 1080 | tpkt = malloc(s->payload_size); |
| 1081 | if (tpkt == NULL) { |
| 1082 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1083 | "send_uapsd: Send buffer allocation failed"); |
| 1084 | return -1; |
| 1085 | } |
| 1086 | usleep(sleep_duration); |
| 1087 | set_ps(s->ifname, dut, ps); |
| 1088 | memset(tpkt, 0, s->payload_size); |
| 1089 | /* if test is for WMM-AC set APTS DEFAULT to 38 */ |
| 1090 | msgid = sigma_wmm_ac ? WMMAC_APTS_DEFAULT : APTS_DEFAULT; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1091 | create_apts_pkt(msgid, tpkt, s->payload_size, usr_priority, s); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1092 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &usr_priority, |
| 1093 | sizeof(usr_priority)); |
| 1094 | for(i = 0; i < 2; i++) { |
| 1095 | if (send(s->sock, tpkt, pktlen, 0) <= 0) { |
| 1096 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1097 | "send_uapsd: Send failed"); |
| 1098 | tx_status = -1; |
| 1099 | } |
| 1100 | } |
| 1101 | if (tx_status == 0) |
| 1102 | s->uapsd_tx_state++; |
| 1103 | free(tpkt); |
| 1104 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1105 | "Exit uapsd_tx_data_twice uapsd_sta_tc %d uapsd_tx_state %d", |
| 1106 | s->uapsd_sta_tc, s->uapsd_tx_state); |
| 1107 | |
| 1108 | return 0; |
| 1109 | } |
| 1110 | |
| 1111 | |
| 1112 | static int uapsd_tx_cyclic(struct sigma_stream *s, |
| 1113 | u32 usr_priority, enum uapsd_psave ps, |
| 1114 | u32 sleep_duration) |
| 1115 | { |
| 1116 | unsigned int *tpkt; |
| 1117 | int pktlen = 256, i = 0, tx_status = 0; |
| 1118 | struct sigma_dut *dut = s->dut; |
| 1119 | u32 msgid; |
| 1120 | |
| 1121 | sigma_dut_print(dut, DUT_MSG_INFO, "send_uapsd: Enter uapsd_tx_cyclic"); |
| 1122 | tpkt = malloc(s->payload_size); |
| 1123 | if (tpkt == NULL) { |
| 1124 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1125 | "send_uapsd: Send buffer allocation failed"); |
| 1126 | return -1; |
| 1127 | } |
| 1128 | |
| 1129 | set_ps(s->ifname, dut, ps); |
| 1130 | for (i = 0; i < 3000; i++) { |
| 1131 | usleep(sleep_duration); |
| 1132 | memset(tpkt, 0, s->payload_size); |
| 1133 | /* if test is for WMM-AC set APTS DEFAULT to 38 */ |
| 1134 | msgid = sigma_wmm_ac ? WMMAC_APTS_DEFAULT : APTS_DEFAULT; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1135 | create_apts_pkt(msgid, tpkt, s->payload_size, usr_priority, s); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1136 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &usr_priority, |
| 1137 | sizeof(usr_priority)); |
| 1138 | if (send(s->sock, tpkt, pktlen, 0) <= 0) { |
| 1139 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1140 | "send_uapsd: Send failed"); |
| 1141 | tx_status = -1; |
| 1142 | } |
| 1143 | } |
| 1144 | if (tx_status == 0) |
| 1145 | s->uapsd_tx_state++; |
| 1146 | free(tpkt); |
| 1147 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1148 | "Exit uapsd_tx_cyclic uapsd_sta_tc %d uapsd_tx_state %d", |
| 1149 | s->uapsd_sta_tc, s->uapsd_tx_state); |
| 1150 | |
| 1151 | return 0; |
| 1152 | } |
| 1153 | |
| 1154 | |
| 1155 | static int uapsd_tx_stop(struct sigma_stream *s, |
| 1156 | u32 usr_priority, enum uapsd_psave ps, |
| 1157 | u32 sleep_duration) |
| 1158 | { |
| 1159 | unsigned int *tpkt; |
| 1160 | int pktlen = 256; |
| 1161 | struct sigma_dut *dut = s->dut; |
| 1162 | u32 msgid; |
| 1163 | |
| 1164 | sigma_dut_print(dut, DUT_MSG_INFO, "send_uapsd: Enter uapsd_tx_stop"); |
| 1165 | tpkt = malloc(s->payload_size); |
| 1166 | if (tpkt == NULL) { |
| 1167 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1168 | "send_uapsd: Send buffer allocation failed"); |
| 1169 | return -1; |
| 1170 | } |
| 1171 | usleep(sleep_duration); |
| 1172 | if(!s->tx_stop_cnt) |
| 1173 | set_ps(s->ifname, dut, ps); |
| 1174 | s->tx_stop_cnt++; |
| 1175 | memset(tpkt, 0, s->payload_size); |
| 1176 | /* if test is for WMM-AC set APTS STOP to 42 */ |
| 1177 | msgid = sigma_wmm_ac ? WMMAC_APTS_STOP : APTS_STOP; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1178 | create_apts_pkt(msgid, tpkt, s->payload_size, usr_priority, s); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1179 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &usr_priority, |
| 1180 | sizeof(usr_priority)); |
| 1181 | if (send(s->sock, tpkt, pktlen, 0) <= 0) { |
| 1182 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1183 | "send_uapsd: Send failed"); |
| 1184 | } |
| 1185 | pthread_mutex_lock(&s->tx_thr_mutex); |
| 1186 | pthread_cond_signal(&s->tx_thr_cond); |
| 1187 | pthread_mutex_unlock(&s->tx_thr_mutex); |
| 1188 | if (s->tx_stop_cnt > MAX_STOP) { |
| 1189 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1190 | "send_uapsd: Enter TX_STOP Max Stop sent %d", |
| 1191 | s->tx_stop_cnt); |
| 1192 | s->stop = 1; |
| 1193 | } |
| 1194 | free(tpkt); |
| 1195 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1196 | "Exit uapsd_tx_stop uapsd_sta_tc %d uapsd_tx_state %d", |
| 1197 | s->uapsd_sta_tc, s->uapsd_tx_state); |
| 1198 | |
| 1199 | return 0; |
| 1200 | } |
| 1201 | |
| 1202 | |
| 1203 | static int uapsd_rx_start(struct sigma_stream *s, |
| 1204 | unsigned int *rxpkt, int rxpkt_len) |
| 1205 | { |
| 1206 | int test_num = 0; |
| 1207 | struct sigma_dut *dut = s->dut; |
| 1208 | int msgid; |
| 1209 | |
| 1210 | test_num = rxpkt[10]; |
| 1211 | |
| 1212 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1213 | "receive_uapsd: Enter uapsd_rx_start"); |
| 1214 | /* if test is for WMM-AC set LAST_TC to 37 */ |
| 1215 | msgid = sigma_wmm_ac ? LAST_TC : M_W; |
| 1216 | |
| 1217 | if (!((test_num >= B_D) && (test_num <= msgid))) |
| 1218 | return -1; |
| 1219 | |
| 1220 | /* |
| 1221 | * Test numbers start from 1. Hence decrement by 1 |
| 1222 | * to match the array index. |
| 1223 | */ |
| 1224 | s->uapsd_sta_tc = (rxpkt[10] - 1); |
| 1225 | s->sta_id = rxpkt[9]; |
| 1226 | (s->uapsd_rx_state)++; |
| 1227 | |
| 1228 | return 0; |
| 1229 | } |
| 1230 | |
| 1231 | |
| 1232 | static int uapsd_rx_data(struct sigma_stream *s, |
| 1233 | unsigned int *rxpkt, int rxpkt_len) |
| 1234 | { |
| 1235 | struct sigma_dut *dut = s->dut; |
| 1236 | u32 msgid; |
| 1237 | |
| 1238 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1239 | "receive_uapsd: Enter uapsd_rx_data"); |
| 1240 | /* if test is for WMM-AC set APTS DEFAULT to 38 */ |
| 1241 | msgid = sigma_wmm_ac ? WMMAC_APTS_DEFAULT : APTS_DEFAULT; |
| 1242 | |
| 1243 | if ((rxpkt[10] == msgid) && |
| 1244 | ((rxpkt[1] == TOS_BE) || |
| 1245 | (rxpkt[1] == TOS_BK) || |
| 1246 | (rxpkt[1] == TOS_VI) || |
| 1247 | (rxpkt[1] == TOS_VO) || |
| 1248 | (rxpkt[1] == TOS_VO7) || |
| 1249 | (rxpkt[1] == TOS_VO6))) { |
| 1250 | s->rx_cookie = rxpkt[0]; |
| 1251 | (s->uapsd_rx_state)++; |
| 1252 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1253 | "receive_uapsd: Recv in uapsd_rx_data uapsd_rx_state %d", |
| 1254 | s->uapsd_rx_state); |
| 1255 | } else { |
| 1256 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1257 | "receive_uapsd: BAD Pkt recv in uapsd_rx_data"); |
| 1258 | sigma_uapsd_reset(s); |
| 1259 | } |
| 1260 | |
| 1261 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1262 | "receive_uapsd: Exit uapsd_rx_data"); |
| 1263 | |
| 1264 | return 0; |
| 1265 | } |
| 1266 | |
| 1267 | |
| 1268 | static int uapsd_rx_stop(struct sigma_stream *s, |
| 1269 | unsigned int *rxpkt, int rxpkt_len) |
| 1270 | { |
| 1271 | struct sigma_dut *dut = s->dut; |
| 1272 | u32 msgid; |
| 1273 | |
| 1274 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1275 | "receive_uapsd: Enter uapsd_rx_stop"); |
| 1276 | /* if test is for WMM-AC set APTS STOP to 42 */ |
| 1277 | msgid = sigma_wmm_ac ? WMMAC_APTS_STOP : APTS_STOP; |
| 1278 | |
| 1279 | if (rxpkt[10] != msgid) { |
| 1280 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1281 | "receive_uapsd: BAD Pkt recv in uapsd_rx_stop"); |
| 1282 | } else { |
| 1283 | sigma_uapsd_stop(s); |
| 1284 | } |
| 1285 | sigma_dut_print(dut, DUT_MSG_INFO, "receive_uapsd: Exit uapsd_rx_stop"); |
| 1286 | |
| 1287 | return 0; |
| 1288 | } |
| 1289 | |
| 1290 | |
| 1291 | static int uapsd_rx_cyclic_vo(struct sigma_stream *s, |
| 1292 | unsigned int *rxpkt, int rxpkt_len) |
| 1293 | { |
| 1294 | struct sigma_dut *dut = s->dut; |
| 1295 | u32 msgid, msgid2; |
| 1296 | |
| 1297 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1298 | "receive_uapsd: Enter uapsd_rx_cyclic_vo"); |
| 1299 | /* if test is for WMM-AC set |
| 1300 | * APTS STOP to 42 and |
| 1301 | * APTS DEFAULT to 38 */ |
| 1302 | if (!sigma_wmm_ac) { |
| 1303 | msgid = APTS_STOP; |
| 1304 | msgid2 = APTS_DEFAULT; |
| 1305 | } else { |
| 1306 | msgid = WMMAC_APTS_STOP; |
| 1307 | msgid2 = WMMAC_APTS_DEFAULT; |
| 1308 | } |
| 1309 | |
| 1310 | if (rxpkt[10] != msgid) { |
| 1311 | if ((rxpkt[10] == msgid2) && |
| 1312 | ((rxpkt[1] == TOS_VO) || |
| 1313 | (rxpkt[1] == TOS_VO7) || |
| 1314 | (rxpkt[1] == TOS_VO6))) { |
| 1315 | /* ; 5.7 */ |
| 1316 | s->rx_cookie = rxpkt[0]; |
| 1317 | } else { |
| 1318 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1319 | "receive_uapsd: BAD Pkt recv in uapsd_rx_cyclic_vo"); |
| 1320 | } |
| 1321 | } else { |
| 1322 | sigma_uapsd_stop(s); |
| 1323 | } |
| 1324 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1325 | "receive_uapsd: Exit uapsd_rx_cyclic_vo"); |
| 1326 | |
| 1327 | return 0; |
| 1328 | } |
| 1329 | |
| 1330 | |
| 1331 | static void create_apts_hello_pkt(int msg, unsigned int *txbuf, |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1332 | size_t txbuf_len, int tx_hello_cnt) |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1333 | { |
| 1334 | struct apts_pkt *t; |
| 1335 | |
| 1336 | if (!sigma_wmm_ac) |
| 1337 | t = &apts_pkts[msg]; |
| 1338 | else |
| 1339 | t = &wmm_ac_apts_pkts[msg]; |
| 1340 | |
| 1341 | txbuf[0] = tx_hello_cnt; |
| 1342 | txbuf[1] = 0; |
| 1343 | txbuf[2] = 0; |
| 1344 | txbuf[3] = 0; |
| 1345 | txbuf[4] = 0; |
| 1346 | txbuf[5] = 0; |
| 1347 | txbuf[6] = t->param0; |
| 1348 | txbuf[7] = t->param1; |
| 1349 | txbuf[8] = t->param2; |
| 1350 | txbuf[9] = t->param3; |
| 1351 | txbuf[10] = t->cmd; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1352 | strlcpy((char *) &txbuf[11], t->name, |
| 1353 | txbuf_len - sizeof(txbuf[0]) * 11); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1354 | printf("create_apts_hello_pkt (%s) %d\n", t->name, t->cmd); |
| 1355 | } |
| 1356 | |
| 1357 | |
| 1358 | static void sigma_uapsd_init(struct sigma_stream *s) |
| 1359 | { |
| 1360 | s->uapsd_sta_tc = 0; /* Test Case to execute or row to select */ |
| 1361 | /* in a test case row, next column or next state function to execute */ |
| 1362 | s->uapsd_rx_state = 0; |
| 1363 | s->uapsd_tx_state = 0; |
| 1364 | |
| 1365 | s->sta_id = 0; |
| 1366 | s->uapsd_send_thr = 0; |
| 1367 | |
| 1368 | s->reset_rx = 0; |
| 1369 | s->num_retry = 0; |
| 1370 | s->tx_stop_cnt = 0; |
| 1371 | s->tx_hello_cnt = 0; |
| 1372 | } |
| 1373 | |
| 1374 | |
| 1375 | static void sigma_uapsd_stop(struct sigma_stream *s) |
| 1376 | { |
| 1377 | pthread_mutex_lock(&s->tx_thr_mutex); |
| 1378 | pthread_cond_wait(&s->tx_thr_cond, &s->tx_thr_mutex); |
| 1379 | pthread_mutex_unlock(&s->tx_thr_mutex); |
| 1380 | s->stop = 1; |
| 1381 | sleep(1); |
| 1382 | } |
| 1383 | |
| 1384 | |
| 1385 | static void sigma_uapsd_reset(struct sigma_stream *s) |
| 1386 | { |
| 1387 | int tos = TOS_BE; |
| 1388 | unsigned int *reset_pkt; |
| 1389 | struct sigma_dut *dut = s->dut; |
| 1390 | u32 msgid; |
| 1391 | |
| 1392 | s->num_retry++; |
| 1393 | |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 1394 | /* if reset is called from U-APSD console set it */ |
| 1395 | s->reset = 1; |
| 1396 | |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1397 | reset_pkt = malloc(s->payload_size); |
| 1398 | if (reset_pkt == NULL) |
| 1399 | return; |
| 1400 | |
| 1401 | if (s->num_retry > MAX_RETRY) { |
| 1402 | /* if test is for WMM-AC set APTS RESET STOP to 49 */ |
| 1403 | msgid = sigma_wmm_ac ? WMMAC_APTS_RESET_STOP : APTS_RESET_STOP; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1404 | create_apts_pkt(msgid, reset_pkt, s->payload_size, tos, s); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1405 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1406 | send(s->sock, reset_pkt, s->payload_size, 0); |
| 1407 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1408 | "sigma_uapsd_reset: Too many Reset retries"); |
| 1409 | s->stop = 1; |
| 1410 | } |
| 1411 | |
| 1412 | if (!(s->reset_rx)) { |
| 1413 | /* if test is for WMM-AC set APTS RESET to 47 */ |
| 1414 | msgid = sigma_wmm_ac ? WMMAC_APTS_RESET : APTS_RESET; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1415 | create_apts_pkt(msgid, reset_pkt, s->payload_size, tos, s); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1416 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1417 | send(s->sock, reset_pkt, s->payload_size, 0); |
| 1418 | } else { |
| 1419 | /* if test is for WMM-AC set APTS RESET RESP to 48 */ |
| 1420 | msgid = sigma_wmm_ac ? WMMAC_APTS_RESET_RESP : APTS_RESET_RESP; |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1421 | create_apts_pkt(msgid, reset_pkt, s->payload_size, tos, s); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1422 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1423 | send(s->sock, reset_pkt, s->payload_size, 0); |
| 1424 | s->reset_rx = 0; |
| 1425 | } |
| 1426 | free(reset_pkt); |
| 1427 | } |
| 1428 | |
| 1429 | |
| 1430 | static void * send_uapsd(void *data) |
| 1431 | { |
| 1432 | struct sigma_stream *s = data; |
| 1433 | struct sigma_dut *dut = s->dut; |
| 1434 | uapsd_tx_state_func_ptr tx_state_func; |
| 1435 | u32 usr_priority, sleep_duration; |
| 1436 | enum uapsd_psave ps; |
| 1437 | |
| 1438 | sigma_dut_print(dut, DUT_MSG_INFO, "send_uapsd: Uapsd TX Start"); |
| 1439 | |
| 1440 | s->payload_size = 512; |
| 1441 | |
| 1442 | while (!s->stop) { |
| 1443 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1444 | "send_uapsd: running while uapsd_rx_state %d", |
| 1445 | s->uapsd_rx_state); |
| 1446 | |
| 1447 | tx_state_func = sta_uapsd_tx_tbl[s->uapsd_sta_tc] |
| 1448 | [s->uapsd_tx_state].state_func; |
| 1449 | usr_priority = sta_uapsd_tx_tbl[s->uapsd_sta_tc] |
| 1450 | [s->uapsd_tx_state].usr_priority; |
| 1451 | sleep_duration = sta_uapsd_tx_tbl[s->uapsd_sta_tc] |
| 1452 | [s->uapsd_tx_state].sleep_dur; |
| 1453 | ps = sta_uapsd_tx_tbl[s->uapsd_sta_tc][s->uapsd_tx_state].ps; |
| 1454 | |
| 1455 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1456 | "send_uapsd: uapsd_sta_tc %d uapsd_tx_state %d", |
| 1457 | s->uapsd_sta_tc, s->uapsd_tx_state); |
| 1458 | if (tx_state_func) { |
| 1459 | tx_state_func(s, usr_priority, ps, sleep_duration); |
| 1460 | } else { |
| 1461 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1462 | "send_uapsd: Null Function Detected for TC : %d in uapsd_tx_state : %d", |
| 1463 | s->uapsd_sta_tc, s->uapsd_tx_state); |
| 1464 | } |
| 1465 | } |
| 1466 | |
| 1467 | sigma_dut_print(dut, DUT_MSG_INFO, "send_uapsd: Uapsd TX End"); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1468 | |
| 1469 | return NULL; |
| 1470 | } |
| 1471 | |
| 1472 | |
| 1473 | void receive_uapsd(struct sigma_stream *s) |
| 1474 | { |
| 1475 | struct timeval tv; |
| 1476 | fd_set rfds; |
| 1477 | int res = 0, ret = 0, rxpkt_len = 0; |
| 1478 | unsigned int *rxpkt; |
| 1479 | uapsd_recv_state_func_ptr recv_state_func; |
| 1480 | struct sigma_dut *dut = s->dut; |
| 1481 | u32 msgid; |
| 1482 | |
| 1483 | sigma_dut_print(dut, DUT_MSG_INFO, "receive_uapsd: Uapsd RX Start"); |
| 1484 | sigma_uapsd_init(s); |
| 1485 | |
| 1486 | ret = pthread_mutex_init(&s->tx_thr_mutex, NULL); |
| 1487 | if (ret != 0) { |
| 1488 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1489 | "receive_uapsd: pthread_mutex_init failed"); |
| 1490 | return; |
| 1491 | } |
| 1492 | |
| 1493 | ret = pthread_cond_init(&s->tx_thr_cond, NULL); |
| 1494 | if (ret != 0) { |
| 1495 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1496 | "receive_uapsd: pthread_cond_init failed"); |
| 1497 | pthread_mutex_destroy(&s->tx_thr_mutex); |
| 1498 | return; |
| 1499 | } |
| 1500 | |
| 1501 | if (pthread_create(&s->uapsd_send_thr, NULL, send_uapsd, s)) { |
| 1502 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1503 | "receive_uapsd: send_uapsd tx thread creation failed"); |
| 1504 | pthread_cond_destroy(&s->tx_thr_cond); |
| 1505 | pthread_mutex_destroy(&s->tx_thr_mutex); |
| 1506 | return; |
| 1507 | } |
| 1508 | |
| 1509 | s->payload_size = 512; |
| 1510 | rxpkt = malloc(s->payload_size); |
| 1511 | if (rxpkt == NULL) { |
| 1512 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1513 | "receive_uapsd: Receive buffer allocation failed"); |
| 1514 | s->stop = 1; |
| 1515 | } |
| 1516 | |
| 1517 | while (!s->stop) { |
| 1518 | FD_ZERO(&rfds); |
| 1519 | FD_SET(s->sock, &rfds); |
| 1520 | tv.tv_sec = 0; |
| 1521 | tv.tv_usec = 100000; |
| 1522 | res = select(s->sock + 1, &rfds, NULL, NULL, &tv); |
| 1523 | if (res < 0) { |
| 1524 | perror("select"); |
| 1525 | usleep(10000); |
| 1526 | continue; |
| 1527 | } |
| 1528 | |
| 1529 | if (!FD_ISSET(s->sock, &rfds)) |
| 1530 | continue; |
| 1531 | |
| 1532 | memset(rxpkt, 0, s->payload_size); |
| 1533 | rxpkt_len = recv(s->sock, rxpkt, s->payload_size, 0); |
| 1534 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1535 | "receive_uapsd: running res %d cookie %d dscp %d apts-pkt %d sta-id %d", |
| 1536 | res, rxpkt[0], rxpkt[1], rxpkt[10], |
| 1537 | rxpkt[9]); |
| 1538 | |
| 1539 | if (rxpkt_len > 0) { |
| 1540 | s->rx_frames++; |
| 1541 | s->rx_payload_bytes += res; |
| 1542 | |
| 1543 | /* if test is for WMM-AC set APTS RESET to 47 */ |
| 1544 | msgid = sigma_wmm_ac ? WMMAC_APTS_RESET : APTS_RESET; |
| 1545 | if (msgid == rxpkt[10]) { |
| 1546 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1547 | "receive_uapsd: RESET Pkt recv"); |
| 1548 | s->reset_rx = 1; |
| 1549 | sigma_uapsd_reset(s); |
| 1550 | continue; |
| 1551 | } |
| 1552 | |
| 1553 | recv_state_func = sta_uapsd_recv_tbl[s->uapsd_sta_tc] |
| 1554 | [s->uapsd_rx_state].state_func; |
| 1555 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1556 | "receive_uapsd: running s->uapsd_sta_tc %d uapsd_rx_state %d", |
| 1557 | s->uapsd_sta_tc, s->uapsd_rx_state); |
| 1558 | if (recv_state_func) { |
| 1559 | recv_state_func(s, rxpkt, rxpkt_len); |
| 1560 | } else { |
| 1561 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1562 | "receive_uapsd: Null Function Detected for TC : %d in uapsd_rx_state : %d", |
| 1563 | s->uapsd_sta_tc, |
| 1564 | s->uapsd_rx_state); |
| 1565 | } |
| 1566 | } else if (res < 0) { |
| 1567 | perror("recv"); |
| 1568 | break; |
| 1569 | } |
| 1570 | } |
| 1571 | |
| 1572 | if (rxpkt) |
| 1573 | free(rxpkt); |
| 1574 | sigma_dut_print(dut, DUT_MSG_INFO, "receive_uapsd: Uapsd RX End"); |
| 1575 | if (s->sock >= 0) { |
Veerendranath Jakkam | 58d357b | 2020-03-12 09:58:14 +0530 | [diff] [blame] | 1576 | pthread_join(s->uapsd_send_thr, NULL); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1577 | close(s->sock); |
| 1578 | s->sock = -1; |
| 1579 | } |
| 1580 | pthread_cond_destroy(&s->tx_thr_cond); |
| 1581 | pthread_mutex_destroy(&s->tx_thr_mutex); |
| 1582 | } |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 1583 | |
| 1584 | |
| 1585 | /* U-APSD apts console code implementation */ |
| 1586 | static int packet_expected(struct sigma_stream *s, unsigned int *rpkt, |
| 1587 | unsigned int type, u32 tos) |
| 1588 | { |
| 1589 | u8 type_ok = 0; |
| 1590 | u8 tos_ok = 0; |
| 1591 | int res = 0; |
| 1592 | struct sigma_dut *dut = s->dut; |
| 1593 | |
| 1594 | type_ok = (rpkt[10] == type) ? 1 : 0; |
| 1595 | |
| 1596 | switch (tos) { |
| 1597 | case TOS_VO7: |
| 1598 | case TOS_VO: |
| 1599 | case TOS_VO6: |
| 1600 | case TOS_VO2: |
| 1601 | if (rpkt[1] == TOS_VO7 || rpkt[1] == TOS_VO || |
| 1602 | rpkt[1] == TOS_VO6 || rpkt[1] == TOS_VO2) |
| 1603 | tos_ok = 1; |
| 1604 | break; |
| 1605 | case TOS_VI: |
| 1606 | case TOS_VI4: |
| 1607 | case TOS_VI5: |
| 1608 | if (rpkt[1] == TOS_VI || rpkt[1] == TOS_VI4 || |
| 1609 | rpkt[1] == TOS_VI5) |
| 1610 | tos_ok = 1; |
| 1611 | break; |
| 1612 | case TOS_BE: |
| 1613 | case TOS_EE: |
| 1614 | if (rpkt[1] == TOS_BE || rpkt[1] == TOS_EE) |
| 1615 | tos_ok = 1; |
| 1616 | break; |
| 1617 | case TOS_BK: |
| 1618 | case TOS_LE: |
| 1619 | if (rpkt[1] == TOS_BK || rpkt[1] == TOS_LE) |
| 1620 | tos_ok = 1; |
| 1621 | break; |
| 1622 | default: |
| 1623 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1624 | "packet_expected: recv not known tos=0x%x", |
| 1625 | tos); |
| 1626 | break; |
| 1627 | } |
| 1628 | |
| 1629 | res = type_ok && tos_ok; |
| 1630 | if (!res) { |
| 1631 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1632 | "packet_expected: No match: received pkt_type %u expected type %u, received dscp 0x%x expected dscp 0x%x", |
| 1633 | rpkt[10], type, rpkt[1], tos); |
| 1634 | } |
| 1635 | |
| 1636 | return res; |
| 1637 | } |
| 1638 | |
| 1639 | |
| 1640 | static int console_send(struct sigma_stream *s, u32 pkt_type, u32 tos) |
| 1641 | { |
| 1642 | u32 *tpkt; |
| 1643 | int res = 0; |
| 1644 | struct sigma_dut *dut = s->dut; |
| 1645 | |
| 1646 | tpkt = malloc(s->payload_size); |
| 1647 | if (tpkt == NULL) { |
| 1648 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1649 | "console_send: Send buffer allocation failed"); |
| 1650 | return 0; |
| 1651 | } |
| 1652 | memset(tpkt, 0, s->payload_size); |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 1653 | create_apts_pkt(pkt_type, tpkt, s->payload_size, tos, s); |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 1654 | if (pkt_type == APTS_DEFAULT || pkt_type == APTS_STOP) |
| 1655 | tpkt[0] = ++(s->rx_cookie); |
| 1656 | tpkt[1] = tos; |
| 1657 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1658 | res = send(s->sock, tpkt, s->payload_size / 2, 0); |
| 1659 | if (res >= 0) { |
| 1660 | s->tx_frames++; |
| 1661 | s->tx_payload_bytes += res; |
| 1662 | } |
| 1663 | s->uapsd_rx_state++; |
| 1664 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1665 | "console_send: Sent packet return %d Type %d Tos %d", |
| 1666 | res, tpkt[10], tpkt[1]); |
| 1667 | free(tpkt); |
| 1668 | |
| 1669 | return 0; |
| 1670 | } |
| 1671 | |
| 1672 | |
| 1673 | static int console_rx_hello(struct sigma_stream *s, unsigned int *rpkt, int len) |
| 1674 | { |
| 1675 | struct sigma_dut *dut = s->dut; |
| 1676 | |
| 1677 | if (!packet_expected(s, rpkt, APTS_HELLO, TOS_BE)) { |
| 1678 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1679 | "console_rx_hello: Hello not Recv or Bad TOS"); |
| 1680 | return 0; |
| 1681 | } |
| 1682 | |
| 1683 | s->rx_cookie = 0; |
| 1684 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1685 | "console_rx_hello: Recv Hello, Sent Test Case"); |
| 1686 | console_send(s, s->uapsd_sta_tc, TOS_BE); |
| 1687 | |
| 1688 | return 0; |
| 1689 | } |
| 1690 | |
| 1691 | |
| 1692 | static int console_rx_confirm(struct sigma_stream *s, unsigned int *rpkt, |
| 1693 | int len) |
| 1694 | { |
| 1695 | struct sigma_dut *dut = s->dut; |
| 1696 | |
| 1697 | if (!packet_expected(s, rpkt, APTS_CONFIRM, TOS_BE)) { |
| 1698 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1699 | "console_rx_confirm: Confirm not Recv or Bad TOS"); |
| 1700 | return 0; |
| 1701 | } |
| 1702 | |
| 1703 | s->rx_cookie = 0; |
| 1704 | s->uapsd_rx_state++; |
| 1705 | sigma_dut_print(dut, DUT_MSG_INFO, "console_rx_confirm: Recv Confirm"); |
| 1706 | |
| 1707 | return 0; |
| 1708 | } |
| 1709 | |
| 1710 | |
| 1711 | static int console_rx_confirm_tx_vi(struct sigma_stream *s, unsigned int *rpkt, |
| 1712 | int len) |
| 1713 | { |
| 1714 | struct sigma_dut *dut = s->dut; |
| 1715 | |
| 1716 | if (!packet_expected(s, rpkt, APTS_CONFIRM, TOS_BE)) { |
| 1717 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1718 | "console_rx_confirm_tx_vi: Confirm not Recv or Bad TOS"); |
| 1719 | return 0; |
| 1720 | } |
| 1721 | |
| 1722 | s->rx_cookie = 0; |
| 1723 | console_send(s, APTS_DEFAULT, TOS_VI); |
| 1724 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1725 | "console_rx_confirm_tx_vi: Recv Confirm, Sent VI"); |
| 1726 | |
| 1727 | return 0; |
| 1728 | |
| 1729 | } |
| 1730 | |
| 1731 | |
| 1732 | static int console_rx_tx_stop(struct sigma_stream *s, unsigned int *rpkt, |
| 1733 | int len) |
| 1734 | { |
| 1735 | struct sigma_dut *dut = s->dut; |
| 1736 | |
| 1737 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1738 | "console_rx_tx_stop: Send stop to STA again quit %d stop %d", |
| 1739 | s->can_quit, s->stop); |
| 1740 | |
| 1741 | console_send(s, APTS_STOP, TOS_BE); |
| 1742 | |
| 1743 | if (packet_expected(s, rpkt, APTS_STOP, TOS_BE)) { |
| 1744 | if (s->can_quit) { |
| 1745 | s->stop = 1; |
| 1746 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1747 | "console_rx_tx_stop: Send stop to STA again quit %d stop %d", |
| 1748 | s->can_quit, s->stop); |
| 1749 | } else { |
| 1750 | s->can_quit = 1; |
| 1751 | } |
| 1752 | } else { |
| 1753 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1754 | "console_rx_tx_stop: STOP not Recv or Bad TOS"); |
| 1755 | } |
| 1756 | |
| 1757 | return 0; |
| 1758 | } |
| 1759 | |
| 1760 | |
| 1761 | static int console_rx_vo_tx_vo(struct sigma_stream *s, unsigned int *rpkt, |
| 1762 | int len) |
| 1763 | { |
| 1764 | struct sigma_dut *dut = s->dut; |
| 1765 | unsigned int tos = TOS_VO7; |
| 1766 | int res; |
| 1767 | |
| 1768 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VO)) { |
| 1769 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1770 | "console_rx_vo_tx_vo: Expected Pkt not Recv or Bad TOS"); |
| 1771 | return 0; |
| 1772 | } |
| 1773 | |
| 1774 | rpkt[0] = ++(s->rx_cookie); |
| 1775 | rpkt[1] = TOS_VO; |
| 1776 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1777 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1778 | if (res >= 0) { |
| 1779 | s->tx_frames++; |
| 1780 | s->tx_payload_bytes += res; |
| 1781 | } |
| 1782 | s->uapsd_rx_state++; |
| 1783 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1784 | "console_rx_vo_tx_vo: Recv VO, Sent VO"); |
| 1785 | |
| 1786 | return 0; |
| 1787 | } |
| 1788 | |
| 1789 | |
| 1790 | static int console_rx_vo_tx_vo_tx_stop(struct sigma_stream *s, |
| 1791 | unsigned int *rpkt, int len) |
| 1792 | { |
| 1793 | struct sigma_dut *dut = s->dut; |
| 1794 | unsigned int tos = TOS_VO7; |
| 1795 | int res; |
| 1796 | |
| 1797 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VO)) { |
| 1798 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1799 | "console_rx_vo_tx_vo_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 1800 | return 0; |
| 1801 | } |
| 1802 | |
| 1803 | rpkt[0] = ++(s->rx_cookie); |
| 1804 | rpkt[1] = TOS_VO; |
| 1805 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1806 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1807 | if (res >= 0) { |
| 1808 | s->tx_frames++; |
| 1809 | s->tx_payload_bytes += res; |
| 1810 | } |
| 1811 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1812 | "console_rx_vo_tx_vo_tx_stop: Recv VO, Sent VO"); |
| 1813 | usleep(500000); |
| 1814 | console_send(s, APTS_STOP, TOS_BE); |
| 1815 | |
| 1816 | return 0; |
| 1817 | } |
| 1818 | |
| 1819 | |
| 1820 | static int console_rx_vo_tx_all_tx_stop(struct sigma_stream *s, |
| 1821 | unsigned int *rpkt, int len) |
| 1822 | { |
| 1823 | struct sigma_dut *dut = s->dut; |
| 1824 | u32 tos = TOS_VO7; |
| 1825 | int res; |
| 1826 | |
| 1827 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VO)) { |
| 1828 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1829 | "console_rx_vo_tx_all_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 1830 | return 0; |
| 1831 | } |
| 1832 | |
| 1833 | rpkt[0] = ++(s->rx_cookie); |
| 1834 | rpkt[1] = TOS_VO; |
| 1835 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1836 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1837 | if (res >= 0) { |
| 1838 | s->tx_frames++; |
| 1839 | s->tx_payload_bytes += res; |
| 1840 | } |
| 1841 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1842 | "console_rx_vo_tx_all_tx_stop: Recv VO, Sent VO"); |
| 1843 | rpkt[0] = ++(s->rx_cookie); |
| 1844 | tos = TOS_VI; |
| 1845 | rpkt[1] = tos; |
| 1846 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1847 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1848 | if (res >= 0) { |
| 1849 | s->tx_frames++; |
| 1850 | s->tx_payload_bytes += res; |
| 1851 | } |
| 1852 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1853 | "console_rx_vo_tx_all_tx_stop: Sent VI"); |
| 1854 | rpkt[0] = ++(s->rx_cookie); |
| 1855 | tos = TOS_BE; |
| 1856 | rpkt[1] = tos; |
| 1857 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1858 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1859 | if (res >= 0) { |
| 1860 | s->tx_frames++; |
| 1861 | s->tx_payload_bytes += res; |
| 1862 | } |
| 1863 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1864 | "console_rx_vo_tx_all_tx_stop: Sent BE"); |
| 1865 | rpkt[0] = ++(s->rx_cookie); |
| 1866 | tos = TOS_BK; |
| 1867 | rpkt[1] = tos; |
| 1868 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1869 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1870 | if (res >= 0) { |
| 1871 | s->tx_frames++; |
| 1872 | s->tx_payload_bytes += res; |
| 1873 | } |
| 1874 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1875 | "console_rx_vo_tx_all_tx_stop: Sent BK"); |
| 1876 | usleep(500000); |
| 1877 | console_send(s, APTS_STOP, TOS_BE); |
| 1878 | |
| 1879 | return 0; |
| 1880 | } |
| 1881 | |
| 1882 | |
| 1883 | static int console_rx_be_tx_be(struct sigma_stream *s, unsigned int *rpkt, |
| 1884 | int len) |
| 1885 | { |
| 1886 | struct sigma_dut *dut = s->dut; |
| 1887 | u32 tos = TOS_BE; |
| 1888 | int res; |
| 1889 | |
| 1890 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_BE)) { |
| 1891 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1892 | "console_rx_be_tx_be: Expected Pkt not Recv or Bad TOS"); |
| 1893 | return 0; |
| 1894 | } |
| 1895 | |
| 1896 | rpkt[0] = ++(s->rx_cookie); |
| 1897 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1898 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1899 | if (res >= 0) { |
| 1900 | s->tx_frames++; |
| 1901 | s->tx_payload_bytes += res; |
| 1902 | } |
| 1903 | s->uapsd_rx_state++; |
| 1904 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1905 | "console_rx_be_tx_be: Recv BE, Sent BE"); |
| 1906 | |
| 1907 | return 0; |
| 1908 | } |
| 1909 | |
| 1910 | |
| 1911 | static int console_rx_be_tx_be_tx_stop(struct sigma_stream *s, |
| 1912 | unsigned int *rpkt, int len) |
| 1913 | { |
| 1914 | struct sigma_dut *dut = s->dut; |
| 1915 | u32 tos = TOS_BE; |
| 1916 | int res; |
| 1917 | |
| 1918 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_BE)) { |
| 1919 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1920 | "console_rx_be_tx_be_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 1921 | return 0; |
| 1922 | } |
| 1923 | |
| 1924 | rpkt[0] = ++(s->rx_cookie); |
| 1925 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1926 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1927 | if (res >= 0) { |
| 1928 | s->tx_frames++; |
| 1929 | s->tx_payload_bytes += res; |
| 1930 | } |
| 1931 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1932 | "console_rx_be_tx_be_tx_stop: Recv BE, Sent BE"); |
| 1933 | console_send(s, APTS_STOP, TOS_BE); |
| 1934 | |
| 1935 | return 0; |
| 1936 | } |
| 1937 | |
| 1938 | |
| 1939 | static int console_rx_vi_tx_be(struct sigma_stream *s, unsigned int *rpkt, |
| 1940 | int len) |
| 1941 | { |
| 1942 | struct sigma_dut *dut = s->dut; |
| 1943 | u32 tos = TOS_BE; |
| 1944 | int res; |
| 1945 | |
| 1946 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VI)) { |
| 1947 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1948 | "console_rx_vi_tx_be: Expected Pkt not Recv or Bad TOS"); |
| 1949 | return 0; |
| 1950 | } |
| 1951 | |
| 1952 | rpkt[0] = ++(s->rx_cookie); |
| 1953 | rpkt[1] = tos; |
| 1954 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1955 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1956 | if (res >= 0) { |
| 1957 | s->tx_frames++; |
| 1958 | s->tx_payload_bytes += res; |
| 1959 | } |
| 1960 | s->uapsd_rx_state++; |
| 1961 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1962 | "console_rx_vi_tx_be: Recv VI, Sent BE"); |
| 1963 | |
| 1964 | return 0; |
| 1965 | } |
| 1966 | |
| 1967 | |
| 1968 | static int console_rx_vi_tx_bk(struct sigma_stream *s, unsigned int *rpkt, |
| 1969 | int len) |
| 1970 | { |
| 1971 | struct sigma_dut *dut = s->dut; |
| 1972 | u32 tos = TOS_BK; |
| 1973 | int res; |
| 1974 | |
| 1975 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VI)) { |
| 1976 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 1977 | "console_rx_vi_tx_bk: Expected Pkt not Recv or Bad TOS"); |
| 1978 | return 0; |
| 1979 | } |
| 1980 | |
| 1981 | rpkt[0] = ++(s->rx_cookie); |
| 1982 | rpkt[1] = tos; |
| 1983 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 1984 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 1985 | if (res >= 0) { |
| 1986 | s->tx_frames++; |
| 1987 | s->tx_payload_bytes += res; |
| 1988 | } |
| 1989 | s->uapsd_rx_state++; |
| 1990 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 1991 | "console_rx_vi_tx_bk: Recv VI, Sent BK"); |
| 1992 | |
| 1993 | return 0; |
| 1994 | } |
| 1995 | |
| 1996 | |
| 1997 | static int console_rx_vo_tx_bcst_tx_stop(struct sigma_stream *s, |
| 1998 | unsigned int *rpkt, int len) |
| 1999 | { |
| 2000 | struct sigma_dut *dut = s->dut; |
| 2001 | u32 tos = TOS_BE; |
| 2002 | int res; |
| 2003 | int broadcast = 1; |
| 2004 | struct sockaddr_in bcst_addr; |
| 2005 | |
| 2006 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VO)) { |
| 2007 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2008 | "console_rx_vo_tx_bcst_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 2009 | return 0; |
| 2010 | } |
| 2011 | |
| 2012 | memset(&bcst_addr, 0, sizeof(struct sockaddr_in)); |
| 2013 | bcst_addr.sin_family = AF_INET; |
| 2014 | bcst_addr.sin_port = htons(s->dst_port); |
| 2015 | bcst_addr.sin_addr.s_addr = (s->dst.s_addr | ~(NETWORK_CLASS_C)); |
| 2016 | |
| 2017 | usleep(300000); |
| 2018 | rpkt[0] = ++(s->rx_cookie); |
| 2019 | rpkt[1] = tos; |
| 2020 | setsockopt(s->sock, SOL_SOCKET, SO_BROADCAST, &broadcast, |
| 2021 | sizeof(broadcast)); |
| 2022 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2023 | res = sendto(s->sock, rpkt, s->payload_size / 2, 0, |
| 2024 | (struct sockaddr *) &bcst_addr, sizeof(bcst_addr)); |
| 2025 | if (res >= 0) { |
| 2026 | s->tx_frames++; |
| 2027 | s->tx_payload_bytes += res; |
| 2028 | } |
| 2029 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2030 | "console_rx_vo_tx_bcst_tx_stop: Recv VO, Sent Broadcast res = %d", |
| 2031 | res); |
| 2032 | console_send(s, APTS_STOP, TOS_BE); |
| 2033 | |
| 2034 | return 0; |
| 2035 | } |
| 2036 | |
| 2037 | |
| 2038 | static int console_rx_vi_tx_bcst(struct sigma_stream *s, unsigned int *rpkt, |
| 2039 | int len) |
| 2040 | { |
| 2041 | struct sigma_dut *dut = s->dut; |
| 2042 | u32 tos = TOS_VI; |
| 2043 | int res; |
| 2044 | int broadcast = 1; |
| 2045 | struct sockaddr_in bcst_addr; |
| 2046 | |
| 2047 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VI)) { |
| 2048 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2049 | "console_rx_vi_tx_bcst: Expected Pkt not Recv or Bad TOS"); |
| 2050 | return 0; |
| 2051 | } |
| 2052 | |
| 2053 | memset(&bcst_addr, 0, sizeof(struct sockaddr_in)); |
| 2054 | bcst_addr.sin_family = AF_INET; |
| 2055 | bcst_addr.sin_port = htons(s->dst_port); |
| 2056 | bcst_addr.sin_addr.s_addr = (s->dst.s_addr | ~(NETWORK_CLASS_C)); |
| 2057 | |
| 2058 | rpkt[0] = ++(s->rx_cookie); |
| 2059 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2060 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 2061 | if (res >= 0) { |
| 2062 | s->tx_frames++; |
| 2063 | s->tx_payload_bytes += res; |
| 2064 | } |
| 2065 | tos = TOS_BE; |
| 2066 | rpkt[0] = ++(s->rx_cookie); |
| 2067 | rpkt[1] = tos; |
| 2068 | setsockopt(s->sock, SOL_SOCKET, SO_BROADCAST, &broadcast, |
| 2069 | sizeof(broadcast)); |
| 2070 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2071 | res = sendto(s->sock, rpkt, s->payload_size / 2, 0, |
| 2072 | (struct sockaddr *) &bcst_addr, sizeof(bcst_addr)); |
| 2073 | if (res >= 0) { |
| 2074 | s->tx_frames++; |
| 2075 | s->tx_payload_bytes += res; |
| 2076 | } |
| 2077 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2078 | "console_rx_vi_tx_bcst: Recv/Sent VI, Sent Broadcast res = %d", |
| 2079 | res); |
| 2080 | s->uapsd_rx_state++; |
| 2081 | |
| 2082 | return 0; |
| 2083 | } |
| 2084 | |
| 2085 | |
| 2086 | static int console_rx_be_tx_bcst(struct sigma_stream *s, unsigned int *rpkt, |
| 2087 | int len) |
| 2088 | { |
| 2089 | struct sigma_dut *dut = s->dut; |
| 2090 | u32 tos = TOS_BE; |
| 2091 | int res; |
| 2092 | int broadcast = 1; |
| 2093 | struct sockaddr_in bcst_addr; |
| 2094 | |
| 2095 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_BE)) { |
| 2096 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2097 | "console_rx_be_tx_bcst: Expected Pkt not Recv or Bad TOS"); |
| 2098 | return 0; |
| 2099 | } |
| 2100 | |
| 2101 | memset(&bcst_addr, 0, sizeof(struct sockaddr_in)); |
| 2102 | bcst_addr.sin_family = AF_INET; |
| 2103 | bcst_addr.sin_port = htons(s->dst_port); |
| 2104 | bcst_addr.sin_addr.s_addr = (s->dst.s_addr | ~(NETWORK_CLASS_C)); |
| 2105 | |
| 2106 | rpkt[0] = ++(s->rx_cookie); |
| 2107 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2108 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 2109 | if (res >= 0) { |
| 2110 | s->tx_frames++; |
| 2111 | s->tx_payload_bytes += res; |
| 2112 | } |
| 2113 | rpkt[0] = ++(s->rx_cookie); |
| 2114 | rpkt[1] = tos; |
| 2115 | setsockopt(s->sock, SOL_SOCKET, SO_BROADCAST, &broadcast, |
| 2116 | sizeof(broadcast)); |
| 2117 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2118 | res = sendto(s->sock, rpkt, s->payload_size / 2, 0, |
| 2119 | (struct sockaddr *) &bcst_addr, sizeof(bcst_addr)); |
| 2120 | if (res >= 0) { |
| 2121 | s->tx_frames++; |
| 2122 | s->tx_payload_bytes += res; |
| 2123 | } |
| 2124 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2125 | "console_rx_be_tx_bcst: Recv/Sent BE, Sent Broadcast res = %d", |
| 2126 | res); |
| 2127 | s->uapsd_rx_state++; |
| 2128 | |
| 2129 | return 0; |
| 2130 | } |
| 2131 | |
| 2132 | |
| 2133 | static int console_rx_be_tx_bcst_tx_stop(struct sigma_stream *s, |
| 2134 | unsigned int *rpkt, int len) |
| 2135 | { |
| 2136 | struct sigma_dut *dut = s->dut; |
| 2137 | u32 tos = TOS_BE; |
| 2138 | int res; |
| 2139 | int broadcast = 1; |
| 2140 | struct sockaddr_in bcst_addr; |
| 2141 | |
| 2142 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_BE)) { |
| 2143 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2144 | "console_rx_be_tx_bcst_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 2145 | return 0; |
| 2146 | } |
| 2147 | |
| 2148 | memset(&bcst_addr, 0, sizeof(struct sockaddr_in)); |
| 2149 | bcst_addr.sin_family = AF_INET; |
| 2150 | bcst_addr.sin_port = htons(s->dst_port); |
| 2151 | bcst_addr.sin_addr.s_addr = (s->dst.s_addr | ~(NETWORK_CLASS_C)); |
| 2152 | |
| 2153 | rpkt[0] = ++(s->rx_cookie); |
| 2154 | setsockopt(s->sock, SOL_SOCKET, SO_BROADCAST, &broadcast, |
| 2155 | sizeof(broadcast)); |
| 2156 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2157 | res = sendto(s->sock, rpkt, s->payload_size / 2, 0, |
| 2158 | (struct sockaddr *) &bcst_addr, sizeof(bcst_addr)); |
| 2159 | if (res >= 0) { |
| 2160 | s->tx_frames++; |
| 2161 | s->tx_payload_bytes += res; |
| 2162 | } |
| 2163 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2164 | "console_rx_be_tx_bcst_tx_stop: Recv BE, Sent Broadcast res = %d", |
| 2165 | res); |
| 2166 | console_send(s, APTS_STOP, TOS_BE); |
| 2167 | |
| 2168 | return 0; |
| 2169 | } |
| 2170 | |
| 2171 | |
| 2172 | static int console_rx_vi_tx_vi(struct sigma_stream *s, unsigned int *rpkt, |
| 2173 | int len) |
| 2174 | { |
| 2175 | struct sigma_dut *dut = s->dut; |
| 2176 | u32 tos = TOS_VI; |
| 2177 | int res; |
| 2178 | |
| 2179 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VI)) { |
| 2180 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2181 | "console_rx_vi_tx_vi: Expected Pkt not Recv or Bad TOS"); |
| 2182 | return 0; |
| 2183 | } |
| 2184 | |
| 2185 | rpkt[0] = ++(s->rx_cookie); |
| 2186 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2187 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 2188 | if (res >= 0) { |
| 2189 | s->tx_frames++; |
| 2190 | s->tx_payload_bytes += res; |
| 2191 | } |
| 2192 | s->uapsd_rx_state++; |
| 2193 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2194 | "console_rx_vi_tx_vi: Recv VI, Sent VI"); |
| 2195 | |
| 2196 | return 0; |
| 2197 | } |
| 2198 | |
| 2199 | |
| 2200 | static int console_rx_vi_tx_vi_tx_stop(struct sigma_stream *s, |
| 2201 | unsigned int *rpkt, int len) |
| 2202 | { |
| 2203 | struct sigma_dut *dut = s->dut; |
| 2204 | u32 tos = TOS_VI; |
| 2205 | int res; |
| 2206 | |
| 2207 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VI)) { |
| 2208 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2209 | "console_rx_vi_tx_vi_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 2210 | return 0; |
| 2211 | } |
| 2212 | |
| 2213 | rpkt[0] = ++(s->rx_cookie); |
| 2214 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2215 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 2216 | if (res >= 0) { |
| 2217 | s->tx_frames++; |
| 2218 | s->tx_payload_bytes += res; |
| 2219 | } |
| 2220 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2221 | "console_rx_vi_tx_vi_tx_stop: Recv VI, Sent VI"); |
| 2222 | console_send(s, APTS_STOP, TOS_BE); |
| 2223 | |
| 2224 | return 0; |
| 2225 | } |
| 2226 | |
| 2227 | |
| 2228 | static int console_rx_vi_tx_vo_tx_stop(struct sigma_stream *s, |
| 2229 | unsigned int *rpkt, int len) |
| 2230 | { |
| 2231 | struct sigma_dut *dut = s->dut; |
| 2232 | u32 tos = TOS_VO7; |
| 2233 | int res; |
| 2234 | |
| 2235 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VI)) { |
| 2236 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2237 | "console_rx_vi_tx_vo_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 2238 | return 0; |
| 2239 | } |
| 2240 | |
| 2241 | rpkt[0] = ++(s->rx_cookie); |
| 2242 | rpkt[1] = TOS_VO; |
| 2243 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2244 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 2245 | if (res >= 0) { |
| 2246 | s->tx_frames++; |
| 2247 | s->tx_payload_bytes += res; |
| 2248 | } |
| 2249 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2250 | "console_rx_vi_tx_vo_tx_stop: Recv VI, Sent VO"); |
| 2251 | console_send(s, APTS_STOP, TOS_BE); |
| 2252 | |
| 2253 | return 0; |
| 2254 | } |
| 2255 | |
| 2256 | |
| 2257 | static int console_rx_vo_tx_stop(struct sigma_stream *s, unsigned int *rpkt, |
| 2258 | int len) |
| 2259 | { |
| 2260 | struct sigma_dut *dut = s->dut; |
| 2261 | |
| 2262 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VO)) { |
| 2263 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2264 | "console_rx_vo_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 2265 | return 0; |
| 2266 | } |
| 2267 | |
| 2268 | sigma_dut_print(dut, DUT_MSG_INFO, "console_rx_vo_tx_stop: Recv VO"); |
| 2269 | sleep(1); |
| 2270 | console_send(s, APTS_STOP, TOS_BE); |
| 2271 | |
| 2272 | return 0; |
| 2273 | } |
| 2274 | |
| 2275 | |
| 2276 | static int console_rx_vi_tx_stop(struct sigma_stream *s, unsigned int *rpkt, |
| 2277 | int len) |
| 2278 | { |
| 2279 | struct sigma_dut *dut = s->dut; |
| 2280 | |
| 2281 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VI)) { |
| 2282 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2283 | "console_rx_vi_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 2284 | return 0; |
| 2285 | } |
| 2286 | |
| 2287 | sigma_dut_print(dut, DUT_MSG_INFO, "console_rx_vi_tx_stop: Recv VI"); |
| 2288 | console_send(s, APTS_STOP, TOS_BE); |
| 2289 | |
| 2290 | return 0; |
| 2291 | } |
| 2292 | |
| 2293 | |
| 2294 | static int console_rx_bk_tx_stop(struct sigma_stream *s, unsigned int *rpkt, |
| 2295 | int len) |
| 2296 | { |
| 2297 | struct sigma_dut *dut = s->dut; |
| 2298 | |
| 2299 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_BK)) { |
| 2300 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2301 | "console_rx_bk_tx_stop: Expected Pkt not Recv or Bad TOS"); |
| 2302 | return 0; |
| 2303 | } |
| 2304 | |
| 2305 | sigma_dut_print(dut, DUT_MSG_INFO, "console_rx_bk_tx_stop: Recv BK"); |
| 2306 | console_send(s, APTS_STOP, TOS_BE); |
| 2307 | |
| 2308 | return 0; |
| 2309 | } |
| 2310 | |
| 2311 | |
| 2312 | static int console_rx_vo_tx_2vo(struct sigma_stream *s, unsigned int *rpkt, |
| 2313 | int len) |
| 2314 | { |
| 2315 | struct sigma_dut *dut = s->dut; |
| 2316 | u32 tos = TOS_VO7; |
| 2317 | int res; |
| 2318 | |
| 2319 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VO)) { |
| 2320 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2321 | "console_rx_vo_tx_2vo: Expected Pkt not Recv or Bad TOS"); |
| 2322 | return 0; |
| 2323 | } |
| 2324 | |
| 2325 | rpkt[0] = ++(s->rx_cookie); |
| 2326 | rpkt[1] = TOS_VO; |
| 2327 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
| 2328 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 2329 | if (res >= 0) { |
| 2330 | s->tx_frames++; |
| 2331 | s->tx_payload_bytes += res; |
| 2332 | } |
| 2333 | rpkt[0] = ++(s->rx_cookie); |
| 2334 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 2335 | if (res >= 0) { |
| 2336 | s->tx_frames++; |
| 2337 | s->tx_payload_bytes += res; |
| 2338 | } |
| 2339 | s->uapsd_rx_state++; |
| 2340 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2341 | "console_rx_vo_tx_2vo: Recv VO, Sent 2 VO"); |
| 2342 | |
| 2343 | return 0; |
| 2344 | } |
| 2345 | |
| 2346 | |
| 2347 | static int console_rx_be(struct sigma_stream *s, unsigned int *rpkt, int len) |
| 2348 | { |
| 2349 | struct sigma_dut *dut = s->dut; |
| 2350 | |
| 2351 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_BE)) { |
| 2352 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2353 | "console_rx_be: Expected Pkt not Recv or Bad TOS"); |
| 2354 | return 0; |
| 2355 | } |
| 2356 | |
| 2357 | s->uapsd_rx_state++; |
| 2358 | sigma_dut_print(dut, DUT_MSG_INFO, "console_rx_be: Recv BE"); |
| 2359 | |
| 2360 | return 0; |
| 2361 | } |
| 2362 | |
| 2363 | |
| 2364 | static int console_rx_vi(struct sigma_stream *s, unsigned int *rpkt, int len) |
| 2365 | { |
| 2366 | struct sigma_dut *dut = s->dut; |
| 2367 | |
| 2368 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VI)) { |
| 2369 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2370 | "console_rx_vi: Expected Pkt not Recv or Bad TOS"); |
| 2371 | return 0; |
| 2372 | } |
| 2373 | |
| 2374 | s->uapsd_rx_state++; |
| 2375 | sigma_dut_print(dut, DUT_MSG_INFO, "console_rx_vi: Recv VI"); |
| 2376 | |
| 2377 | return 0; |
| 2378 | } |
| 2379 | |
| 2380 | |
| 2381 | static int console_rx_vo(struct sigma_stream *s, unsigned int *rpkt, int len) |
| 2382 | { |
| 2383 | struct sigma_dut *dut = s->dut; |
| 2384 | |
| 2385 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VO)) { |
| 2386 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2387 | "console_rx_vo : Expected Pkt not Recv or Bad TOS"); |
| 2388 | return 0; |
| 2389 | } |
| 2390 | |
| 2391 | s->uapsd_rx_state++; |
| 2392 | sigma_dut_print(dut, DUT_MSG_INFO, "console_rx_vo: Recv VO"); |
| 2393 | |
| 2394 | return 0; |
| 2395 | |
| 2396 | } |
| 2397 | |
| 2398 | |
| 2399 | static int console_rx_vo_tx_vo_cyclic(struct sigma_stream *s, |
| 2400 | unsigned int *rpkt, int len) |
| 2401 | { |
| 2402 | int res = 0; |
| 2403 | unsigned int tos = 0; |
| 2404 | unsigned int *tpkt; |
| 2405 | struct sigma_dut *dut = s->dut; |
| 2406 | |
| 2407 | tpkt = malloc(s->payload_size); |
| 2408 | if (tpkt == NULL) |
| 2409 | return -1; |
| 2410 | |
| 2411 | if (!packet_expected(s, rpkt, APTS_DEFAULT, TOS_VO)) { |
| 2412 | if (rpkt[10] != APTS_STOP) |
| 2413 | sigma_uapsd_reset(s); |
| 2414 | |
| 2415 | if (!packet_expected(s, rpkt, APTS_STOP, TOS_BE)) { |
| 2416 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2417 | "console_rx_vo_tx_vo_cyclic: Expected STOP Pkt not Recv or Bad TOS"); |
| 2418 | free(tpkt); |
| 2419 | return 0; |
| 2420 | } |
| 2421 | |
Pradeep Reddy POTTETI | 1977e0d | 2016-03-10 17:10:55 +0530 | [diff] [blame] | 2422 | memset(tpkt, 0, s->payload_size); |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 2423 | tpkt[0] = s->rx_cookie; |
| 2424 | tos = TOS_BE; |
| 2425 | setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); |
Jouni Malinen | 947fdf6 | 2017-05-14 22:29:32 +0300 | [diff] [blame] | 2426 | create_apts_pkt(APTS_STOP, tpkt, s->payload_size, tos, s); |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 2427 | tpkt[1] = tos; |
| 2428 | if (s->can_quit) { |
Pradeep Reddy POTTETI | 1977e0d | 2016-03-10 17:10:55 +0530 | [diff] [blame] | 2429 | const char *stop_cmd = "APTSL1 STOP"; |
| 2430 | size_t stop_cmd_len = strlen(stop_cmd); |
| 2431 | |
| 2432 | if (s->payload_size > 11 * sizeof(int) + stop_cmd_len) |
| 2433 | memcpy(&tpkt[11], stop_cmd, stop_cmd_len + 1); |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 2434 | res = send(s->sock, tpkt, s->payload_size / 2, 0); |
| 2435 | if (res >= 0) { |
| 2436 | s->tx_frames++; |
| 2437 | s->tx_payload_bytes += res; |
| 2438 | } |
| 2439 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2440 | "console_rx_vo_tx_vo_cyclic: Sent STOP"); |
| 2441 | sleep(5); |
| 2442 | s->stop = 1; |
| 2443 | } else { |
| 2444 | res = send(s->sock, tpkt, s->payload_size / 2, 0); |
| 2445 | if (res >= 0) { |
| 2446 | s->tx_frames++; |
| 2447 | s->tx_payload_bytes += res; |
| 2448 | } |
| 2449 | s->can_quit = 1; |
| 2450 | } |
| 2451 | } else { |
| 2452 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2453 | "console_rx_vo_tx_vo_cyclic: Recv Pkt: %d Cookie: %d Sta-id %d", |
| 2454 | rpkt[0], s->rx_cookie, s->sta_id); |
| 2455 | rpkt[0] = ++(s->rx_cookie); |
| 2456 | tos = TOS_VO7; |
| 2457 | rpkt[1] = TOS_VO; |
| 2458 | res = setsockopt(s->sock, IPPROTO_IP, IP_TOS, &tos, |
| 2459 | sizeof(tos)); |
| 2460 | res = send(s->sock, rpkt, s->payload_size / 2, 0); |
| 2461 | if (res >= 0) { |
| 2462 | s->tx_frames++; |
| 2463 | s->tx_payload_bytes += res; |
| 2464 | } |
| 2465 | |
| 2466 | if (s->rx_cookie >= 3000) { |
| 2467 | /* No state change for L.1 */ |
| 2468 | } |
| 2469 | } |
| 2470 | |
| 2471 | free(tpkt); |
| 2472 | |
| 2473 | return 0; |
| 2474 | } |
| 2475 | |
| 2476 | |
| 2477 | static struct apts_pkt * apts_lookup(const char *s) |
| 2478 | { |
| 2479 | struct apts_pkt *t; |
| 2480 | |
| 2481 | for (t = &apts_pkts[1]; s && t->cmd; t++) { |
Pradeep Reddy POTTETI | e104a5b | 2016-03-09 18:40:04 +0530 | [diff] [blame] | 2482 | if (strcmp(s, "L.1AP") == 0) |
| 2483 | s = "L.1"; |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 2484 | if (t->name && strcmp(t->name, s) == 0) |
| 2485 | return t; |
| 2486 | } |
| 2487 | |
| 2488 | return NULL; |
| 2489 | } |
| 2490 | |
| 2491 | |
| 2492 | void send_uapsd_console(struct sigma_stream *s) |
| 2493 | { |
| 2494 | struct timeval tv; |
| 2495 | fd_set rfds; |
| 2496 | int res; |
| 2497 | unsigned int *rpkt; |
| 2498 | uapsd_console_state_func_ptr console_state_func; |
| 2499 | struct apts_pkt *testcase; |
| 2500 | struct sigma_dut *dut = s->dut; |
| 2501 | /* start timer for self exit */ |
| 2502 | int uapsd_timer = UAPSD_CONSOLE_TIMER; |
| 2503 | |
| 2504 | s->can_quit = 0; |
| 2505 | s->reset = 0; |
| 2506 | s->reset_rx = 0; |
| 2507 | s->uapsd_sta_tc = 0; |
| 2508 | |
| 2509 | testcase = apts_lookup(s->test_name); |
| 2510 | if (testcase == NULL) { |
| 2511 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2512 | "send_uapsd_console: no testcase found"); |
| 2513 | return; |
| 2514 | } |
| 2515 | |
| 2516 | /* send test case number to be executed */ |
| 2517 | s->uapsd_sta_tc = testcase->cmd; |
| 2518 | if (s->uapsd_sta_tc < B_D || s->uapsd_sta_tc > LAST_TC) { |
| 2519 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2520 | "send_uapsd_console: Test Case: %s Unknown", |
| 2521 | s->test_name); |
| 2522 | return; |
| 2523 | } |
| 2524 | |
| 2525 | s->payload_size = 512; |
| 2526 | rpkt = malloc(s->payload_size); |
| 2527 | if (rpkt == NULL) { |
| 2528 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2529 | "send_uapsd_console: buffer allocation failed"); |
| 2530 | return; |
| 2531 | } |
| 2532 | |
| 2533 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2534 | "send_uapsd_console: Uapsd Console Start"); |
| 2535 | |
| 2536 | while (!s->stop) { |
| 2537 | uapsd_timer--; |
| 2538 | FD_ZERO(&rfds); |
| 2539 | FD_SET(s->sock, &rfds); |
| 2540 | tv.tv_sec = 0; |
| 2541 | tv.tv_usec = 300000; |
| 2542 | res = select(s->sock + 1, &rfds, NULL, NULL, &tv); |
| 2543 | if (res < 0) { |
| 2544 | perror("select"); |
| 2545 | usleep(10000); |
| 2546 | } else if (FD_ISSET(s->sock, &rfds)) { |
| 2547 | memset(rpkt, 0, s->payload_size); |
| 2548 | res = recv(s->sock, rpkt, s->payload_size, 0); |
| 2549 | if (res < 0) { |
| 2550 | perror("recv"); |
| 2551 | break; |
| 2552 | } |
| 2553 | |
| 2554 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2555 | "send_uapsd_console: running res %d cookie %d dscp %d apts-pkt %d sta-id %d", |
| 2556 | res, rpkt[0], rpkt[1], rpkt[10], |
| 2557 | rpkt[9]); |
| 2558 | if (res == 0) |
| 2559 | continue; |
| 2560 | |
| 2561 | s->rx_frames++; |
| 2562 | s->rx_payload_bytes += res; |
| 2563 | /* |
| 2564 | * Reset the timer as packet is received |
| 2565 | * within steps. |
| 2566 | */ |
| 2567 | uapsd_timer = UAPSD_CONSOLE_TIMER; |
| 2568 | |
| 2569 | if (rpkt[10] == APTS_HELLO) { |
| 2570 | if (s->reset) |
| 2571 | s->reset = 0; |
| 2572 | s->rx_cookie = 0; |
Pradeep Reddy POTTETI | 83d62cb | 2016-02-04 13:07:49 +0530 | [diff] [blame] | 2573 | /* assign a unique id to this sta */ |
| 2574 | s->sta_id = s->stream_id; |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 2575 | /* uapsd console process table state */ |
| 2576 | s->uapsd_rx_state = 0; |
| 2577 | s->can_quit = 1; |
| 2578 | } else { |
| 2579 | if (s->reset) |
| 2580 | continue; |
| 2581 | } |
| 2582 | |
| 2583 | if (rpkt[10] == APTS_RESET) { |
| 2584 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2585 | "send_uapsd_console: RESET Pkt recv"); |
| 2586 | s->reset_rx = 1; |
| 2587 | sigma_uapsd_reset(s); |
| 2588 | } |
| 2589 | |
| 2590 | if (rpkt[10] == APTS_RESET_STOP) { |
| 2591 | sigma_dut_print(dut, DUT_MSG_ERROR, |
| 2592 | "send_uapsd_console: RESET STOP Pkt recv"); |
| 2593 | s->stop = 1; |
| 2594 | } |
| 2595 | |
| 2596 | if (rpkt[10] == APTS_BCST) { |
| 2597 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2598 | "send_uapsd_console: Broadcast Pkt recv"); |
| 2599 | continue; |
| 2600 | } |
| 2601 | |
| 2602 | console_state_func = |
| 2603 | uapsd_console_state_tbl[s->uapsd_sta_tc] |
| 2604 | [s->uapsd_rx_state].state_func; |
| 2605 | if (console_state_func) { |
| 2606 | console_state_func(s, rpkt, res); |
| 2607 | } else { |
| 2608 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2609 | "send_uapsd_console: Null function detected for TC: %d in uapsd_rx_state: %d", |
| 2610 | s->uapsd_sta_tc, |
| 2611 | s->uapsd_rx_state); |
| 2612 | } |
| 2613 | } |
| 2614 | |
| 2615 | /* Stop the thread. No transactions for the set time */ |
| 2616 | if (uapsd_timer == 0) { |
| 2617 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2618 | "send_uapsd_console: Timer Expired"); |
| 2619 | s->stop = 1; |
| 2620 | } |
| 2621 | } |
| 2622 | |
| 2623 | free(rpkt); |
| 2624 | sigma_dut_print(dut, DUT_MSG_INFO, |
| 2625 | "send_uapsd_console: Uapsd Console End"); |
| 2626 | } |