Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2481469ybd; Mon, 24 Jun 2019 07:11:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBzhWAPXRJRgyqenzub0olGRe1yMgV/vrUESv09UEK2GYADwvn55g0704mhFoJtaHMMkJW X-Received: by 2002:a17:902:7603:: with SMTP id k3mr41467085pll.245.1561385495863; Mon, 24 Jun 2019 07:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561385495; cv=none; d=google.com; s=arc-20160816; b=vhz/88wPExUk5pTFg3Q8aA5b94Oi5eFa2iYxjAO6w8qV51LQ1Xl0l2od+0ufPqF27f 2XAvx5FWXu1yCE7+APVoS/CssmZVDvPeVD/wMX2kqOteRDsaSBlCmRtNaP2OyYvBaFLE bl2BbAHS3RbJUlRg2ammDnsF5OpvsnqCQxefHQQbKSxSUH/nUa65H4pbYaKVJeDCxlxb KFvDYG7xxQqDepegp8AsYp7fV5zOQm/7KA9Q+R1vEVhzAbKv+oO12V8Yih9hBfS594ZS i95Vg+p02bokHTHDKrAC6XVT/50CoGWegKYCr8KRWWrY1vUz8Wf2oRjVCcZTCcIo2g8x UGXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NBQpPVoPfxSA0hhMuklC1reToxwqwLVi6vf7QEag8wM=; b=K3NnJRZ3uy4Xlm6tbxI3PdlWuy3ciAtIQP0rW4ApIJICNnl9jCrJOkMtsh1j0q/SmY WT6pdv+U7P5fgBg41kYvC9RZh2zoAJTSE1wSvKfF1qyTxaax5AKQFMAL6oWfj+KaXzhE EcDa7P5+MkFSEc7D596lgIomkp7GBForJhXD7fdcu91r4OMBwGI1RMTn+9lsJdMw3pOz SQwRKzdXnd749isWWPhLdl4c0qeFiEuhYM9yVxc2OZ7bEzqNjrq6hQ6xvta60dOUPHNl XC+ZsGab+Cr/242zlOVhAxEkP2DyzO/eljaFG1KjhfXfTMaXowC2bbMARFiNMMY8Mxos YUrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="MlyM/+Ho"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i41si10742780pje.45.2019.06.24.07.11.19; Mon, 24 Jun 2019 07:11:35 -0700 (PDT) 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=@kernel.org header.s=default header.b="MlyM/+Ho"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730217AbfFXM2U (ORCPT + 99 others); Mon, 24 Jun 2019 08:28:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:39022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727344AbfFXM2U (ORCPT ); Mon, 24 Jun 2019 08:28:20 -0400 Received: from localhost (unknown [106.201.35.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2CB30205C9; Mon, 24 Jun 2019 12:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561379299; bh=xAWHMRPfHHeuUDsb2NoJwA0gB6ClzmGYlj5zwWg9ygE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MlyM/+HoLj6dP1Gga8KhvuWJr/2JNCuTOzkpKzyQtMA9G2d2AL8LpAJPPzcYZtoJc hoj7Vz6tmY8M6T6+WZRAuUcaEMtLhJgGUvCm3VwdSZfbP3Gsquq18W03zaSDnpgsgp GAwwNq3q7d2zEWW4aEsL3irBZy4q4bOA5TGRs1xU= Date: Mon, 24 Jun 2019 17:55:09 +0530 From: Vinod Koul To: Peng Ma Cc: dan.j.williams@intel.com, leoyang.li@nxp.com, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org Subject: Re: [V4 1/2] dmaengine: fsl-dpaa2-qdma: Add the DPDMAI(Data Path DMA Interface) support Message-ID: <20190624122509.GC2962@vkoul-mobl> References: <20190613101341.21169-1-peng.ma@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190613101341.21169-1-peng.ma@nxp.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13-06-19, 10:13, Peng Ma wrote: > The MC(Management Complex) exports the DPDMAI(Data Path DMA Interface) > object as an interface to operate the DPAA2(Data Path Acceleration > Architecture 2) qDMA Engine. The DPDMAI enables sending frame-based > requests to qDMA and receiving back confirmation response on transaction > completion, utilizing the DPAA2 QBMan(Queue Manager and Buffer Manager > hardware) infrastructure. DPDMAI object provides up to two priorities for > processing qDMA requests. > The following list summarizes the DPDMAI main features and capabilities: > 1. Supports up to two scheduling priorities for processing > service requests. > - Each DPDMAI transmit queue is mapped to one of two service > priorities, allowing further prioritization in hardware between > requests from different DPDMAI objects. > 2. Supports up to two receive queues for incoming transaction > completion confirmations. > - Each DPDMAI receive queue is mapped to one of two receive > priorities, allowing further prioritization between other > interfaces when associating the DPDMAI receive queues to DPIO > or DPCON(Data Path Concentrator) objects. > 3. Supports different scheduling options for processing received > packets: > - Queues can be configured either in 'parked' mode (default), > oattached to a DPIO object, or attached to DPCON object. ^^^^^^^^^ typo? > +struct dpdmai_cmd_open { > + __le32 dpdmai_id; > +}; Do you really need a struct to handle a 32bit value? And seeing it used once, we can skip and avoid needless cast in usage as well! > +/* cmd, param, offset, width, type, arg_name */ > +#define DPDMAI_CMD_CREATE(_cmd, _cfg) \ > +do { \ > + typeof(_cmd) (cmd) = (_cmd); \ > + typeof(_cfg) (cfg) = (_cfg); \ > + MC_CMD_OP(cmd, 0, 8, 8, u8, (cfg)->priorities[0]);\ > + MC_CMD_OP(cmd, 0, 16, 8, u8, (cfg)->priorities[1]);\ > +} while (0) > + > +static inline u64 mc_enc(int lsoffset, int width, u64 val) > +{ > + return (u64)(((u64)val & MAKE_UMASK64(width)) << lsoffset); this looks not so nice. val is u64 so why is it required to cast to u64 again? > +} > + > +static inline u64 mc_dec(u64 val, int lsoffset, int width) > +{ > + return (u64)((val >> lsoffset) & MAKE_UMASK64(width)); do we need the cast here? > +int dpdmai_create(struct fsl_mc_io *mc_io, u32 cmd_flags, > + const struct dpdmai_cfg *cfg, u16 *token) > +{ > + struct fsl_mc_command cmd = { 0 }; > + int err; > + > + /* prepare command */ > + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_CREATE, > + cmd_flags, > + 0); This seems to fit in a single line! > + DPDMAI_CMD_CREATE(cmd, cfg); > + > + /* send command to mc*/ > + err = mc_send_command(mc_io, &cmd); > + if (err) > + return err; > + > + /* retrieve response parameters */ > + *token = MC_CMD_HDR_READ_TOKEN(cmd.header); This looks very similar to dpdmai_open() and I suppose you can create a macro to create and send cmd with optional params! > + > + return 0; > +} > + > +int dpdmai_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, > + u16 token) > +{ > + struct fsl_mc_command cmd = { 0 }; > + > + /* prepare command */ > + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_ENABLE, > + cmd_flags, > + token); This can fit in two lines > + > + /* send command to mc*/ > + return mc_send_command(mc_io, &cmd); > +} > + > +int dpdmai_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, > + u16 token) why two lines for this! > +{ > + struct fsl_mc_command cmd = { 0 }; > + > + /* prepare command */ > + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_DISABLE, > + cmd_flags, > + token); This also! Please check rest of the driver for these style issues and see bunch of places can fit into a line or two! > +/** > + * dpdmai_open() - Open a control session for the specified object > + * @mc_io: Pointer to MC portal's I/O object > + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' > + * @dpdmai_id: DPDMAI unique ID > + * @token: Returned token; use in subsequent API calls > + * > + * This function can be used to open a control session for an > + * already created object; an object may have been declared in > + * the DPL or by calling the dpdmai_create() function. > + * This function returns a unique authentication token, > + * associated with the specific object ID and the specific MC > + * portal; this token must be used in all subsequent commands for > + * this specific object. This is good but can you move them to C file with the function -- ~Vinod