trans.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2015-2016 Quantenna Communications, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #ifndef _QTN_FMAC_TRANS_H_
  17. #define _QTN_FMAC_TRANS_H_
  18. #include <linux/kernel.h>
  19. #include <linux/module.h>
  20. #include <linux/skbuff.h>
  21. #include <linux/mutex.h>
  22. #include "qlink.h"
  23. #define QTNF_CMD_FLAG_RESP_REQ BIT(0)
  24. #define QTNF_MAX_CMD_BUF_SIZE 2048
  25. #define QTNF_DEF_CMD_HROOM 4
  26. struct qtnf_bus;
  27. struct qtnf_cmd_ctl_node {
  28. struct completion cmd_resp_completion;
  29. struct sk_buff *resp_skb;
  30. u16 seq_num;
  31. bool waiting_for_resp;
  32. spinlock_t resp_lock; /* lock for resp_skb & waiting_for_resp changes */
  33. };
  34. struct qtnf_qlink_transport {
  35. struct qtnf_cmd_ctl_node curr_cmd;
  36. struct sk_buff_head event_queue;
  37. size_t event_queue_max_len;
  38. };
  39. void qtnf_trans_init(struct qtnf_bus *bus);
  40. void qtnf_trans_free(struct qtnf_bus *bus);
  41. int qtnf_trans_send_next_cmd(struct qtnf_bus *bus);
  42. int qtnf_trans_handle_rx_ctl_packet(struct qtnf_bus *bus, struct sk_buff *skb);
  43. int qtnf_trans_send_cmd_with_resp(struct qtnf_bus *bus,
  44. struct sk_buff *cmd_skb,
  45. struct sk_buff **response_skb);
  46. #endif /* _QTN_FMAC_TRANS_H_ */