From patchwork Fri May 31 11:15:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13681519 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A864D745E7; Fri, 31 May 2024 11:16:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717154164; cv=none; b=oXlGngCgMPxyjKnSv9kqy2qS9gZiERhOnCmt4pXmQveeVCRrrlgmIbLUrmPenHY1EcsomEkGpKrfSlX4fFg4JFvBIoykr9Ct1dKEDthZ89s59QAPHJpex6gHUxGxktsjluxMzDNCVhE2AdJNcQi1y8Pw4kCMCXCA6X5qlktnjFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717154164; c=relaxed/simple; bh=lzU+ACahgdWp8DXcp9/J0T05KhWTiXpBLy8PGomSY14=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KcHW9phTfvJTjiWYivozesl0NleuShHsdlg7jEZu1FO+HUlXcX1INYaZzPetox+oVfekGaYVzPF0lEcIp8RKKWmvOkXV1nNaP3eAQjUrhjyHVAtftP772IL3vvm41VVhZStvKTWPnuoDeOM1LZkrc2skI/kLKEUnw6uq5V085iA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a6893c33403so5236066b.3; Fri, 31 May 2024 04:16:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717154161; x=1717758961; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=otBvvEMTLMLnzI9ZLifgCog+x7xxrRbOwj15O7mxl/g=; b=fSfveSvcFTKPGQmvVk2rXtbx+w72BEXLQtLO79tDghTpAjlhEnP4nyn+Npb9Lqkq3K pBls7rS605SHqRdiGqMeomcAIo+EemA8hD/AAvccvQrS709ONTBBA2c+Iy2fkX631I3H 3ETOXgYSw8iWrjN3v3PSrtZEYrE3evgMCV0rDlK0zw3rSW+1MzBkAcQJ6c7FrKkp4Icc B4tpsLJ6kzOhy2bav3QkIcg4ccPe0WSepIC4DeGixC4RBC6ja6rOP6hmg+AGTlJs51px yNCy05ceFyN85vYFs6+1AbdaFcgRNF84uDb1T8b6IWAYZTLUhJaUb2F2E+cVCYaFmovY QeIA== X-Forwarded-Encrypted: i=1; AJvYcCVFiFJLTYDP+J62dJ+93NfBIE+ZlJu6D2R4ikAn2ggI3obCFe7AuR0K88TTHBAiPuqp4pET8nhzVBnKgADQKaShDcLuZZXxC45vqytc X-Gm-Message-State: AOJu0Yw76E8n3J0nA0+s+FuBkrylPH/97WzhGDx1A7K87HEQOesQBwi0 p0AsGkF0XIY0kr9MzG0u2aVrC4dgmEWkG6i6prWfvdTg+rmr7pBs X-Google-Smtp-Source: AGHT+IEoBf5u3A5Syw/lTniBy3rP5CqaR9zdYeTxFTfMNe2FbFjsxeJnBvTnP+Rdo1EjmwdKQK5RzQ== X-Received: by 2002:a17:906:175a:b0:a63:2698:2163 with SMTP id a640c23a62f3a-a681fc5d513mr141285066b.7.1717154160854; Fri, 31 May 2024 04:16:00 -0700 (PDT) Received: from localhost (fwdproxy-lla-004.fbsv.net. [2a03:2880:30ff:4::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a67e78db9b9sm75815266b.97.2024.05.31.04.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 04:16:00 -0700 (PDT) From: Breno Leitao To: Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, horms@kernel.org, dev@openvswitch.org (open list:OPENVSWITCH), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 1/2] openvswitch: Move stats allocation to core Date: Fri, 31 May 2024 04:15:49 -0700 Message-ID: <20240531111552.3209198-1-leitao@debian.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org With commit 34d21de99cea9 ("net: Move {l,t,d}stats allocation to core and convert veth & vrf"), stats allocation could be done on net core instead of this driver. With this new approach, the driver doesn't have to bother with error handling (allocation failure checking, making sure free happens in the right spot, etc). This is core responsibility now. Move openvswitch driver to leverage the core allocation. Signed-off-by: Breno Leitao --- net/openvswitch/vport-internal_dev.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c index 74c88a6baa43..7daba6ac6912 100644 --- a/net/openvswitch/vport-internal_dev.c +++ b/net/openvswitch/vport-internal_dev.c @@ -140,11 +140,7 @@ static struct vport *internal_dev_create(const struct vport_parms *parms) err = -ENOMEM; goto error_free_vport; } - vport->dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!vport->dev->tstats) { - err = -ENOMEM; - goto error_free_netdev; - } + dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; dev_net_set(vport->dev, ovs_dp_get_net(vport->dp)); dev->ifindex = parms->desired_ifindex; @@ -169,8 +165,6 @@ static struct vport *internal_dev_create(const struct vport_parms *parms) error_unlock: rtnl_unlock(); - free_percpu(dev->tstats); -error_free_netdev: free_netdev(dev); error_free_vport: ovs_vport_free(vport); @@ -186,7 +180,6 @@ static void internal_dev_destroy(struct vport *vport) /* unregister_netdevice() waits for an RCU grace period. */ unregister_netdevice(vport->dev); - free_percpu(vport->dev->tstats); rtnl_unlock(); } From patchwork Fri May 31 11:15:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13681520 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C8B0745E7; Fri, 31 May 2024 11:16:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717154171; cv=none; b=a6oTDFUphKbY2OhoJl32KGYlmFzn7tbrsUpEE3Ljvl8iCqRHr5/bmLGb69CVD5esPaOydpwq1kMd2fMPYL62hbyILa5Ev+QBDDCU8ch+xfNqUIpCvadJtk9VdrBcdb9Ezf2zAUhmBONWYhYkAreJXuMG6dz1Aui6zXbO5UQIMQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717154171; c=relaxed/simple; bh=nO788btYOfbgY9PwApNR0EY21VGu1jdGSBnrLexNxD0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jPnIqfFwlI0qlUbXQGBB+ySY+3xRfS4ink94J0ylSjb4REZvbjX3n7cwgZFl6HEfvC07hXDFBkuS+1j5qPUINzD2MO0IqCPaOmUwUGgoFXRKGjI3Go/VeE3wSdBaEIg2GThCOWHtbnQelNhrIgcUfXxNHRhRvsAahDQa08JEP0g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a688d7e0eceso30387966b.3; Fri, 31 May 2024 04:16:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717154168; x=1717758968; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5JKt3epdML/t49nbGx1wXSnWIf2u7N7ttQPQyMq5sDQ=; b=ooVLmeT9pQ1NTrw1HptnIdHITY4sk/RtbIUp9u8sqoJIyxcBl/wOEDb2IR/Ca6BOdq plQUCZhOaGxD8HZb4OXOe2oNTkVxK93cAY5998vzySn8jPbj95vMGotP8Q0289QO0lnE jqrnVdEhr+Wh6ZadAqusrJvvTvfnQZvIn6akjNjfoDE0MXoz4RYt7nLRMYAbM+Y8gyzA 347U1rrUBJIa9X0HgVOpKIuRf/34PaCmQ14AsxCNFmDHmH73CB0Ur8WShF31vrdJwnnc zxnF7ILJq6HcrXFAvH3lkslEA2o8KHYQWhEeLo9zg5fRfAF5EQE6PLbztU2AMG90XUtq dNjg== X-Forwarded-Encrypted: i=1; AJvYcCW0jthuyOeEkBYmijw2CIEVE0HgYlMzpNcBATD+s94aq+0w4Mcrbvf31nKTrkd5QeCvEaclVWf9vA3ZOtbnrzP+fzgHmr0julIWwBUj X-Gm-Message-State: AOJu0Yy89fthta56xLrY8XY/BU/pSSok+/Q1uxuP3DjhnZfoBaP8dHID NTFsb7HMVU/2RHinfD55nFNgPHVlVFNmXiX/VVbW+oc9hjs71mLZ X-Google-Smtp-Source: AGHT+IE9d7L0hI9U/YFi+ikwDoPuo687q9bP9rT2JoqNkinpNTzbi+zZI8/8ks50byP9jTfg7k0DGg== X-Received: by 2002:a17:906:e246:b0:a64:eca6:b15a with SMTP id a640c23a62f3a-a682204999bmr116166166b.53.1717154167812; Fri, 31 May 2024 04:16:07 -0700 (PDT) Received: from localhost (fwdproxy-lla-003.fbsv.net. [2a03:2880:30ff:3::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a67eab85be4sm74865566b.157.2024.05.31.04.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 04:16:07 -0700 (PDT) From: Breno Leitao To: Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, horms@kernel.org, dev@openvswitch.org (open list:OPENVSWITCH), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 2/2] openvswitch: Remove generic .ndo_get_stats64 Date: Fri, 31 May 2024 04:15:50 -0700 Message-ID: <20240531111552.3209198-2-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240531111552.3209198-1-leitao@debian.org> References: <20240531111552.3209198-1-leitao@debian.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Commit 3e2f544dd8a33 ("net: get stats64 if device if driver is configured") moved the callback to dev_get_tstats64() to net core, so, unless the driver is doing some custom stats collection, it does not need to set .ndo_get_stats64. Since this driver is now relying in NETDEV_PCPU_STAT_TSTATS, then, it doesn't need to set the dev_get_tstats64() generic .ndo_get_stats64 function pointer. Signed-off-by: Breno Leitao Reviewed-by: Subbaraya Sundeep --- net/openvswitch/vport-internal_dev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c index 7daba6ac6912..4b33133cbdff 100644 --- a/net/openvswitch/vport-internal_dev.c +++ b/net/openvswitch/vport-internal_dev.c @@ -85,7 +85,6 @@ static const struct net_device_ops internal_dev_netdev_ops = { .ndo_stop = internal_dev_stop, .ndo_start_xmit = internal_dev_xmit, .ndo_set_mac_address = eth_mac_addr, - .ndo_get_stats64 = dev_get_tstats64, }; static struct rtnl_link_ops internal_dev_link_ops __read_mostly = {