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/11/26 14:33:08 UTC

[GitHub] [nuttx] anchao opened a new pull request, #7701: net/devif: add common funtion to build L2 headers before sending

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

   ## Summary
   
   net/devif: add common funtion to build L2 headers before sending
   net/devif: move preprocess of txpoll into common code
   
   ## Impact
   
   N/A
   
   ## Testing
   
   ci-check


-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #7701: net/devif: add common funtion to build L2 headers before sending

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7701:
URL: https://github.com/apache/nuttx/pull/7701#discussion_r1032821737


##########
arch/arm/src/c5471/c5471_ethernet.c:
##########
@@ -1015,51 +1015,19 @@ static int c5471_txpoll(struct net_driver_s *dev)
 {
   struct c5471_driver_s *priv = (struct c5471_driver_s *)dev->d_private;
 
-  /* If the polling resulted in data that should be sent out on the network,
-   * the field d_len is set to a value > 0.
-   */
-
-  if (priv->c_dev.d_len > 0)
-    {
-      /* Look up the destination MAC address and add it to the Ethernet
-       * header.
-       */
-
-#ifdef CONFIG_NET_IPv4
-#ifdef CONFIG_NET_IPv6
-      if (IFF_IS_IPv4(priv->c_dev.d_flags))
-#endif
-        {
-          arp_out(&priv->c_dev);
-        }
-#endif /* CONFIG_NET_IPv4 */
-
-#ifdef CONFIG_NET_IPv6
-#ifdef CONFIG_NET_IPv4
-      else
-#endif
-        {
-          neighbor_out(&priv->c_dev);
-        }
-#endif /* CONFIG_NET_IPv6 */
+  /* Send the packet */
 
-      if (!devif_loopback(&priv->c_dev))

Review Comment:
   let's move devif_loopback to net/devif/devif.h



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #7701: net/devif: add common funtion to build L2 headers before sending

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7701:
URL: https://github.com/apache/nuttx/pull/7701#discussion_r1032795827


##########
net/devif/devif_poll.c:
##########
@@ -181,6 +181,63 @@ static void devif_packet_conversion(FAR struct net_driver_s *dev,
 #  define devif_packet_conversion(dev,pkttype)
 #endif /* CONFIG_NET_6LOWPAN */
 
+
+/****************************************************************************
+ * Name: devif_out
+ *
+ * Description:
+ *   Generic callback before device output to build L2 headers before sending
+ *
+ * Assumptions:
+ *   This function is called from the MAC device driver with the network
+ *   locked.
+ *
+ ****************************************************************************/
+
+static int devif_out(FAR struct net_driver_s *dev,
+                     devif_poll_callback_t callback)
+{
+  FAR struct iob_s *frag;

Review Comment:
   not use?



##########
net/devif/devif_poll.c:
##########
@@ -181,6 +181,63 @@ static void devif_packet_conversion(FAR struct net_driver_s *dev,
 #  define devif_packet_conversion(dev,pkttype)
 #endif /* CONFIG_NET_6LOWPAN */
 
+
+/****************************************************************************
+ * Name: devif_out
+ *
+ * Description:
+ *   Generic callback before device output to build L2 headers before sending
+ *
+ * Assumptions:
+ *   This function is called from the MAC device driver with the network
+ *   locked.
+ *
+ ****************************************************************************/
+
+static int devif_out(FAR struct net_driver_s *dev,
+                     devif_poll_callback_t callback)
+{
+  FAR struct iob_s *frag;
+  int bstop;
+
+  if (dev->d_len == 0)
+    {
+      return 0;
+    }
+
+  bstop = devif_loopback(dev);

Review Comment:
   move to next patch



-- 
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] [nuttx] xiaoxiang781216 merged pull request #7701: net/devif: add common funtion to build L2 headers before sending

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


-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #7701: net/devif: add common funtion to build L2 headers before sending

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7701:
URL: https://github.com/apache/nuttx/pull/7701#discussion_r1032825238


##########
drivers/usbhost/usbhost_cdcmbim.c:
##########
@@ -2279,12 +2279,9 @@ static int cdcmbim_txpoll(struct net_driver_s *dev)
 
   if (priv->netdev.d_len > 0)

Review Comment:
   remove the check



-- 
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] [nuttx] anchao commented on a diff in pull request #7701: net/devif: add common funtion to build L2 headers before sending

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


##########
arch/arm/src/c5471/c5471_ethernet.c:
##########
@@ -1015,51 +1015,19 @@ static int c5471_txpoll(struct net_driver_s *dev)
 {
   struct c5471_driver_s *priv = (struct c5471_driver_s *)dev->d_private;
 
-  /* If the polling resulted in data that should be sent out on the network,
-   * the field d_len is set to a value > 0.
-   */
-
-  if (priv->c_dev.d_len > 0)
-    {
-      /* Look up the destination MAC address and add it to the Ethernet
-       * header.
-       */
-
-#ifdef CONFIG_NET_IPv4
-#ifdef CONFIG_NET_IPv6
-      if (IFF_IS_IPv4(priv->c_dev.d_flags))
-#endif
-        {
-          arp_out(&priv->c_dev);
-        }
-#endif /* CONFIG_NET_IPv4 */
-
-#ifdef CONFIG_NET_IPv6
-#ifdef CONFIG_NET_IPv4
-      else
-#endif
-        {
-          neighbor_out(&priv->c_dev);
-        }
-#endif /* CONFIG_NET_IPv6 */
+  /* Send the packet */
 
-      if (!devif_loopback(&priv->c_dev))

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


[GitHub] [nuttx] anchao commented on a diff in pull request #7701: net/devif: add common funtion to build L2 headers before sending

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


##########
net/devif/devif_poll.c:
##########
@@ -181,6 +181,63 @@ static void devif_packet_conversion(FAR struct net_driver_s *dev,
 #  define devif_packet_conversion(dev,pkttype)
 #endif /* CONFIG_NET_6LOWPAN */
 
+
+/****************************************************************************
+ * Name: devif_out
+ *
+ * Description:
+ *   Generic callback before device output to build L2 headers before sending
+ *
+ * Assumptions:
+ *   This function is called from the MAC device driver with the network
+ *   locked.
+ *
+ ****************************************************************************/
+
+static int devif_out(FAR struct net_driver_s *dev,
+                     devif_poll_callback_t callback)
+{
+  FAR struct iob_s *frag;
+  int bstop;
+
+  if (dev->d_len == 0)
+    {
+      return 0;
+    }
+
+  bstop = devif_loopback(dev);

Review Comment:
   Done



##########
net/devif/devif_poll.c:
##########
@@ -181,6 +181,63 @@ static void devif_packet_conversion(FAR struct net_driver_s *dev,
 #  define devif_packet_conversion(dev,pkttype)
 #endif /* CONFIG_NET_6LOWPAN */
 
+
+/****************************************************************************
+ * Name: devif_out
+ *
+ * Description:
+ *   Generic callback before device output to build L2 headers before sending
+ *
+ * Assumptions:
+ *   This function is called from the MAC device driver with the network
+ *   locked.
+ *
+ ****************************************************************************/
+
+static int devif_out(FAR struct net_driver_s *dev,
+                     devif_poll_callback_t callback)
+{
+  FAR struct iob_s *frag;

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


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #7701: net/devif: add common funtion to build L2 headers before sending

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7701:
URL: https://github.com/apache/nuttx/pull/7701#discussion_r1032824576


##########
include/nuttx/net/netdev.h:
##########
@@ -564,6 +564,20 @@ int sixlowpan_input(FAR struct radio_driver_s *ieee,
 
 int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback);
 
+/****************************************************************************
+ * Name: devif_out
+ *
+ * Description:
+ *   Generic callback before device output to build L2 headers before sending
+ *
+ * Assumptions:
+ *   This function is called from the MAC device driver with the network
+ *   locked.
+ *
+ ****************************************************************************/
+
+int devif_out(FAR struct net_driver_s *dev, devif_poll_callback_t callback);

Review Comment:
   let's move to devif/devif.h



-- 
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