]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i40e: Refactor argument of several client notification functions
authorIvan Vecera <ivecera@redhat.com>
Sat, 27 Apr 2024 07:26:03 +0000 (09:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:55 +0000 (13:09 +0100)
[ Upstream commit 54c4664e48eea52f2b296c73ddb8f5629b958678 ]

Commit 0ef2d5afb12d ("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>
Stable-dep-of: 699428342153 ("i40e: validate ring_len parameter against hardware-specific values")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_client.c
drivers/net/ethernet/intel/i40e/i40e_main.c

index e031906f23a4f38ec470bf45ff19ab4d7e06a747..bbd95b3d73263a0b7ca3b2d2e3440f061a0009e6 100644 (file)
@@ -1198,8 +1198,8 @@ static inline void i40e_dbg_exit(void) {}
 int i40e_lan_add_device(struct i40e_pf *pf);
 int i40e_lan_del_device(struct i40e_pf *pf);
 void i40e_client_subtask(struct i40e_pf *pf);
-void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi);
-void i40e_notify_client_of_netdev_close(struct i40e_vsi *vsi, bool reset);
+void i40e_notify_client_of_l2_param_changes(struct i40e_pf *pf);
+void i40e_notify_client_of_netdev_close(struct i40e_pf *pf, bool reset);
 void i40e_notify_client_of_vf_enable(struct i40e_pf *pf, u32 num_vfs);
 void i40e_notify_client_of_vf_reset(struct i40e_pf *pf, u32 vf_id);
 void i40e_client_update_msix_info(struct i40e_pf *pf);
index 4af2a4c5910671434a39714be2b208f94a2427b4..126223d28152cd50dea3ca89dd4aef0274c486a8 100644 (file)
@@ -102,25 +102,26 @@ i40e_notify_client_of_vf_msg(struct i40e_vsi *vsi, u32 vf_id, u8 *msg, u16 len)
 
 /**
  * i40e_notify_client_of_l2_param_changes - call the client notify callback
- * @vsi: the VSI with l2 param changes
+ * @pf: PF device pointer
  *
- * If there is a client to this VSI, call the client
+ * If there is a client, call its callback
  **/
-void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi)
+void i40e_notify_client_of_l2_param_changes(struct i40e_pf *pf)
 {
-       struct i40e_pf *pf = vsi->back;
        struct i40e_client_instance *cdev = pf->cinst;
+       struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
        struct i40e_params params;
 
        if (!cdev || !cdev->client)
                return;
        if (!cdev->client->ops || !cdev->client->ops->l2_param_change) {
-               dev_dbg(&vsi->back->pdev->dev,
+               dev_dbg(&pf->pdev->dev,
                        "Cannot locate client instance l2_param_change routine\n");
                return;
        }
        if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
-               dev_dbg(&vsi->back->pdev->dev, "Client is not open, abort l2 param change\n");
+               dev_dbg(&pf->pdev->dev,
+                       "Client is not open, abort l2 param change\n");
                return;
        }
        memset(&params, 0, sizeof(params));
@@ -160,20 +161,19 @@ static void i40e_client_release_qvlist(struct i40e_info *ldev)
 
 /**
  * i40e_notify_client_of_netdev_close - call the client close callback
- * @vsi: the VSI with netdev closed
+ * @pf: PF device pointer
  * @reset: true when close called due to a reset pending
  *
  * If there is a client to this netdev, call the client with close
  **/
-void i40e_notify_client_of_netdev_close(struct i40e_vsi *vsi, bool reset)
+void i40e_notify_client_of_netdev_close(struct i40e_pf *pf, bool reset)
 {
-       struct i40e_pf *pf = vsi->back;
        struct i40e_client_instance *cdev = pf->cinst;
 
        if (!cdev || !cdev->client)
                return;
        if (!cdev->client->ops || !cdev->client->ops->close) {
-               dev_dbg(&vsi->back->pdev->dev,
+               dev_dbg(&pf->pdev->dev,
                        "Cannot locate client instance close routine\n");
                return;
        }
index 8f9cbbfec63e7686d9eebe139d2f1539a01a192e..9671058cda409575c5230cb837bd5bba027226c7 100644 (file)
@@ -11284,14 +11284,12 @@ static void i40e_service_task(struct work_struct *work)
                i40e_fdir_reinit_subtask(pf);
                if (test_and_clear_bit(__I40E_CLIENT_RESET, pf->state)) {
                        /* Client subtask will reopen next time through. */
-                       i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi],
-                                                          true);
+                       i40e_notify_client_of_netdev_close(pf, true);
                } else {
                        i40e_client_subtask(pf);
                        if (test_and_clear_bit(__I40E_CLIENT_L2_CHANGE,
                                               pf->state))
-                               i40e_notify_client_of_l2_param_changes(
-                                                               pf->vsi[pf->lan_vsi]);
+                               i40e_notify_client_of_l2_param_changes(pf);
                }
                i40e_sync_filters_subtask(pf);
        } else {
@@ -16263,7 +16261,7 @@ static void i40e_remove(struct pci_dev *pdev)
        /* Client close must be called explicitly here because the timer
         * has been stopped.
         */
-       i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
+       i40e_notify_client_of_netdev_close(pf, false);
 
        i40e_fdir_teardown(pf);
 
@@ -16529,7 +16527,7 @@ static void i40e_shutdown(struct pci_dev *pdev)
        /* Client close must be called explicitly here because the timer
         * has been stopped.
         */
-       i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
+       i40e_notify_client_of_netdev_close(pf, false);
 
        if (pf->wol_en && (pf->hw_features & I40E_HW_WOL_MC_MAGIC_PKT_WAKE))
                i40e_enable_mc_magic_wake(pf);
@@ -16582,7 +16580,7 @@ static int __maybe_unused i40e_suspend(struct device *dev)
        /* Client close must be called explicitly here because the timer
         * has been stopped.
         */
-       i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
+       i40e_notify_client_of_netdev_close(pf, false);
 
        if (pf->wol_en && (pf->hw_features & I40E_HW_WOL_MC_MAGIC_PKT_WAKE))
                i40e_enable_mc_magic_wake(pf);