Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * This file is based on code from OCTEON SDK by Cavium Networks.
0004  *
0005  * Copyright (c) 2003-2007 Cavium Networks
0006  */
0007 
0008 void cvm_oct_poll_controller(struct net_device *dev);
0009 void cvm_oct_rx_initialize(void);
0010 void cvm_oct_rx_shutdown(void);
0011 
0012 static inline void cvm_oct_rx_refill_pool(int fill_threshold)
0013 {
0014     int number_to_free;
0015     int num_freed;
0016     /* Refill the packet buffer pool */
0017     number_to_free =
0018         cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
0019 
0020     if (number_to_free > fill_threshold) {
0021         cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
0022                       -number_to_free);
0023         num_freed = cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL,
0024                          CVMX_FPA_PACKET_POOL_SIZE,
0025                          number_to_free);
0026         if (num_freed != number_to_free) {
0027             cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
0028                           number_to_free - num_freed);
0029         }
0030     }
0031 }