Sfoglia il codice sorgente

[netdevice] Notify upper-layer drivers when RX processing is (un)frozen

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 anni fa
parent
commit
87465258ab
2 ha cambiato i file con 30 aggiunte e 20 eliminazioni
  1. 2
    20
      src/include/ipxe/netdevice.h
  2. 28
    0
      src/net/netdevice.c

+ 2
- 20
src/include/ipxe/netdevice.h Vedi File

@@ -658,6 +658,8 @@ netdev_rx_frozen ( struct net_device *netdev ) {
658 658
 	return ( netdev->state & NETDEV_RX_FROZEN );
659 659
 }
660 660
 
661
+extern void netdev_rx_freeze ( struct net_device *netdev );
662
+extern void netdev_rx_unfreeze ( struct net_device *netdev );
661 663
 extern void netdev_link_err ( struct net_device *netdev, int rc );
662 664
 extern void netdev_link_down ( struct net_device *netdev );
663 665
 extern int netdev_tx ( struct net_device *netdev, struct io_buffer *iobuf );
@@ -733,24 +735,4 @@ netdev_link_up ( struct net_device *netdev ) {
733 735
 	netdev_link_err ( netdev, 0 );
734 736
 }
735 737
 
736
-/**
737
- * Freeze network device receive queue processing
738
- *
739
- * @v netdev		Network device
740
- */
741
-static inline __attribute__ (( always_inline )) void
742
-netdev_rx_freeze ( struct net_device *netdev ) {
743
-	netdev->state |= NETDEV_RX_FROZEN;
744
-}
745
-
746
-/**
747
- * Unfreeze network device receive queue processing
748
- *
749
- * @v netdev		Network device
750
- */
751
-static inline __attribute__ (( always_inline )) void
752
-netdev_rx_unfreeze ( struct net_device *netdev ) {
753
-	netdev->state &= ~NETDEV_RX_FROZEN;
754
-}
755
-
756 738
 #endif /* _IPXE_NETDEVICE_H */

+ 28
- 0
src/net/netdevice.c Vedi File

@@ -108,6 +108,34 @@ static void netdev_notify ( struct net_device *netdev ) {
108 108
 	}
109 109
 }
110 110
 
111
+/**
112
+ * Freeze network device receive queue processing
113
+ *
114
+ * @v netdev		Network device
115
+ */
116
+void netdev_rx_freeze ( struct net_device *netdev ) {
117
+
118
+	/* Mark receive queue processing as frozen */
119
+	netdev->state |= NETDEV_RX_FROZEN;
120
+
121
+	/* Notify drivers of change */
122
+	netdev_notify ( netdev );
123
+}
124
+
125
+/**
126
+ * Unfreeze network device receive queue processing
127
+ *
128
+ * @v netdev		Network device
129
+ */
130
+void netdev_rx_unfreeze ( struct net_device *netdev ) {
131
+
132
+	/* Mark receive queue processing as not frozen */
133
+	netdev->state &= ~NETDEV_RX_FROZEN;
134
+
135
+	/* Notify drivers of change */
136
+	netdev_notify ( netdev );
137
+}
138
+
111 139
 /**
112 140
  * Mark network device as having a specific link state
113 141
  *

Loading…
Annulla
Salva