@@ -2051,42 +2051,24 @@ netmap_do_regif(struct netmap_priv_d *priv, struct netmap_adapter *na,
20512051 return error ;
20522052}
20532053
2054-
20552054/*
2056- * update kring and ring at the end of txsync.
2055+ * update kring and ring at the end of rxsync/ txsync.
20572056 */
20582057static inline void
2059- nm_txsync_finalize (struct netmap_kring * kring )
2058+ nm_sync_finalize (struct netmap_kring * kring )
20602059{
2061- /* update ring tail to what the kernel knows */
2060+ /*
2061+ * Update ring tail to what the kernel knows
2062+ * After txsync: head/rhead/hwcur might be behind cur/rcur
2063+ * if no carrier.
2064+ */
20622065 kring -> ring -> tail = kring -> rtail = kring -> nr_hwtail ;
20632066
2064- /* note, head/rhead/hwcur might be behind cur/rcur
2065- * if no carrier
2066- */
20672067 ND (5 , "%s now hwcur %d hwtail %d head %d cur %d tail %d" ,
20682068 kring -> name , kring -> nr_hwcur , kring -> nr_hwtail ,
20692069 kring -> rhead , kring -> rcur , kring -> rtail );
20702070}
20712071
2072-
2073- /*
2074- * update kring and ring at the end of rxsync
2075- */
2076- static inline void
2077- nm_rxsync_finalize (struct netmap_kring * kring )
2078- {
2079- /* tell userspace that there might be new packets */
2080- //struct netmap_ring *ring = kring->ring;
2081- ND ("head %d cur %d tail %d -> %d" , ring -> head , ring -> cur , ring -> tail ,
2082- kring -> nr_hwtail );
2083- kring -> ring -> tail = kring -> rtail = kring -> nr_hwtail ;
2084- /* make a copy of the state for next round */
2085- kring -> rhead = kring -> ring -> head ;
2086- kring -> rcur = kring -> ring -> cur ;
2087- }
2088-
2089-
20902072/*
20912073 * ioctl(2) support for the "netmap" device.
20922074 *
@@ -2291,7 +2273,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, struct thread
22912273 if (nm_txsync_prologue (kring , ring ) >= kring -> nkr_num_slots ) {
22922274 netmap_ring_reinit (kring );
22932275 } else if (kring -> nm_sync (kring , NAF_FORCE_RECLAIM ) == 0 ) {
2294- nm_txsync_finalize (kring );
2276+ nm_sync_finalize (kring );
22952277 }
22962278 if (netmap_verbose & NM_VERB_TXSYNC )
22972279 D ("post txsync ring %d cur %d hwcur %d" ,
@@ -2301,7 +2283,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, struct thread
23012283 if (nm_rxsync_prologue (kring , ring ) >= kring -> nkr_num_slots ) {
23022284 netmap_ring_reinit (kring );
23032285 } else if (kring -> nm_sync (kring , NAF_FORCE_READ ) == 0 ) {
2304- nm_rxsync_finalize (kring );
2286+ nm_sync_finalize (kring );
23052287 }
23062288 microtime (& ring -> ts );
23072289 }
@@ -2477,7 +2459,7 @@ netmap_poll(struct netmap_priv_d *priv, int events, NM_SELRECORD_T *sr)
24772459 if (kring -> nm_sync (kring , 0 ))
24782460 revents |= POLLERR ;
24792461 else
2480- nm_txsync_finalize (kring );
2462+ nm_sync_finalize (kring );
24812463 }
24822464
24832465 /*
@@ -2540,7 +2522,7 @@ netmap_poll(struct netmap_priv_d *priv, int events, NM_SELRECORD_T *sr)
25402522 if (kring -> nm_sync (kring , 0 ))
25412523 revents |= POLLERR ;
25422524 else
2543- nm_rxsync_finalize (kring );
2525+ nm_sync_finalize (kring );
25442526 send_down |= (kring -> nr_kflags & NR_FORWARD ); /* host ring only */
25452527 if (netmap_no_timestamp == 0 ||
25462528 ring -> flags & NR_TIMESTAMP ) {
0 commit comments