@@ -132,6 +132,7 @@ pub(crate) fn mempool_lookup<S: Into<String>>(name: S) -> Result<MempoolPtr> {
132132}
133133
134134/// Returns the number of elements which have been allocated from the mempool.
135+ #[ allow( dead_code) ]
135136pub ( crate ) fn mempool_in_use_count ( mp : & MempoolPtr ) -> usize {
136137 unsafe { cffi:: rte_mempool_in_use_count ( mp. deref ( ) ) as usize }
137138}
@@ -197,14 +198,14 @@ pub(crate) fn get_next_lcore(
197198
198199 match unsafe { cffi:: rte_get_next_lcore ( i, skip_master, wrap) } {
199200 cffi:: RTE_MAX_LCORE => None ,
200- id @ _ => Some ( LcoreId ( id) ) ,
201+ id => Some ( LcoreId ( id) ) ,
201202 }
202203}
203204
204205/// The function passed to `rte_eal_remote_launch`.
205206unsafe extern "C" fn lcore_fn < F > ( arg : * mut raw:: c_void ) -> raw:: c_int
206207where
207- F : FnOnce ( ) -> ( ) + Send + ' static ,
208+ F : FnOnce ( ) + Send + ' static ,
208209{
209210 let f = Box :: from_raw ( arg as * mut F ) ;
210211
@@ -221,7 +222,7 @@ where
221222/// Launches a function on another lcore.
222223pub ( crate ) fn eal_remote_launch < F > ( worker_id : LcoreId , f : F ) -> Result < ( ) >
223224where
224- F : FnOnce ( ) -> ( ) + Send + ' static ,
225+ F : FnOnce ( ) + Send + ' static ,
225226{
226227 let ptr = Box :: into_raw ( Box :: new ( f) ) as * mut raw:: c_void ;
227228
@@ -299,11 +300,10 @@ pub(crate) fn eth_dev_adjust_nb_rx_tx_desc(
299300
300301/// Returns the value of promiscuous mode for a device.
301302pub ( crate ) fn eth_promiscuous_get ( port_id : PortId ) -> bool {
302- match unsafe { cffi:: rte_eth_promiscuous_get ( port_id. 0 ) . into_result ( DpdkError :: from_errno) } {
303- Ok ( 1 ) => true ,
304- // assuming port_id is valid, we treat error as mode disabled.
305- _ => false ,
306- }
303+ let mode =
304+ unsafe { cffi:: rte_eth_promiscuous_get ( port_id. 0 ) . into_result ( DpdkError :: from_errno) } ;
305+ // assuming port_id is valid, treats Ok(0) and Err(_) both as disabled.
306+ matches ! ( mode, Ok ( 1 ) )
307307}
308308
309309/// Enables receipt in promiscuous mode for a device.
@@ -326,11 +326,10 @@ pub(crate) fn eth_promiscuous_disable(port_id: PortId) -> Result<()> {
326326
327327/// Returns the value of allmulticast mode for a device.
328328pub ( crate ) fn eth_allmulticast_get ( port_id : PortId ) -> bool {
329- match unsafe { cffi:: rte_eth_allmulticast_get ( port_id. 0 ) . into_result ( DpdkError :: from_errno) } {
330- Ok ( 1 ) => true ,
331- // assuming port_id is valid, we treat error as mode disabled.
332- _ => false ,
333- }
329+ let mode =
330+ unsafe { cffi:: rte_eth_allmulticast_get ( port_id. 0 ) . into_result ( DpdkError :: from_errno) } ;
331+ // assuming port_id is valid, treats Ok(0) and Err(_) both as disabled.
332+ matches ! ( mode, Ok ( 1 ) )
334333}
335334
336335/// Enables the receipt of any multicast frame by a device.
0 commit comments