@@ -192,12 +192,11 @@ enum iavf_status iavf_allocate_dma_mem_d(struct iavf_hw *hw,
192192}
193193
194194/**
195- * iavf_free_dma_mem_d - OS specific memory free for shared code
195+ * iavf_free_dma_mem - wrapper for DMA memory freeing
196196 * @hw: pointer to the HW structure
197197 * @mem: ptr to mem struct to free
198198 **/
199- enum iavf_status iavf_free_dma_mem_d (struct iavf_hw * hw ,
200- struct iavf_dma_mem * mem )
199+ enum iavf_status iavf_free_dma_mem (struct iavf_hw * hw , struct iavf_dma_mem * mem )
201200{
202201 struct iavf_adapter * adapter = (struct iavf_adapter * )hw -> back ;
203202
@@ -209,13 +208,13 @@ enum iavf_status iavf_free_dma_mem_d(struct iavf_hw *hw,
209208}
210209
211210/**
212- * iavf_allocate_virt_mem_d - OS specific memory alloc for shared code
211+ * iavf_allocate_virt_mem - virt memory alloc wrapper
213212 * @hw: pointer to the HW structure
214213 * @mem: ptr to mem struct to fill out
215214 * @size: size of memory requested
216215 **/
217- enum iavf_status iavf_allocate_virt_mem_d (struct iavf_hw * hw ,
218- struct iavf_virt_mem * mem , u32 size )
216+ enum iavf_status iavf_allocate_virt_mem (struct iavf_hw * hw ,
217+ struct iavf_virt_mem * mem , u32 size )
219218{
220219 if (!mem )
221220 return IAVF_ERR_PARAM ;
@@ -230,20 +229,13 @@ enum iavf_status iavf_allocate_virt_mem_d(struct iavf_hw *hw,
230229}
231230
232231/**
233- * iavf_free_virt_mem_d - OS specific memory free for shared code
232+ * iavf_free_virt_mem - virt memory free wrapper
234233 * @hw: pointer to the HW structure
235234 * @mem: ptr to mem struct to free
236235 **/
237- enum iavf_status iavf_free_virt_mem_d (struct iavf_hw * hw ,
238- struct iavf_virt_mem * mem )
236+ void iavf_free_virt_mem (struct iavf_hw * hw , struct iavf_virt_mem * mem )
239237{
240- if (!mem )
241- return IAVF_ERR_PARAM ;
242-
243- /* it's ok to kfree a NULL pointer */
244238 kfree (mem -> va );
245-
246- return 0 ;
247239}
248240
249241/**
@@ -253,7 +245,7 @@ enum iavf_status iavf_free_virt_mem_d(struct iavf_hw *hw,
253245 *
254246 * Returns 0 on success, negative on failure
255247 **/
256- int iavf_lock_timeout (struct mutex * lock , unsigned int msecs )
248+ static int iavf_lock_timeout (struct mutex * lock , unsigned int msecs )
257249{
258250 unsigned int wait , delay = 10 ;
259251
@@ -362,7 +354,7 @@ static void iavf_irq_disable(struct iavf_adapter *adapter)
362354 * iavf_irq_enable_queues - Enable interrupt for all queues
363355 * @adapter: board private structure
364356 **/
365- void iavf_irq_enable_queues (struct iavf_adapter * adapter )
357+ static void iavf_irq_enable_queues (struct iavf_adapter * adapter )
366358{
367359 struct iavf_hw * hw = & adapter -> hw ;
368360 int i ;
@@ -1003,44 +995,40 @@ struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,
1003995 *
1004996 * Do not call this with mac_vlan_list_lock!
1005997 **/
1006- int iavf_replace_primary_mac (struct iavf_adapter * adapter ,
1007- const u8 * new_mac )
998+ static int iavf_replace_primary_mac (struct iavf_adapter * adapter ,
999+ const u8 * new_mac )
10081000{
10091001 struct iavf_hw * hw = & adapter -> hw ;
1010- struct iavf_mac_filter * f ;
1002+ struct iavf_mac_filter * new_f ;
1003+ struct iavf_mac_filter * old_f ;
10111004
10121005 spin_lock_bh (& adapter -> mac_vlan_list_lock );
10131006
1014- list_for_each_entry (f , & adapter -> mac_filter_list , list ) {
1015- f -> is_primary = false;
1007+ new_f = iavf_add_filter (adapter , new_mac );
1008+ if (!new_f ) {
1009+ spin_unlock_bh (& adapter -> mac_vlan_list_lock );
1010+ return - ENOMEM ;
10161011 }
10171012
1018- f = iavf_find_filter (adapter , hw -> mac .addr );
1019- if (f ) {
1020- f -> remove = true;
1013+ old_f = iavf_find_filter (adapter , hw -> mac .addr );
1014+ if (old_f ) {
1015+ old_f -> is_primary = false;
1016+ old_f -> remove = true;
10211017 adapter -> aq_required |= IAVF_FLAG_AQ_DEL_MAC_FILTER ;
10221018 }
1023-
1024- f = iavf_add_filter (adapter , new_mac );
1025-
1026- if (f ) {
1027- /* Always send the request to add if changing primary MAC
1028- * even if filter is already present on the list
1029- */
1030- f -> is_primary = true;
1031- f -> add = true;
1032- adapter -> aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER ;
1033- ether_addr_copy (hw -> mac .addr , new_mac );
1034- }
1019+ /* Always send the request to add if changing primary MAC,
1020+ * even if filter is already present on the list
1021+ */
1022+ new_f -> is_primary = true;
1023+ new_f -> add = true;
1024+ adapter -> aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER ;
1025+ ether_addr_copy (hw -> mac .addr , new_mac );
10351026
10361027 spin_unlock_bh (& adapter -> mac_vlan_list_lock );
10371028
10381029 /* schedule the watchdog task to immediately process the request */
1039- if (f ) {
1040- mod_delayed_work (adapter -> wq , & adapter -> watchdog_task , 0 );
1041- return 0 ;
1042- }
1043- return - ENOMEM ;
1030+ mod_delayed_work (adapter -> wq , & adapter -> watchdog_task , 0 );
1031+ return 0 ;
10441032}
10451033
10461034/**
@@ -1863,7 +1851,7 @@ static void iavf_free_q_vectors(struct iavf_adapter *adapter)
18631851 * @adapter: board private structure
18641852 *
18651853 **/
1866- void iavf_reset_interrupt_capability (struct iavf_adapter * adapter )
1854+ static void iavf_reset_interrupt_capability (struct iavf_adapter * adapter )
18671855{
18681856 if (!adapter -> msix_entries )
18691857 return ;
@@ -1878,7 +1866,7 @@ void iavf_reset_interrupt_capability(struct iavf_adapter *adapter)
18781866 * @adapter: board private structure to initialize
18791867 *
18801868 **/
1881- int iavf_init_interrupt_scheme (struct iavf_adapter * adapter )
1869+ static int iavf_init_interrupt_scheme (struct iavf_adapter * adapter )
18821870{
18831871 int err ;
18841872
@@ -2176,7 +2164,7 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)
21762164 * the watchdog if any changes are requested to expedite the request via
21772165 * virtchnl.
21782166 **/
2179- void
2167+ static void
21802168iavf_set_vlan_offload_features (struct iavf_adapter * adapter ,
21812169 netdev_features_t prev_features ,
21822170 netdev_features_t features )
0 commit comments