Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9072413rwp; Wed, 19 Jul 2023 22:04:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlF/yabQRkwapx9CNdw1/OG11WaeaTMjjUnDxqIXZ8tVLvBBu9DbvKI/sRmgGSF2iMOUtDxN X-Received: by 2002:a05:6a20:414:b0:125:4d74:ac77 with SMTP id a20-20020a056a20041400b001254d74ac77mr3083083pza.42.1689829472629; Wed, 19 Jul 2023 22:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689829472; cv=none; d=google.com; s=arc-20160816; b=LYt7VZNx6CKUhe19Bj4D0MtDymSsYQcus/eMqGrEPq74AcSWr2FNBCbwsGe7zQGg03 Q6Az+oCiddWFMlkz1GuHh5mgTr9S5Goi+wGuuBKJIhOvYSRPVXveE1gr51MFUO0S9HD2 lvI+XCL734bp79T3whW6dTUqdTCpiFjp1GQhsXlOgAeEZMJQRBBx+IDTkzCTBVTkI9KD MAF2xYmkILphAxS838gjMgXdsOrA2Eqf0Ysf2FdEJSGf1b1w4jjJz+nSBbAdV/bPOvJE NVFKmbMG3WToCh4t/c1RIq+T9NsQebYuRCFBMjrbrqzBMBLQTfSC9CBhzeLDUpHQH4BC g4nA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=omDGoT61FtwPbYf9pv3gBlB9IQKwjZIx54Pgnbe/G+E=; fh=/9P10/wjP3k8lLEsNYggEcflKDor34xZXTyCe5c7J6c=; b=XjH30Jjbj/cf9Iw0wxBCKgE6P9LKJQnhRRKm8yEpuskzgRUukaUatYgmqPQUcHND0a uGNuC3d85ariahSE1z+QC0tfNzv75yrF/gQjLACrJBJ/Vgf0sDc9wzwUgFNrI50IGM4P wEahI4hGyRnh3NYxaLEHGYqobrE+n2SrDb3llgC+8Bqqs4JNIwbz3Z/QvtOFuykuAFBe zXKjC0/ges0PMnWF7XYuwHZD7QVBas4/Ljun195XxpCA5419kZNOSic2Yq4XbH7O+WqM JiM+qTe4GiSsTRuECsziskHy/ATH/vBhiEZBhidCXP+y0Ghjzk9YhYFesZ2q9W+YAJgL Zacw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ky2dINi/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a170902e84500b001b6aa82743esi169603plg.271.2023.07.19.22.04.20; Wed, 19 Jul 2023 22:04:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ky2dINi/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229528AbjGTDp5 (ORCPT + 99 others); Wed, 19 Jul 2023 23:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjGTDp4 (ORCPT ); Wed, 19 Jul 2023 23:45:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 943961FCD for ; Wed, 19 Jul 2023 20:45:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2E6776126D for ; Thu, 20 Jul 2023 03:45:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00A2EC433C8; Thu, 20 Jul 2023 03:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689824754; bh=z0i62JjuZ7ZlCOWbWdYwj78VlFeYhWN9ot1ReDkacAw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ky2dINi/AGQI0jKAECg1n2BYUJ8uk4hUBYBW4SzCHcMKYROrxiFVxazf9OL2VMrNP Tgc1Wv94Y+mKhMa8Mwm/EPHSlvJ4ktx4xD99UCujutg8jaK8i0KUR3DbzCJltUsDvz WTbJnDmH7pgx4tbBa7profEpRE1O+6PEhwbKLmclwpQAGtsfLsA+mN7PWhzAmlEBPl 8d+WVRLU7ACijBa5G66YVkol8cYX7H5As5Cl0/FqzsK0zm3QC3SjOx4/sCLG1BZlAF 7O0m/tFTMYdG3YqwJkBleaOSRAg7/8B/EYGy/sliPQmRa7QPfzr+ox02xnUxybv4J4 JefDu/63+IWRw== Date: Wed, 19 Jul 2023 20:45:53 -0700 From: Jakub Kicinski To: Wei Fang Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, xiaoning.wang@nxp.com, shenwei.wang@nxp.com, netdev@vger.kernel.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH net-next] net: fec: add XDP_TX feature support Message-ID: <20230719204553.46856b29@kernel.org> In-Reply-To: <20230717103709.2629372-1-wei.fang@nxp.com> References: <20230717103709.2629372-1-wei.fang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Jul 2023 18:37:09 +0800 Wei Fang wrote: > - xdp_return_frame(xdpf); > + if (txq->tx_buf[index].type == FEC_TXBUF_T_XDP_NDO) > + xdp_return_frame(xdpf); > + else > + xdp_return_frame_rx_napi(xdpf); Are you taking budget into account? When NAPI is called with budget of 0 we are *not* in napi / softirq context. You can't be processing any XDP tx under such conditions (it may be a netpoll call from IRQ context). > +static int fec_enet_xdp_tx_xmit(struct net_device *ndev, > + struct xdp_buff *xdp) > +{ > + struct xdp_frame *xdpf = xdp_convert_buff_to_frame(xdp); > + struct fec_enet_private *fep = netdev_priv(ndev); > + struct fec_enet_priv_tx_q *txq; > + int cpu = smp_processor_id(); > + struct netdev_queue *nq; > + int queue, ret; > + > + queue = fec_enet_xdp_get_tx_queue(fep, cpu); > + txq = fep->tx_queue[queue]; > + nq = netdev_get_tx_queue(fep->netdev, queue); > + > + __netif_tx_lock(nq, cpu); > + > + ret = fec_enet_txq_xmit_frame(fep, txq, xdpf, false); > + > + __netif_tx_unlock(nq); If you're reusing the same queues as the stack you need to call txq_trans_cond_update() at some point, otherwise the stack may print a splat complaining the queue got stuck. -- pw-bot: cr