From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8053DC83F33 for ; Mon, 4 Sep 2023 14:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346525AbjIDOCj (ORCPT ); Mon, 4 Sep 2023 10:02:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232389AbjIDOCh (ORCPT ); Mon, 4 Sep 2023 10:02:37 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4699CD7; Mon, 4 Sep 2023 07:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=iA9dWLzNwmWgeVruKfWYQm9/Fv8+bNUF3EphUHboovM=; b=J/6wblO2pMDEzIC/YsObv6CEKC pefWd2u72eNAJUyYSlk71pPSSmj989fSEAAaSScqLgjSolpfXoTRw0Jy/WmZwvaXnOfhzetzRYcRe 6KhV0Py7LNNKETCrilj3wV4PGA1pZuDUvZhKoWdZyvGJJ3Y1s/EPd1+WDbPjlcqCbOBY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qdA9m-005kBI-9E; Mon, 04 Sep 2023 16:02:22 +0200 Date: Mon, 4 Sep 2023 16:02:22 +0200 From: Andrew Lunn To: MD Danish Anwar Cc: Simon Horman , Roger Quadros , Vignesh Raghavendra , Jacob Keller , Richard Cochran , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, srk@ti.com, r-gunasekaran@ti.com Subject: Re: [RFC PATCH net-next 1/4] net: ti: icssg-prueth: Add helper functions to configure FDB Message-ID: References: <20230830110847.1219515-1-danishanwar@ti.com> <20230830110847.1219515-2-danishanwar@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230830110847.1219515-2-danishanwar@ti.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +int icssg_send_fdb_msg(struct prueth_emac *emac, struct mgmt_cmd *cmd, > + struct mgmt_cmd_rsp *rsp) > +{ > + struct prueth *prueth = emac->prueth; > + int slice = prueth_emac_slice(emac); > + int i = 10000; > + int addr; > + > + addr = icssg_queue_pop(prueth, slice == 0 ? > + ICSSG_CMD_POP_SLICE0 : ICSSG_CMD_POP_SLICE1); > + if (addr < 0) > + return addr; > + > + /* First 4 bytes have FW owned buffer linking info which should > + * not be touched > + */ > + memcpy_toio(prueth->shram.va + addr + 4, cmd, sizeof(*cmd)); > + icssg_queue_push(prueth, slice == 0 ? > + ICSSG_CMD_PUSH_SLICE0 : ICSSG_CMD_PUSH_SLICE1, addr); > + while (i--) { > + addr = icssg_queue_pop(prueth, slice == 0 ? > + ICSSG_RSP_POP_SLICE0 : ICSSG_RSP_POP_SLICE1); > + if (addr < 0) { > + usleep_range(1000, 2000); > + continue; > + } Please try to make use of include/linux/iopoll.h. > + if (i <= 0) { > + netdev_err(emac->ndev, "Timedout sending HWQ message\n"); > + return -EINVAL; Using iopoll.h will fix this, but -ETIMEDOUT, not -EINVAL. Andrew