xref: /wlan-driver/qcacld-3.0/components/pmo/core/src/wlan_pmo_icmp.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: Implements icmp offload feature API's
19  */
20 
21 #include "wlan_pmo_icmp.h"
22 #include "wlan_pmo_main.h"
23 #include "wlan_pmo_obj_mgmt_public_struct.h"
24 
pmo_core_icmp_check_offload(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)25 QDF_STATUS pmo_core_icmp_check_offload(struct wlan_objmgr_psoc *psoc,
26 				       uint8_t vdev_id)
27 {
28 	QDF_STATUS status = QDF_STATUS_SUCCESS;
29 	struct wlan_objmgr_vdev *vdev;
30 	enum QDF_OPMODE opmode;
31 
32 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, WLAN_PMO_ID);
33 	if (!vdev) {
34 		pmo_err("vdev is NULL. vdev_id is %d", vdev_id);
35 		return QDF_STATUS_E_INVAL;
36 	}
37 
38 	opmode = pmo_get_vdev_opmode(vdev);
39 	if (opmode != QDF_STA_MODE) {
40 		pmo_debug("ICMP offload is supported in STA mode only");
41 		status = QDF_STATUS_E_INVAL;
42 		goto out;
43 	}
44 
45 out:
46 	wlan_objmgr_vdev_release_ref(vdev, WLAN_PMO_ID);
47 	return status;
48 }
49 
50