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