trans.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /* Copyright (c) 2015-2016 Quantenna Communications. All rights reserved. */
  3. #ifndef _QTN_FMAC_TRANS_H_
  4. #define _QTN_FMAC_TRANS_H_
  5. #include <linux/kernel.h>
  6. #include <linux/module.h>
  7. #include <linux/skbuff.h>
  8. #include <linux/mutex.h>
  9. #include "qlink.h"
  10. #define QTNF_CMD_FLAG_RESP_REQ BIT(0)
  11. #define QTNF_MAX_CMD_BUF_SIZE 2048
  12. #define QTNF_DEF_CMD_HROOM 4
  13. struct qtnf_bus;
  14. struct qtnf_cmd_ctl_node {
  15. struct completion cmd_resp_completion;
  16. struct sk_buff *resp_skb;
  17. u16 seq_num;
  18. bool waiting_for_resp;
  19. spinlock_t resp_lock; /* lock for resp_skb & waiting_for_resp changes */
  20. };
  21. struct qtnf_qlink_transport {
  22. struct qtnf_cmd_ctl_node curr_cmd;
  23. struct sk_buff_head event_queue;
  24. size_t event_queue_max_len;
  25. };
  26. void qtnf_trans_init(struct qtnf_bus *bus);
  27. void qtnf_trans_free(struct qtnf_bus *bus);
  28. int qtnf_trans_send_next_cmd(struct qtnf_bus *bus);
  29. int qtnf_trans_handle_rx_ctl_packet(struct qtnf_bus *bus, struct sk_buff *skb);
  30. int qtnf_trans_send_cmd_with_resp(struct qtnf_bus *bus,
  31. struct sk_buff *cmd_skb,
  32. struct sk_buff **response_skb);
  33. #endif /* _QTN_FMAC_TRANS_H_ */