qcacmn: CFR: Abstract retrieval of netdevice name

Since netdevice name retrieval is tied to OS,
move it to qdf OS layer instead of doing it
inside CFR ucfg layer.

Change-Id: Ia9dcbdf56bcb36a1f0788be9964ea87fdf5beb3f
CRs-Fixed: 2643682
This commit is contained in:
Padma Raghunathan
2020-03-23 14:15:53 +05:30
committed by nshrivas
parent 0c314d439d
commit be65ea9002
4 changed files with 60 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. * Copyright (c) 2016-2017,2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -20,6 +20,8 @@
#ifndef _WLAN_OSIF_PRIV_H_ #ifndef _WLAN_OSIF_PRIV_H_
#define _WLAN_OSIF_PRIV_H_ #define _WLAN_OSIF_PRIV_H_
#include "qdf_net_if.h"
struct osif_scan_pdev; struct osif_scan_pdev;
struct osif_tdls_vdev; struct osif_tdls_vdev;
@@ -28,11 +30,13 @@ struct osif_tdls_vdev;
* @wiphy: wiphy handle * @wiphy: wiphy handle
* @legacy_osif_priv: legacy osif private handle * @legacy_osif_priv: legacy osif private handle
* @scan_priv: Scan related data used by cfg80211 scan * @scan_priv: Scan related data used by cfg80211 scan
* @nif: pdev net device
*/ */
struct pdev_osif_priv { struct pdev_osif_priv {
struct wiphy *wiphy; struct wiphy *wiphy;
void *legacy_osif_priv; void *legacy_osif_priv;
struct osif_scan_pdev *osif_scan; struct osif_scan_pdev *osif_scan;
struct qdf_net_if *nif;
}; };
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014-2019 The Linux Foundation. All rights reserved. * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -48,4 +48,12 @@ qdf_net_if_create_dummy_if(struct qdf_net_if *nif)
return __qdf_net_if_create_dummy_if(nif); return __qdf_net_if_create_dummy_if(nif);
} }
#endif #endif
/**
* qdf_net_if_get_devname() - Retrieve netdevice name
* @nif: Abstraction of netdevice
*
* Return: netdevice name
*/
char *qdf_net_if_get_devname(struct qdf_net_if *nif);
#endif /* __QDF_NET_IF_H */ #endif /* __QDF_NET_IF_H */

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 The Linux Foundation. All rights reserved. * Copyright (c) 2018,2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -41,3 +41,19 @@ qdf_net_if_create_dummy_if(struct qdf_net_if *nif)
} }
qdf_export_symbol(qdf_net_if_create_dummy_if); qdf_export_symbol(qdf_net_if_create_dummy_if);
/**
* qdf_net_if_get_devname() - Retrieve netdevice name
* @nif: Abstraction of netdevice
*
* Return: netdevice name
*/
char *qdf_net_if_get_devname(struct qdf_net_if *nif)
{
if (!nif)
return NULL;
return (((struct net_device *)nif)->name);
}
qdf_export_symbol(qdf_net_if_get_devname);

View File

@@ -24,10 +24,7 @@
#include <wlan_cfr_tgt_api.h> #include <wlan_cfr_tgt_api.h>
#include <qdf_streamfs.h> #include <qdf_streamfs.h>
#include <target_if.h> #include <target_if.h>
#ifndef CFR_USE_FIXED_FOLDER #include <wlan_osif_priv.h>
#include <os_if_athvar.h>
#endif
QDF_STATUS QDF_STATUS
wlan_cfr_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg) wlan_cfr_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg)
@@ -172,44 +169,44 @@ wlan_cfr_peer_obj_destroy_handler(struct wlan_objmgr_peer *peer, void *arg)
} }
#ifdef CFR_USE_FIXED_FOLDER #ifdef CFR_USE_FIXED_FOLDER
static const char *cfr_get_dev_name(struct wlan_objmgr_pdev *pdev) static char *cfr_get_dev_name(struct wlan_objmgr_pdev *pdev)
{ {
const char *default_name = "wlan"; char *default_name = "wlan";
return default_name; return default_name;
} }
#else #else
static const char *cfr_get_dev_name(struct wlan_objmgr_pdev *pdev) /**
* cfr_get_dev_name() - Get net device name from pdev
* @pdev: objmgr pdev
*
* Return: netdev name
*/
static char *cfr_get_dev_name(struct wlan_objmgr_pdev *pdev)
{ {
struct pdev_cfr *pa = NULL; struct pdev_osif_priv *pdev_ospriv;
char folder[32]; struct qdf_net_if *nif;
struct net_device *pdev_netdev;
struct ol_ath_softc_net80211 *scn;
struct target_pdev_info *tgt_hdl;
const char *default_name = "wlan";
if (!pdev) { pdev_ospriv = wlan_pdev_get_ospriv(pdev);
cfr_err("PDEV is NULL\n"); if (!pdev_ospriv) {
return default_name; cfr_err("pdev_ospriv is NULL\n");
return NULL;
} }
tgt_hdl = wlan_pdev_get_tgt_if_handle(pdev); nif = pdev_ospriv->nif;
if (!nif) {
if (!tgt_hdl) { cfr_err("pdev nif is NULL\n");
cfr_err("target_pdev_info is NULL\n"); return NULL;
return default_name;
} }
scn = target_pdev_get_feature_ptr(tgt_hdl); return qdf_net_if_get_devname(nif);
pdev_netdev = scn->netdev;
return pdev_netdev->name;
} }
#endif #endif
QDF_STATUS cfr_streamfs_init(struct wlan_objmgr_pdev *pdev) QDF_STATUS cfr_streamfs_init(struct wlan_objmgr_pdev *pdev)
{ {
struct pdev_cfr *pa = NULL; struct pdev_cfr *pa = NULL;
char *devname;
char folder[32]; char folder[32];
if (!pdev) { if (!pdev) {
@@ -229,7 +226,13 @@ QDF_STATUS cfr_streamfs_init(struct wlan_objmgr_pdev *pdev)
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
snprintf(folder, sizeof(folder), "cfr%s", cfr_get_dev_name(pdev)); devname = cfr_get_dev_name(pdev);
if (!devname) {
cfr_err("devname is NULL\n");
return QDF_STATUS_E_FAILURE;
}
snprintf(folder, sizeof(folder), "cfr%s", devname);
pa->dir_ptr = qdf_streamfs_create_dir((const char *)folder, NULL); pa->dir_ptr = qdf_streamfs_create_dir((const char *)folder, NULL);