From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by dpdk.org (Postfix) with ESMTP id A0BC86848 for ; Sat, 7 Jun 2014 01:50:56 +0200 (CEST) Received: by mail-pd0-f182.google.com with SMTP id r10so3036639pdi.27 for ; Fri, 06 Jun 2014 16:51:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject :references:mime-version:content-type:content-disposition; bh=WX77g5yYrvVAO9tgai7be3WAXd9xeKbR8ujb8HwcWP0=; b=kfQMeMI1Lrupn615cgOfFOnES1Rq+ExVEkeGpRYnDMeLbuORLJxQmZTtArRFDjag8d WVF1LCBvazlhbTjcgY8sxe6c6Xg6BU5iYDuzS/Zot+JLYmbQSAACkxNzC71PY7XdOQOf noJjHqXr4TmJGEDt2M2EKcZmruTv19r05ejrloy7waEtL23eFrTVco0qh2ZxgoElnPWV GF+1OuWrJKGKioQoMU8KwJV6WvbGP5HKsofZ2tPUi5IBwe84Y4SRH0Ff+SjE7rAKeywr /iIzr9OSNYpuTaX2AagrMPZ3y1mlhUUtS3r2GJo57f9rSaqE6jLqqY7R2pZuH6+Ew9wg v1Bw== X-Gm-Message-State: ALoCoQm3y5+pzyv5UEtnWpaAvj/kRgcq8jdIGP0HqVVJsC1UiV468DQTMrmIGQBSadUDkbfMg1Vp X-Received: by 10.68.194.134 with SMTP id hw6mr6090495pbc.49.1402098670069; Fri, 06 Jun 2014 16:51:10 -0700 (PDT) Received: from localhost (static-50-53-83-51.bvtn.or.frontiernet.net. [50.53.83.51]) by mx.google.com with ESMTPSA id gr10sm40830950pbc.84.2014.06.06.16.51.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jun 2014 16:51:09 -0700 (PDT) Message-Id: <20140606235108.480879979@networkplumber.org> User-Agent: quilt/0.63-1 Date: Fri, 06 Jun 2014 16:50:33 -0700 From: Stephen Hemminger To: Alan Carew References: <20140606235028.189345212@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=igb_uio-msix-vector.patch Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v2 05/10] Subjec: igb_uio: msix cleanups 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: Fri, 06 Jun 2014 23:50:57 -0000 Since only one MSI-X entry is ever defined, there is no need to put it as an array in the driver private data structure. One msix_entry can just be put on the stack and initialized there. Also remove the unused backport defines related to MSI-X. I suspect this code was just inherited from some other project and never cleaned up. Signed-off-by: Stephen Hemminger --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -36,21 +36,6 @@ #include #endif -/** - * MSI-X related macros, copy from linux/pci_regs.h in kernel 2.6.39, - * but none of them in kernel 2.6.35. - */ -#ifndef PCI_MSIX_ENTRY_SIZE -#define PCI_MSIX_ENTRY_SIZE 16 -#define PCI_MSIX_ENTRY_LOWER_ADDR 0 -#define PCI_MSIX_ENTRY_UPPER_ADDR 4 -#define PCI_MSIX_ENTRY_DATA 8 -#define PCI_MSIX_ENTRY_VECTOR_CTRL 12 -#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 -#endif - -#define IGBUIO_NUM_MSI_VECTORS 1 - /* interrupt mode */ enum igbuio_intr_mode { IGBUIO_LEGACY_INTR_MODE = 0, @@ -67,8 +52,6 @@ struct pci_dev *pdev; spinlock_t lock; /* spinlock for accessing PCI config space or msix data in multi tasks/isr */ enum igbuio_intr_mode mode; - struct msix_entry \ - msix_entries[IGBUIO_NUM_MSI_VECTORS]; /* pointer to the msix vectors to be allocated later */ }; static char *intr_mode; @@ -526,17 +509,16 @@ /* check if it need to try msix first */ if (igbuio_intr_mode_preferred == IGBUIO_MSIX_INTR_MODE) { - int vector; - - for (vector = 0; vector < IGBUIO_NUM_MSI_VECTORS; vector ++) - udev->msix_entries[vector].entry = vector; + /* only one MSIX vector needed */ + struct msix_entry msix_entry = { + .entry = 0, + }; - if (pci_enable_msix(udev->pdev, udev->msix_entries, IGBUIO_NUM_MSI_VECTORS) == 0) { + if (pci_enable_msix(udev->pdev, &msix_entry, 1) == 0) { udev->mode = IGBUIO_MSIX_INTR_MODE; - } - else { - pci_disable_msix(udev->pdev); - pr_info("fail to enable pci msix, or not enough msix entries\n"); + } else { + pr_err("failed to enable pci msix, or not enough msix entries\n"); + udev->mode = IGBUIO_LEGACY_INTR_MODE; } } switch (udev->mode) {