@@ -114,7 +114,7 @@ veth_netmap_reg(struct netmap_adapter *na, int onoff)
114114 /* Enable or disable flags and callbacks in na and ifp. */
115115 if (onoff ) {
116116 for_rx_tx (t ) {
117- for (i = 0 ; i < nma_get_nrings (na , t ) + 1 ; i ++ ) {
117+ for (i = 0 ; i < nma_get_nrings (na , t ); i ++ ) {
118118 struct netmap_kring * kring = & NMR (na , t )[i ];
119119
120120 if (nm_kring_pending_on (kring )) {
@@ -154,10 +154,15 @@ veth_netmap_reg(struct netmap_adapter *na, int onoff)
154154
155155 if (nm_kring_pending_off (kring )) {
156156 kring -> nr_mode = NKR_NETMAP_OFF ;
157- /* mark the peer ring as no longer needed by us
158- * (it may still be kept if sombody else is using it)
157+ /* If hw kring, mark the peer kring
158+ * as no longer needed by us (it may
159+ * still be kept if sombody else is
160+ * using it).
159161 */
160- kring -> pipe -> nr_kflags &= ~NKR_NEEDRING ;
162+ if (kring -> pipe ) {
163+ kring -> pipe -> nr_kflags &=
164+ ~NKR_NEEDRING ;
165+ }
161166 }
162167 }
163168 }
@@ -212,7 +217,7 @@ veth_netmap_krings_create(struct netmap_adapter *na)
212217 if (error )
213218 goto del_krings1 ;
214219
215- /* cross link the krings */
220+ /* cross link the krings (only the hw ones, not the host krings) */
216221 for_rx_tx (t ) {
217222 enum txrx r = nm_txrx_swap (t ); /* swap NR_TX <-> NR_RX */
218223 int i ;
0 commit comments