Skip to content

Commit 1c78eb8

Browse files
committed
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-06-22 (iavf) This series contains updates to iavf driver only. Przemek defers removing, previous, primary MAC address until after getting result of adding its replacement. He also does some cleanup by removing unused functions and making applicable functions static. * '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue: iavf: make functions static where possible iavf: remove some unused functions and pointless wrappers iavf: fix err handling for MAC replace ==================== Link: https://lore.kernel.org/r/20230622165914.2203081-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 6a11af7 + a4aadf0 commit 1c78eb8

8 files changed

Lines changed: 55 additions & 142 deletions

File tree

drivers/net/ethernet/intel/iavf/iavf.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,6 @@ void iavf_schedule_request_stats(struct iavf_adapter *adapter);
523523
void iavf_reset(struct iavf_adapter *adapter);
524524
void iavf_set_ethtool_ops(struct net_device *netdev);
525525
void iavf_update_stats(struct iavf_adapter *adapter);
526-
void iavf_reset_interrupt_capability(struct iavf_adapter *adapter);
527-
int iavf_init_interrupt_scheme(struct iavf_adapter *adapter);
528-
void iavf_irq_enable_queues(struct iavf_adapter *adapter);
529526
void iavf_free_all_tx_resources(struct iavf_adapter *adapter);
530527
void iavf_free_all_rx_resources(struct iavf_adapter *adapter);
531528

@@ -579,17 +576,10 @@ void iavf_enable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid);
579576
void iavf_disable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid);
580577
void iavf_enable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid);
581578
void iavf_disable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid);
582-
int iavf_replace_primary_mac(struct iavf_adapter *adapter,
583-
const u8 *new_mac);
584-
void
585-
iavf_set_vlan_offload_features(struct iavf_adapter *adapter,
586-
netdev_features_t prev_features,
587-
netdev_features_t features);
588579
void iavf_add_fdir_filter(struct iavf_adapter *adapter);
589580
void iavf_del_fdir_filter(struct iavf_adapter *adapter);
590581
void iavf_add_adv_rss_cfg(struct iavf_adapter *adapter);
591582
void iavf_del_adv_rss_cfg(struct iavf_adapter *adapter);
592583
struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,
593584
const u8 *macaddr);
594-
int iavf_lock_timeout(struct mutex *lock, unsigned int msecs);
595585
#endif /* _IAVF_H_ */

drivers/net/ethernet/intel/iavf/iavf_alloc.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ enum iavf_status iavf_free_dma_mem(struct iavf_hw *hw,
2828
struct iavf_dma_mem *mem);
2929
enum iavf_status iavf_allocate_virt_mem(struct iavf_hw *hw,
3030
struct iavf_virt_mem *mem, u32 size);
31-
enum iavf_status iavf_free_virt_mem(struct iavf_hw *hw,
32-
struct iavf_virt_mem *mem);
31+
void iavf_free_virt_mem(struct iavf_hw *hw, struct iavf_virt_mem *mem);
3332

3433
#endif /* _IAVF_ALLOC_H_ */

drivers/net/ethernet/intel/iavf/iavf_common.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ enum iavf_status iavf_set_mac_type(struct iavf_hw *hw)
3535
status = IAVF_ERR_DEVICE_NOT_SUPPORTED;
3636
}
3737

38-
hw_dbg(hw, "found mac: %d, returns: %d\n", hw->mac.type, status);
3938
return status;
4039
}
4140

@@ -397,23 +396,6 @@ static enum iavf_status iavf_aq_get_set_rss_lut(struct iavf_hw *hw,
397396
return status;
398397
}
399398

400-
/**
401-
* iavf_aq_get_rss_lut
402-
* @hw: pointer to the hardware structure
403-
* @vsi_id: vsi fw index
404-
* @pf_lut: for PF table set true, for VSI table set false
405-
* @lut: pointer to the lut buffer provided by the caller
406-
* @lut_size: size of the lut buffer
407-
*
408-
* get the RSS lookup table, PF or VSI type
409-
**/
410-
enum iavf_status iavf_aq_get_rss_lut(struct iavf_hw *hw, u16 vsi_id,
411-
bool pf_lut, u8 *lut, u16 lut_size)
412-
{
413-
return iavf_aq_get_set_rss_lut(hw, vsi_id, pf_lut, lut, lut_size,
414-
false);
415-
}
416-
417399
/**
418400
* iavf_aq_set_rss_lut
419401
* @hw: pointer to the hardware structure
@@ -472,19 +454,6 @@ iavf_status iavf_aq_get_set_rss_key(struct iavf_hw *hw, u16 vsi_id,
472454
return status;
473455
}
474456

475-
/**
476-
* iavf_aq_get_rss_key
477-
* @hw: pointer to the hw struct
478-
* @vsi_id: vsi fw index
479-
* @key: pointer to key info struct
480-
*
481-
**/
482-
enum iavf_status iavf_aq_get_rss_key(struct iavf_hw *hw, u16 vsi_id,
483-
struct iavf_aqc_get_set_rss_key_data *key)
484-
{
485-
return iavf_aq_get_set_rss_key(hw, vsi_id, key, false);
486-
}
487-
488457
/**
489458
* iavf_aq_set_rss_key
490459
* @hw: pointer to the hw struct
@@ -828,17 +797,3 @@ void iavf_vf_parse_hw_config(struct iavf_hw *hw,
828797
vsi_res++;
829798
}
830799
}
831-
832-
/**
833-
* iavf_vf_reset
834-
* @hw: pointer to the hardware structure
835-
*
836-
* Send a VF_RESET message to the PF. Does not wait for response from PF
837-
* as none will be forthcoming. Immediately after calling this function,
838-
* the admin queue should be shut down and (optionally) reinitialized.
839-
**/
840-
enum iavf_status iavf_vf_reset(struct iavf_hw *hw)
841-
{
842-
return iavf_aq_send_msg_to_pf(hw, VIRTCHNL_OP_RESET_VF,
843-
0, NULL, 0, NULL);
844-
}

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -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
21802168
iavf_set_vlan_offload_features(struct iavf_adapter *adapter,
21812169
netdev_features_t prev_features,
21822170
netdev_features_t features)

drivers/net/ethernet/intel/iavf/iavf_osdep.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
/* get readq/writeq support for 32 bit kernels, use the low-first version */
1414
#include <linux/io-64-nonatomic-lo-hi.h>
1515

16-
/* File to be the magic between shared code and
17-
* actual OS primitives
18-
*/
19-
20-
#define hw_dbg(hw, S, A...) do {} while (0)
21-
2216
#define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
2317
#define rd32(a, reg) readl((a)->hw_addr + (reg))
2418

@@ -35,14 +29,11 @@ struct iavf_dma_mem {
3529

3630
#define iavf_allocate_dma_mem(h, m, unused, s, a) \
3731
iavf_allocate_dma_mem_d(h, m, s, a)
38-
#define iavf_free_dma_mem(h, m) iavf_free_dma_mem_d(h, m)
3932

4033
struct iavf_virt_mem {
4134
void *va;
4235
u32 size;
4336
};
44-
#define iavf_allocate_virt_mem(h, m, s) iavf_allocate_virt_mem_d(h, m, s)
45-
#define iavf_free_virt_mem(h, m) iavf_free_virt_mem_d(h, m)
4637

4738
#define iavf_debug(h, m, s, ...) \
4839
do { \

drivers/net/ethernet/intel/iavf/iavf_prototype.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,8 @@ enum iavf_status iavf_aq_queue_shutdown(struct iavf_hw *hw, bool unloading);
4040
const char *iavf_aq_str(struct iavf_hw *hw, enum iavf_admin_queue_err aq_err);
4141
const char *iavf_stat_str(struct iavf_hw *hw, enum iavf_status stat_err);
4242

43-
enum iavf_status iavf_aq_get_rss_lut(struct iavf_hw *hw, u16 seid,
44-
bool pf_lut, u8 *lut, u16 lut_size);
4543
enum iavf_status iavf_aq_set_rss_lut(struct iavf_hw *hw, u16 seid,
4644
bool pf_lut, u8 *lut, u16 lut_size);
47-
enum iavf_status iavf_aq_get_rss_key(struct iavf_hw *hw, u16 seid,
48-
struct iavf_aqc_get_set_rss_key_data *key);
4945
enum iavf_status iavf_aq_set_rss_key(struct iavf_hw *hw, u16 seid,
5046
struct iavf_aqc_get_set_rss_key_data *key);
5147

@@ -60,7 +56,6 @@ static inline struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
6056

6157
void iavf_vf_parse_hw_config(struct iavf_hw *hw,
6258
struct virtchnl_vf_resource *msg);
63-
enum iavf_status iavf_vf_reset(struct iavf_hw *hw);
6459
enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
6560
enum virtchnl_ops v_opcode,
6661
enum iavf_status v_retval,

drivers/net/ethernet/intel/iavf/iavf_txrx.c

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void iavf_unmap_and_free_tx_resource(struct iavf_ring *ring,
5454
* iavf_clean_tx_ring - Free any empty Tx buffers
5555
* @tx_ring: ring to be cleaned
5656
**/
57-
void iavf_clean_tx_ring(struct iavf_ring *tx_ring)
57+
static void iavf_clean_tx_ring(struct iavf_ring *tx_ring)
5858
{
5959
unsigned long bi_size;
6060
u16 i;
@@ -110,7 +110,7 @@ void iavf_free_tx_resources(struct iavf_ring *tx_ring)
110110
* Since there is no access to the ring head register
111111
* in XL710, we need to use our local copies
112112
**/
113-
u32 iavf_get_tx_pending(struct iavf_ring *ring, bool in_sw)
113+
static u32 iavf_get_tx_pending(struct iavf_ring *ring, bool in_sw)
114114
{
115115
u32 head, tail;
116116

@@ -127,6 +127,24 @@ u32 iavf_get_tx_pending(struct iavf_ring *ring, bool in_sw)
127127
return 0;
128128
}
129129

130+
/**
131+
* iavf_force_wb - Issue SW Interrupt so HW does a wb
132+
* @vsi: the VSI we care about
133+
* @q_vector: the vector on which to force writeback
134+
**/
135+
static void iavf_force_wb(struct iavf_vsi *vsi, struct iavf_q_vector *q_vector)
136+
{
137+
u32 val = IAVF_VFINT_DYN_CTLN1_INTENA_MASK |
138+
IAVF_VFINT_DYN_CTLN1_ITR_INDX_MASK | /* set noitr */
139+
IAVF_VFINT_DYN_CTLN1_SWINT_TRIG_MASK |
140+
IAVF_VFINT_DYN_CTLN1_SW_ITR_INDX_ENA_MASK
141+
/* allow 00 to be written to the index */;
142+
143+
wr32(&vsi->back->hw,
144+
IAVF_VFINT_DYN_CTLN1(q_vector->reg_idx),
145+
val);
146+
}
147+
130148
/**
131149
* iavf_detect_recover_hung - Function to detect and recover hung_queues
132150
* @vsi: pointer to vsi struct with tx queues
@@ -352,25 +370,6 @@ static void iavf_enable_wb_on_itr(struct iavf_vsi *vsi,
352370
q_vector->arm_wb_state = true;
353371
}
354372

355-
/**
356-
* iavf_force_wb - Issue SW Interrupt so HW does a wb
357-
* @vsi: the VSI we care about
358-
* @q_vector: the vector on which to force writeback
359-
*
360-
**/
361-
void iavf_force_wb(struct iavf_vsi *vsi, struct iavf_q_vector *q_vector)
362-
{
363-
u32 val = IAVF_VFINT_DYN_CTLN1_INTENA_MASK |
364-
IAVF_VFINT_DYN_CTLN1_ITR_INDX_MASK | /* set noitr */
365-
IAVF_VFINT_DYN_CTLN1_SWINT_TRIG_MASK |
366-
IAVF_VFINT_DYN_CTLN1_SW_ITR_INDX_ENA_MASK
367-
/* allow 00 to be written to the index */;
368-
369-
wr32(&vsi->back->hw,
370-
IAVF_VFINT_DYN_CTLN1(q_vector->reg_idx),
371-
val);
372-
}
373-
374373
static inline bool iavf_container_is_rx(struct iavf_q_vector *q_vector,
375374
struct iavf_ring_container *rc)
376375
{
@@ -687,7 +686,7 @@ int iavf_setup_tx_descriptors(struct iavf_ring *tx_ring)
687686
* iavf_clean_rx_ring - Free Rx buffers
688687
* @rx_ring: ring to be cleaned
689688
**/
690-
void iavf_clean_rx_ring(struct iavf_ring *rx_ring)
689+
static void iavf_clean_rx_ring(struct iavf_ring *rx_ring)
691690
{
692691
unsigned long bi_size;
693692
u16 i;

0 commit comments

Comments
 (0)