Received: by 2002:ab2:23c8:0:b0:1f2:fdbc:cb93 with SMTP id a8csp142516lqe; Wed, 27 Mar 2024 01:04:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUx7xs6JtYXi+9ENw0ZyLicjIi2Mvse2sdeL9R/K+TXpNlgYLw126H3iLCFGeE4rbYN/bk2izVRJR2kVplPjTHHchyXY9y+w0MQC7C5Kw== X-Google-Smtp-Source: AGHT+IEVKZcQ3Szh8d6hML4+22kCxc6CwR9jfi8Wa3f6YK7723qgDoaa1LouBB3ExeeF1vbUjVf9 X-Received: by 2002:a17:902:e9cd:b0:1e0:4ce4:7e42 with SMTP id 13-20020a170902e9cd00b001e04ce47e42mr502314plk.17.1711526662871; Wed, 27 Mar 2024 01:04:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711526662; cv=pass; d=google.com; s=arc-20160816; b=lZO8ORvXBjXYhH555KFhjHqC2hDjzl12sVcTMk0tL/yTI6SDMEwmjyrDZ5NVrPPmmd 7eS4WUyT4JZL9+ZP8I2NMr7uv4GARmxJiCLRd5E13sUqFG3M0ogVHWxeqoh4Ftd9CeLo +nHWy7zwC4eSTXOkHag6ClAxsy6A5SnH8abxkDVjNMf++URA8AarApZfIiilR0qWCk/M J2Lb8ajtPTcA1fvY9Lt0hrN1P5f1mQKs+JoWu9hW77x79H4W7uaJDNWe/JrDqPSNIf65 /68UFWwT8W/+ivOpDIWhmo8OA4SzZRsUjkpJ0j6/1AWCjLNzl2Vssp2mW9iYD8JHRAYY 6pfA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=743xqqMxvEa8pf291lhegMW777M4srXuD6J4SDbXQ5g=; fh=LttDPJ5Ee4PCAxGT1oGINSa8eHk8IA0/KLDF6QTPubo=; b=wc86W+4QmB48a8Z4iFgozPcM4SOTkENOfSg2jFyfVSK1Z/iRWfra6eW4zLDVc4cEtr pdKkJ6mpxk7xRa3ap0mPpdAcuW8n1Kuf05F4Dqg9oaKv6Pfkq1iysKaAFUbCtuvrgTdo jkBvNc/Kh4XgEAVFsgV1qFpFoFGIHCkfOUEdgrgVvZ7fd/N4J3GfhRPAsQVaIPDtyEi8 fgb/n5EPTw4tnM23mmgbMjTtJFusW99GB1uN29UdKF+dgFIq4V6SAOjrzd8JOd9JLTWA eJh7yoRJH72UiDY/rCEh4slyEZW1Apld5kWWBuojmK83WBkLAkOtA47AVdqF6lbIlWKz zLbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WRNQtcAk; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-120469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m8-20020a170902db0800b001e0c121791asi5450360plx.540.2024.03.27.01.04.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 01:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WRNQtcAk; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-120469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C48F829BB1A for ; Wed, 27 Mar 2024 07:53:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3538A374EE; Wed, 27 Mar 2024 07:48:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WRNQtcAk" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EADB364A0 for ; Wed, 27 Mar 2024 07:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711525734; cv=none; b=RHqQmvfOIYLL9w1VT6i2pCSk2lqR0pBKy7pZpo6eh6DYOtXznDuaEaFb3ddEE8EMkq04Th8MefSWWJg2MNvbbdnMH1/E5k2dPmrDbv5TYCLGkotdirIn/lFACx/F4wOPx8uR9KGhvKk0ukjvRjw6WMUjJyC2q8lRh7WOXuI4H60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711525734; c=relaxed/simple; bh=7YMhfk0p2O36gZWTX2RotZ/8+ijBT+vuda5UTe+68oo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iPlnnWyr1Z6a4F7tIrkQ6Cjzl8HtYJtl2MrdeMEDYYXjZvb2WQIAqKhu2giSt8nFDXRWRIIvl/trckS0u0kRzGrTCSRVsYI0SBmubREQ96E4oE5ZmpBPPeIGSA2ElK1R7gbrWUkRdzHA1Q4FplBwjpVAr0EMwzdeWAxQauDiCME= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=WRNQtcAk; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711525730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=743xqqMxvEa8pf291lhegMW777M4srXuD6J4SDbXQ5g=; b=WRNQtcAkjdn+fRpD9YjdqVGZcMUOMJ56vV8h5RRTRFAhpsMTdtnrZEtz2lo40aVEPFycHy 1/CJfbsGz+FqoARNCFSvzrCEMgLhPyGh1+YmxIgcKJnfkaWdDDlOmR9BDg3kGZr/wFWHD9 junk5l0pF8UVRCV4fhcYIbW8iqHomo8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-574-hNsPy_KzPli9ocmHw0iLrA-1; Wed, 27 Mar 2024 03:48:46 -0400 X-MC-Unique: hNsPy_KzPli9ocmHw0iLrA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 834FA1C01719; Wed, 27 Mar 2024 07:48:45 +0000 (UTC) Received: from p1.luc.cera.cz (unknown [10.45.224.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7205492BDA; Wed, 27 Mar 2024 07:48:43 +0000 (UTC) From: Ivan Vecera To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, mschmidt@redhat.com, aleksandr.loktionov@intel.com, jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Subject: [PATCH iwl-next v2 3/8] i40e: Refactor argument of several client notification functions Date: Wed, 27 Mar 2024 08:48:28 +0100 Message-ID: <20240327074833.8701-4-ivecera@redhat.com> In-Reply-To: <20240327074833.8701-1-ivecera@redhat.com> References: <20240327074833.8701-1-ivecera@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 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 Signed-off-by: Ivan Vecera --- drivers/net/ethernet/intel/i40e/i40e.h | 4 ++-- drivers/net/ethernet/intel/i40e/i40e_client.c | 20 +++++++++---------- drivers/net/ethernet/intel/i40e/i40e_main.c | 12 +++++------ 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 5248e78f7849..0792c7324527 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -1236,8 +1236,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); diff --git a/drivers/net/ethernet/intel/i40e/i40e_client.c b/drivers/net/ethernet/intel/i40e/i40e_client.c index b32071ee84af..93e52138826e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_client.c +++ b/drivers/net/ethernet/intel/i40e/i40e_client.c @@ -101,25 +101,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(¶ms, 0, sizeof(params)); @@ -157,20 +158,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; } diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 2f1604ae78c7..7fed7fb69d4e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -11283,14 +11283,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 { @@ -16228,7 +16226,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); @@ -16487,7 +16485,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 (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) && pf->wol_en) @@ -16541,7 +16539,7 @@ static int 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 (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) && pf->wol_en) -- 2.43.0