Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3026213ybl; Fri, 20 Dec 2019 02:43:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwZVDwwkL+vz6t+j4DEFx2gO/u4LZhXNXVm8vC/1mpa74NUFLj6ysLYVW6/V03FFeesbT2r X-Received: by 2002:a05:6830:13d9:: with SMTP id e25mr13799654otq.134.1576838588138; Fri, 20 Dec 2019 02:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576838588; cv=none; d=google.com; s=arc-20160816; b=f5eWSZNmagIs9ZR47vD3sLW4NBJHa2YNEbY+2qH6Np4559ckkgM1+reaZlpbRZVBCY 55ei0F5tReuYBZE5eXtPovUDu1kpAW5xoZsdA/wz7iV9pVikrI3K5UWVuE2NM2kg0O0K JE7HrH+auPXVCE7E4DQNs22yGc3NQogT6nt20viMXG7/n8pK/PXMge8J4FDJeP5ThPPg iOU0Kv274tBP4VWCxmWtpN24YIT9qSoXjURsDUxbmca7Dc4lTLzS3DkngU8Bq+gWyUMN EezoP1oNdNgJ3pp59rkbH80R1d9z2dACZjL0lxBB+zxKY5qs9SlbX/M6Oq13fpkM4GIv Mlcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=2v2z+FS+yA7LYnWwxztL6URPv5REOEKRsiKuUYtz5xE=; b=T4ezUybSA9h0oymN3AyIqt+JNayVg0wfPDHYv5qHNhzuH8A1XpNxjBZY0Wo3eY8jhz CPZtxQ0Q6bK/GgdFTEsjWx22sih2XZBaaGisWLw04CbJ5j7drQohix8TO7zP5TII3Gk9 +NvCmzMjt6Fwyw4rxe5RMklioj514saMxaMGDmaHdddMA49qWjgJ0rJ2kOZJr/fLggMi 6aiRPafmAxBFc5CZmC8xSaBcxNZoQLjrSB62aUyS1s9IuFPTxk7/5ecujKf0XeDGd20f n/Jd4XiO/7IFAKS7P85qDYfnFg5gmH0gaMT08bx6rAgzq5SSvRSUFh3M5XsMHM1fuET6 NOrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dHt2yfVj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si2763030otr.233.2019.12.20.02.42.56; Fri, 20 Dec 2019 02:43:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dHt2yfVj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727281AbfLTKmF (ORCPT + 99 others); Fri, 20 Dec 2019 05:42:05 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:50870 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbfLTKmF (ORCPT ); Fri, 20 Dec 2019 05:42:05 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBKAfu1p061714; Fri, 20 Dec 2019 04:41:56 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1576838516; bh=2v2z+FS+yA7LYnWwxztL6URPv5REOEKRsiKuUYtz5xE=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=dHt2yfVjBXdDDHSnVV4JabkC8Wkx8sVLr0nA12+xfaxXlDn2MLtSHGdx6hxK474nB dKIi6IGX6eLhZP/XKdwhe1ZG57BtZN1t5HwNlLUgc061NKIK5fnDOklWP0ZKopBg+J S750CPw72EoWAfXbN9EwXBZsDZgrv+dgFxRlayPY= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xBKAfuG1103346 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 20 Dec 2019 04:41:56 -0600 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Fri, 20 Dec 2019 04:41:55 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Fri, 20 Dec 2019 04:41:55 -0600 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBKAfqQ1122772; Fri, 20 Dec 2019 04:41:52 -0600 Subject: Re: [PATCH v7 06/12] dmaengine: ti: Add cppi5 header for K3 NAVSS/UDMA To: Vinod Koul CC: , , , , , , , , , , , , , References: <20191209094332.4047-1-peter.ujfalusi@ti.com> <20191209094332.4047-7-peter.ujfalusi@ti.com> <20191220095455.GM2536@vkoul-mobl> From: Peter Ujfalusi Message-ID: Date: Fri, 20 Dec 2019 12:42:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191220095455.GM2536@vkoul-mobl> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vinod, On 20/12/2019 11.54, Vinod Koul wrote: > On 09-12-19, 11:43, Peter Ujfalusi wrote: > >> +#define CPPI5_INFO2_DESC_RETPUSHPOLICY BIT(16) >> +#define CPPI5_INFO2_DESC_RETP_MASK GENMASK(18, 16) >> + >> +#define CPPI5_INFO2_DESC_RETQ_SHIFT (0) >> +#define CPPI5_INFO2_DESC_RETQ_MASK GENMASK(15, 0) >> + >> +#define CPPI5_INFO3_DESC_SRCTAG_SHIFT (16U) >> +#define CPPI5_INFO3_DESC_SRCTAG_MASK GENMASK(31, 16) >> +#define CPPI5_INFO3_DESC_DSTTAG_SHIFT (0) >> +#define CPPI5_INFO3_DESC_DSTTAG_MASK GENMASK(15, 0) >> + >> +#define CPPI5_BUFINFO1_HDESC_DATA_LEN_SHIFT (0) >> +#define CPPI5_BUFINFO1_HDESC_DATA_LEN_MASK GENMASK(27, 0) >> + >> +#define CPPI5_OBUFINFO0_HDESC_BUF_LEN_SHIFT (0) >> +#define CPPI5_OBUFINFO0_HDESC_BUF_LEN_MASK GENMASK(27, 0) > > I think you can remove the SHIFT defines and use ffs() to get the bit > position for shift Right. I'll convert to use ffs() > >> +static inline u32 cppi5_hdesc_calc_size(bool epib, u32 psdata_size, >> + u32 sw_data_size) >> +{ >> + u32 desc_size; >> + >> + if (psdata_size > CPPI5_INFO0_HDESC_PSDATA_MAX_SIZE) >> + return 0; >> + >> + desc_size = sizeof(struct cppi5_host_desc_t) + psdata_size + >> + sw_data_size; > > I think there was an API for this kind of mem allocation of struct and > buffer attached... The returned size is not only used when allocating memory or setting up the dma_pool, but for UDMAP's fetch size parameter. >> +static inline void cppi5_hdesc_reset_hbdesc(struct cppi5_host_desc_t *desc) >> +{ >> + desc->hdr = (struct cppi5_desc_hdr_t) { 0 }; >> + desc->next_desc = 0; > > would this not be superfluous? Or if you want a memset call? The intention is to reset the header and the next descriptor link but leave the backing buffer information intact. This allows the reuse of a descriptor+buffer and we only need to set the header bits + next descriptor pointer if any. >> +static inline u32 *cppi5_hdesc_get_psdata32(struct cppi5_host_desc_t *desc) >> +{ >> + return (u32 *)cppi5_hdesc_get_psdata(desc); > > you dont need casts away from void * Hrm, or just remove this, clients can use the cppi5_hdesc_get_psdata() directly. - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki