From owner-svn-src-projects@FreeBSD.ORG Mon Dec 27 13:58:45 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5891F1065672; Mon, 27 Dec 2010 13:58:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2A94F8FC18; Mon, 27 Dec 2010 13:58:45 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id D78D346B2E; Mon, 27 Dec 2010 08:58:44 -0500 (EST) Received: from John-Baldwins-Macbook-Pro.local (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AE6B78A009; Mon, 27 Dec 2010 08:58:43 -0500 (EST) Message-ID: <4D189B93.3020204@FreeBSD.org> Date: Mon, 27 Dec 2010 08:58:43 -0500 From: John Baldwin User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Jeff Roberson References: <201012270547.oBR5lOhJ012472@svn.freebsd.org> In-Reply-To: <201012270547.oBR5lOhJ012472@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 27 Dec 2010 08:58:44 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-0.9 required=4.2 tests=BAYES_00,RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r216729 - in projects/ofed/head/sys/ofed: drivers/infiniband/hw/mthca drivers/net/mlx4 include/linux X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Dec 2010 13:58:45 -0000 Jeff Roberson wrote: > Author: jeff > Date: Mon Dec 27 05:47:24 2010 > New Revision: 216729 > URL: http://svn.freebsd.org/changeset/base/216729 > > Log: > - Implement Linux compatible support for msix, removing some diffs against > driver sources. > - Add plubming to find the device based on the irq to eliminate another > linux incompatibility in request_irq(). > - Implement free_irq() which was previously empty. > > Sponsored by: Isilon Systems, iX Systems, and Panasas. > > Modified: > projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_eq.c > projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c > projects/ofed/head/sys/ofed/drivers/net/mlx4/eq.c > projects/ofed/head/sys/ofed/drivers/net/mlx4/main.c > projects/ofed/head/sys/ofed/include/linux/device.h > projects/ofed/head/sys/ofed/include/linux/interrupt.h > projects/ofed/head/sys/ofed/include/linux/linux_compat.c > projects/ofed/head/sys/ofed/include/linux/pci.h > > @@ -444,6 +486,40 @@ pci_unregister_driver(struct pci_driver > devclass_delete_driver(bus, &pdrv->driver); > } > > +struct msix_entry { > + int entry; > + int vector; > +}; > + > +/* > + * Enable msix, positive errors indicate actual number of available > + * vectors. Negative errors are failures. > + */ > +static inline int > +pci_enable_msix(struct pci_dev *pdev, struct msix_entry *entries, int nreq) > +{ > + struct resource_list_entry *rle; > + int error; > + int avail; > + int i; > + > + avail = pci_msix_count(pdev->dev.bsddev); > + if (avail < nreq) { > + if (avail == 0) > + return -EINVAL; > + return avail; > + } > + avail = nreq; > + if ((error = -pci_alloc_msix(pdev->dev.bsddev, &avail)) != 0) > + return error; > + rle = _pci_get_rle(pdev, SYS_RES_IRQ, 1); > + pdev->dev.msix = rle->start; > + pdev->dev.msix_max = rle->start + avail; MSI-X and MSI IRQs are not guaranteed to be a contiguous range. Only the RIDs are guaranteed to be 1...N. They usually are contiguous on x86 because there is not a lot of turnover in MSI IRQs, but this is not guaranteed. -- John Baldwin