Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp383790pxb; Thu, 21 Jan 2021 09:17:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdRXXLp1sjbeZ+qYcLBbscFeC3fRKo3aGgRzy0RdmGcDtnp4uU+v7+z4lvLMeQkqmxOQ1K X-Received: by 2002:a17:906:6b08:: with SMTP id q8mr316376ejr.391.1611249425054; Thu, 21 Jan 2021 09:17:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611249425; cv=none; d=google.com; s=arc-20160816; b=sIDgGmu0wBP61J+K1ynvfHe841wmo5elJDMs0j6OzlSER0hrU+c8jaJYUf4nKBDMZZ T2VKMdosqYN6UedeLKM0NIGvmKMI2v+EmPlIRIsiIGqEhV/iKAJrqOVhg3FkUq/YFC3G reAzMhB0UCAxpVa9ljRwtzmzMxx/yl3DJH6Dded72o6CKZALgA9ZYmu3EPT2uogG1ED/ gwVC9Lpnwmbd6mVO7hnAxyMVfwPR5Yb1WuJpzBphkeEJMUmhGJuowpPOGhU92A/Fm/oe +5QjI7IZVFvMvHNE/ymBkuXrKIS5eImKgXaSv9s6nWRGaF78yeCbR6lmMxKf8BJrn8jU Yy7A== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=Zpfe9pV1wDccOzvvQj2AB8KEGCkQf3RaJd2xe765gDc=; b=wdLqRZyF+cBW9J05B+6ansZYfiupkwAeeOPVskiDbFL7AmBbcMxH+yQ7wfghbn3WVJ 6fTvZfAvr+tFh4ARGxN9WtR58R+aldZptgYcHvb17jcaBAlFdX2xuVoDS6TDWF3hmOpC OVinL0ON365MYMvfXarmYYPnr6u/tJcjjrBXXhzR8ShTqkARVwGM6n3ip+5O9xCe8mkl 9m3HwRNLD0Cx2+8axi/Tk7Fx8AOPacp43EdIcEDMzEcCcrYERgsz+hsF3GVJ+tmpSQEk fe25l3T5GT/LpaMCLXL14UfP0zdVBYymIiD+xB9uw6jcVn8SjVqWQ/ZKJkq+1GPXIgIL VkZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tp22aZQG; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ec18si1859388ejb.166.2021.01.21.09.16.35; Thu, 21 Jan 2021 09:17:05 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=Tp22aZQG; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388367AbhAURQC (ORCPT + 99 others); Thu, 21 Jan 2021 12:16:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52646 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388569AbhAURNJ (ORCPT ); Thu, 21 Jan 2021 12:13:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611249102; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zpfe9pV1wDccOzvvQj2AB8KEGCkQf3RaJd2xe765gDc=; b=Tp22aZQGNkl6ekin78dGWo8htIR3//vE75F/RRt7sz4MSy3zcow1eJiyQZVamTxsUHEKY4 oGIYAmyon5YWtv64VFw/j17G075kVDe16cKxBqhuGDcvMfI4Hwq2atlA29VfCJanzg1LLU lNzWAj348LPHHfEveEboKUWD9FmtvVg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-506-glX1a6oRMK6Ogrp9MQn1ng-1; Thu, 21 Jan 2021 12:11:38 -0500 X-MC-Unique: glX1a6oRMK6Ogrp9MQn1ng-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B87C80A5D7; Thu, 21 Jan 2021 17:11:36 +0000 (UTC) Received: from carbon (unknown [10.36.110.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 356AD5F9D7; Thu, 21 Jan 2021 17:11:32 +0000 (UTC) Date: Thu, 21 Jan 2021 18:11:30 +0100 From: Jesper Dangaard Brouer To: Ivan Babrou Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kernel-team@cloudflare.com, Edward Cree , Martin Habets , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend Subject: Re: [PATCH net-next] sfc: reduce the number of requested xdp ev queues Message-ID: <20210121181130.77c06723@carbon> In-Reply-To: <20210120212759.81548-1-ivan@cloudflare.com> References: <20210120212759.81548-1-ivan@cloudflare.com> Organization: Red Hat Inc. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Jan 2021 13:27:59 -0800 Ivan Babrou wrote: > Without this change the driver tries to allocate too many queues, > breaching the number of available msi-x interrupts on machines > with many logical cpus and default adapter settings: > > Insufficient resources for 12 XDP event queues (24 other channels, max 32) > > Which in turn triggers EINVAL on XDP processing: > > sfc 0000:86:00.0 ext0: XDP TX failed (-22) > > Signed-off-by: Ivan Babrou > --- I guess the patch is good in itself due to available msi-x interrupts. Per earlier discussion: What will happen if a CPU with an ID higher than available XDP TX-queues redirect a packet out this driver? > drivers/net/ethernet/sfc/efx_channels.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c > index a4a626e9cd9a..1bfeee283ea9 100644 > --- a/drivers/net/ethernet/sfc/efx_channels.c > +++ b/drivers/net/ethernet/sfc/efx_channels.c > @@ -17,6 +17,7 @@ > #include "rx_common.h" > #include "nic.h" > #include "sriov.h" > +#include "workarounds.h" > > /* This is the first interrupt mode to try out of: > * 0 => MSI-X > @@ -137,6 +138,7 @@ static int efx_allocate_msix_channels(struct efx_nic *efx, > { > unsigned int n_channels = parallelism; > int vec_count; > + int tx_per_ev; > int n_xdp_tx; > int n_xdp_ev; > > @@ -149,9 +151,9 @@ static int efx_allocate_msix_channels(struct efx_nic *efx, > * multiple tx queues, assuming tx and ev queues are both > * maximum size. > */ > - > + tx_per_ev = EFX_MAX_EVQ_SIZE / EFX_TXQ_MAX_ENT(efx); > n_xdp_tx = num_possible_cpus(); > - n_xdp_ev = DIV_ROUND_UP(n_xdp_tx, EFX_MAX_TXQ_PER_CHANNEL); > + n_xdp_ev = DIV_ROUND_UP(n_xdp_tx, tx_per_ev); > > vec_count = pci_msix_vec_count(efx->pci_dev); > if (vec_count < 0) -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer