From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bgl-iport-2.cisco.com (bgl-iport-2.cisco.com [72.163.197.26]) by dpdk.org (Postfix) with ESMTP id 08F5E1F7 for ; Thu, 18 Dec 2014 10:11:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=4578; q=dns/txt; s=iport; t=1418893876; x=1420103476; h=from:to:cc:subject:date:message-id; bh=t4XkgDfOXp96Kp1bdedMRhN5B3Hks+H6cY451n7uqso=; b=CwFQRxFwYVldHR2AH9KVIZbnt4Z9iVs0XxtmK1UcKSBK1l7V4An/0c9N OL9EDPfjhqAlrN3jZkabTgxoDLMeajPeQCAjKallAjSqduQH0N1kYAoYV ooubsT+Ftd9Lith6k0aVO38cbLNZzF1MLxRKVRs6qBCVbr9/6GetuyVvQ w=; X-IronPort-AV: E=Sophos;i="5.07,599,1413244800"; d="scan'208";a="48563980" Received: from vla196-nat.cisco.com (HELO bgl-core-4.cisco.com) ([72.163.197.24]) by bgl-iport-2.cisco.com with ESMTP; 18 Dec 2014 09:11:14 +0000 Received: from localhost ([10.106.186.168]) (authenticated bits=0) by bgl-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id sBI9B2CJ009875 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 18 Dec 2014 09:11:08 GMT From: Sujith Sankar To: dev@dpdk.org Date: Thu, 18 Dec 2014 14:39:40 +0530 Message-Id: <1418893780-19195-1-git-send-email-ssujith@cisco.com> X-Mailer: git-send-email 1.9.1 X-Authenticated-User: ssujith@cisco.com Subject: [dpdk-dev] [PATCH] enic: remove code under VFIO_PRESENT and use eal code for interrupts X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Dec 2014 09:11:16 -0000 This patch removes the interrupt registration code which was under the flag VFIO_PRESENT and relies on the rte_lib code for the same. This also ignores the initial trigger of ISR from the lib. Signed-off-by: Sujith Sankar --- lib/librte_pmd_enic/enic_main.c | 117 ---------------------------------------- 1 file changed, 117 deletions(-) diff --git a/lib/librte_pmd_enic/enic_main.c b/lib/librte_pmd_enic/enic_main.c index e4f43c5..8ab8e44 100644 --- a/lib/librte_pmd_enic/enic_main.c +++ b/lib/librte_pmd_enic/enic_main.c @@ -567,7 +567,6 @@ enic_intr_handler(__rte_unused struct rte_intr_handle *handle, { struct enic *enic = pmd_priv((struct rte_eth_dev *)arg); - dev_err(enic, "Err intr.\n"); vnic_intr_return_all_credits(&enic->intr); enic_log_q_error(enic); @@ -605,13 +604,11 @@ int enic_enable(struct enic *enic) vnic_dev_enable_wait(enic->vdev); -#ifndef VFIO_PRESENT /* Register and enable error interrupt */ rte_intr_callback_register(&(enic->pdev->intr_handle), enic_intr_handler, (void *)enic->rte_dev); rte_intr_enable(&(enic->pdev->intr_handle)); -#endif vnic_intr_unmask(&enic->intr); return 0; @@ -969,31 +966,6 @@ int enic_setup_finish(struct enic *enic) return 0; } -#ifdef VFIO_PRESENT -static void enic_eventfd_init(struct enic *enic) -{ - enic->eventfd = enic->pdev->intr_handle.fd; -} - -void *enic_err_intr_handler(void *arg) -{ - struct enic *enic = (struct enic *)arg; - unsigned int intr = enic_msix_err_intr(enic); - ssize_t size; - uint64_t data; - - while (1) { - size = read(enic->eventfd, &data, sizeof(data)); - dev_err(enic, "Err intr.\n"); - vnic_intr_return_all_credits(&enic->intr); - - enic_log_q_error(enic); - } - - return NULL; -} -#endif - void enic_add_packet_filter(struct enic *enic) { /* Args -> directed, multicast, broadcast, promisc, allmulti */ @@ -1006,87 +978,12 @@ int enic_get_link_status(struct enic *enic) return vnic_dev_link_status(enic->vdev); } - -#ifdef VFIO_PRESENT -static int enic_create_err_intr_thread(struct enic *enic) -{ - pthread_attr_t intr_attr; - - /* create threads for error interrupt handling */ - pthread_attr_init(&intr_attr); - pthread_attr_setstacksize(&intr_attr, 0x100000); - - /* ERR */ - if (pthread_create(&enic->err_intr_thread, &intr_attr, - enic_err_intr_handler, (void *)enic)) { - dev_err(enic, "Failed to create err interrupt handler threads\n"); - return -1; - } - - pthread_attr_destroy(&intr_attr); - - return 0; -} - - -static int enic_set_intr_mode(struct enic *enic) -{ - struct vfio_irq_set *irq_set; - int *fds; - int size; - int ret = -1; - int index; - - if (enic->intr_count < 1) { - dev_err(enic, "Unsupported resource conf.\n"); - return -1; - } - vnic_dev_set_intr_mode(enic->vdev, VNIC_DEV_INTR_MODE_MSIX); - - enic->intr_count = 1; - - enic_eventfd_init(enic); - size = sizeof(*irq_set) + (sizeof(int)); - - irq_set = rte_zmalloc("enic_vfio_irq", size, 0); - irq_set->argsz = size; - irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX; - irq_set->start = 0; - irq_set->count = 1; /* For error interrupt only */ - irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | - VFIO_IRQ_SET_ACTION_TRIGGER; - fds = (int *)&irq_set->data; - - fds[0] = enic->eventfd; - - ret = ioctl(enic->pdev->intr_handle.vfio_dev_fd, - VFIO_DEVICE_SET_IRQS, irq_set); - rte_free(irq_set); - if (ret) { - dev_err(enic, "Failed to set eventfds for interrupts\n"); - return -1; - } - - enic_create_err_intr_thread(enic); - return 0; -} - -static void enic_clear_intr_mode(struct enic *enic) -{ - vnic_dev_set_intr_mode(enic->vdev, VNIC_DEV_INTR_MODE_UNKNOWN); -} -#endif - static void enic_dev_deinit(struct enic *enic) { struct rte_eth_dev *eth_dev = enic->rte_dev; if (eth_dev->data->mac_addrs) rte_free(eth_dev->data->mac_addrs); - -#ifdef VFIO_PRESENT - enic_clear_intr_mode(enic); -#endif } @@ -1139,20 +1036,6 @@ static int enic_dev_init(struct enic *enic) */ enic_get_res_counts(enic); -#ifdef VFIO_PRESENT - /* Set interrupt mode based on resource counts and system - * capabilities - */ - err = enic_set_intr_mode(enic); - if (err) { - rte_free(eth_dev->data->mac_addrs); - enic_clear_intr_mode(enic); - dev_err(dev, "Failed to set intr mode based on resource "\ - "counts and system capabilities, aborting\n"); - return err; - } -#endif - vnic_dev_set_reset_flag(enic->vdev, 0); return 0; -- 1.9.1