All of lore.kernel.org
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Adam Lee <adam.lee@canonical.com>
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	Larry Finger <Larry.Finger@lwfinger.net>,
	stable@vger.kernel.org, Chaoming Li <chaoming_li@realsil.com.cn>
Subject: Re: [PATCH v2] rtlwifi: add MSI interrupts support
Date: Thu, 27 Mar 2014 14:15:13 -0400	[thread overview]
Message-ID: <20140327181513.GF31168@tuxdriver.com> (raw)
In-Reply-To: <1395715732-9545-1-git-send-email-adam.lee@canonical.com>

I'm confused -- is "rtlwifi: rtl8188ee: enable MSI interrupts support"
still wanted/needed?

John

On Tue, Mar 25, 2014 at 10:48:52AM +0800, Adam Lee wrote:
> Add MSI interrupts support, enable it when msi_support flag is true,
> also could fallback to pin-based interrupts mode if MSI mode fails.
> 
> Signed-off-by: Adam Lee <adam.lee@canonical.com>
> Cc: <stable@vger.kernel.org> [3.10+]
> ---
>  drivers/net/wireless/rtlwifi/pci.c | 65 ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 63 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
> index f26f4ff..155d010 100644
> --- a/drivers/net/wireless/rtlwifi/pci.c
> +++ b/drivers/net/wireless/rtlwifi/pci.c
> @@ -1853,6 +1853,65 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
>  	return true;
>  }
>  
> +static int rtl_pci_intr_mode_msi(struct ieee80211_hw *hw)
> +{
> +	struct rtl_priv *rtlpriv = rtl_priv(hw);
> +	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
> +	struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
> +	int ret;
> +
> +	ret = pci_enable_msi(rtlpci->pdev);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt,
> +			  IRQF_SHARED, KBUILD_MODNAME, hw);
> +	if (ret < 0) {
> +		pci_disable_msi(rtlpci->pdev);
> +		return ret;
> +	}
> +
> +	rtlpci->using_msi = true;
> +
> +	RT_TRACE(rtlpriv, COMP_INIT|COMP_INTR, DBG_DMESG,
> +		 "MSI Interrupt Mode!\n");
> +	return 0;
> +}
> +
> +static int rtl_pci_intr_mode_legacy(struct ieee80211_hw *hw)
> +{
> +	struct rtl_priv *rtlpriv = rtl_priv(hw);
> +	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
> +	struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
> +	int ret;
> +
> +	ret = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt,
> +			  IRQF_SHARED, KBUILD_MODNAME, hw);
> +	if (ret < 0)
> +		return ret;
> +
> +	rtlpci->using_msi = false;
> +	RT_TRACE(rtlpriv, COMP_INIT|COMP_INTR, DBG_DMESG,
> +		 "Pin-based Interrupt Mode!\n");
> +	return 0;
> +}
> +
> +static int rtl_pci_intr_mode_decide(struct ieee80211_hw *hw)
> +{
> +	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
> +	struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
> +	int ret;
> +
> +	if (rtlpci->msi_support) {
> +		ret = rtl_pci_intr_mode_msi(hw);
> +		if (ret < 0)
> +			ret = rtl_pci_intr_mode_legacy(hw);
> +	} else {
> +		ret = rtl_pci_intr_mode_legacy(hw);
> +	}
> +	return ret;
> +}
> +
>  int rtl_pci_probe(struct pci_dev *pdev,
>  			    const struct pci_device_id *id)
>  {
> @@ -1995,8 +2054,7 @@ int rtl_pci_probe(struct pci_dev *pdev,
>  	}
>  
>  	rtlpci = rtl_pcidev(pcipriv);
> -	err = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt,
> -			  IRQF_SHARED, KBUILD_MODNAME, hw);
> +	err = rtl_pci_intr_mode_decide(hw);
>  	if (err) {
>  		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
>  			 "%s: failed to register IRQ handler\n",
> @@ -2064,6 +2122,9 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
>  		rtlpci->irq_alloc = 0;
>  	}
>  
> +	if (rtlpci->using_msi)
> +		pci_disable_msi(rtlpci->pdev);
> +
>  	list_del(&rtlpriv->list);
>  	if (rtlpriv->io.pci_mem_start != 0) {
>  		pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
> -- 
> 1.9.1
> 
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

WARNING: multiple messages have this Message-ID (diff)
From: "John W. Linville" <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
To: Adam Lee <adam.lee-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Larry Finger
	<Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>,
	stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Chaoming Li <chaoming_li-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>
Subject: Re: [PATCH v2] rtlwifi: add MSI interrupts support
Date: Thu, 27 Mar 2014 14:15:13 -0400	[thread overview]
Message-ID: <20140327181513.GF31168@tuxdriver.com> (raw)
In-Reply-To: <1395715732-9545-1-git-send-email-adam.lee-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

I'm confused -- is "rtlwifi: rtl8188ee: enable MSI interrupts support"
still wanted/needed?

John

On Tue, Mar 25, 2014 at 10:48:52AM +0800, Adam Lee wrote:
> Add MSI interrupts support, enable it when msi_support flag is true,
> also could fallback to pin-based interrupts mode if MSI mode fails.
> 
> Signed-off-by: Adam Lee <adam.lee-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> [3.10+]
> ---
>  drivers/net/wireless/rtlwifi/pci.c | 65 ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 63 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
> index f26f4ff..155d010 100644
> --- a/drivers/net/wireless/rtlwifi/pci.c
> +++ b/drivers/net/wireless/rtlwifi/pci.c
> @@ -1853,6 +1853,65 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
>  	return true;
>  }
>  
> +static int rtl_pci_intr_mode_msi(struct ieee80211_hw *hw)
> +{
> +	struct rtl_priv *rtlpriv = rtl_priv(hw);
> +	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
> +	struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
> +	int ret;
> +
> +	ret = pci_enable_msi(rtlpci->pdev);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt,
> +			  IRQF_SHARED, KBUILD_MODNAME, hw);
> +	if (ret < 0) {
> +		pci_disable_msi(rtlpci->pdev);
> +		return ret;
> +	}
> +
> +	rtlpci->using_msi = true;
> +
> +	RT_TRACE(rtlpriv, COMP_INIT|COMP_INTR, DBG_DMESG,
> +		 "MSI Interrupt Mode!\n");
> +	return 0;
> +}
> +
> +static int rtl_pci_intr_mode_legacy(struct ieee80211_hw *hw)
> +{
> +	struct rtl_priv *rtlpriv = rtl_priv(hw);
> +	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
> +	struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
> +	int ret;
> +
> +	ret = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt,
> +			  IRQF_SHARED, KBUILD_MODNAME, hw);
> +	if (ret < 0)
> +		return ret;
> +
> +	rtlpci->using_msi = false;
> +	RT_TRACE(rtlpriv, COMP_INIT|COMP_INTR, DBG_DMESG,
> +		 "Pin-based Interrupt Mode!\n");
> +	return 0;
> +}
> +
> +static int rtl_pci_intr_mode_decide(struct ieee80211_hw *hw)
> +{
> +	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
> +	struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
> +	int ret;
> +
> +	if (rtlpci->msi_support) {
> +		ret = rtl_pci_intr_mode_msi(hw);
> +		if (ret < 0)
> +			ret = rtl_pci_intr_mode_legacy(hw);
> +	} else {
> +		ret = rtl_pci_intr_mode_legacy(hw);
> +	}
> +	return ret;
> +}
> +
>  int rtl_pci_probe(struct pci_dev *pdev,
>  			    const struct pci_device_id *id)
>  {
> @@ -1995,8 +2054,7 @@ int rtl_pci_probe(struct pci_dev *pdev,
>  	}
>  
>  	rtlpci = rtl_pcidev(pcipriv);
> -	err = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt,
> -			  IRQF_SHARED, KBUILD_MODNAME, hw);
> +	err = rtl_pci_intr_mode_decide(hw);
>  	if (err) {
>  		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
>  			 "%s: failed to register IRQ handler\n",
> @@ -2064,6 +2122,9 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
>  		rtlpci->irq_alloc = 0;
>  	}
>  
> +	if (rtlpci->using_msi)
> +		pci_disable_msi(rtlpci->pdev);
> +
>  	list_del(&rtlpriv->list);
>  	if (rtlpriv->io.pci_mem_start != 0) {
>  		pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
> -- 
> 1.9.1
> 
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org			might be all we have.  Be ready.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-03-27 18:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24  6:00 [PATCH] rtlwifi: rtl8188ee: enable MSI interrupts support Adam Lee
2014-03-24  6:00 ` Adam Lee
2014-03-24  6:05 ` Adam Lee
2014-03-24  6:05   ` Adam Lee
2014-03-24  6:12   ` Greg KH
2014-03-24 11:34 ` [PATCH] rtlwifi: add " Adam Lee
2014-03-24 11:49   ` Adam Lee
2014-03-24 11:49     ` Adam Lee
2014-03-24 15:14   ` Larry Finger
2014-03-25  9:13     ` Adam Lee
2014-03-25  9:13       ` Adam Lee
2014-03-25  2:48   ` [PATCH v2] " Adam Lee
2014-03-25  2:48     ` Adam Lee
2014-03-27 18:15     ` John W. Linville [this message]
2014-03-27 18:15       ` John W. Linville
2014-03-27 18:45       ` Larry Finger
2014-03-28  3:36     ` [PATCH v3 1/2] rtlwifi: add MSI interrupts mode support Adam Lee
2014-03-28  3:36       ` [PATCH v3 2/2] rtlwifi: rtl8188ee: enable MSI interrupts mode Adam Lee
2014-03-28  3:36         ` Adam Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140327181513.GF31168@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=adam.lee@canonical.com \
    --cc=chaoming_li@realsil.com.cn \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.