summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorman Liu <normanwhl@google.com>2023-05-18 07:02:08 +0000
committerAndroid Partner Code Review <android-gerrit-partner@google.com>2023-05-18 07:02:08 +0000
commit3f45c0fdbcea95af24e52986f3388f2fabe14505 (patch)
tree95c30e9b5ca178f7fdee978431e657acf06835e5
parent8f87d5405ee457220270435711c1aa693b5721bb (diff)
parentdf92093a1b952000ae923b39a0134c5d6053d15f (diff)
downloaddhd43752p-android-gs-bluejay-android14-release.tar.gz
-rw-r--r--dhd_debug_linux.c31
-rw-r--r--wl_cfg80211.h8
-rw-r--r--wl_cfgvendor.c38
3 files changed, 44 insertions, 33 deletions
diff --git a/dhd_debug_linux.c b/dhd_debug_linux.c
index 26d47e3..0a80a0e 100644
--- a/dhd_debug_linux.c
+++ b/dhd_debug_linux.c
@@ -109,6 +109,14 @@ dbg_ring_poll_worker(struct work_struct *work)
uint32 buflen, rlen;
unsigned long flags;
+ BCM_REFERENCE(hdr);
+
+ if (!CAN_SLEEP()) {
+ DHD_CONS_ONLY(("this context should be sleepable\n"));
+ sched = FALSE;
+ goto exit;
+ }
+
GCC_DIAGNOSTIC_PUSH_SUPPRESS_CAST();
ring_info = container_of(d_work, linux_dbgring_info_t, work);
GCC_DIAGNOSTIC_POP();
@@ -148,15 +156,10 @@ dbg_ring_poll_worker(struct work_struct *work)
DHD_DBG_RING_UNLOCK(ring->lock, flags);
}
- if (!CAN_SLEEP()) {
- DHD_ERROR(("this context should be sleepable\n"));
- sched = FALSE;
- goto exit;
- }
- buf = MALLOCZ(dhdp->osh, buflen);
+ buf = VMALLOCZ(dhdp->osh, buflen);
if (!buf) {
- DHD_ERROR(("%s failed to allocate read buf\n", __FUNCTION__));
+ DHD_CONS_ONLY(("%s failed to allocate read buf\n", __FUNCTION__));
sched = FALSE;
goto exit;
}
@@ -196,7 +199,7 @@ dbg_ring_poll_worker(struct work_struct *work)
rlen -= ENTRY_LENGTH(hdr);
hdr = (dhd_dbg_ring_entry_t *)((char *)hdr + ENTRY_LENGTH(hdr));
}
- MFREE(dhdp->osh, buf, buflen);
+ VMFREE(dhdp->osh, buf, buflen);
DHD_DBG_RING_LOCK(ring->lock, flags);
if (!ring->sched_pull) {
@@ -289,8 +292,6 @@ dhd_os_reset_logging(dhd_pub_t *dhdp)
DHD_INFO(("%s: Stop ring buffer %d\n", __FUNCTION__, ring_id));
ring_info = &os_priv[ring_id];
- /* cancel any pending work */
- cancel_delayed_work_sync(&ring_info->work);
/* log level zero makes stop logging on that ring */
ring_info->log_level = 0;
ring_info->interval = 0;
@@ -300,6 +301,8 @@ dhd_os_reset_logging(dhd_pub_t *dhdp)
DHD_ERROR(("dhd_set_configuration is failed : %d\n", ret));
return ret;
}
+ /* cancel any pending work */
+ cancel_delayed_work_sync(&ring_info->work);
}
return ret;
}
@@ -534,9 +537,9 @@ dhd_os_dbg_attach(dhd_pub_t *dhdp)
int ring_id;
/* os_dbg data */
- os_priv = MALLOCZ(dhdp->osh, sizeof(*os_priv) * DEBUG_RING_ID_MAX);
+ os_priv = VMALLOCZ(dhdp->osh, sizeof(*os_priv) * DEBUG_RING_ID_MAX);
if (!os_priv) {
- DHD_ERROR(("%s:%d: MALLOC failed for os_priv, size %d\n", __FUNCTION__,
+ DHD_ERROR(("%s:%d: VMALLOC failed for os_priv, size %d\n", __FUNCTION__,
__LINE__, (uint32)sizeof(*os_priv) * DEBUG_RING_ID_MAX));
return BCME_NOMEM;
}
@@ -551,7 +554,7 @@ dhd_os_dbg_attach(dhd_pub_t *dhdp)
ret = dhd_dbg_attach(dhdp, dhd_os_dbg_pullreq, dhd_os_dbg_urgent_notifier, os_priv);
if (ret) {
- MFREE(dhdp->osh, os_priv, sizeof(*os_priv) * DEBUG_RING_ID_MAX);
+ VMFREE(dhdp->osh, os_priv, sizeof(*os_priv) * DEBUG_RING_ID_MAX);
}
return ret;
@@ -574,7 +577,7 @@ dhd_os_dbg_detach(dhd_pub_t *dhdp)
cancel_delayed_work_sync(&ring_info->work);
}
}
- MFREE(dhdp->osh, os_priv, sizeof(*os_priv) * DEBUG_RING_ID_MAX);
+ VMFREE(dhdp->osh, os_priv, sizeof(*os_priv) * DEBUG_RING_ID_MAX);
return dhd_dbg_detach(dhdp);
}
diff --git a/wl_cfg80211.h b/wl_cfg80211.h
index db02e73..c30f5a0 100644
--- a/wl_cfg80211.h
+++ b/wl_cfg80211.h
@@ -458,6 +458,13 @@ extern char *dhd_log_dump_get_timestamp(void);
#define CFG80211_SCAN_TEXT USER_PREFIX_CFG80211
#define CFG80211_TRACE_TEXT USER_PREFIX_CFG80211
#define CFG80211_DEBUG_TEXT USER_PREFIX_CFG80211
+
+#define WL_CONS_ONLY(args) \
+do { \
+ WL_DBG_PRINT_SYSTEM_TIME; \
+ pr_cont(USER_PREFIX_CFG80211 "%s : ", __func__); \
+ pr_cont args; \
+} while (0)
#else
#define CFG80211_INFO_TEXT "CFG80211-INFO) "
/* Samsung want to print INFO2 instead of ERROR
@@ -472,6 +479,7 @@ extern char *dhd_log_dump_get_timestamp(void);
#define CFG80211_SCAN_TEXT "CFG80211-SCAN) "
#define CFG80211_TRACE_TEXT "CFG80211-TRACE) "
#define CFG80211_DEBUG_TEXT "CFG80211-DEBUG) "
+#define WL_CONS_ONLY(args) do { printf args; } while (0)
#endif /* defined(CUSTOMER_DBG_PREFIX_ENABLE) */
#ifdef DHD_DEBUG
diff --git a/wl_cfgvendor.c b/wl_cfgvendor.c
index 93c3de5..e116450 100644
--- a/wl_cfgvendor.c
+++ b/wl_cfgvendor.c
@@ -222,7 +222,7 @@ int wl_cfgvendor_send_async_event(struct wiphy *wiphy,
#endif /* (defined(CONFIG_ARCH_MSM) && defined(SUPPORT_WDEV_CFG80211_VENDOR_EVENT_ALLOC)) || */
/* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) */
if (!skb) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
return -ENOMEM;
}
@@ -244,7 +244,7 @@ wl_cfgvendor_send_cmd_reply(struct wiphy *wiphy,
/* Alloc the SKB for vendor_event */
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len);
if (unlikely(!skb)) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
err = -ENOMEM;
goto exit;
}
@@ -290,7 +290,7 @@ wl_cfgvendor_get_feature_set_matrix(struct wiphy *wiphy,
/* Alloc the SKB for vendor_event */
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed);
if (unlikely(!skb)) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
err = -ENOMEM;
goto exit;
}
@@ -453,7 +453,7 @@ wl_cfgvendor_send_hotlist_event(struct wiphy *wiphy,
#endif /* (defined(CONFIG_ARCH_MSM) && defined(SUPPORT_WDEV_CFG80211_VENDOR_EVENT_ALLOC)) || */
/* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) */
if (!skb) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
return -ENOMEM;
}
@@ -558,7 +558,7 @@ wl_cfgvendor_gscan_get_batch_results(struct wiphy *wiphy,
/* Alloc the SKB for vendor_event */
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed);
if (unlikely(!skb)) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
dhd_dev_pno_unlock_access_batch_results(bcmcfg_to_prmry_ndev(cfg));
return -ENOMEM;
}
@@ -1272,7 +1272,7 @@ wl_cfgvendor_gscan_get_channel_list(struct wiphy *wiphy,
/* Alloc the SKB for vendor_event */
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed);
if (unlikely(!skb)) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
err = -ENOMEM;
goto exit;
}
@@ -1751,7 +1751,7 @@ wl_cfgvendor_rtt_evt(void *ctx, void *rtt_data)
#endif /* (defined(CONFIG_ARCH_MSM) && defined(SUPPORT_WDEV_CFG80211_VENDOR_EVENT_ALLOC)) || */
/* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) */
if (!skb) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
return;
}
evt_complete = 1;
@@ -1776,7 +1776,7 @@ wl_cfgvendor_rtt_evt(void *ctx, void *rtt_data)
#endif /* (defined(CONFIG_ARCH_MSM) && defined(SUPPORT_WDEV_CFG80211_VENDOR_EVENT_ALLOC)) || */
/* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) */
if (!skb) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
return;
}
if (list_is_last(&rtt_header->list, rtt_cache_list)) {
@@ -1910,7 +1910,7 @@ wl_cfgvendor_rtt_set_config(struct wiphy *wiphy, struct wireless_dev *wdev,
nla_for_each_nested(iter1, iter, rem1) {
if ((uint8 *)rtt_target >= ((uint8 *)rtt_param.target_info +
TARGET_INFO_SIZE(target_cnt))) {
- WL_ERR(("rtt_target increased over its max size"));
+ WL_ERR(("rtt_target increased over its max size\n"));
err = -EINVAL;
goto exit;
}
@@ -8207,8 +8207,8 @@ static void wl_cfgvendor_dbg_ring_send_evt(void *ctx,
struct sk_buff *skb;
struct nlmsghdr *nlh;
struct bcm_cfg80211 *cfg;
- if (!ndev) {
- WL_ERR(("ndev is NULL\n"));
+ if (ndev == NULL || ndev->ieee80211_ptr == NULL) {
+ WL_CONS_ONLY(("no device for debug ring id:%d\n", ring_id));
return;
}
kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
@@ -8217,7 +8217,7 @@ static void wl_cfgvendor_dbg_ring_send_evt(void *ctx,
/* If wifi hal is not start, don't send event to wifi hal */
if (!cfg->hal_started) {
- WL_ERR(("Hal is not started\n"));
+ WL_CONS_ONLY(("Hal is not started id:%d\n", ring_id));
return;
}
@@ -8232,7 +8232,7 @@ static void wl_cfgvendor_dbg_ring_send_evt(void *ctx,
#endif /* (defined(CONFIG_ARCH_MSM) && defined(SUPPORT_WDEV_CFG80211_VENDOR_EVENT_ALLOC)) || */
/* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) */
if (!skb) {
- WL_ERR(("skb alloc failed"));
+ WL_CONS_ONLY(("skb alloc failed id:%d\n", ring_id));
return;
}
/* Set halpid for sending unicast event to wifi hal */
@@ -8683,7 +8683,7 @@ static void wl_cfgvendor_dbg_send_file_dump_evt(void *ctx, const void *data,
#endif /* (defined(CONFIG_ARCH_MSM) && defined(SUPPORT_WDEV_CFG80211_VENDOR_EVENT_ALLOC)) || */
/* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) */
if (!skb) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
return;
}
@@ -8727,7 +8727,7 @@ static int wl_cfgvendor_dbg_get_version(struct wiphy *wiphy,
buf_ptr = (char *)MALLOCZ(cfg->osh, buf_len);
if (!buf_ptr) {
- WL_ERR(("failed to allocate the buffer for version n"));
+ WL_ERR(("failed to allocate the buffer for version\n"));
ret = BCME_NOMEM;
goto exit;
}
@@ -8829,7 +8829,7 @@ static int __wl_cfgvendor_dbg_get_pkt_fates(struct wiphy *wiphy,
mem_needed = VENDOR_REPLY_OVERHEAD + ATTRIBUTE_U32_LEN;
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed);
if (unlikely(!skb)) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
ret = -ENOMEM;
goto exit;
}
@@ -9307,7 +9307,7 @@ static int wl_cfgvendor_get_driver_feature(struct wiphy *wiphy,
/* Alloc the SKB for vendor_event */
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed);
if (unlikely(!skb)) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
ret = BCME_NOMEM;
goto exit;
}
@@ -11556,7 +11556,7 @@ wl_cfgvendor_notify_twt_event(struct bcm_cfg80211 *cfg,
skb = CFG80211_VENDOR_EVENT_ALLOC(wiphy, ndev_to_wdev(ndev),
BRCM_TWT_HAL_VENDOR_EVENT_BUF_LEN, BRCM_VENDOR_EVENT_TWT, kflags);
if (!skb) {
- WL_ERR(("skb alloc failed"));
+ WL_ERR(("skb alloc failed\n"));
err = BCME_NOMEM;
goto fail;
}
@@ -13573,7 +13573,7 @@ wl_copy_hang_info_if_falure(struct net_device *dev, u16 reason, s32 ret)
int remain_len = 0;
if (!dev) {
- WL_ERR(("dev is null"));
+ WL_ERR(("dev is null\n"));
return;
}