You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/07/02 04:53:42 UTC

[GitHub] [incubator-nuttx] anchao opened a new pull request, #6556: wireless/bcm43xxx: set listen interval on lowpower

anchao opened a new pull request, #6556:
URL: https://github.com/apache/incubator-nuttx/pull/6556

   ## Summary
   
   wireless/bcm43xxx: set listen interval on lowpower
   
   set listen interval dtim(Delivery Traffic Indication Message) on lowpower mode
   
   Signed-off-by: chao.an <an...@xiaomi.com>
   
   ## Impact
   
   N/A
   
   ## Testing
   
   bcm43013


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #6556: wireless/bcm43xxx: set listen interval on lowpower

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6556:
URL: https://github.com/apache/incubator-nuttx/pull/6556


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6556: wireless/bcm43xxx: set listen interval on lowpower

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6556:
URL: https://github.com/apache/incubator-nuttx/pull/6556#discussion_r912367066


##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c:
##########
@@ -788,32 +799,57 @@ static int bcmf_ifdown(FAR struct net_driver_s *dev)
  ****************************************************************************/
 
 #ifdef CONFIG_IEEE80211_BROADCOM_LOWPOWER
-static void bcmf_lowpower_work(FAR void *arg)
+static bool bcmf_lowpower_expiration(FAR struct bcmf_dev_s *priv,
+                                     FAR struct work_s *work,
+                                     worker_t worker, clock_t timeout)
 {
-  FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)arg;
-  irqstate_t flags;
   clock_t ticks;
-  clock_t timeout;
 
   if (priv->bc_bifup)
     {
       /* Disable the hardware interrupt */
 
-      flags = enter_critical_section();
-
       ticks = clock_systime_ticks() - priv->lp_ticks;
-      timeout = SEC2TICK(CONFIG_IEEE80211_BROADCOM_LOWPOWER_TIMEOUT);
 
       if (ticks >= timeout)
         {
-          leave_critical_section(flags);
-          bcmf_wl_set_pm(priv, PM_MAX);
+          return true;
         }
       else
         {
-          work_queue(LPWORK, &priv->lp_work, bcmf_lowpower_work,
-                     priv, timeout - ticks);
-          leave_critical_section(flags);
+          work_queue(LPWORK, work, worker, priv, timeout - ticks);
+        }
+    }
+
+  return false;
+}
+
+static void bcmf_lowpower_work(FAR void *arg)
+{
+  FAR struct bcmf_dev_s *priv = arg;
+
+  if (bcmf_lowpower_expiration(arg, &priv->lp_work_dtim, bcmf_lowpower_work,
+                               SEC2TICK(LP_DTIM_TIMEOUT)))
+    {
+      if (priv->bc_bifup)
+        {
+          bcmf_wl_set_dtim(priv, LP_DTIM_INTERVAL);
+        }
+    }
+}
+
+static void bcmf_lowpower_ifdown_work(FAR void *arg)
+{
+  FAR struct bcmf_dev_s *priv = arg;
+
+  if (bcmf_lowpower_expiration(arg, &priv->lp_work_ifdown,
+                               bcmf_lowpower_ifdown_work,
+                               SEC2TICK(LP_IFDOWN_TIMEOUT)))
+    {
+      if (priv->bc_bifup)
+        {
+          extern void netdev_ifdown(FAR struct net_driver_s *dev);

Review Comment:
   can `net/netdev/netdev.h` be somehow included instead of `extern`?



##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c:
##########
@@ -1811,3 +1786,37 @@ int bcmf_wl_get_country(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr)
 
   return ret;
 }
+
+#ifdef CONFIG_IEEE80211_BROADCOM_LOWPOWER
+
+int bcmf_wl_set_dtim(FAR struct bcmf_dev_s *priv,
+                     uint32_t interval_ms)
+{
+  uint32_t value = interval_ms / 100;
+  uint32_t out_len;
+  int ret;
+
+  out_len = sizeof(interval_ms);
+
+  if (value == 0)
+    {
+      return -EINVAL;
+    }
+
+  if (priv->lp_dtim == interval_ms)
+    {
+      return OK;
+    }
+
+  ret = bcmf_cdc_iovar_request(priv, CHIP_STA_INTERFACE, true,
+                               IOVAR_STR_LISTEN_INTERVAL_DTIM,
+                               (uint8_t *)&value, &out_len);

Review Comment:
   ```suggestion
                                  (FAR uint8_t *)&value, &out_len);
   ```



##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c:
##########
@@ -492,7 +464,10 @@ int bcmf_wl_active(FAR struct bcmf_dev_s *priv, bool active)
 
   /* Set default power save mode */
 
-  ret = bcmf_wl_set_pm(priv, PM_OFF);
+  out_len = 4;
+  value   = PM_OFF;
+  ret     = bcmf_cdc_ioctl(priv, interface, true, WLC_SET_PM,
+                           (uint8_t *)&value, &out_len);

Review Comment:
   ```suggestion
                              (FAR uint8_t *)&value, &out_len);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] anchao commented on a diff in pull request #6556: wireless/bcm43xxx: set listen interval on lowpower

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #6556:
URL: https://github.com/apache/incubator-nuttx/pull/6556#discussion_r912374104


##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c:
##########
@@ -788,32 +799,57 @@ static int bcmf_ifdown(FAR struct net_driver_s *dev)
  ****************************************************************************/
 
 #ifdef CONFIG_IEEE80211_BROADCOM_LOWPOWER
-static void bcmf_lowpower_work(FAR void *arg)
+static bool bcmf_lowpower_expiration(FAR struct bcmf_dev_s *priv,
+                                     FAR struct work_s *work,
+                                     worker_t worker, clock_t timeout)
 {
-  FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)arg;
-  irqstate_t flags;
   clock_t ticks;
-  clock_t timeout;
 
   if (priv->bc_bifup)
     {
       /* Disable the hardware interrupt */
 
-      flags = enter_critical_section();
-
       ticks = clock_systime_ticks() - priv->lp_ticks;
-      timeout = SEC2TICK(CONFIG_IEEE80211_BROADCOM_LOWPOWER_TIMEOUT);
 
       if (ticks >= timeout)
         {
-          leave_critical_section(flags);
-          bcmf_wl_set_pm(priv, PM_MAX);
+          return true;
         }
       else
         {
-          work_queue(LPWORK, &priv->lp_work, bcmf_lowpower_work,
-                     priv, timeout - ticks);
-          leave_critical_section(flags);
+          work_queue(LPWORK, work, worker, priv, timeout - ticks);
+        }
+    }
+
+  return false;
+}
+
+static void bcmf_lowpower_work(FAR void *arg)
+{
+  FAR struct bcmf_dev_s *priv = arg;
+
+  if (bcmf_lowpower_expiration(arg, &priv->lp_work_dtim, bcmf_lowpower_work,
+                               SEC2TICK(LP_DTIM_TIMEOUT)))
+    {
+      if (priv->bc_bifup)
+        {
+          bcmf_wl_set_dtim(priv, LP_DTIM_INTERVAL);
+        }
+    }
+}
+
+static void bcmf_lowpower_ifdown_work(FAR void *arg)
+{
+  FAR struct bcmf_dev_s *priv = arg;
+
+  if (bcmf_lowpower_expiration(arg, &priv->lp_work_ifdown,
+                               bcmf_lowpower_ifdown_work,
+                               SEC2TICK(LP_IFDOWN_TIMEOUT)))
+    {
+      if (priv->bc_bifup)
+        {
+          extern void netdev_ifdown(FAR struct net_driver_s *dev);

Review Comment:
   Done



##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c:
##########
@@ -1811,3 +1786,37 @@ int bcmf_wl_get_country(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr)
 
   return ret;
 }
+
+#ifdef CONFIG_IEEE80211_BROADCOM_LOWPOWER
+
+int bcmf_wl_set_dtim(FAR struct bcmf_dev_s *priv,
+                     uint32_t interval_ms)
+{
+  uint32_t value = interval_ms / 100;
+  uint32_t out_len;
+  int ret;
+
+  out_len = sizeof(interval_ms);
+
+  if (value == 0)
+    {
+      return -EINVAL;
+    }
+
+  if (priv->lp_dtim == interval_ms)
+    {
+      return OK;
+    }
+
+  ret = bcmf_cdc_iovar_request(priv, CHIP_STA_INTERFACE, true,
+                               IOVAR_STR_LISTEN_INTERVAL_DTIM,
+                               (uint8_t *)&value, &out_len);

Review Comment:
   Done



##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c:
##########
@@ -492,7 +464,10 @@ int bcmf_wl_active(FAR struct bcmf_dev_s *priv, bool active)
 
   /* Set default power save mode */
 
-  ret = bcmf_wl_set_pm(priv, PM_OFF);
+  out_len = 4;
+  value   = PM_OFF;
+  ret     = bcmf_cdc_ioctl(priv, interface, true, WLC_SET_PM,
+                           (uint8_t *)&value, &out_len);

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org