Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3422369pxf; Mon, 29 Mar 2021 01:36:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi+Xerfd6F0+MyHUivkI/RxyAUovqsZnte/3wWFYcJZ1Wev/4xFZXYcUu4j6AMWZKb3/Zz X-Received: by 2002:a05:6402:3593:: with SMTP id y19mr27349606edc.317.1617007007766; Mon, 29 Mar 2021 01:36:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617007007; cv=none; d=google.com; s=arc-20160816; b=FyAUoX/VAjlWuDCV4QPwzyZMVWmlaL3WtEZAqzJpxs5l+BTPbs/3xURfxOOP7ciJGL DICD0z8S0SmwrKn+rfHAigSK9jQjA0JRR/SVhD4TFmwAZD/HLnj3rzd+l6a3ZPJMio2T c5tsiSYJtx3S/W4y7mqpuOsUf2tHnvUw4PNkynaEZwu1hrg1VYdwp078kPtBCrNd4A5J kKmJZOYtGyD3FIXtKmPlDh8xj+6px5WyyBDrcw1UPCmvWvuARVG0o4r7+b8zOf6X7pNv U1Nb+mpJkUtqprxls2/dWY+BeyfeQt1DpAxF+/HDXDvchh7+yxEQ4v/macoxrqfHc31Q rwLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bICHlzyWmPjjFIlGxOoTYkbmmqvJGJT3e8YuXLuxEG8=; b=cfPBTO+hr+bmrGTP01J9j6L5G+h7WkZyFSY7JopznLS6kSdvdwEmL/lx27DZCn3FMH GAxgCxOOAdeLP/HS41nD9PMAgUntBk0g/MQeUhF1dQ7bMRk/C+A0hP255UxRFQU07VyV qVvsGHFcYAoa1gvRwcWt7Zwn/aTexoZrht1VSoWxjxtlLuvK39GN+wGauaNL+GAwQ/0i VThTaFo8/CIf7guQ7mnFEC4hWHkhu6+GQad3sPXBlBLKkXHYLwtIoE38joCPXb2dtgXt L3xUnZLVjETbPVl2N8NxF7REl9/Ha8orNlvCRX9IDz2FcYR8ojHxhEWTN3l+pe1X9e4D cp3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D/6zazSY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si11850774eja.625.2021.03.29.01.36.25; Mon, 29 Mar 2021 01:36:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D/6zazSY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234656AbhC2IdY (ORCPT + 99 others); Mon, 29 Mar 2021 04:33:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:37810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232290AbhC2IUt (ORCPT ); Mon, 29 Mar 2021 04:20:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9737161601; Mon, 29 Mar 2021 08:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006049; bh=SYxeOhqfQo1AdueVitiqw7jOCAaQFi5n0p20gIk1kyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D/6zazSYRcpe9U754nDShoMel9+HQ2SgL9OgwDNTHSBDt3T4t4kdjL7jx6UYbB3yr 7VfllJwuJixUWVWuneXP2vNODUsZvOUdXgQR1DFfRymoWXOFRCzKkjKACv73KnHvbc CjxAkRsnVBal+LYBk8h6PVhuthcw6iHuprtW1rvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.10 098/221] net/mlx5e: When changing XDP program without reset, take refs for XSK RQs Date: Mon, 29 Mar 2021 09:57:09 +0200 Message-Id: <20210329075632.474593670@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Mikityanskiy [ Upstream commit e5eb01344e9b09bb9d255b9727449186f7168df8 ] Each RQ (including XSK RQs) takes a reference to the XDP program. When an XDP program is attached or detached, the channels and queues are recreated, however, there is a special flow for changing an active XDP program to another one. In that flow, channels and queues stay alive, but the refcounts of the old and new XDP programs are adjusted. This flow didn't increment refcount by the number of active XSK RQs, and this commit fixes it. Fixes: db05815b36cb ("net/mlx5e: Add XSK zero-copy support") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 8b0826d689c0..0dc572aaf177 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4494,8 +4494,10 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) struct mlx5e_channel *c = priv->channels.c[i]; mlx5e_rq_replace_xdp_prog(&c->rq, prog); - if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) + if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) { + bpf_prog_inc(prog); mlx5e_rq_replace_xdp_prog(&c->xskrq, prog); + } } unlock: -- 2.30.1