Netdev List
 help / color / mirror / Atom feed
* [PATCH V2]  vhost: fix check for # of outstanding buffers
From: Shirley Ma @ 2011-07-20 17:23 UTC (permalink / raw)
  To: mst; +Cc: David Miller, netdev, jasowang

Fix the check for number of outstanding buffers returns incorrect
results due to vq->pend_idx wrap around;

Signed-off-by: Shirley Ma <xma@us.ibm.com>
---

 drivers/vhost/net.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 70ac604..946a71e 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -182,15 +182,21 @@ static void handle_tx(struct vhost_net *net)
 			break;
 		/* Nothing new?  Wait for eventfd to tell us they refilled. */
 		if (head == vq->num) {
+			int num_pends;
+
 			wmem = atomic_read(&sock->sk->sk_wmem_alloc);
 			if (wmem >= sock->sk->sk_sndbuf * 3 / 4) {
 				tx_poll_start(net, sock);
 				set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
 				break;
 			}
-			/* If more outstanding DMAs, queue the work */
-			if (unlikely(vq->upend_idx - vq->done_idx >
-				     VHOST_MAX_PEND)) {
+			/* If more outstanding DMAs, queue the work
+			 * handle upend_idx wrap around
+			 */
+			num_pends = (vq->upend_idx >= vq->done_idx) ?
+				    (vq->upend_idx - vq->done_idx) :
+				    (vq->upend_idx + UIO_MAXIOV - vq->done_idx);
+			if (unlikely(num_pends > VHOST_MAX_PEND)) {
 				tx_poll_start(net, sock);
 				set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
 				break;



^ permalink raw reply related

* Re: [PATCH net-next]vhost: fix condition check for # of outstanding dma buffers
From: Shirley Ma @ 2011-07-20 16:49 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: David Miller, netdev, jasowang
In-Reply-To: <20110720161721.GD8077@redhat.com>

On Wed, 2011-07-20 at 19:17 +0300, Michael S. Tsirkin wrote:
> My point was that the logic isn't the same, even though
> you said 'it is equal to'.
> Same applies to upend_idx == 1, done_idx == 0.

:) not sure what I was thinking.

I will resubmit the patch.

Thanks
Shirley



^ permalink raw reply

* Re: [PATCH] rtlwifi: Convert printks to pr_<level>
From: Larry Finger @ 2011-07-20 16:38 UTC (permalink / raw)
  To: Joe Perches
  Cc: Chaoming Li, John W. Linville, linux-wireless, netdev,
	linux-kernel
In-Reply-To: <b57f00fc1d0947443aa1830c11c288e78924af44.1311177059.git.joe@perches.com>

On 07/20/2011 10:51 AM, Joe Perches wrote:
> Use the current logging styles.
> Add pr_fmt where appropriate.
> Remove now unnecessary prefixes from printks.
> Convert hard coded prefix to __func__.
> Add a missing "\n" to a format.
>
> Signed-off-by: Joe Perches<joe@perches.com>
> ---
>   drivers/net/wireless/rtlwifi/base.c               |    9 ++-
>   drivers/net/wireless/rtlwifi/cam.c                |    4 +-
>   drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c |    5 +-
>   drivers/net/wireless/rtlwifi/rtl8192cu/hw.c       |   69 ++++++++------------
>   drivers/net/wireless/rtlwifi/rtl8192cu/mac.c      |   11 ++-
>   drivers/net/wireless/rtlwifi/rtl8192de/sw.c       |    8 +-
>   drivers/net/wireless/rtlwifi/rtl8192se/hw.c       |   10 ++--
>   drivers/net/wireless/rtlwifi/rtl8192se/phy.c      |    5 +-
>   drivers/net/wireless/rtlwifi/rtl8192se/rf.c       |    4 +-
>   drivers/net/wireless/rtlwifi/rtl8192se/sw.c       |    6 +-
>   drivers/net/wireless/rtlwifi/usb.c                |   12 ++--
>   11 files changed, 72 insertions(+), 71 deletions(-)
>
> diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
> index bc13533..d88e405 100644
> --- a/drivers/net/wireless/rtlwifi/base.c
> +++ b/drivers/net/wireless/rtlwifi/base.c
> @@ -27,6 +27,8 @@
>    *
>    *****************************************************************************/
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include<linux/ip.h>
>   #include "wifi.h"
>   #include "rc.h"
> @@ -397,8 +399,8 @@ void rtl_init_rfkill(struct ieee80211_hw *hw)
>   	radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw,&valid);
>
>   	if (valid) {
> -		printk(KERN_INFO "rtlwifi: wireless switch is %s\n",
> -				rtlpriv->rfkill.rfkill_state ? "on" : "off");
> +		pr_info("wireless switch is %s\n",
> +			rtlpriv->rfkill.rfkill_state ? "on" : "off");
>
>   		rtlpriv->rfkill.rfkill_state = radio_state;
>
> @@ -1402,8 +1404,7 @@ MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core");
>   static int __init rtl_core_module_init(void)
>   {
>   	if (rtl_rate_control_register())
> -		printk(KERN_ERR "rtlwifi: Unable to register rtl_rc,"
> -		       "use default RC !!\n");
> +		pr_err("Unable to register rtl_rc, use default RC !!\n");
>
>   	return 0;
>   }
> diff --git a/drivers/net/wireless/rtlwifi/cam.c b/drivers/net/wireless/rtlwifi/cam.c
> index 7295af0..b12a668 100644
> --- a/drivers/net/wireless/rtlwifi/cam.c
> +++ b/drivers/net/wireless/rtlwifi/cam.c
> @@ -27,6 +27,8 @@
>    *
>    *****************************************************************************/
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include "wifi.h"
>   #include "cam.h"
>
> @@ -347,7 +349,7 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
>   			/* Remove from HW Security CAM */
>   			memset(rtlpriv->sec.hwsec_cam_sta_addr[i], 0, ETH_ALEN);
>   			rtlpriv->sec.hwsec_cam_bitmap&= ~(BIT(0)<<  i);
> -			printk(KERN_INFO "&&&&&&&&&del entry %d\n", i);
> +			pr_info("&&&&&&&&&del entry %d\n", i);
>   		}
>   	}
>   	return;
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
> index f9f2370..49a064b 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
> @@ -27,6 +27,8 @@
>    *
>    *****************************************************************************/
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include<linux/firmware.h>
>   #include "../wifi.h"
>   #include "../pci.h"
> @@ -224,8 +226,7 @@ int rtl92c_download_fw(struct ieee80211_hw *hw)
>   	u32 fwsize;
>   	enum version_8192c version = rtlhal->version;
>
> -	printk(KERN_INFO "rtl8192c: Loading firmware file %s\n",
> -	       rtlpriv->cfg->fw_name);
> +	pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name);
>   	if (!rtlhal->pfirmware)
>   		return 1;
>
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
> index 2b34764..814c05d 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
> @@ -27,6 +27,8 @@
>    *
>    *****************************************************************************/
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include "../wifi.h"
>   #include "../efuse.h"
>   #include "../base.h"
> @@ -337,7 +339,7 @@ static void _rtl92cu_read_board_type(struct ieee80211_hw *hw, u8 *contents)
>   	rtlefuse->board_type = boardType;
>   	if (IS_HIGHT_PA(rtlefuse->board_type))
>   		rtlefuse->external_pa = 1;
> -	printk(KERN_INFO "rtl8192cu: Board Type %x\n", rtlefuse->board_type);
> +	pr_info("Board Type %x\n", rtlefuse->board_type);
>
>   #ifdef CONFIG_ANTENNA_DIVERSITY
>   	/* Antenna Diversity setting. */
> @@ -346,8 +348,7 @@ static void _rtl92cu_read_board_type(struct ieee80211_hw *hw, u8 *contents)
>   	else
>   		rtl_efuse->antenna_cfg = registry_par->antdiv_cfg; /* 0:OFF, */
>
> -	printk(KERN_INFO "rtl8192cu: Antenna Config %x\n",
> -	       rtl_efuse->antenna_cfg);
> +	pr_info("Antenna Config %x\n", rtl_efuse->antenna_cfg);
>   #endif
>   }
>
> @@ -384,71 +385,57 @@ static void _update_bt_param(_adapter *padapter)
>   	pbtpriv->bBTNonTrafficModeSet = _FALSE;
>   	pbtpriv->CurrentState = 0;
>   	pbtpriv->PreviousState = 0;
> -	printk(KERN_INFO "rtl8192cu: BT Coexistance = %s\n",
> -	       (pbtpriv->BT_Coexist == _TRUE) ? "enable" : "disable");
> +	pr_info("BT Coexistance = %s\n",
> +		(pbtpriv->BT_Coexist == _TRUE) ? "enable" : "disable");
>   	if (pbtpriv->BT_Coexist) {
>   		if (pbtpriv->BT_Ant_Num == Ant_x2)
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
> -			       "Ant_Num = Antx2\n");
> +			pr_info("BlueTooth BT_Ant_Num = Antx2\n");
>   		else if (pbtpriv->BT_Ant_Num == Ant_x1)
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
> -			       "Ant_Num = Antx1\n");
> +			pr_info("BlueTooth BT_Ant_Num = Antx1\n");
>   		switch (pbtpriv->BT_CoexistType) {
>   		case BT_2Wire:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
> -			       "CoexistType = BT_2Wire\n");
> +			pr_info("BlueTooth BT_CoexistType = BT_2Wire\n");
>   			break;
>   		case BT_ISSC_3Wire:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
> -			       "CoexistType = BT_ISSC_3Wire\n");
> +			pr_info("BlueTooth BT_CoexistType = BT_ISSC_3Wire\n");
>   			break;
>   		case BT_Accel:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
> -			       "CoexistType = BT_Accel\n");
> +			pr_info("BlueTooth BT_CoexistType = BT_Accel\n");
>   			break;
>   		case BT_CSR_BC4:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
> -			       "CoexistType = BT_CSR_BC4\n");
> +			pr_info("BlueTooth BT_CoexistType = BT_CSR_BC4\n");
>   			break;
>   		case BT_CSR_BC8:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
> -			       "CoexistType = BT_CSR_BC8\n");
> +			pr_info("BlueTooth BT_CoexistType = BT_CSR_BC8\n");
>   			break;
>   		case BT_RTL8756:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
> -			       "CoexistType = BT_RTL8756\n");
> +			pr_info("BlueTooth BT_CoexistType = BT_RTL8756\n");
>   			break;
>   		default:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
> -			       "CoexistType = Unknown\n");
> +			pr_info("BlueTooth BT_CoexistType = Unknown\n");
>   			break;
>   		}
> -		printk(KERN_INFO "rtl8192cu: BlueTooth BT_Ant_isolation = %d\n",
> -		       pbtpriv->BT_Ant_isolation);
> +		pr_info("BlueTooth BT_Ant_isolation = %d\n",
> +			pbtpriv->BT_Ant_isolation);
>   		switch (pbtpriv->BT_Service) {
>   		case BT_OtherAction:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
> -			       "BT_OtherAction\n");
> +			pr_info("BlueTooth BT_Service = BT_OtherAction\n");
>   			break;
>   		case BT_SCO:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
> -			       "BT_SCO\n");
> +			pr_info("BlueTooth BT_Service = BT_SCO\n");
>   			break;
>   		case BT_Busy:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
> -			       "BT_Busy\n");
> +			pr_info("BlueTooth BT_Service = BT_Busy\n");
>   			break;
>   		case BT_OtherBusy:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
> -			       "BT_OtherBusy\n");
> +			pr_info("BlueTooth BT_Service = BT_OtherBusy\n");
>   			break;
>   		default:
> -			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
> -			       "BT_Idle\n");
> +			pr_info("BlueTooth BT_Service = BT_Idle\n");
>   			break;
>   		}
> -		printk(KERN_INFO "rtl8192cu: BT_RadioSharedType = 0x%x\n",
> -		       pbtpriv->BT_RadioSharedType);
> +		pr_info("BT_RadioSharedType = 0x%x\n",
> +			pbtpriv->BT_RadioSharedType);
>   	}
>   }
>
> @@ -526,7 +513,7 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw)
>   		usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
>   		*((u16 *) (&rtlefuse->dev_addr[i])) = usvalue;
>   	}
> -	printk(KERN_INFO "rtl8192cu: MAC address: %pM\n", rtlefuse->dev_addr);
> +	pr_info("MAC address: %pM\n", rtlefuse->dev_addr);
>   	_rtl92cu_read_txpower_info_from_hwpg(hw,
>   					   rtlefuse->autoload_failflag, hwinfo);
>   	rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID];
> @@ -665,7 +652,7 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
>   	rtl_write_word(rtlpriv, REG_APS_FSMCO, value16);
>   	do {
>   		if (!(rtl_read_word(rtlpriv, REG_APS_FSMCO)&  APFM_ONMAC)) {
> -			printk(KERN_INFO "rtl8192cu: MAC auto ON okay!\n");
> +			pr_info("MAC auto ON okay!\n");
>   			break;
>   		}
>   		if (pollingCount++>  100) {
> @@ -819,7 +806,7 @@ static void _rtl92cu_init_chipN_one_out_ep_priority(struct ieee80211_hw *hw,
>   	}
>   	_rtl92c_init_chipN_reg_priority(hw, value, value, value, value,
>   					value, value);
> -	printk(KERN_INFO "rtl8192cu: Tx queue select: 0x%02x\n", queue_sel);
> +	pr_info("Tx queue select: 0x%02x\n", queue_sel);
>   }
>
>   static void _rtl92cu_init_chipN_two_out_ep_priority(struct ieee80211_hw *hw,
> @@ -863,7 +850,7 @@ static void _rtl92cu_init_chipN_two_out_ep_priority(struct ieee80211_hw *hw,
>   		hiQ = valueHi;
>   	}
>   	_rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ);
> -	printk(KERN_INFO "rtl8192cu: Tx queue select: 0x%02x\n", queue_sel);
> +	pr_info("Tx queue select: 0x%02x\n", queue_sel);
>   }
>
>   static void _rtl92cu_init_chipN_three_out_ep_priority(struct ieee80211_hw *hw,
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
> index a90c09b..194fc69 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
> @@ -26,6 +26,9 @@
>    * Larry Finger<Larry.Finger@lwfinger.net>
>    *
>   ****************************************************************************/
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include<linux/module.h>
>
>   #include "../wifi.h"
> @@ -213,14 +216,14 @@ bool rtl92c_init_llt_table(struct ieee80211_hw *hw, u32 boundary)
>   	for (i = 0; i<  (boundary - 1); i++) {
>   		rst = rtl92c_llt_write(hw, i , i + 1);
>   		if (true != rst) {
> -			printk(KERN_ERR "===>  %s #1 fail\n", __func__);
> +			pr_err("===>  %s #1 fail\n", __func__);
>   			return rst;
>   		}
>   	}
>   	/* end of list */
>   	rst = rtl92c_llt_write(hw, (boundary - 1), 0xFF);
>   	if (true != rst) {
> -		printk(KERN_ERR "===>  %s #2 fail\n", __func__);
> +		pr_err("===>  %s #2 fail\n", __func__);
>   		return rst;
>   	}
>   	/* Make the other pages as ring buffer
> @@ -231,14 +234,14 @@ bool rtl92c_init_llt_table(struct ieee80211_hw *hw, u32 boundary)
>   	for (i = boundary; i<  LLT_LAST_ENTRY_OF_TX_PKT_BUFFER; i++) {
>   		rst = rtl92c_llt_write(hw, i, (i + 1));
>   		if (true != rst) {
> -			printk(KERN_ERR "===>  %s #3 fail\n", __func__);
> +			pr_err("===>  %s #3 fail\n", __func__);
>   			return rst;
>   		}
>   	}
>   	/* Let last entry point to the start entry of ring buffer */
>   	rst = rtl92c_llt_write(hw, LLT_LAST_ENTRY_OF_TX_PKT_BUFFER, boundary);
>   	if (true != rst) {
> -		printk(KERN_ERR "===>  %s #4 fail\n", __func__);
> +		pr_err("===>  %s #4 fail\n", __func__);
>   		return rst;
>   	}
>   	return rst;
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
> index 0883774..351765d 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
> @@ -27,6 +27,8 @@
>    *
>    *****************************************************************************/
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include<linux/vmalloc.h>
>
>   #include "../wifi.h"
> @@ -170,10 +172,8 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)
>   	}
>
>   	if (!header_print) {
> -		printk(KERN_INFO "rtl8192de: Driver for Realtek RTL8192DE"
> -		       " WLAN interface");
> -		printk(KERN_INFO "rtl8192de: Loading firmware file %s\n",
> -		       rtlpriv->cfg->fw_name);
> +		pr_info("Driver for Realtek RTL8192DE WLAN interface\n");
> +		pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name);
>   		header_print++;
>   	}
>   	/* request fw */
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
> index b1d0213..73142a9 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
> @@ -27,6 +27,8 @@
>    *
>    *****************************************************************************/
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include "../wifi.h"
>   #include "../efuse.h"
>   #include "../base.h"
> @@ -465,8 +467,7 @@ static u8 _rtl92ce_halset_sysclk(struct ieee80211_hw *hw, u8 data)
>   			if ((tmpvalue&  BIT(6)))
>   				break;
>
> -			printk(KERN_ERR "wait for BIT(6) return value %x\n",
> -			       tmpvalue);
> +			pr_err("wait for BIT(6) return value %x\n", tmpvalue);
>   			if (waitcount == 0)
>   				break;
>
> @@ -1255,8 +1256,7 @@ static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data)
>   			if ((tmp&  BIT(6)))
>   				break;
>
> -			printk(KERN_ERR "wait for BIT(6) return value %x\n",
> -			       tmp);
> +			pr_err("wait for BIT(6) return value %x\n", tmp);
>
>   			if (waitcnt == 0)
>   				break;
> @@ -1315,7 +1315,7 @@ static void _rtl92s_phy_set_rfhalt(struct ieee80211_hw *hw)
>   	if (u1btmp&  BIT(7)) {
>   		u1btmp&= ~(BIT(6) | BIT(7));
>   		if (!_rtl92s_set_sysclk(hw, u1btmp)) {
> -			printk(KERN_ERR "Switch ctrl path fail\n");
> +			pr_err("Switch ctrl path fail\n");
>   			return;
>   		}
>   	}
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
> index 81a5aa4..f27171a 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
> @@ -27,6 +27,8 @@
>    *
>    *****************************************************************************/
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include "../wifi.h"
>   #include "../pci.h"
>   #include "../ps.h"
> @@ -1016,8 +1018,7 @@ static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw *hw)
>   	rtstatus = _rtl92s_phy_config_bb(hw, BASEBAND_CONFIG_AGC_TAB);
>
>   	if (rtstatus != true) {
> -		printk(KERN_ERR  "_rtl92s_phy_bb_config_parafile(): "
> -		       "AGC Table Fail\n");
> +		pr_err("%s(): AGC Table Fail\n", __func__);
>   		goto phy_BB8190_Config_ParaFile_Fail;
>   	}
>
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
> index c6e3a4c..0ad50fe 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
> @@ -27,6 +27,8 @@
>    *
>    *****************************************************************************/
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include "../wifi.h"
>   #include "reg.h"
>   #include "def.h"
> @@ -507,7 +509,7 @@ bool rtl92s_phy_rf6052_config(struct ieee80211_hw *hw)
>   		}
>
>   		if (rtstatus != true) {
> -			printk(KERN_ERR "Radio[%d] Fail!!", rfpath);
> +			pr_err("Radio[%d] Fail!!\n", rfpath);
>   			goto fail;
>   		}
>
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
> index 1c6cb1d..3876078 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
> @@ -27,6 +27,8 @@
>    *
>    *****************************************************************************/
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include<linux/vmalloc.h>
>
>   #include "../wifi.h"
> @@ -183,8 +185,8 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
>   		return 1;
>   	}
>
> -	printk(KERN_INFO "rtl8192se: Driver for Realtek RTL8192SE/RTL8191SE\n"
> -	       "           Loading firmware %s\n", rtlpriv->cfg->fw_name);
> +	pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n"
> +		"Loading firmware %s\n", rtlpriv->cfg->fw_name);
>   	/* request fw */
>   	err = request_firmware(&firmware, rtlpriv->cfg->fw_name,
>   			rtlpriv->io.dev);
> diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
> index a9367eb..8b1cef0 100644
> --- a/drivers/net/wireless/rtlwifi/usb.c
> +++ b/drivers/net/wireless/rtlwifi/usb.c
> @@ -24,6 +24,9 @@
>    * Hsinchu 300, Taiwan.
>    *
>    *****************************************************************************/
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include<linux/usb.h>
>   #include "core.h"
>   #include "wifi.h"
> @@ -104,9 +107,8 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request,
>   				 pdata, len, 0); /* max. timeout */
>
>   	if (status<  0)
> -		printk(KERN_ERR "reg 0x%x, usbctrl_vendorreq TimeOut! "
> -		       "status:0x%x value=0x%x\n", value, status,
> -		       *(u32 *)pdata);
> +		pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x\n",
> +		       value, status, *(u32 *)pdata);
>   	return status;
>   }
>
> @@ -316,7 +318,7 @@ static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
>   	rtlusb->usb_rx_segregate_hdl =
>   		rtlpriv->cfg->usb_interface_cfg->usb_rx_segregate_hdl;
>
> -	printk(KERN_INFO "rtl8192cu: rx_max_size %d, rx_urb_num %d, in_ep %d\n",
> +	pr_info("rx_max_size %d, rx_urb_num %d, in_ep %d\n",
>   		rtlusb->rx_max_size, rtlusb->rx_urb_num, rtlusb->in_ep);
>   	init_usb_anchor(&rtlusb->rx_submitted);
>   	return 0;
> @@ -580,7 +582,7 @@ static void _rtl_rx_completed(struct urb *_urb)
>   		} else{
>   			/* TO DO */
>   			_rtl_rx_pre_process(hw, skb);
> -			printk(KERN_ERR "rtlwifi: rx agg not supported\n");
> +			pr_err("rx agg not supported\n");
>   		}
>   		goto resubmit;
>   	}

Joe,

In general these look good, but why not define pr_fmt in rtlwifi/wifi.h. That 
header is used by every source file, and you only need the define once.

Larry


^ permalink raw reply

* Re: sch_generic warn_on (timed out)
From: Brandeburg, Jesse @ 2011-07-20 16:38 UTC (permalink / raw)
  To: Dave Jones; +Cc: netdev@vger.kernel.org
In-Reply-To: <20110711204834.GA4950@redhat.com>



On Mon, 11 Jul 2011, Dave Jones wrote:
>             WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n",
>                       dev->name, netdev_drivername(dev, drivername, 64), i);
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=702723 is our 'master bug' that we're
> duping all others against. It seems to be showing up on a variety of different
> hardware (r8169, atl1c, ipheth, e1000e, 8139too). Do all these drivers need
> fixing ? or is it just 'crap hardware' ?

neither, probably
 
> note that I've only been looking through fedora 15 bugs so far (which is still on 2.6.38),
> but looking at the commit log for sch_generic, it doesn't seem that there's anything
> obvious that needs backporting.

it used to just be a KERN_ERR printk, then it changed it to be a WARN_ONCE 
in order to trigger kerneloops reports so we knew how many people were 
getting tx hangs from their hardware.

The bad news is there is never anything useful in the backtrace, besides 
what driver it is.  Users have been trained to send backtrace for panic 
messages, and in this case it doesn't help very much to identify what 
the problem was.

If the reports within each driver were able to be traced back to a 
specific *model* of hardware then that might be useful (particularly for 
Intel hardware).  Maybe the WARN_ONCE should print vendor/device pair so 
we would at least know the hardware from the panic trace.

If this is happening more frequently on F15 than F14 across multiple 
pieces of hardware, it may indicate that a kernel/stack change is starting 
to (ab)use a changed working model that is causing an issue, or that there 
is an actual kernel issue with locks or interrupts or tx completions that 
is causing an excessive delay in completion of transmits.

Dave can you query for F14 reports and/or isolate what kernel this started 
with?

^ permalink raw reply

* Re: [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods
From: Ben Greear @ 2011-07-20 16:37 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Neil Horman, Eric Dumazet, Jiri Pirko, netdev, Alexey Dobriyan,
	David S. Miller, robert.olsson
In-Reply-To: <CAHXqBFKD1bD8uMYOwbhsutT0ZuEiw=7pUDM1hVGpCgrdnV6zAg@mail.gmail.com>

On 07/20/2011 08:35 AM, Michał Mirosław wrote:
> 2011/7/20 Neil Horman<nhorman@tuxdriver.com>:
>> On Wed, Jul 20, 2011 at 06:24:15AM +0200, Eric Dumazet wrote:
>>> Le mardi 19 juillet 2011 à 22:07 -0400, Neil Horman a écrit :
>>>>>
>>>> I think this is a good idea.  It lets pktgen dynamically make the clone/share
>>>> decision dynamically and only impacts performance for those systems.
>>>>
>>>
>>> Just let pktgen refuse to use clone_skb command for these devices.
>>>
>> copy that, This is by no means final, but what do you think of this?  If its
>> agreeable to you, Ben, et al. I can add this to my local tree and start auditing
>> all the drivers that may need to have the flag set.
>>
>> Regards
>> Neil
>>
>>
>> diff --git a/include/linux/if.h b/include/linux/if.h
>> index 3bc63e6..ae904fe 100644
>> --- a/include/linux/if.h
>> +++ b/include/linux/if.h
>> @@ -76,6 +76,7 @@
>>   #define IFF_BRIDGE_PORT        0x4000          /* device used as bridge port */
>>   #define IFF_OVS_DATAPATH       0x8000  /* device used as Open vSwitch
>>                                          * datapath port */
>> +#define IFF_CANT_SHARE_SKB     0x10000 /* Device can't share skbs in tx path */
>>
>>   #define IF_GET_IFACE   0x0001          /* for querying only */
>>   #define IF_GET_PROTO   0x0002
>> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
>> index f76079c..bf6d88d 100644
>> --- a/net/core/pktgen.c
>> +++ b/net/core/pktgen.c
>> @@ -1071,6 +1071,9 @@ static ssize_t pktgen_if_write(struct file *file,
>>                 if (len<  0)
>>                         return len;
>>
>> +               if (pkt_dev->priv_flags&  IFF_CANT_SHARE_SKB)
>> +                       return -EOPNOTSUPP;
>> +
>>                 i += len;
>>                 pkt_dev->clone_skb = value;
>>
>
> I would prefer that the flag be inclusive, i.e. it should mark drivers
> which can use shared skbs. And it might be better to clone the skb in
> case the flag is disabled to keep functionality working.

The whole point of clone-skb is for speedup due to not allocating
new memory..so if the netdev can't support it, lets just fail instead
of giving user false sense of it working...

User can just use clone-skb value of 0 in that case...

Thanks,
Ben

>
> Best Regards,
> Michał Mirosław
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* Re: IPv6: autoconfiguration and suspend/resume or link down/up
From: Jiri Bohac @ 2011-07-20 16:36 UTC (permalink / raw)
  To: Dan Williams
  Cc: Jiri Bohac, netdev, Herbert Xu, David S. Miller,
	stephen hemminger
In-Reply-To: <1311178905.21004.9.camel@dcbw.foobar.com>

On Wed, Jul 20, 2011 at 11:21:43AM -0500, Dan Williams wrote:
> ... and in the resume handler use that value to age anything
> that needs to know about time spent in suspend, and then do what needs
> to be done with that.  So something like that may work for IPv6
> addrconf; on suspend save current time, and on resume check the current
> time, subtract the time you saved on suspend, and magically add that to
> the lifetime counts and then run any expiry stuff.

IPv6 (by specification) does not send any RS when an IP address
or route expires. So only subtracting the supend time from the
lifetimes and possibly expiring the routes/IP addresses won't fix
the problem.

When I move to a new network, I need to restart the
autoconfiguration. This does not currently happen - neither for
an alive system where the ethernet link goes down/up, nor for a
system that gets suspended, moved and then resumed.

-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CZ


^ permalink raw reply

* Re: [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods
From: Neil Horman @ 2011-07-20 16:36 UTC (permalink / raw)
  To: Ben Greear
  Cc: Eric Dumazet, Jiri Pirko, netdev, Alexey Dobriyan,
	David S. Miller, robert.olsson
In-Reply-To: <4E270350.7050904@candelatech.com>

On Wed, Jul 20, 2011 at 09:33:20AM -0700, Ben Greear wrote:
> On 07/20/2011 08:18 AM, Neil Horman wrote:
> >On Wed, Jul 20, 2011 at 06:24:15AM +0200, Eric Dumazet wrote:
> >>Le mardi 19 juillet 2011 à 22:07 -0400, Neil Horman a écrit :
> >>>>
> >>>I think this is a good idea.  It lets pktgen dynamically make the clone/share
> >>>decision dynamically and only impacts performance for those systems.
> >>>
> >>
> >>Just let pktgen refuse to use clone_skb command for these devices.
> >>
> >copy that, This is by no means final, but what do you think of this?  If its
> >agreeable to you, Ben, et al. I can add this to my local tree and start auditing
> >all the drivers that may need to have the flag set.
> >
> >Regards
> >Neil
> >
> >
> >diff --git a/include/linux/if.h b/include/linux/if.h
> >index 3bc63e6..ae904fe 100644
> >--- a/include/linux/if.h
> >+++ b/include/linux/if.h
> >@@ -76,6 +76,7 @@
> >  #define IFF_BRIDGE_PORT	0x4000		/* device used as bridge port */
> >  #define IFF_OVS_DATAPATH	0x8000	/* device used as Open vSwitch
> >  					 * datapath port */
> >+#define IFF_CANT_SHARE_SKB	0x10000	/* Device can't share skbs in tx path */
> >
> >  #define IF_GET_IFACE	0x0001		/* for querying only */
> >  #define IF_GET_PROTO	0x0002
> >diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> >index f76079c..bf6d88d 100644
> >--- a/net/core/pktgen.c
> >+++ b/net/core/pktgen.c
> >@@ -1071,6 +1071,9 @@ static ssize_t pktgen_if_write(struct file *file,
> >  		if (len<  0)
> >  			return len;
> >
> >+		if (pkt_dev->priv_flags&  IFF_CANT_SHARE_SKB)
> >+			return -EOPNOTSUPP;
> >+
> >  		i += len;
> >  		pkt_dev->clone_skb = value;
> >
> 
> Please only return an error if value > 1.
> 
> Also, if there is any place where user can configure pkt_dev,
> you would want code there to check for the CANT_SHARE_SKB flag
> and force clone_skb to zero if user changes to a different
> device that cannot share skbs.
> 
> Thanks,
> Ben
> 
Understood, thank you Ben.
Neil

> -- 
> Ben Greear <greearb@candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
> 
> 

^ permalink raw reply

* Re: [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods
From: Ben Greear @ 2011-07-20 16:33 UTC (permalink / raw)
  To: Neil Horman
  Cc: Eric Dumazet, Jiri Pirko, netdev, Alexey Dobriyan,
	David S. Miller, robert.olsson
In-Reply-To: <20110720151827.GD12349@hmsreliant.think-freely.org>

On 07/20/2011 08:18 AM, Neil Horman wrote:
> On Wed, Jul 20, 2011 at 06:24:15AM +0200, Eric Dumazet wrote:
>> Le mardi 19 juillet 2011 à 22:07 -0400, Neil Horman a écrit :
>>>>
>>> I think this is a good idea.  It lets pktgen dynamically make the clone/share
>>> decision dynamically and only impacts performance for those systems.
>>>
>>
>> Just let pktgen refuse to use clone_skb command for these devices.
>>
> copy that, This is by no means final, but what do you think of this?  If its
> agreeable to you, Ben, et al. I can add this to my local tree and start auditing
> all the drivers that may need to have the flag set.
>
> Regards
> Neil
>
>
> diff --git a/include/linux/if.h b/include/linux/if.h
> index 3bc63e6..ae904fe 100644
> --- a/include/linux/if.h
> +++ b/include/linux/if.h
> @@ -76,6 +76,7 @@
>   #define IFF_BRIDGE_PORT	0x4000		/* device used as bridge port */
>   #define IFF_OVS_DATAPATH	0x8000	/* device used as Open vSwitch
>   					 * datapath port */
> +#define IFF_CANT_SHARE_SKB	0x10000	/* Device can't share skbs in tx path */
>
>   #define IF_GET_IFACE	0x0001		/* for querying only */
>   #define IF_GET_PROTO	0x0002
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index f76079c..bf6d88d 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -1071,6 +1071,9 @@ static ssize_t pktgen_if_write(struct file *file,
>   		if (len<  0)
>   			return len;
>
> +		if (pkt_dev->priv_flags&  IFF_CANT_SHARE_SKB)
> +			return -EOPNOTSUPP;
> +
>   		i += len;
>   		pkt_dev->clone_skb = value;
>

Please only return an error if value > 1.

Also, if there is any place where user can configure pkt_dev,
you would want code there to check for the CANT_SHARE_SKB flag
and force clone_skb to zero if user changes to a different
device that cannot share skbs.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply

* Re: [PATCH 1/3] wireless: rtlwifi: throw away MAC_FMT and use %pM instead
From: Larry Finger @ 2011-07-20 16:31 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andy Shevchenko, linux-wireless, netdev, John W. Linville,
	linux-kernel, 'Chaoming_Li'
In-Reply-To: <1311177762.1663.9.camel@Joe-Laptop>

On 07/20/2011 11:02 AM, Joe Perches wrote:
> On Wed, 2011-07-20 at 10:47 -0500, Larry Finger wrote:
>> Thanks for the patch.
>
> Hey Larry.
>
> rtlwifi has a CONFIG_BT_COEXIST which is currently
> unused/undefined by Kconfig.
>
> Are there plans to enable this or should the code
> just be removed?
>
> There may be a few dependencies in rtlwifi for
> variables set in this block so it seems from
> superficial reading that removal might be a bit
> involved.  I didn't look much more than that,
> but struct btcoexist_priv doesn't seem to be
> specified by the code anywhere.

I don't know the answer to that, but I have added Chaoming Li to the Cc. He will 
know if Realtek has any plans for BT coexistence.

Larry

^ permalink raw reply

* Re: IPv6: autoconfiguration and suspend/resume or link down/up
From: Jiri Bohac @ 2011-07-20 16:29 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Jiri Bohac, netdev, Herbert Xu, David S. Miller
In-Reply-To: <20110720091556.619a0c14@nehalam.ftrdhcpuser.net>

On Wed, Jul 20, 2011 at 09:15:56AM -0700, Stephen Hemminger wrote:
> > When the cable is unplugged and plugged in again, we already get
> > notified through linkwatch -> netdev_state_change ->
> >   -> call_netdevice_notifiers(NETDEV_CHANGE, ...)
> > However, if the device has already been autoconfigured,
> > addrconf_notify() only handles this event by printing a
> > message.

...

> If the driver drops the link during suspend then the necessary link
> events happen to keep bridging, ipv6, bonding and all the other possible
> network protocols happy.

OK, so maybe providing the link event on suspend/resume should be
left to the drivers.

The main problem persists: IPv6 currently does nothing when the link goes
down and returns. Shouldn't the kernel anticipate that the new
network could be different, forget all the autoconfigured
parameters and restart the autoconfiguration?

-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CZ


^ permalink raw reply

* Re: linux-next: Tree for July 20 (qlcnic)
From: Randy Dunlap @ 2011-07-20 16:19 UTC (permalink / raw)
  To: Stephen Rothwell, netdev; +Cc: linux-next, LKML, linux-driver
In-Reply-To: <20110720180041.5774ca335e6697c17374dca5@canb.auug.org.au>

On Wed, 20 Jul 2011 18:00:41 +1000 Stephen Rothwell wrote:

> Hi all,

When CONFIG_VLAN_8021Q is not enabled:

drivers/net/qlcnic/qlcnic_main.c:4207: error: 'struct net_device' has no member named 'vlgrp'

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply

* Re: [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods
From: Neil Horman @ 2011-07-20 16:19 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Ben Greear, Jiri Pirko, netdev, Alexey Dobriyan, David S. Miller,
	robert.olsson
In-Reply-To: <1311176688.2338.49.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Wed, Jul 20, 2011 at 05:44:48PM +0200, Eric Dumazet wrote:
> Le mercredi 20 juillet 2011 à 11:39 -0400, Neil Horman a écrit :
> 
> > Isn't that exactly what this does?  Disallows a user from issuing the cone_skb
> > command in a pktgen script if the underlying driver can't support the sharing of
> > skbs.
> 
> My bad, I misread your patch. Seems fine to me ;)
> 
Ok, thanks.  I'll put this in a local tree and stat auditing drivers to see who
needs it set/cleared.  I'll post a new series when I have it done.

Thanks!
Neil


^ permalink raw reply

* Re: [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods
From: Neil Horman @ 2011-07-20 16:18 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Eric Dumazet, Ben Greear, Jiri Pirko, netdev, Alexey Dobriyan,
	David S. Miller, robert.olsson
In-Reply-To: <CAHXqBFJhChXOpDOON-bz-DAkFUaggTYjwe6qjggb07Pf9bF8Vw@mail.gmail.com>

On Wed, Jul 20, 2011 at 06:08:39PM +0200, Michał Mirosław wrote:
> W dniu 20 lipca 2011 17:40 użytkownik Neil Horman
> <nhorman@tuxdriver.com> napisał:
> > On Wed, Jul 20, 2011 at 05:35:47PM +0200, Michał Mirosław wrote:
> >> 2011/7/20 Neil Horman <nhorman@tuxdriver.com>:
> >> > On Wed, Jul 20, 2011 at 06:24:15AM +0200, Eric Dumazet wrote:
> >> >> Le mardi 19 juillet 2011 à 22:07 -0400, Neil Horman a écrit :
> >> >> > >
> >> >> > I think this is a good idea.  It lets pktgen dynamically make the clone/share
> >> >> > decision dynamically and only impacts performance for those systems.
> >> >> >
> >> >>
> >> >> Just let pktgen refuse to use clone_skb command for these devices.
> >> >>
> >> > copy that, This is by no means final, but what do you think of this?  If its
> >> > agreeable to you, Ben, et al. I can add this to my local tree and start auditing
> >> > all the drivers that may need to have the flag set.
> >> >
> >> > Regards
> >> > Neil
> >> >
> >> >
> >> > diff --git a/include/linux/if.h b/include/linux/if.h
> >> > index 3bc63e6..ae904fe 100644
> >> > --- a/include/linux/if.h
> >> > +++ b/include/linux/if.h
> >> > @@ -76,6 +76,7 @@
> >> >  #define IFF_BRIDGE_PORT        0x4000          /* device used as bridge port */
> >> >  #define IFF_OVS_DATAPATH       0x8000  /* device used as Open vSwitch
> >> >                                         * datapath port */
> >> > +#define IFF_CANT_SHARE_SKB     0x10000 /* Device can't share skbs in tx path */
> >> >
> >> >  #define IF_GET_IFACE   0x0001          /* for querying only */
> >> >  #define IF_GET_PROTO   0x0002
> >> > diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> >> > index f76079c..bf6d88d 100644
> >> > --- a/net/core/pktgen.c
> >> > +++ b/net/core/pktgen.c
> >> > @@ -1071,6 +1071,9 @@ static ssize_t pktgen_if_write(struct file *file,
> >> >                if (len < 0)
> >> >                        return len;
> >> >
> >> > +               if (pkt_dev->priv_flags & IFF_CANT_SHARE_SKB)
> >> > +                       return -EOPNOTSUPP;
> >> > +
> >> >                i += len;
> >> >                pkt_dev->clone_skb = value;
> >> >
> >>
> >> I would prefer that the flag be inclusive, i.e. it should mark drivers
> >> which can use shared skbs. And it might be better to clone the skb in
> >> case the flag is disabled to keep functionality working.
> > Ok, I can agree with that.  But you're ok with the general approach?
> 
> I assumed you wanted to use netdev->features and I noticed priv_flags
> just now. If the flag is supposed to be permanent then its fine by me.
> Actually this makes me wonder if NETIF_F_LLTX and similar should get
> moved to netdev->priv_flags.
> 
Yeah, I expect it will be both permanent and invisible to user space.
Neil

> Best Regards,
> Michał Mirosław
> 

^ permalink raw reply

* Re: IPv6: autoconfiguration and suspend/resume or link down/up
From: Dan Williams @ 2011-07-20 16:21 UTC (permalink / raw)
  To: Jiri Bohac; +Cc: netdev, Herbert Xu, David S. Miller, stephen hemminger
In-Reply-To: <20110719180222.GA7509@midget.suse.cz>

On Tue, 2011-07-19 at 20:02 +0200, Jiri Bohac wrote:
> Hi,
> 
> I came over a surprising behaviour with IPv6 autoconfiguration,
> which I think is a bug, but I would first like to hear other
> people's opinions before trying to fix this:
> 
> Problem 1: all the address/route lifetimes are kept in jiffies
> and jiffies don't get incremented on resume. So when a
> route/address lifetime is 30 minutes and the system resumes after
> 1 hour, the route/address should be considered expired, but it is
> not.
> 
> Problem 2: when a system is moved to a new network a RS is not
> sent. Thus, IPv6 does not autoconfigure until the router sends a
> periodic RA. This can occur both while the system is alive and
> while it is suspended. I think the autoconfigured state should be
> discarded when the kernel suspects the system could have been
> moved to a different network.
> 
> When the cable is unplugged and plugged in again, we already get
> notified through linkwatch -> netdev_state_change ->
>   -> call_netdevice_notifiers(NETDEV_CHANGE, ...)
> However, if the device has already been autoconfigured,
> addrconf_notify() only handles this event by printing a
> message.
> 
> So my idea was to:
> - handle link up/down in addrconf_notify() similarly to
>   NETDEV_UP/NETDEV_DOWN
> 
> - on suspend, faking a link down event; on resume, faking a link up event
>   (or better, having a special event type for suspend/resume)
> 
> This would cause autoconfiguration to be restarted on resume as
> well as cable plug/unplug, solving both the above problems.

Faking a link event seems like a hack.  We had this problem with the
wifi stack a while ago where the current AP list wasn't expired on
wakeup so it still looked like the APs that were there when you went to
sleep were there when you resumed even if you'd moved 100 miles.  What
we did there was save the current time (using get_seconds()) when
suspending, and in the resume handler use that value to age anything
that needs to know about time spent in suspend, and then do what needs
to be done with that.  So something like that may work for IPv6
addrconf; on suspend save current time, and on resume check the current
time, subtract the time you saved on suspend, and magically add that to
the lifetime counts and then run any expiry stuff.

Dan


^ permalink raw reply

* Re: [PATCH net-next]vhost: fix condition check for # of outstanding dma buffers
From: Michael S. Tsirkin @ 2011-07-20 16:17 UTC (permalink / raw)
  To: Shirley Ma; +Cc: David Miller, netdev, jasowang
In-Reply-To: <1311176589.8573.33.camel@localhost.localdomain>

On Wed, Jul 20, 2011 at 08:43:09AM -0700, Shirley Ma wrote:
> On Wed, 2011-07-20 at 13:28 +0300, Michael S. Tsirkin wrote:
> > On Tue, Jul 19, 2011 at 01:56:25PM -0700, Shirley Ma wrote:
> > > On Tue, 2011-07-19 at 22:09 +0300, Michael S. Tsirkin wrote:
> > > > On Tue, Jul 19, 2011 at 11:37:58AM -0700, Shirley Ma wrote:
> > > > > Signed-off-by: Shirley Ma <xma@us.ibm.com>
> > > > > ---
> > > > > 
> > > > >  drivers/vhost/net.c |    6 ++++--
> > > > >  1 files changed, 4 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > > > > index 70ac604..83cb738 100644
> > > > > --- a/drivers/vhost/net.c
> > > > > +++ b/drivers/vhost/net.c
> > > > > @@ -189,8 +189,10 @@ static void handle_tx(struct vhost_net
> > *net)
> > > > >                               break;
> > > > >                       }
> > > > >                       /* If more outstanding DMAs, queue the
> > work */
> > > > > -                     if (unlikely(vq->upend_idx - vq->done_idx
> > >
> > > > > -                                  VHOST_MAX_PEND)) {
> > > > > +                     if (unlikely((vq->upend_idx - vq->done_idx
> > >
> > > > > +                                     VHOST_MAX_PEND) ||
> > > > > +                                  (vq->upend_idx - vq->done_idx
> > >
> > > > > +                                      VHOST_MAX_PEND -
> > > > UIO_MAXIOV))) {
> > > > 
> > > > Could you please explain why this makes sense please?
> > > > VHOST_MAX_PEND is 128 UIO_MAXIOV is 1024 so
> > > > the result is negative?
> > > 
> > > I thought it is equal to:
> > > 
> > > if (vq->upend_idx > vq->done_idx) 
> > >       check vq->upend_idx - vq->done_idx > VHOST_MAX_PEND
> > > if (vq->upend_idx < vq->done_idx)
> > >       check vq->upend_idx + UIO_MAXIOV - vq->done_idx >
> > VHOST_MAX_PEND
> > >       
> > 
> > Check it out: upend_idx == done_idx == 0 does not satisfy the
> > above conditions but does trigger in your code, right?
> 
> We don't hit upend_idx == done_idx == 0. Only upend_idx == done_idx ==
> UIO_MAXIOV could happen if the lower device has issue and never DMA any
> packets out.

My point was that the logic isn't the same, even though
you said 'it is equal to'.
Same applies to upend_idx == 1, done_idx == 0.

> > Better keep it simple. Maybe:
> > 
> >         if (unlikely(vq->upend_idx - vq->done_idx > VHOST_MAX_PEND) ||
> >                 (unlikely(vq->upend_idx < vq->done_idx) &&
> >                 unlikely(vq->upend_idx + UIO_MAXIOV - vq->done_idx >
> >                          VHOST_MAX_PEND)))
> > 
> > ?
> > 
> > Also, please add commit log documenting what does the patch
> > fix: something like:
> >         'the test for # of outstanding buffers returned
> >          incorrect results when due to wrap around,
> >          upend_idx < done_idx'?
> 
> Sure, will modify it and resubmit.
> 
> > > > I thought upend_idx - done_idx is exactly the number
> > > > of buffers, so once we get too many we stop until
> > > > one gets freed?
> > > 
> > > They are index, so in vhost zerocopy callback, we can get the idx
> > right
> > > away.
> > > 
> > > > 
> > > > >                               tx_poll_start(net, sock);
> > > > >                               set_bit(SOCK_ASYNC_NOSPACE,
> > > > &sock->flags);
> > > > >                               break;
> > > > > 
> 
> Thanks
> Shirley

^ permalink raw reply

* Re: IPv6: autoconfiguration and suspend/resume or link down/up
From: Stephen Hemminger @ 2011-07-20 16:15 UTC (permalink / raw)
  To: Jiri Bohac; +Cc: netdev, Herbert Xu, David S. Miller
In-Reply-To: <20110719180222.GA7509@midget.suse.cz>

On Tue, 19 Jul 2011 20:02:53 +0200
Jiri Bohac <jbohac@suse.cz> wrote:

> Hi,
> 
> I came over a surprising behaviour with IPv6 autoconfiguration,
> which I think is a bug, but I would first like to hear other
> people's opinions before trying to fix this:
> 
> Problem 1: all the address/route lifetimes are kept in jiffies
> and jiffies don't get incremented on resume. So when a
> route/address lifetime is 30 minutes and the system resumes after
> 1 hour, the route/address should be considered expired, but it is
> not.
> 
> Problem 2: when a system is moved to a new network a RS is not
> sent. Thus, IPv6 does not autoconfigure until the router sends a
> periodic RA. This can occur both while the system is alive and
> while it is suspended. I think the autoconfigured state should be
> discarded when the kernel suspects the system could have been
> moved to a different network.
> 
> When the cable is unplugged and plugged in again, we already get
> notified through linkwatch -> netdev_state_change ->
>   -> call_netdevice_notifiers(NETDEV_CHANGE, ...)
> However, if the device has already been autoconfigured,
> addrconf_notify() only handles this event by printing a
> message.
> 
> So my idea was to:
> - handle link up/down in addrconf_notify() similarly to
>   NETDEV_UP/NETDEV_DOWN
> 
> - on suspend, faking a link down event; on resume, faking a link up event
>   (or better, having a special event type for suspend/resume)
> 
> This would cause autoconfiguration to be restarted on resume as
> well as cable plug/unplug, solving both the above problems.
> 
> Or do we want to completely rely on userspace tools
> (networkmanager/ifplug) and expect them to do NETDEV_DOWN on
> unplug/suspend and NETDEV_UP on plug/resume?
> 
> Any thoughts?

What hardware?

I think the normal solution is to have the device drop the link
during it's suspend and then attempt to renegotiate it on resume.
This is needed for wired (autonegotiation) and wireless already.
There maybe old drivers that don't do this. That is probably why
Ubuntu and other distro's used to rmmod the drivers during suspend.

If the driver drops the link during suspend then the necessary link
events happen to keep bridging, ipv6, bonding and all the other possible
network protocols happy.


^ permalink raw reply

* Re: [RFC] iproute2, ifindex option
From: Denys Fedoryshchenko @ 2011-07-20 16:12 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20110720085842.03dd411c@nehalam.ftrdhcpuser.net>

 On Wed, 20 Jul 2011 08:58:42 -0700, Stephen Hemminger wrote:
> On Wed, 20 Jul 2011 18:54:44 +0300
> Denys Fedoryshchenko <denys@visp.net.lb> wrote:
>
>>  On Wed, 20 Jul 2011 08:37:53 -0700, Stephen Hemminger wrote:
>> >
>> > If caching is a problem, I would rather just get rid of the cache
>> > altogether.
>> > There are a number of other places where it is a problem as well.
>>  It is good, but it must be controlled. Also people put some efforts 
>> to
>>  improve it...
>>  Before i did custom patch to "trash" the cache, but after cache
>>  improved i should rewrite it. If required, i can make cache 
>> behavior
>>  changeable (on,off,flush ?).
>>  Will it help for you too?
>>
>>  I think ifindex is good anyway, because sometimes it is better to 
>> refer
>>  to specific ppp interface by ifindex.
>
> The problem is that it is not possible to make a "safe" cache since
> it is possible for network device names to be changed at any time.

 Maybe then by removing cache, but using ifindex option, and maybe even 
 adding in output additional ifindex field (for show commands), we can 
 leave user to implement his own caching?

 Another thing, on tc -s -d qdisc show, if there is many interfaces, 
 without cache on each line ll_index_to_name() it will be CPU and netlink 
 hog to retrieve all interface names again and again, especially if there 
 is too many intefaces.

 ---
 System administrator
 Denys Fedoryshchenko
 Virtual ISP S.A.L.

^ permalink raw reply

* Re: [PATCH] pktgen: Clone skb to avoid corruption of skbs in ndo_start_xmit methods
From: Michał Mirosław @ 2011-07-20 16:08 UTC (permalink / raw)
  To: Neil Horman
  Cc: Eric Dumazet, Ben Greear, Jiri Pirko, netdev, Alexey Dobriyan,
	David S. Miller, robert.olsson
In-Reply-To: <20110720154057.GF12349@hmsreliant.think-freely.org>

W dniu 20 lipca 2011 17:40 użytkownik Neil Horman
<nhorman@tuxdriver.com> napisał:
> On Wed, Jul 20, 2011 at 05:35:47PM +0200, Michał Mirosław wrote:
>> 2011/7/20 Neil Horman <nhorman@tuxdriver.com>:
>> > On Wed, Jul 20, 2011 at 06:24:15AM +0200, Eric Dumazet wrote:
>> >> Le mardi 19 juillet 2011 à 22:07 -0400, Neil Horman a écrit :
>> >> > >
>> >> > I think this is a good idea.  It lets pktgen dynamically make the clone/share
>> >> > decision dynamically and only impacts performance for those systems.
>> >> >
>> >>
>> >> Just let pktgen refuse to use clone_skb command for these devices.
>> >>
>> > copy that, This is by no means final, but what do you think of this?  If its
>> > agreeable to you, Ben, et al. I can add this to my local tree and start auditing
>> > all the drivers that may need to have the flag set.
>> >
>> > Regards
>> > Neil
>> >
>> >
>> > diff --git a/include/linux/if.h b/include/linux/if.h
>> > index 3bc63e6..ae904fe 100644
>> > --- a/include/linux/if.h
>> > +++ b/include/linux/if.h
>> > @@ -76,6 +76,7 @@
>> >  #define IFF_BRIDGE_PORT        0x4000          /* device used as bridge port */
>> >  #define IFF_OVS_DATAPATH       0x8000  /* device used as Open vSwitch
>> >                                         * datapath port */
>> > +#define IFF_CANT_SHARE_SKB     0x10000 /* Device can't share skbs in tx path */
>> >
>> >  #define IF_GET_IFACE   0x0001          /* for querying only */
>> >  #define IF_GET_PROTO   0x0002
>> > diff --git a/net/core/pktgen.c b/net/core/pktgen.c
>> > index f76079c..bf6d88d 100644
>> > --- a/net/core/pktgen.c
>> > +++ b/net/core/pktgen.c
>> > @@ -1071,6 +1071,9 @@ static ssize_t pktgen_if_write(struct file *file,
>> >                if (len < 0)
>> >                        return len;
>> >
>> > +               if (pkt_dev->priv_flags & IFF_CANT_SHARE_SKB)
>> > +                       return -EOPNOTSUPP;
>> > +
>> >                i += len;
>> >                pkt_dev->clone_skb = value;
>> >
>>
>> I would prefer that the flag be inclusive, i.e. it should mark drivers
>> which can use shared skbs. And it might be better to clone the skb in
>> case the flag is disabled to keep functionality working.
> Ok, I can agree with that.  But you're ok with the general approach?

I assumed you wanted to use netdev->features and I noticed priv_flags
just now. If the flag is supposed to be permanent then its fine by me.
Actually this makes me wonder if NETIF_F_LLTX and similar should get
moved to netdev->priv_flags.

Best Regards,
Michał Mirosław

^ permalink raw reply

* Re: [PATCH 1/3] wireless: rtlwifi: throw away MAC_FMT and use %pM instead
From: Joe Perches @ 2011-07-20 16:02 UTC (permalink / raw)
  To: Larry Finger
  Cc: Andy Shevchenko, linux-wireless, netdev, John W. Linville,
	linux-kernel
In-Reply-To: <4E26F879.8010601@lwfinger.net>

On Wed, 2011-07-20 at 10:47 -0500, Larry Finger wrote:
> Thanks for the patch.

Hey Larry.

rtlwifi has a CONFIG_BT_COEXIST which is currently
unused/undefined by Kconfig.

Are there plans to enable this or should the code
just be removed?

There may be a few dependencies in rtlwifi for
variables set in this block so it seems from
superficial reading that removal might be a bit
involved.  I didn't look much more than that,
but struct btcoexist_priv doesn't seem to be
specified by the code anywhere.

^ permalink raw reply

* Re: [patch net-next-2.6 04/47] nes: do vlan cleanup
From: Michał Mirosław @ 2011-07-20 16:01 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, shemminger, eric.dumazet, greearb, faisal.latif
In-Reply-To: <CAHXqBFK6u1JqGjC3Wh8Bn7Y0VjsMOf8WL7eHadLRJafNLX0HXw@mail.gmail.com>

W dniu 20 lipca 2011 17:45 użytkownik Michał Mirosław
<mirqus@gmail.com> napisał:
> 2011/7/20 Jiri Pirko <jpirko@redhat.com>:
>> - unify vlan and nonvlan rx path
>> - kill nesvnic->vlan_grp and nes_netdev_vlan_rx_register
>> - allow to turn on/off rx/tx vlan accel via ethtool (set_features)
> [...]
>>  /**
>> @@ -1656,7 +1679,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
>>        netdev->ethtool_ops = &nes_ethtool_ops;
>>        netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128);
>>        nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n");
>> -       netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
>> +       netdev->features |= NETIF_F_HW_VLAN_TX;
> Just remove this line - nes_fix_features() is controlling the flag anyway.

Forget it - it's good.

I need to think about calling ndo_set_features callback at end of
register_netdev() so the drivers won't need to duplicate the
call/configuration in their ndo_init.

Best Regards,
Michał Mirosław

^ permalink raw reply

* Re: [RFC] iproute2, ifindex option
From: Stephen Hemminger @ 2011-07-20 15:58 UTC (permalink / raw)
  To: Denys Fedoryshchenko; +Cc: netdev
In-Reply-To: <8dcbf9cb55d19da1e7f849d11d8eb216@visp.net.lb>

On Wed, 20 Jul 2011 18:54:44 +0300
Denys Fedoryshchenko <denys@visp.net.lb> wrote:

>  On Wed, 20 Jul 2011 08:37:53 -0700, Stephen Hemminger wrote:
> >
> > If caching is a problem, I would rather just get rid of the cache 
> > altogether.
> > There are a number of other places where it is a problem as well.
>  It is good, but it must be controlled. Also people put some efforts to 
>  improve it...
>  Before i did custom patch to "trash" the cache, but after cache 
>  improved i should rewrite it. If required, i can make cache behavior 
>  changeable (on,off,flush ?).
>  Will it help for you too?
> 
>  I think ifindex is good anyway, because sometimes it is better to refer 
>  to specific ppp interface by ifindex.

The problem is that it is not possible to make a "safe" cache since
it is possible for network device names to be changed at any time.

^ permalink raw reply

* [PATCH] ASIX: Add AX88772B USB ID
From: Marek Vasut @ 2011-07-20 15:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, linux-usb, gregkh, Marek Vasut

This device can be found in Acer Iconia TAB W500 tablet dock.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
 drivers/net/usb/asix.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 6998aa6..5250288 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -1502,6 +1502,10 @@ static const struct usb_device_id	products [] = {
 	USB_DEVICE (0x04f1, 0x3008),
 	.driver_info = (unsigned long) &ax8817x_info,
 }, {
+	// ASIX AX88772B 10/100
+	USB_DEVICE (0x0b95, 0x772b),
+	.driver_info = (unsigned long) &ax88772_info,
+}, {
 	// ASIX AX88772 10/100
 	USB_DEVICE (0x0b95, 0x7720),
 	.driver_info = (unsigned long) &ax88772_info,
-- 
1.7.5.3

^ permalink raw reply related

* Re: [RFC] iproute2, ifindex option
From: Denys Fedoryshchenko @ 2011-07-20 15:54 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20110720083753.2b8de970@nehalam.ftrdhcpuser.net>

 On Wed, 20 Jul 2011 08:37:53 -0700, Stephen Hemminger wrote:
>
> If caching is a problem, I would rather just get rid of the cache 
> altogether.
> There are a number of other places where it is a problem as well.
 It is good, but it must be controlled. Also people put some efforts to 
 improve it...
 Before i did custom patch to "trash" the cache, but after cache 
 improved i should rewrite it. If required, i can make cache behavior 
 changeable (on,off,flush ?).
 Will it help for you too?

 I think ifindex is good anyway, because sometimes it is better to refer 
 to specific ppp interface by ifindex.

 ---
 System administrator
 Denys Fedoryshchenko
 Virtual ISP S.A.L.

^ permalink raw reply

* [PATCH] rtlwifi: Convert printks to pr_<level>
From: Joe Perches @ 2011-07-20 15:51 UTC (permalink / raw)
  To: Larry Finger, Chaoming Li
  Cc: John W. Linville, linux-wireless, netdev, linux-kernel

Use the current logging styles.
Add pr_fmt where appropriate.
Remove now unnecessary prefixes from printks.
Convert hard coded prefix to __func__.
Add a missing "\n" to a format.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/wireless/rtlwifi/base.c               |    9 ++-
 drivers/net/wireless/rtlwifi/cam.c                |    4 +-
 drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c |    5 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.c       |   69 ++++++++------------
 drivers/net/wireless/rtlwifi/rtl8192cu/mac.c      |   11 ++-
 drivers/net/wireless/rtlwifi/rtl8192de/sw.c       |    8 +-
 drivers/net/wireless/rtlwifi/rtl8192se/hw.c       |   10 ++--
 drivers/net/wireless/rtlwifi/rtl8192se/phy.c      |    5 +-
 drivers/net/wireless/rtlwifi/rtl8192se/rf.c       |    4 +-
 drivers/net/wireless/rtlwifi/rtl8192se/sw.c       |    6 +-
 drivers/net/wireless/rtlwifi/usb.c                |   12 ++--
 11 files changed, 72 insertions(+), 71 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index bc13533..d88e405 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -27,6 +27,8 @@
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/ip.h>
 #include "wifi.h"
 #include "rc.h"
@@ -397,8 +399,8 @@ void rtl_init_rfkill(struct ieee80211_hw *hw)
 	radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid);
 
 	if (valid) {
-		printk(KERN_INFO "rtlwifi: wireless switch is %s\n",
-				rtlpriv->rfkill.rfkill_state ? "on" : "off");
+		pr_info("wireless switch is %s\n",
+			rtlpriv->rfkill.rfkill_state ? "on" : "off");
 
 		rtlpriv->rfkill.rfkill_state = radio_state;
 
@@ -1402,8 +1404,7 @@ MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core");
 static int __init rtl_core_module_init(void)
 {
 	if (rtl_rate_control_register())
-		printk(KERN_ERR "rtlwifi: Unable to register rtl_rc,"
-		       "use default RC !!\n");
+		pr_err("Unable to register rtl_rc, use default RC !!\n");
 
 	return 0;
 }
diff --git a/drivers/net/wireless/rtlwifi/cam.c b/drivers/net/wireless/rtlwifi/cam.c
index 7295af0..b12a668 100644
--- a/drivers/net/wireless/rtlwifi/cam.c
+++ b/drivers/net/wireless/rtlwifi/cam.c
@@ -27,6 +27,8 @@
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "wifi.h"
 #include "cam.h"
 
@@ -347,7 +349,7 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
 			/* Remove from HW Security CAM */
 			memset(rtlpriv->sec.hwsec_cam_sta_addr[i], 0, ETH_ALEN);
 			rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i);
-			printk(KERN_INFO "&&&&&&&&&del entry %d\n", i);
+			pr_info("&&&&&&&&&del entry %d\n", i);
 		}
 	}
 	return;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
index f9f2370..49a064b 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
@@ -27,6 +27,8 @@
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/firmware.h>
 #include "../wifi.h"
 #include "../pci.h"
@@ -224,8 +226,7 @@ int rtl92c_download_fw(struct ieee80211_hw *hw)
 	u32 fwsize;
 	enum version_8192c version = rtlhal->version;
 
-	printk(KERN_INFO "rtl8192c: Loading firmware file %s\n",
-	       rtlpriv->cfg->fw_name);
+	pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name);
 	if (!rtlhal->pfirmware)
 		return 1;
 
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index 2b34764..814c05d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -27,6 +27,8 @@
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "../wifi.h"
 #include "../efuse.h"
 #include "../base.h"
@@ -337,7 +339,7 @@ static void _rtl92cu_read_board_type(struct ieee80211_hw *hw, u8 *contents)
 	rtlefuse->board_type = boardType;
 	if (IS_HIGHT_PA(rtlefuse->board_type))
 		rtlefuse->external_pa = 1;
-	printk(KERN_INFO "rtl8192cu: Board Type %x\n", rtlefuse->board_type);
+	pr_info("Board Type %x\n", rtlefuse->board_type);
 
 #ifdef CONFIG_ANTENNA_DIVERSITY
 	/* Antenna Diversity setting. */
@@ -346,8 +348,7 @@ static void _rtl92cu_read_board_type(struct ieee80211_hw *hw, u8 *contents)
 	else
 		rtl_efuse->antenna_cfg = registry_par->antdiv_cfg; /* 0:OFF, */
 
-	printk(KERN_INFO "rtl8192cu: Antenna Config %x\n",
-	       rtl_efuse->antenna_cfg);
+	pr_info("Antenna Config %x\n", rtl_efuse->antenna_cfg);
 #endif
 }
 
@@ -384,71 +385,57 @@ static void _update_bt_param(_adapter *padapter)
 	pbtpriv->bBTNonTrafficModeSet = _FALSE;
 	pbtpriv->CurrentState = 0;
 	pbtpriv->PreviousState = 0;
-	printk(KERN_INFO "rtl8192cu: BT Coexistance = %s\n",
-	       (pbtpriv->BT_Coexist == _TRUE) ? "enable" : "disable");
+	pr_info("BT Coexistance = %s\n",
+		(pbtpriv->BT_Coexist == _TRUE) ? "enable" : "disable");
 	if (pbtpriv->BT_Coexist) {
 		if (pbtpriv->BT_Ant_Num == Ant_x2)
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
-			       "Ant_Num = Antx2\n");
+			pr_info("BlueTooth BT_Ant_Num = Antx2\n");
 		else if (pbtpriv->BT_Ant_Num == Ant_x1)
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
-			       "Ant_Num = Antx1\n");
+			pr_info("BlueTooth BT_Ant_Num = Antx1\n");
 		switch (pbtpriv->BT_CoexistType) {
 		case BT_2Wire:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
-			       "CoexistType = BT_2Wire\n");
+			pr_info("BlueTooth BT_CoexistType = BT_2Wire\n");
 			break;
 		case BT_ISSC_3Wire:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
-			       "CoexistType = BT_ISSC_3Wire\n");
+			pr_info("BlueTooth BT_CoexistType = BT_ISSC_3Wire\n");
 			break;
 		case BT_Accel:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
-			       "CoexistType = BT_Accel\n");
+			pr_info("BlueTooth BT_CoexistType = BT_Accel\n");
 			break;
 		case BT_CSR_BC4:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
-			       "CoexistType = BT_CSR_BC4\n");
+			pr_info("BlueTooth BT_CoexistType = BT_CSR_BC4\n");
 			break;
 		case BT_CSR_BC8:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
-			       "CoexistType = BT_CSR_BC8\n");
+			pr_info("BlueTooth BT_CoexistType = BT_CSR_BC8\n");
 			break;
 		case BT_RTL8756:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
-			       "CoexistType = BT_RTL8756\n");
+			pr_info("BlueTooth BT_CoexistType = BT_RTL8756\n");
 			break;
 		default:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_"
-			       "CoexistType = Unknown\n");
+			pr_info("BlueTooth BT_CoexistType = Unknown\n");
 			break;
 		}
-		printk(KERN_INFO "rtl8192cu: BlueTooth BT_Ant_isolation = %d\n",
-		       pbtpriv->BT_Ant_isolation);
+		pr_info("BlueTooth BT_Ant_isolation = %d\n",
+			pbtpriv->BT_Ant_isolation);
 		switch (pbtpriv->BT_Service) {
 		case BT_OtherAction:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
-			       "BT_OtherAction\n");
+			pr_info("BlueTooth BT_Service = BT_OtherAction\n");
 			break;
 		case BT_SCO:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
-			       "BT_SCO\n");
+			pr_info("BlueTooth BT_Service = BT_SCO\n");
 			break;
 		case BT_Busy:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
-			       "BT_Busy\n");
+			pr_info("BlueTooth BT_Service = BT_Busy\n");
 			break;
 		case BT_OtherBusy:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
-			       "BT_OtherBusy\n");
+			pr_info("BlueTooth BT_Service = BT_OtherBusy\n");
 			break;
 		default:
-			printk(KERN_INFO "rtl8192cu: BlueTooth BT_Service = "
-			       "BT_Idle\n");
+			pr_info("BlueTooth BT_Service = BT_Idle\n");
 			break;
 		}
-		printk(KERN_INFO "rtl8192cu: BT_RadioSharedType = 0x%x\n",
-		       pbtpriv->BT_RadioSharedType);
+		pr_info("BT_RadioSharedType = 0x%x\n",
+			pbtpriv->BT_RadioSharedType);
 	}
 }
 
@@ -526,7 +513,7 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw)
 		usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
 		*((u16 *) (&rtlefuse->dev_addr[i])) = usvalue;
 	}
-	printk(KERN_INFO "rtl8192cu: MAC address: %pM\n", rtlefuse->dev_addr);
+	pr_info("MAC address: %pM\n", rtlefuse->dev_addr);
 	_rtl92cu_read_txpower_info_from_hwpg(hw,
 					   rtlefuse->autoload_failflag, hwinfo);
 	rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID];
@@ -665,7 +652,7 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
 	rtl_write_word(rtlpriv, REG_APS_FSMCO, value16);
 	do {
 		if (!(rtl_read_word(rtlpriv, REG_APS_FSMCO) & APFM_ONMAC)) {
-			printk(KERN_INFO "rtl8192cu: MAC auto ON okay!\n");
+			pr_info("MAC auto ON okay!\n");
 			break;
 		}
 		if (pollingCount++ > 100) {
@@ -819,7 +806,7 @@ static void _rtl92cu_init_chipN_one_out_ep_priority(struct ieee80211_hw *hw,
 	}
 	_rtl92c_init_chipN_reg_priority(hw, value, value, value, value,
 					value, value);
-	printk(KERN_INFO "rtl8192cu: Tx queue select: 0x%02x\n", queue_sel);
+	pr_info("Tx queue select: 0x%02x\n", queue_sel);
 }
 
 static void _rtl92cu_init_chipN_two_out_ep_priority(struct ieee80211_hw *hw,
@@ -863,7 +850,7 @@ static void _rtl92cu_init_chipN_two_out_ep_priority(struct ieee80211_hw *hw,
 		hiQ = valueHi;
 	}
 	_rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ);
-	printk(KERN_INFO "rtl8192cu: Tx queue select: 0x%02x\n", queue_sel);
+	pr_info("Tx queue select: 0x%02x\n", queue_sel);
 }
 
 static void _rtl92cu_init_chipN_three_out_ep_priority(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
index a90c09b..194fc69 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
@@ -26,6 +26,9 @@
  * Larry Finger <Larry.Finger@lwfinger.net>
  *
 ****************************************************************************/
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 
 #include "../wifi.h"
@@ -213,14 +216,14 @@ bool rtl92c_init_llt_table(struct ieee80211_hw *hw, u32 boundary)
 	for (i = 0; i < (boundary - 1); i++) {
 		rst = rtl92c_llt_write(hw, i , i + 1);
 		if (true != rst) {
-			printk(KERN_ERR "===> %s #1 fail\n", __func__);
+			pr_err("===> %s #1 fail\n", __func__);
 			return rst;
 		}
 	}
 	/* end of list */
 	rst = rtl92c_llt_write(hw, (boundary - 1), 0xFF);
 	if (true != rst) {
-		printk(KERN_ERR "===> %s #2 fail\n", __func__);
+		pr_err("===> %s #2 fail\n", __func__);
 		return rst;
 	}
 	/* Make the other pages as ring buffer
@@ -231,14 +234,14 @@ bool rtl92c_init_llt_table(struct ieee80211_hw *hw, u32 boundary)
 	for (i = boundary; i < LLT_LAST_ENTRY_OF_TX_PKT_BUFFER; i++) {
 		rst = rtl92c_llt_write(hw, i, (i + 1));
 		if (true != rst) {
-			printk(KERN_ERR "===> %s #3 fail\n", __func__);
+			pr_err("===> %s #3 fail\n", __func__);
 			return rst;
 		}
 	}
 	/* Let last entry point to the start entry of ring buffer */
 	rst = rtl92c_llt_write(hw, LLT_LAST_ENTRY_OF_TX_PKT_BUFFER, boundary);
 	if (true != rst) {
-		printk(KERN_ERR "===> %s #4 fail\n", __func__);
+		pr_err("===> %s #4 fail\n", __func__);
 		return rst;
 	}
 	return rst;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
index 0883774..351765d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
@@ -27,6 +27,8 @@
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/vmalloc.h>
 
 #include "../wifi.h"
@@ -170,10 +172,8 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)
 	}
 
 	if (!header_print) {
-		printk(KERN_INFO "rtl8192de: Driver for Realtek RTL8192DE"
-		       " WLAN interface");
-		printk(KERN_INFO "rtl8192de: Loading firmware file %s\n",
-		       rtlpriv->cfg->fw_name);
+		pr_info("Driver for Realtek RTL8192DE WLAN interface\n");
+		pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name);
 		header_print++;
 	}
 	/* request fw */
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
index b1d0213..73142a9 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
@@ -27,6 +27,8 @@
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "../wifi.h"
 #include "../efuse.h"
 #include "../base.h"
@@ -465,8 +467,7 @@ static u8 _rtl92ce_halset_sysclk(struct ieee80211_hw *hw, u8 data)
 			if ((tmpvalue & BIT(6)))
 				break;
 
-			printk(KERN_ERR "wait for BIT(6) return value %x\n",
-			       tmpvalue);
+			pr_err("wait for BIT(6) return value %x\n", tmpvalue);
 			if (waitcount == 0)
 				break;
 
@@ -1255,8 +1256,7 @@ static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data)
 			if ((tmp & BIT(6)))
 				break;
 
-			printk(KERN_ERR "wait for BIT(6) return value %x\n",
-			       tmp);
+			pr_err("wait for BIT(6) return value %x\n", tmp);
 
 			if (waitcnt == 0)
 				break;
@@ -1315,7 +1315,7 @@ static void _rtl92s_phy_set_rfhalt(struct ieee80211_hw *hw)
 	if (u1btmp & BIT(7)) {
 		u1btmp &= ~(BIT(6) | BIT(7));
 		if (!_rtl92s_set_sysclk(hw, u1btmp)) {
-			printk(KERN_ERR "Switch ctrl path fail\n");
+			pr_err("Switch ctrl path fail\n");
 			return;
 		}
 	}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
index 81a5aa4..f27171a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
@@ -27,6 +27,8 @@
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "../wifi.h"
 #include "../pci.h"
 #include "../ps.h"
@@ -1016,8 +1018,7 @@ static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw *hw)
 	rtstatus = _rtl92s_phy_config_bb(hw, BASEBAND_CONFIG_AGC_TAB);
 
 	if (rtstatus != true) {
-		printk(KERN_ERR  "_rtl92s_phy_bb_config_parafile(): "
-		       "AGC Table Fail\n");
+		pr_err("%s(): AGC Table Fail\n", __func__);
 		goto phy_BB8190_Config_ParaFile_Fail;
 	}
 
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
index c6e3a4c..0ad50fe 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
@@ -27,6 +27,8 @@
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "../wifi.h"
 #include "reg.h"
 #include "def.h"
@@ -507,7 +509,7 @@ bool rtl92s_phy_rf6052_config(struct ieee80211_hw *hw)
 		}
 
 		if (rtstatus != true) {
-			printk(KERN_ERR "Radio[%d] Fail!!", rfpath);
+			pr_err("Radio[%d] Fail!!\n", rfpath);
 			goto fail;
 		}
 
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
index 1c6cb1d..3876078 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
@@ -27,6 +27,8 @@
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/vmalloc.h>
 
 #include "../wifi.h"
@@ -183,8 +185,8 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
 		return 1;
 	}
 
-	printk(KERN_INFO "rtl8192se: Driver for Realtek RTL8192SE/RTL8191SE\n"
-	       "           Loading firmware %s\n", rtlpriv->cfg->fw_name);
+	pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n"
+		"Loading firmware %s\n", rtlpriv->cfg->fw_name);
 	/* request fw */
 	err = request_firmware(&firmware, rtlpriv->cfg->fw_name,
 			rtlpriv->io.dev);
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index a9367eb..8b1cef0 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -24,6 +24,9 @@
  * Hsinchu 300, Taiwan.
  *
  *****************************************************************************/
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/usb.h>
 #include "core.h"
 #include "wifi.h"
@@ -104,9 +107,8 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request,
 				 pdata, len, 0); /* max. timeout */
 
 	if (status < 0)
-		printk(KERN_ERR "reg 0x%x, usbctrl_vendorreq TimeOut! "
-		       "status:0x%x value=0x%x\n", value, status,
-		       *(u32 *)pdata);
+		pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x\n",
+		       value, status, *(u32 *)pdata);
 	return status;
 }
 
@@ -316,7 +318,7 @@ static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
 	rtlusb->usb_rx_segregate_hdl =
 		rtlpriv->cfg->usb_interface_cfg->usb_rx_segregate_hdl;
 
-	printk(KERN_INFO "rtl8192cu: rx_max_size %d, rx_urb_num %d, in_ep %d\n",
+	pr_info("rx_max_size %d, rx_urb_num %d, in_ep %d\n",
 		rtlusb->rx_max_size, rtlusb->rx_urb_num, rtlusb->in_ep);
 	init_usb_anchor(&rtlusb->rx_submitted);
 	return 0;
@@ -580,7 +582,7 @@ static void _rtl_rx_completed(struct urb *_urb)
 		} else{
 			/* TO DO */
 			_rtl_rx_pre_process(hw, skb);
-			printk(KERN_ERR "rtlwifi: rx agg not supported\n");
+			pr_err("rx agg not supported\n");
 		}
 		goto resubmit;
 	}
-- 
1.7.6.131.g99019

^ permalink raw reply related

* Re: [PATCH 1/3] wireless: rtlwifi: throw away MAC_FMT and use %pM instead
From: Larry Finger @ 2011-07-20 15:47 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-wireless, netdev, John W. Linville, linux-kernel
In-Reply-To: <fddeabc04a1b81a5c1f51a4164d93366dccf5f8e.1311162926.git.andriy.shevchenko@linux.intel.com>

On 07/20/2011 08:34 AM, Andy Shevchenko wrote:
> Signed-off-by: Andy Shevchenko<andriy.shevchenko@linux.intel.com>
> Cc: Larry Finger<Larry.Finger@lwfinger.net>
> ---
>   drivers/net/wireless/rtlwifi/base.c         |   11 +++++------
>   drivers/net/wireless/rtlwifi/cam.c          |    4 ++--
>   drivers/net/wireless/rtlwifi/core.c         |    6 +++---
>   drivers/net/wireless/rtlwifi/debug.h        |    5 -----
>   drivers/net/wireless/rtlwifi/rtl8192ce/hw.c |    2 +-
>   drivers/net/wireless/rtlwifi/rtl8192de/hw.c |    2 +-
>   drivers/net/wireless/rtlwifi/rtl8192se/hw.c |    2 +-
>   7 files changed, 13 insertions(+), 19 deletions(-)

ACK.  Thanks for the patch.

Larry

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox