iwl_mvm.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* Intel 7265D/3165 firmware command layer ("mvm"): see iwl_mvm.c.
  2. *
  3. * One station interface: MAC context 0, PHY context 0 (= binding 0), the aux
  4. * station 1 for scan probes and the AP station 0 on TX queue 4. */
  5. #ifndef IWL_MVM_H
  6. #define IWL_MVM_H
  7. /* Station IDs follow iwlmvm's iwl_mvm_find_free_sta_id(): the aux station
  8. * (added first, NL80211_IFTYPE_UNSPECIFIED) reserves ID 0, so it gets 1,
  9. * and the BSS/AP station gets 0. The firmware's RX/decrypt path expects
  10. * the BSS station there. */
  11. #define IWL_STA_AUX 1
  12. #define IWL_STA_AP 0
  13. /* RX MPDU status bits (fw/api/rx.h). */
  14. #define IWL_RX_CRC_OK (1u << 0)
  15. #define IWL_RX_OVERRUN_OK (1u << 1)
  16. #define IWL_RX_MIC_OK (1u << 6)
  17. #define IWL_RX_SEC_MSK (7u << 8)
  18. #define IWL_RX_SEC_CCM (2u << 8)
  19. /* Upcalls into wifi.c. */
  20. void wifi_rx_frame(const unsigned char *frame, unsigned int len, int rssi,
  21. unsigned int status, unsigned int channel);
  22. void wifi_scan_done(int ok);
  23. /* Bring the card up (INIT image + calibration + NVM, then the runtime
  24. * image). Fills the NVM MAC address. 0 on success. */
  25. int iwl_mvm_up(unsigned char mac[6]);
  26. int iwl_mvm_is_up(void);
  27. void iwl_mvm_down(void);
  28. const char *iwl_mvm_state(void); /* short status for `wifi` */
  29. /* Poll the firmware RX ring (notifications, frames, TX responses). */
  30. int iwl_mvm_poll(void);
  31. int iwl_mvm_scan_start(void); /* wildcard active scan, all channels */
  32. int iwl_mvm_scan_running(void);
  33. /* Connection: PHY context to `chan`, binding + quota, MAC with the BSSID,
  34. * AP station + queue, session protection. Then the 802.11 frames go out
  35. * with iwl_mvm_tx_mgmt(). */
  36. int iwl_mvm_prepare_connect(const unsigned char bssid[6], unsigned int chan,
  37. unsigned int beacon_int);
  38. int iwl_mvm_set_assoc(unsigned short aid, unsigned int beacon_int,
  39. unsigned int dtim);
  40. void iwl_mvm_disconnect(void);
  41. /* Raw 802.11 frames (header included). Management frames go at the
  42. * lowest rate; data at a fixed OFDM rate. `protect`: CCMP with the
  43. * pairwise key (the frame must already carry the 8-byte CCMP header). */
  44. int iwl_mvm_tx_mgmt(const unsigned char *frame, unsigned int len);
  45. int iwl_mvm_tx_data(const unsigned char *frame, unsigned int len,
  46. int protect);
  47. /* Install a CCMP key: pairwise (key index 0) or group (`keyidx`, with the
  48. * 6-byte receive sequence counter from the EAPOL frame). */
  49. int iwl_mvm_set_key(int pairwise, int keyidx, const unsigned char key[16],
  50. const unsigned char rsc[6]);
  51. void iwl_mvm_clear_keys(void);
  52. #endif