Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp420303rdb; Thu, 22 Feb 2024 07:48:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUlijAZyOi8XeJHX1YUIzjC+mbQCdpGSRveDJ0QXxbFDB9pooc2+/XRADqi4gHTrf2Dt6Ph/k3lrHWjg6cIYn7IANHLv5um/Yj5iMUUkQ== X-Google-Smtp-Source: AGHT+IHnv84JyYYf6+qn9Q2yCzyCv3yrsOVZOCXh/hkSaX19dayihIdG620YeYnhbU9rPDV5ZVQ0 X-Received: by 2002:a05:6402:1b1b:b0:564:311d:9912 with SMTP id by27-20020a0564021b1b00b00564311d9912mr11179735edb.30.1708616886430; Thu, 22 Feb 2024 07:48:06 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x8-20020aa7cd88000000b005640c092a86si5546072edv.87.2024.02.22.07.48.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:48:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76812-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b="I5F/XIpi"; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-76812-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76812-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 30EB11F2587A for ; Thu, 22 Feb 2024 15:48:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A84B14F9E0; Thu, 22 Feb 2024 15:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="I5F/XIpi" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D71914F9CF; Thu, 22 Feb 2024 15:47:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616865; cv=none; b=QFl+DAcOKcG+/qVYIR6VTlP5NVrjva0tivBaezTv6oUdEvlPc/mTY3OIJT6vb0bhCEqrvSczV/5uVLHh4nKTPKp4IAxRaFr/dD1y3la/nErqkE6qbKLmbw8N5cBE8G/raxYlf9SGVnAGYNRtIxZo+DRFfjinXlBn6i+Fwffx6Do= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616865; c=relaxed/simple; bh=qNO63zIkGbx+1iQfTUn4yfr86/RWZAYZ7RtIlx0aB0A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XRpkuqOc8puvUYzPW4ImP1PNT0vpEMb2yPQtF4my47NmHWANJAAA3b0HlJUO+waWJwIZ2uc1i/c4CFBlooAE0rJTPu4alDJCPYhqzVltDHQ0PzvFRMOFbkde11xifZxGitUPY6IeFuDx9pnHHyXznxFCqjAGg0GTO0zCUgB70CI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=I5F/XIpi; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708616863; x=1740152863; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=qNO63zIkGbx+1iQfTUn4yfr86/RWZAYZ7RtIlx0aB0A=; b=I5F/XIpiFZaWge5uEF4T6e5YwleZuX3hmtUyiMnn35h+h+WMCrdg704h b0tj9IFNEiQ4Ab0eqIQI3CZTomamEuyqGzrXb52/244S4KufmRA6YwfCm LQ++olQqQMh5XSUd/jYJDHztUBa0h4I97UBBhQVjdPx8pevzplKlx1CNX x1wZpagItgybI8NCxC2tgGdktw9REDGcwbVFFcpv/1CEpI3EU23XY4RDc a5LNhhIxwgMy8zJGNpoyNVDascT0aQZ/+aMB9A9AznyafRNCmY5CqJE8q zWf0oxQyLDceMj9xAAzgIY6BenYVpUFYegsVnVkINeFH5h7jeKzt2O+Lw g==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="2986570" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="2986570" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 07:47:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="913545306" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="913545306" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 07:47:38 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rdBIN-00000006fSw-0zPE; Thu, 22 Feb 2024 17:47:35 +0200 Date: Thu, 22 Feb 2024 17:47:34 +0200 From: Andy Shevchenko To: Herve Codina Cc: Vadim Fedorenko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Yury Norov , Rasmus Villemoes , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Andrew Lunn , Mark Brown , Christophe Leroy , Thomas Petazzoni Subject: Re: [PATCH v4 4/5] net: wan: fsl_qmc_hdlc: Add runtime timeslots changes support Message-ID: References: <20240222142219.441767-1-herve.codina@bootlin.com> <20240222142219.441767-5-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240222142219.441767-5-herve.codina@bootlin.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Thu, Feb 22, 2024 at 03:22:17PM +0100, Herve Codina wrote: > QMC channels support runtime timeslots changes but nothing is done at > the QMC HDLC driver to handle these changes. > > Use existing IFACE ioctl in order to configure the timeslots to use. .. > +static int qmc_hdlc_xlate_slot_map(struct qmc_hdlc *qmc_hdlc, > + u32 slot_map, struct qmc_chan_ts_info *ts_info) > +{ > + DECLARE_BITMAP(ts_mask_avail, 64); > + DECLARE_BITMAP(ts_mask, 64); > + DECLARE_BITMAP(map, 64); Perhaps more 1:1 naming? DECLARE_BITMAP(rx_ts_mask_avail, 64); DECLARE_BITMAP(tx_ts_mask, 64); DECLARE_BITMAP(slot_map, 64); > + /* Tx and Rx available masks must be identical */ > + if (ts_info->rx_ts_mask_avail != ts_info->tx_ts_mask_avail) { > + dev_err(qmc_hdlc->dev, "tx and rx available timeslots mismatch (0x%llx, 0x%llx)\n", > + ts_info->rx_ts_mask_avail, ts_info->tx_ts_mask_avail); > + return -EINVAL; > + } > + > + bitmap_from_u64(ts_mask_avail, ts_info->rx_ts_mask_avail); > + bitmap_from_u64(map, slot_map); > + bitmap_scatter(ts_mask, map, ts_mask_avail, 64); > + > + if (bitmap_weight(ts_mask, 64) != bitmap_weight(map, 64)) { > + dev_err(qmc_hdlc->dev, "Cannot translate timeslots %*pb -> (%*pb, %*pb)\n", > + 64, map, 64, ts_mask_avail, 64, ts_mask); You can save a bit of code and stack: dev_err(qmc_hdlc->dev, "Cannot translate timeslots %64pb -> (%64pb, %64pb)\n", slot_map, rx_ts_mask_avail, tx_ts_mask); > + return -EINVAL; > + } > + > + bitmap_to_arr64(&ts_info->tx_ts_mask, ts_mask, 64); > + ts_info->rx_ts_mask = ts_info->tx_ts_mask; > + return 0; > +} .. > +static int qmc_hdlc_xlate_ts_info(struct qmc_hdlc *qmc_hdlc, > + const struct qmc_chan_ts_info *ts_info, u32 *slot_map) Similar comments apply as per above function. .. > + ret = qmc_chan_get_ts_info(qmc_hdlc->qmc_chan, &ts_info); > + if (ret) { > + dev_err(qmc_hdlc->dev, "get QMC channel ts info failed %d\n", ret); > + return ret; return dev_err_probe(...); > + } -- With Best Regards, Andy Shevchenko