1 /******************************************************************************
3 * Copyright (c) 2012 - 2018 Samsung Electronics Co., Ltd. All rights reserved
5 *****************************************************************************/
7 #include <linux/kthread.h>
16 #define SLSI_TEST_DEV_SDIO_BLOCK_SIZE 500
17 bool hip4_sampler_sample_start_stop_q
= true;
18 struct hip4_hip_control test_hip_control
;
20 /* SAP implementations container. Local and static to hip */
21 static struct hip_sap
{
22 struct sap_api
*sap
[SAP_TOTAL
];
25 /* Register SAP with HIP layer */
26 int slsi_hip_sap_register(struct sap_api
*sap_api
)
28 u8
class = sap_api
->sap_class
;
30 if (class >= SAP_TOTAL
)
33 hip_sap_cont
.sap
[class] = sap_api
;
38 /* UNregister SAP with HIP layer */
39 int slsi_hip_sap_unregister(struct sap_api
*sap_api
)
41 u8
class = sap_api
->sap_class
;
43 if (class >= SAP_TOTAL
)
46 hip_sap_cont
.sap
[class] = NULL
;
51 int slsi_hip_sap_setup(struct slsi_dev
*sdev
)
53 /* Execute callbacks to intorm Supported version */
56 if (hip_sap_cont
.sap
[SAP_MLME
]->sap_version_supported
) {
57 version
= scsc_wifi_get_hip_config_version_4_u16(&sdev
->hip4_inst
.hip_control
->config_v4
, sap_mlme_ver
);
58 if (hip_sap_cont
.sap
[SAP_MLME
]->sap_version_supported(version
))
64 if (hip_sap_cont
.sap
[SAP_MA
]->sap_version_supported
) {
65 version
= scsc_wifi_get_hip_config_version_4_u16(&sdev
->hip4_inst
.hip_control
->config_v4
, sap_ma_ver
);
66 if (hip_sap_cont
.sap
[SAP_MA
]->sap_version_supported(version
))
72 if (hip_sap_cont
.sap
[SAP_DBG
]->sap_version_supported
) {
73 version
= scsc_wifi_get_hip_config_version_4_u16(&sdev
->hip4_inst
.hip_control
->config_v4
, sap_debug_ver
);
74 if (hip_sap_cont
.sap
[SAP_DBG
]->sap_version_supported(version
))
80 if (hip_sap_cont
.sap
[SAP_TST
]->sap_version_supported
) {
81 version
= scsc_wifi_get_hip_config_version_4_u16(&sdev
->hip4_inst
.hip_control
->config_v4
, sap_test_ver
);
82 if (hip_sap_cont
.sap
[SAP_TST
]->sap_version_supported(version
))
93 int slsi_hip_rx(struct slsi_dev
*sdev
, struct sk_buff
*skb
)
97 /* Udi test : If pid in UDI range then pass to UDI and ignore */
98 slsi_log_clients_log_signal_fast(sdev
, &sdev
->log_clients
, skb
, SLSI_LOG_DIRECTION_TO_HOST
);
99 pid
= fapi_get_u16(skb
, receiver_pid
);
100 if (pid
>= SLSI_TX_PROCESS_ID_UDI_MIN
&& pid
<= SLSI_TX_PROCESS_ID_UDI_MAX
) {
106 return hip_sap_cont
.sap
[SAP_MA
]->sap_handler(sdev
, skb
);
108 if (fapi_is_mlme(skb
))
109 return hip_sap_cont
.sap
[SAP_MLME
]->sap_handler(sdev
, skb
);
111 if (fapi_is_debug(skb
))
112 return hip_sap_cont
.sap
[SAP_DBG
]->sap_handler(sdev
, skb
);
114 if (fapi_is_test(skb
))
115 return hip_sap_cont
.sap
[SAP_TST
]->sap_handler(sdev
, skb
);
120 /* value used at all levels in the driver */
121 int slsi_hip_init(struct slsi_dev
*sdev
, struct device
*dev
)
123 SLSI_UNUSED_PARAMETER(dev
);
125 memset(&sdev
->hip
, 0, sizeof(sdev
->hip
));
127 sdev
->hip
.sdev
= sdev
;
128 mutex_init(&sdev
->hip
.hip_mutex
);
130 sdev
->hip4_inst
.hip_control
= &test_hip_control
;
134 void slsi_hip_deinit(struct slsi_dev
*sdev
)
136 mutex_destroy(&sdev
->hip
.hip_mutex
);
139 int slsi_hip_stop(struct slsi_dev
*sdev
)
144 int hip4_free_ctrl_slots_count(struct slsi_hip4
*hip
)
146 return HIP4_CTL_SLOTS
;
149 int scsc_wifi_transmit_frame(struct slsi_hip4
*hip
, bool ctrl_packet
, struct sk_buff
*skb
)
151 struct slsi_dev
*sdev
= container_of(hip
, struct slsi_dev
, hip4_inst
);
153 slsi_log_clients_log_signal_fast(sdev
, &sdev
->log_clients
, skb
, SLSI_LOG_DIRECTION_FROM_HOST
);
160 void slsi_test_bh_work_f(struct work_struct
*work
)
164 /* ALL Dummies to get UT build through goes below */
165 bool hip4_sampler_sample_q
;
166 bool hip4_sampler_sample_qref
;
167 bool hip4_sampler_sample_int
;
168 bool hip4_sampler_sample_fapi
;
169 bool hip4_sampler_sample_through
;
170 bool hip4_sampler_sample_start_stop_q
;
171 bool hip4_sampler_sample_mbulk
;
172 bool hip4_sampler_sample_qfull
;
173 bool hip4_sampler_sample_mfull
;
174 bool hip4_sampler_vif
;
175 bool hip4_sampler_bot
;
176 bool hip4_sampler_pkt_tx
;
178 void hip4_sampler_update_record(u32 minor
, u8 param1
, u8 param2
, u8 param3
, u8 param4
)
182 void hip4_sampler_create(struct slsi_dev
*sdev
, struct scsc_mx
*mx
)
186 void hip4_sampler_destroy(struct slsi_dev
*sdev
, struct scsc_mx
*mx
)
190 int hip4_sampler_register_hip(struct scsc_mx
*mx
)
195 int scsc_wifi_fcq_ctrl_q_init(struct scsc_wifi_fcq_ctrl_q
*queue
)
200 void scsc_wifi_fcq_ctrl_q_deinit(struct scsc_wifi_fcq_ctrl_q
*queue
)
204 int scsc_wifi_fcq_unicast_qset_init(struct net_device
*dev
, struct scsc_wifi_fcq_data_qset
*qs
, u8 qs_num
, struct slsi_dev
*sdev
, u8 vif
, struct slsi_peer
*peer
)
209 int scsc_wifi_fcq_multicast_qset_init(struct net_device
*dev
, struct scsc_wifi_fcq_data_qset
*qs
, struct slsi_dev
*sdev
, u8 vif
)
214 void scsc_wifi_fcq_qset_deinit(struct net_device
*dev
, struct scsc_wifi_fcq_data_qset
*qs
, struct slsi_dev
*sdev
, u8 vif
, struct slsi_peer
*peer
)
218 int scsc_wifi_fcq_transmit_data(struct net_device
*dev
, struct scsc_wifi_fcq_data_qset
*qs
, u16 priority
, struct slsi_dev
*sdev
, u8 vif
, u8 peer_index
)
223 int scsc_wifi_fcq_receive_data(struct net_device
*dev
, struct scsc_wifi_fcq_data_qset
*qs
, u16 priority
, struct slsi_dev
*sdev
, u8 vif
, u8 peer_index
)
228 int scsc_wifi_fcq_receive_data_no_peer(struct net_device
*dev
, u16 priority
, struct slsi_dev
*sdev
, u8 vif
, u8 peer_index
)
233 void scsc_wifi_fcq_pause_queues(struct slsi_dev
*sdev
)
237 void scsc_wifi_fcq_unpause_queues(struct slsi_dev
*sdev
)
241 int scsc_wifi_fcq_transmit_ctrl(struct net_device
*dev
, struct scsc_wifi_fcq_ctrl_q
*queue
)
246 int scsc_wifi_fcq_receive_ctrl(struct net_device
*dev
, struct scsc_wifi_fcq_ctrl_q
*queue
)
251 int scsc_wifi_fcq_update_smod(struct scsc_wifi_fcq_data_qset
*qs
, enum scsc_wifi_fcq_ps_state peer_ps_state
,
252 enum scsc_wifi_fcq_queue_set_type type
)
257 int scsc_wifi_fcq_8021x_port_state(struct net_device
*dev
, struct scsc_wifi_fcq_data_qset
*qs
, enum scsc_wifi_fcq_8021x_state state
)
262 int scsc_wifi_fcq_stat_queue(struct scsc_wifi_fcq_q_header
*queue
,
263 struct scsc_wifi_fcq_q_stat
*queue_stat
,
264 int *qmod
, int *qcod
)
269 int scsc_wifi_fcq_stat_queueset(struct scsc_wifi_fcq_data_qset
*queue_set
,
270 struct scsc_wifi_fcq_q_stat
*queue_stat
,
271 int *smod
, int *scod
, enum scsc_wifi_fcq_8021x_state
*cp_state
,
272 u32
*peer_ps_state_transitions
)