Skip to content

Commit 54c4664

Browse files
iveceraanguy11
authored andcommitted
i40e: Refactor argument of several client notification functions
Commit 0ef2d5a ("i40e: KISS the client interface") simplified the client interface so in practice it supports only one client per i40e netdev. But we have still 2 notification functions that uses as parameter a pointer to VSI of netdevice associated with the client. After the mentioned commit only possible and used VSI is the main (LAN) VSI. So refactor these functions so they are called with PF pointer argument and the associated VSI (LAN) is taken inside them. Reviewed-by: Michal Schmidt <mschmidt@redhat.com> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> Signed-off-by: Ivan Vecera <ivecera@redhat.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent b92379d commit 54c4664

3 files changed

Lines changed: 17 additions & 19 deletions

File tree

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,8 +1236,8 @@ static inline void i40e_dbg_exit(void) {}
12361236
int i40e_lan_add_device(struct i40e_pf *pf);
12371237
int i40e_lan_del_device(struct i40e_pf *pf);
12381238
void i40e_client_subtask(struct i40e_pf *pf);
1239-
void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi);
1240-
void i40e_notify_client_of_netdev_close(struct i40e_vsi *vsi, bool reset);
1239+
void i40e_notify_client_of_l2_param_changes(struct i40e_pf *pf);
1240+
void i40e_notify_client_of_netdev_close(struct i40e_pf *pf, bool reset);
12411241
void i40e_notify_client_of_vf_enable(struct i40e_pf *pf, u32 num_vfs);
12421242
void i40e_notify_client_of_vf_reset(struct i40e_pf *pf, u32 vf_id);
12431243
void i40e_client_update_msix_info(struct i40e_pf *pf);

drivers/net/ethernet/intel/i40e/i40e_client.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,26 @@ i40e_notify_client_of_vf_msg(struct i40e_vsi *vsi, u32 vf_id, u8 *msg, u16 len)
101101

102102
/**
103103
* i40e_notify_client_of_l2_param_changes - call the client notify callback
104-
* @vsi: the VSI with l2 param changes
104+
* @pf: PF device pointer
105105
*
106-
* If there is a client to this VSI, call the client
106+
* If there is a client, call its callback
107107
**/
108-
void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi)
108+
void i40e_notify_client_of_l2_param_changes(struct i40e_pf *pf)
109109
{
110-
struct i40e_pf *pf = vsi->back;
111110
struct i40e_client_instance *cdev = pf->cinst;
111+
struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
112112
struct i40e_params params;
113113

114114
if (!cdev || !cdev->client)
115115
return;
116116
if (!cdev->client->ops || !cdev->client->ops->l2_param_change) {
117-
dev_dbg(&vsi->back->pdev->dev,
117+
dev_dbg(&pf->pdev->dev,
118118
"Cannot locate client instance l2_param_change routine\n");
119119
return;
120120
}
121121
if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
122-
dev_dbg(&vsi->back->pdev->dev, "Client is not open, abort l2 param change\n");
122+
dev_dbg(&pf->pdev->dev,
123+
"Client is not open, abort l2 param change\n");
123124
return;
124125
}
125126
memset(&params, 0, sizeof(params));
@@ -157,20 +158,19 @@ static void i40e_client_release_qvlist(struct i40e_info *ldev)
157158

158159
/**
159160
* i40e_notify_client_of_netdev_close - call the client close callback
160-
* @vsi: the VSI with netdev closed
161+
* @pf: PF device pointer
161162
* @reset: true when close called due to a reset pending
162163
*
163164
* If there is a client to this netdev, call the client with close
164165
**/
165-
void i40e_notify_client_of_netdev_close(struct i40e_vsi *vsi, bool reset)
166+
void i40e_notify_client_of_netdev_close(struct i40e_pf *pf, bool reset)
166167
{
167-
struct i40e_pf *pf = vsi->back;
168168
struct i40e_client_instance *cdev = pf->cinst;
169169

170170
if (!cdev || !cdev->client)
171171
return;
172172
if (!cdev->client->ops || !cdev->client->ops->close) {
173-
dev_dbg(&vsi->back->pdev->dev,
173+
dev_dbg(&pf->pdev->dev,
174174
"Cannot locate client instance close routine\n");
175175
return;
176176
}

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11276,14 +11276,12 @@ static void i40e_service_task(struct work_struct *work)
1127611276
i40e_fdir_reinit_subtask(pf);
1127711277
if (test_and_clear_bit(__I40E_CLIENT_RESET, pf->state)) {
1127811278
/* Client subtask will reopen next time through. */
11279-
i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi],
11280-
true);
11279+
i40e_notify_client_of_netdev_close(pf, true);
1128111280
} else {
1128211281
i40e_client_subtask(pf);
1128311282
if (test_and_clear_bit(__I40E_CLIENT_L2_CHANGE,
1128411283
pf->state))
11285-
i40e_notify_client_of_l2_param_changes(
11286-
pf->vsi[pf->lan_vsi]);
11284+
i40e_notify_client_of_l2_param_changes(pf);
1128711285
}
1128811286
i40e_sync_filters_subtask(pf);
1128911287
} else {
@@ -16217,7 +16215,7 @@ static void i40e_remove(struct pci_dev *pdev)
1621716215
/* Client close must be called explicitly here because the timer
1621816216
* has been stopped.
1621916217
*/
16220-
i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
16218+
i40e_notify_client_of_netdev_close(pf, false);
1622116219

1622216220
i40e_fdir_teardown(pf);
1622316221

@@ -16476,7 +16474,7 @@ static void i40e_shutdown(struct pci_dev *pdev)
1647616474
/* Client close must be called explicitly here because the timer
1647716475
* has been stopped.
1647816476
*/
16479-
i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
16477+
i40e_notify_client_of_netdev_close(pf, false);
1648016478

1648116479
if (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) &&
1648216480
pf->wol_en)
@@ -16530,7 +16528,7 @@ static int i40e_suspend(struct device *dev)
1653016528
/* Client close must be called explicitly here because the timer
1653116529
* has been stopped.
1653216530
*/
16533-
i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
16531+
i40e_notify_client_of_netdev_close(pf, false);
1653416532

1653516533
if (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) &&
1653616534
pf->wol_en)

0 commit comments

Comments
 (0)