Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752457AbdHMKSe (ORCPT ); Sun, 13 Aug 2017 06:18:34 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:57023 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751022AbdHMKSd (ORCPT ); Sun, 13 Aug 2017 06:18:33 -0400 Date: Sun, 13 Aug 2017 03:18:31 -0700 From: Christoph Hellwig To: Long Li Cc: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, Long Li Subject: Re: [[PATCH v1] 11/37] [CIFS] SMBD: Post a receive request Message-ID: <20170813101831.GD17287@infradead.org> References: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> <1501704648-20159-12-git-send-email-longli@exchange.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1501704648-20159-12-git-send-email-longli@exchange.microsoft.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 659 Lines: 20 > + switch(response->type) { > + case SMBD_TRANSFER_DATA: > + data_transfer = (struct smbd_data_transfer *) response->packet; Maybe add a little helper for the packet data to hide these cast, e.g. static inline void *smbd_payload(struct cifs_rdma_response *resp) { return (void *)response->packet; } > + atomic_dec(&info->receive_credits); > + atomic_set(&info->receive_credit_target, > + le16_to_cpu(data_transfer->credits_requested)); > + atomic_add(le16_to_cpu(data_transfer->credits_granted), > + &info->send_credits); That's a lot of atomic ops in the fast path handler. Also remember that atomic_set isn't really atomic vs other callers.