Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp138280lqg; Fri, 26 Apr 2024 10:50:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8d/3yAEFI9/BNYiOvMYsiZPqQ5yVYdFNaPyZ5k0UTstXmPn6JchsYIKDxKzVitXLWXhx2fXtmOG2GOWVGRsVFcF9tP4toiJ8XpsON2A== X-Google-Smtp-Source: AGHT+IGs6T4agm1w3dQ7Pxh3yHesGVEDdAkvOf5qWQ5wjWjcE1G/nLuIsvdcH5/u53uuk90bvDJt X-Received: by 2002:a05:6a20:9497:b0:1aa:590a:96d7 with SMTP id hs23-20020a056a20949700b001aa590a96d7mr4023846pzb.53.1714153847406; Fri, 26 Apr 2024 10:50:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714153847; cv=pass; d=google.com; s=arc-20160816; b=qNPbWvXm09GgvzDweGl0GMU/JTQyBigEYXU7us6J0d46FYEPktS7Va5VVJ1toO1WN7 GZ8Uid2mTy2L0KMN8YZjbvDbJ3+Ez8txY+Se14qknRQpzJFZACRldJg4tueIWX4ak1/7 Ym4TmOuX4vq3/5WCJ6012JJaGPxkX0DnW3JapjtUVcSJXTX5IZqzKDCVJdfYeovDrrz0 1ZEb5LxlJOQoCw4y6Jxtm9ZH3Cu0mvCAQEXXnE36hVsCyJyxaLcv525ZIIajcyHZ8dvG b3KpAYkoQ/Q9c8tmHqe/TD+aNpIUNJl0K52Hu7O9kle27HVAONegWfLMtiQ4GCCge534 iekw== 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=Bj9Wr6bJvBUA12ICZZ88R9dnEAsRSmHQe/2uWm86V4s=; fh=K0Z9i3lJIeY5eGvtJ/RSrPA0uTZKuKLMJp+SMwJXpTk=; b=TqL8qebSCJ46vWMqYt116MDChWGmjXN5rdDesD/P1zjaTygBYAaUVFQ3rnkOZMP+gn 5EpLrOhLd0i/5ZBrIgKZVmIptSohR4dbV5pifh71vQdv49fhvD7hZCO6cPqd8MCJBUEk XKwRjxlCz2w05vmSzCq2JhJR6V2MA/diwmalsYQQSEOBSoxS1B391RdsINzg+41wY+HD 49HOq6XHiIegsy0vbDUiDYl+rS+EJ0UJEY6j+R4Ub9p7+vPNEeqtYpg0jb/8HsWfDwcC EhgVByR/NSBdKwOqj5B51xZEZ7ZwUYlC6AaSRhDq44nyfPFGuIw5AqKFZUvqlj0FlNEo m0pw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=itPSYVBG; 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-160517-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160517-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 ca37-20020a056a0206a500b0060c153c48dbsi2454488pgb.713.2024.04.26.10.50.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 10:50:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160517-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=itPSYVBG; 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-160517-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160517-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 02BE3285E73 for ; Fri, 26 Apr 2024 17:50:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBF2C16F823; Fri, 26 Apr 2024 17:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="itPSYVBG" 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 514C416190A for ; Fri, 26 Apr 2024 17:50:05 +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=1714153807; cv=none; b=b+uGuUSWx5VAG8fJaEPC84FcmonpvGfALacENYwIO1Aiut2O6LBbudHcLqoQM9XprzE9Ke6gEroIUSfnk626s4N2gGBrd7YgW/IeklalyOf3MkfxIExJF+GDyf0am1GMmjuUFrA8HQAnY2ExA78FHSzTidoWhQtc/bp5IcOZxM0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714153807; c=relaxed/simple; bh=hcGrw5cZo3CJ6mE6tbTLq0OShRPGM/ZBTeWl8spEoqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ds0NnPLMLOmmYH6gLorY8f0tpAJ2NpoblyKqMq9KJNdmGZ3Pri74eNan/vZmrPrwqYGntplRygBd8yuABN/AAzp9Rg2w9i+ZFhq2IsQOCG6+jMxymfPGeU7phW7u5+dfuxmlyylz59nESjM7eWgmBoUt5Tv4Kb0CNtSbkeO1B5E= 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=itPSYVBG; 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=1714153805; 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=Bj9Wr6bJvBUA12ICZZ88R9dnEAsRSmHQe/2uWm86V4s=; b=itPSYVBG0dZ9mAhZ9a6rFmYWdpyOaINiIGzl1nKHQimg8DOuUOmvsXxAjUnCIoeiBat6dd 0O25Q1fxRqOG53pINe32eXFClbpTHRakWnXQD9hD0iPHwcAibMMWn1yz8kubukY2U0G/3h 2+4D3KhIm647lvJL3xq4DDTgVIzkCjU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-42-Rxa0yS5gNWmJlX0Fg7xnHQ-1; Fri, 26 Apr 2024 13:50:01 -0400 X-MC-Unique: Rxa0yS5gNWmJlX0Fg7xnHQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 4107D812C52; Fri, 26 Apr 2024 17:50:01 +0000 (UTC) Received: from p1.luc.cera.cz (unknown [10.45.225.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C3C2C13FA3; Fri, 26 Apr 2024 17:49:59 +0000 (UTC) From: Ivan Vecera To: netdev@vger.kernel.org Cc: Michal Schmidt , Tony Nguyen , Pucha Himasekhar Reddy , Jesse Brandeburg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , intel-wired-lan@lists.osuosl.org (moderated list:INTEL ETHERNET DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next v3 2/7] i40e: Refactor argument of several client notification functions Date: Fri, 26 Apr 2024 19:49:41 +0200 Message-ID: <20240426174953.208591-3-ivecera@redhat.com> In-Reply-To: <20240426174953.208591-1-ivecera@redhat.com> References: <20240426174953.208591-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.8 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 Reviewed-by: Tony Nguyen Tested-by: Pucha Himasekhar Reddy 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 e27b2aa544b6..aa874d6ff8c3 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -11276,14 +11276,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 { @@ -16217,7 +16215,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); @@ -16476,7 +16474,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) @@ -16530,7 +16528,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.2