From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23B28A034E; Thu, 17 Feb 2022 17:12:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DAB8411FE; Thu, 17 Feb 2022 17:11:05 +0100 (CET) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id BFB1840395 for ; Thu, 17 Feb 2022 17:07:08 +0100 (CET) Received: by mail-pf1-f178.google.com with SMTP id p8so55979pfh.8 for ; Thu, 17 Feb 2022 08:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oneconvergence.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=24USIDW5u9jBuciqNgCJl38TwWMNjuN3ETz4n2EI6RQ=; b=LGGOdi3NgQCWqoWKdKvONHybSK0yK+wYNDg1H/xUsvvgkTsyK9NJOHnjQF6RBtQ7oJ ZXVNsmoZ+hRhOhNG5xRP7SrdUXK1MogflNyHXnBLgK3ZJjg2z8I7xcrTiHN2ze/IhMDp WNQXNCCNWgj7qmEdhoWgDNvL+nVuSIUlLLll0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=24USIDW5u9jBuciqNgCJl38TwWMNjuN3ETz4n2EI6RQ=; b=qVZFJllfi4C+VFWHYqx/yz4NDFavqSlBK4r5QbTe93ANfADW2KR2YeeTKCgnmYS2Mw 6b81Omk00h4SOn41sr4bjy2RNflWKFZx2/3K++45NZwU3SduEth/tR+tQ0G0cYnD1IlH 8W4j8Ofw2Rc7Sj8dOszfJxFf/YunSbtStIi5zrD8d5T3pLg/UfIf1OHbT5TJHD7ONLKG /gk6VirgIU3tcB0bnSjCg/Ox3NAhTVjCf6OKzbLOu30d/LtqJA+6IGDG4ADJHf/Az84u GnXbCTtjvX0CaPBkaPS+IZ3eb5KOc3fL1KJv49t2PaZctsPxS25kDVeJseXFYc5jhEg3 C74A== X-Gm-Message-State: AOAM5336PFaCDjkkADyonZabZZqsureleWtK514xB2HgKFWlNi7Lv+m8 rp59ZcTG1MBWXA5C3EjIagf6LA== X-Google-Smtp-Source: ABdhPJxEOGmZX8ALpD90pxatizOlRQKfowW1O71vOdHk5xUavqWn45stPq4CEFme0RMvNZFePBp4rQ== X-Received: by 2002:a63:5525:0:b0:372:c376:74f1 with SMTP id j37-20020a635525000000b00372c37674f1mr2887513pgb.433.1645114028045; Thu, 17 Feb 2022 08:07:08 -0800 (PST) Received: from srikanth-ThinkPad-T450.. ([49.37.144.122]) by smtp.gmail.com with ESMTPSA id z14sm47807pfh.173.2022.02.17.08.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 08:07:07 -0800 (PST) From: Srikanth Kaka To: sthemmin@microsoft.com, longli@microsoft.com Cc: dev@dpdk.org, vag.singh@oneconvergence.com, avelu@juniper.net, Srikanth Kaka Subject: [PATCH v3 14/15] bus/vmbus: add APIs to mask/unmask IRQs Date: Thu, 17 Feb 2022 21:36:12 +0530 Message-Id: <20220217160613.70161-15-srikanth.k@oneconvergence.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220217160613.70161-1-srikanth.k@oneconvergence.com> References: <20210927134231.11177-1-srikanth.k@oneconvergence.com> <20220217160613.70161-1-srikanth.k@oneconvergence.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 17 Feb 2022 17:10:51 +0100 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org the IRQ masking/unmasking APIs use the HV_UIO driver's read and write CBs for their work. Signed-off-by: Srikanth Kaka Signed-off-by: Vag Singh Signed-off-by: Anand Thulasiram --- drivers/bus/vmbus/freebsd/vmbus_bus.c | 15 ++++++++++++++ drivers/bus/vmbus/freebsd/vmbus_uio.c | 28 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/bus/vmbus/freebsd/vmbus_bus.c b/drivers/bus/vmbus/freebsd/vmbus_bus.c index fa0f4883f7..b275723bd3 100644 --- a/drivers/bus/vmbus/freebsd/vmbus_bus.c +++ b/drivers/bus/vmbus/freebsd/vmbus_bus.c @@ -265,3 +265,18 @@ rte_vmbus_scan(void) error: return -1; } + +void rte_vmbus_irq_mask(struct rte_vmbus_device *device) +{ + vmbus_uio_irq_control(device, 1); +} + +void rte_vmbus_irq_unmask(struct rte_vmbus_device *device) +{ + vmbus_uio_irq_control(device, 0); +} + +int rte_vmbus_irq_read(struct rte_vmbus_device *device) +{ + return vmbus_uio_irq_read(device); +} diff --git a/drivers/bus/vmbus/freebsd/vmbus_uio.c b/drivers/bus/vmbus/freebsd/vmbus_uio.c index ca6f5fac59..7eb8b73e29 100644 --- a/drivers/bus/vmbus/freebsd/vmbus_uio.c +++ b/drivers/bus/vmbus/freebsd/vmbus_uio.c @@ -38,6 +38,34 @@ static const char *map_names[VMBUS_MAX_RESOURCE] = { [HV_SEND_BUF_MAP] = "send_buf", }; +/* Control interrupts */ +void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff) +{ + if (write(dev->intr_handle.fd, &onoff, sizeof(onoff)) < 0) { + VMBUS_LOG(ERR, "cannot write to %d:%s", + dev->intr_handle.fd, strerror(errno)); + } +} + +int vmbus_uio_irq_read(struct rte_vmbus_device *dev) +{ + int32_t count; + int cc; + + cc = read(dev->intr_handle.fd, &count, sizeof(count)); + if (cc < (int)sizeof(count)) { + if (cc < 0) { + VMBUS_LOG(ERR, "IRQ read failed %s", + strerror(errno)); + return -errno; + } + VMBUS_LOG(ERR, "can't read IRQ count"); + return -EINVAL; + } + + return count; +} + void vmbus_uio_free_resource(struct rte_vmbus_device *dev, struct mapped_vmbus_resource *uio_res) -- 2.30.2