Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp206874pxb; Wed, 4 Nov 2020 19:57:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBidE0jd2JmZuQkZ3Vj4fCw2OKb45KblcT2utQo5tmI3Xj7/lKdoYmvxrkIKR31jYLflkZ X-Received: by 2002:aa7:c3c1:: with SMTP id l1mr614260edr.153.1604548656478; Wed, 04 Nov 2020 19:57:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604548656; cv=none; d=google.com; s=arc-20160816; b=kqBui1nT+pn47lHOqICCSaxmh2xcyinRfJ2CEhmiC3Nj0CEIrYEZr8ioHtP8DYjFuP 579WcShx+801gbIwTxu1ebChcLBPDf6mHmNPVXM3tAG1SUqgkGzhrZVejzZWMRHcTYQn dEr/XtCEkBwMAfkC9Z8l3mXVMjMhJ67MHotIxPWHhbt772rVdLGwDGJpcmDmFVxvoP2l byC2ClJHCVfo0ciz4ZliClQ8ayQD/Mc1dAUTwupmPLRA5PLIeI0Iv0KtxtMt8xbhsPM0 t9zAcs5TqdSJNL9rBuk0l/QX2xm9KsH0CIMMIYH3gfwxLmKtZO8HGQ9TzhfoMFCtN4Rv daGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=C7iVM7CexS9+qUxbevrmUipnJA4wJw4CIl0YWkvBdmU=; b=0QSqi+q3WG3syEb1rHcetmUD6vMvbQ7gLDI1/rtYo/C5tbXkbvW1SmlEkQ1ZXW2ugK FLe/JSx9oPTNgSGibiO/h5RGvA7yU5cFzt5CYG5jqlIcyAcGnW/7U88UoLjiER+BPssv HGdD+IRfEAPwY9QBkLvLlSdg7g68vk9sQDM0QeEEyTyTZBkM40fEMyo6DtZJ1TtQqrfv +7Jy5oYQVFJfEt8S6SAJetsoNwlsXIgTh7hOcVaEcyjwodLgu4Oi1+4YDyVWoy5TGDG5 d/jgvnDjWcgJRPXat6ROTJP6T5hpAZhIGUZeJQJgm1Pd6MeXhNW+Yj8Zd+YdpzvSBYrH 6HvQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga36si275081ejc.37.2020.11.04.19.57.14; Wed, 04 Nov 2020 19:57:36 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732523AbgKEApU (ORCPT + 99 others); Wed, 4 Nov 2020 19:45:20 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:36162 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729024AbgKEApU (ORCPT ); Wed, 4 Nov 2020 19:45:20 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kaTOu-005J54-SD; Thu, 05 Nov 2020 01:45:16 +0100 Date: Thu, 5 Nov 2020 01:45:16 +0100 From: Andrew Lunn To: Ioana Ciornei Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Ioana Ciornei Subject: Re: [RFC 5/9] staging: dpaa2-switch: handle Rx path on control interface Message-ID: <20201105004516.GG933237@lunn.ch> References: <20201104165720.2566399-1-ciorneiioana@gmail.com> <20201104165720.2566399-6-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201104165720.2566399-6-ciorneiioana@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +/* Manage all NAPI instances for the control interface. > + * > + * We only have one RX queue and one Tx Conf queue for all > + * switch ports. Therefore, we only need to enable the NAPI instance once, the > + * first time one of the switch ports runs .dev_open(). > + */ > + > +static void dpaa2_switch_enable_ctrl_if_napi(struct ethsw_core *ethsw) > +{ > + int i; > + > + /* a new interface is using the NAPI instance */ > + ethsw->napi_users++; > + > + /* if there is already a user of the instance, return */ > + if (ethsw->napi_users > 1) > + return; Does there need to be any locking here? Or does it rely on RTNL? Maybe a comment would be nice, or a check that RTNL is actually held. > + > + if (!dpaa2_switch_has_ctrl_if(ethsw)) > + return; > + > + for (i = 0; i < DPAA2_SWITCH_RX_NUM_FQS; i++) > + napi_enable(ðsw->fq[i].napi); > +} > +static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq, > + const struct dpaa2_fd *fd) > +{ > + struct ethsw_core *ethsw = fq->ethsw; > + struct ethsw_port_priv *port_priv; > + struct net_device *netdev; > + struct vlan_ethhdr *hdr; > + struct sk_buff *skb; > + u16 vlan_tci, vid; > + int if_id = -1; > + int err; > + > + /* prefetch the frame descriptor */ > + prefetch(fd); Does this actually do any good, given that the next call: > + > + /* get switch ingress interface ID */ > + if_id = upper_32_bits(dpaa2_fd_get_flc(fd)) & 0x0000FFFF; is accessing the frame descriptor? The idea of prefetch is to let it bring it into the cache while you are busy doing something else, hopefully with something which is already cache hot. Andrew