From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD93BC43460 for ; Mon, 12 Apr 2021 12:32:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC77E61287 for ; Mon, 12 Apr 2021 12:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238015AbhDLMc1 (ORCPT ); Mon, 12 Apr 2021 08:32:27 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:45340 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239061AbhDLMc0 (ORCPT ); Mon, 12 Apr 2021 08:32:26 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1lVvjU-00GGID-7f; Mon, 12 Apr 2021 14:32:00 +0200 Date: Mon, 12 Apr 2021 14:32:00 +0200 From: Andrew Lunn To: Dexuan Cui Cc: davem@davemloft.net, kuba@kernel.org, kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, liuwe@microsoft.com, netdev@vger.kernel.org, leon@kernel.org, bernd@petrovitsch.priv.at, rdunlap@infradead.org, shacharr@microsoft.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: Re: [PATCH v4 net-next] net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) Message-ID: References: <20210412023455.45594-1-decui@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210412023455.45594-1-decui@microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-hyperv@vger.kernel.org > +static void mana_gd_deregiser_irq(struct gdma_queue *queue) > +{ > + struct gdma_dev *gd = queue->gdma_dev; > + struct gdma_irq_context *gic; > + struct gdma_context *gc; > + struct gdma_resource *r; > + unsigned int msix_index; > + unsigned long flags; > + > + /* At most num_online_cpus() + 1 interrupts are used. */ > + msix_index = queue->eq.msix_index; > + if (WARN_ON(msix_index > num_online_cpus())) > + return; Do you handle hot{un}plug of CPUs? > +static void mana_hwc_init_event_handler(void *ctx, struct gdma_queue *q_self, > + struct gdma_event *event) > +{ > + struct hw_channel_context *hwc = ctx; > + struct gdma_dev *gd = hwc->gdma_dev; > + union hwc_init_type_data type_data; > + union hwc_init_eq_id_db eq_db; > + u32 type, val; > + > + switch (event->type) { > + case GDMA_EQE_HWC_INIT_EQ_ID_DB: > + eq_db.as_uint32 = event->details[0]; > + hwc->cq->gdma_eq->id = eq_db.eq_id; > + gd->doorbell = eq_db.doorbell; > + break; > + > + case GDMA_EQE_HWC_INIT_DATA: > + > + type_data.as_uint32 = event->details[0]; > + > + case GDMA_EQE_HWC_INIT_DONE: > + complete(&hwc->hwc_init_eqe_comp); > + break; ... > + default: > + WARN_ON(1); > + break; > + } Are these events from the firmware? If you have newer firmware with an older driver, are you going to spam the kernel log with WARN_ON dumps? > +static int mana_move_wq_tail(struct gdma_queue *wq, u32 num_units) > +{ > + u32 used_space_old; > + u32 used_space_new; > + > + used_space_old = wq->head - wq->tail; > + used_space_new = wq->head - (wq->tail + num_units); > + > + if (used_space_new > used_space_old) { > + WARN_ON(1); > + return -ERANGE; > + } You could replace the 1 by the condition. There are a couple of these. Andrew