Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4525644ybl; Tue, 20 Aug 2019 13:24:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy25EhcFV/pFGBOiDm/6j7zksgvr9aEc01DNht1gXU/PCEopA2jY1o56gRUKMAhKmiykw1G X-Received: by 2002:a17:90a:dd41:: with SMTP id u1mr1810107pjv.132.1566332641382; Tue, 20 Aug 2019 13:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566332641; cv=none; d=google.com; s=arc-20160816; b=VpMmqr4ziTzimzGgQa0V8m6AVUdUeSe1Uzaz9MVArS7r7aEbW1c+2CIV7UHWGhht/h ryfmUMFgoGznClYH4QJIC1JLPuubi1kmddcNJrpvFRdsteC88vpavKIUpTBABEHsvEt3 /xlDayWhBQ7Zv51gxxHpAxEkbO4LsvGpORUwAjICMXavPQPUUP5xUV2OO/CqPXtlSKM8 /YRtibZtzvOcpNOc0x5V3P3uFTQepet7ofUaBPAP6g39pBcsx4BJyW+s7Q8XKWCf1Poz +lgqVfTYR2MykPlwdStH53ZG5VXJZIoyJdZLWi2DISj0YybOcpTWXAM0NaxlI7jcSWvl s5iQ== 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:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=UNLBP3EvDdSWrXduuJUHBTebR8UczAkX/Dd2atX8XKE=; b=VUAe642WkafQ25ytZWxkkhj6MkvgnIeNVf8LuEctUt9vJ212fPDWGu+WuPGC0UNG/L Rx1X1ZD4T6Ms87KJi7gocJtYWhzIOt5weCscyRkx/sfrDTzil7734qRW7KL9mFwrFLbX RlQ8USSBdy/zxlrvOjHCHSIqlyBh//Fje5oQ+/TZ2pkmb/6M+2DycIDrpXQID1WY/DH8 TbftwAy+bQa92A9wKE937pPxFekjDoaiDC70HV7StwJKRIpGRqURe0g8XwsW6y/UuNuT zHDqEMfBD8JVx6Rz92lXX6V4VzRJglnIqoANRu0+m4ZXaMM1J9OFkLOzM3GKODt9CgFr 3NMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si2481607plr.252.2019.08.20.13.23.43; Tue, 20 Aug 2019 13:24:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730202AbfHTUXk (ORCPT + 99 others); Tue, 20 Aug 2019 16:23:40 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:43280 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729833AbfHTUXk (ORCPT ); Tue, 20 Aug 2019 16:23:40 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i0AfG-0007nu-IY; Tue, 20 Aug 2019 22:23:35 +0200 Message-ID: <54d8d4600d53bac855b19a26fa744ed16be09bf0.camel@sipsolutions.net> Subject: Re: [PATCH 06/49] ath11k: add ce.c From: Johannes Berg To: Kalle Valo , linux-wireless@vger.kernel.org Cc: ath11k@lists.infradead.org, devicetree@vger.kernel.org Date: Tue, 20 Aug 2019 22:23:32 +0200 In-Reply-To: <1566316095-27507-7-git-send-email-kvalo@codeaurora.org> (sfid-20190820_175153_878417_8C2C389B) References: <1566316095-27507-1-git-send-email-kvalo@codeaurora.org> <1566316095-27507-7-git-send-email-kvalo@codeaurora.org> (sfid-20190820_175153_878417_8C2C389B) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, 2019-08-20 at 18:47 +0300, Kalle Valo wrote: > +static const struct ce_attr host_ce_config_wlan[] = { > + /* CE0: host->target HTC control and raw streams */ > + { > + .flags = CE_ATTR_FLAGS, > + .src_nentries = 16, > + .src_sz_max = 2048, > + .dest_nentries = 0, > + }, > Curious - this looks a lot like a similar thing in AHB, but there you did it all in little endian? Totally different really, just looks similar, or what's the reason? > + ring->skb[write_index] = skb; > + write_index = CE_RING_IDX_INCR(nentries_mask, write_index); > + ring->write_index = write_index; > + > + ath11k_hal_srng_access_end(ab, srng); > + > + spin_unlock_bh(&srng->lock); > + > + pipe->rx_buf_needed--; > + > + return 0; > + > +err: > + ath11k_hal_srng_access_end(ab, srng); > + > + spin_unlock_bh(&srng->lock); Seems like you could unify those unlock paths, the rx_buf_needed-- can almost certainly be before the access_end/unlock, and then just set ret=0? > +static int ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe, > + struct sk_buff **skb) Personally, I'd have preferred to have the *skb as the return value, and use ERR_PTR()/IS_ERR() etc. to encode the error values, rather than the double pointer. > +{ > + struct ath11k_base *ab = pipe->ab; > + struct hal_srng *srng; > + unsigned int sw_index; > + unsigned int nentries_mask; > + u32 *desc; > + int ret = 0; Maybe don't initialize that to a success value, just for robustness? You don't actually need to initialize it at all though if you set ret=0 when you actually succeed, which might be even nicer given that the function is simple enough for the compiler to figure out if you used 'ret' uninitialized or not. > +static struct ath11k_ce_ring * > +ath11k_ce_alloc_ring(struct ath11k_base *ab, int nentries, int desc_sz) > +{ > + struct ath11k_ce_ring *ce_ring; > + dma_addr_t base_addr; > + > + ce_ring = kzalloc(sizeof(*ce_ring) + (nentries * sizeof(*ce_ring->skb)), > + GFP_KERNEL); You should probably use struct_size(). johannes