All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] staging/wlan-ng: update function header comment
@ 2014-05-12 15:22 Denis Pithon
  2014-05-12 15:22 ` [PATCH 2/4] staging/wlan-ng: remove function declaration Denis Pithon
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Denis Pithon @ 2014-05-12 15:22 UTC (permalink / raw)
  To: gregkh; +Cc: himangi774, devel, linux-kernel

Header comment of p80211netdev_rx_bh() does not match function
prototype. Fixed.

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index e3ae802..e350e1c 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -243,19 +243,11 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
 	tasklet_schedule(&wlandev->rx_bh);
 }
 
-/*----------------------------------------------------------------
-* p80211netdev_rx_bh
-*
-* Deferred processing of all received frames.
-*
-* Arguments:
-*	wlandev		WLAN network device structure
-*	skb		skbuff containing a full 802.11 frame.
-* Returns:
-*	nothing
-* Side effects:
-*
-----------------------------------------------------------------*/
+/**
+ * p80211netdev_rx_bh - deferred processing of all received frames
+ *
+ * @arg: pointer to WLAN network device structure (cast to unsigned long)
+ */
 static void p80211netdev_rx_bh(unsigned long arg)
 {
 	wlandevice_t *wlandev = (wlandevice_t *) arg;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/4] staging/wlan-ng: remove function declaration
  2014-05-12 15:22 [PATCH 1/4] staging/wlan-ng: update function header comment Denis Pithon
@ 2014-05-12 15:22 ` Denis Pithon
  2014-05-12 15:22 ` [PATCH 3/4] staging/wlan-ng: code refactoring Denis Pithon
  2014-05-12 15:22 ` [PATCH 4/4] staging/wlan-ng: replace printk() with pr_xxx() Denis Pithon
  2 siblings, 0 replies; 12+ messages in thread
From: Denis Pithon @ 2014-05-12 15:22 UTC (permalink / raw)
  To: gregkh; +Cc: himangi774, devel, linux-kernel

Removed useless function prototype: static function p80211netdev_rx_bh()
is defined before being used.

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index e350e1c..2da3cbb 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -90,9 +90,6 @@
 
 #include "cfg80211.c"
 
-/* Support functions */
-static void p80211netdev_rx_bh(unsigned long arg);
-
 /* netdevice method functions */
 static int p80211knetdev_init(netdevice_t *netdev);
 static struct net_device_stats *p80211knetdev_get_stats(netdevice_t *netdev);
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] staging/wlan-ng: code refactoring
  2014-05-12 15:22 [PATCH 1/4] staging/wlan-ng: update function header comment Denis Pithon
  2014-05-12 15:22 ` [PATCH 2/4] staging/wlan-ng: remove function declaration Denis Pithon
@ 2014-05-12 15:22 ` Denis Pithon
  2014-05-16  7:26   ` Tobias Klauser
  2014-05-12 15:22 ` [PATCH 4/4] staging/wlan-ng: replace printk() with pr_xxx() Denis Pithon
  2 siblings, 1 reply; 12+ messages in thread
From: Denis Pithon @ 2014-05-12 15:22 UTC (permalink / raw)
  To: gregkh; +Cc: himangi774, devel, linux-kernel

Extract new static function from p80211netdev_rx_bh() to fix coding
style issue (too many leading tabs).

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 74 ++++++++++++++++++++--------------
 1 file changed, 43 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 2da3cbb..61a3092 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -240,6 +240,48 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
 	tasklet_schedule(&wlandev->rx_bh);
 }
 
+#define CONV_TO_ETHER_SKIPPED	0x01
+#define CONV_TO_ETHER_FAILED	0x02
+
+/**
+ * convert_frame_to_ether - conversion from 802.11 frame to ethernet frame
+ * @wlandev: pointer to WLAN device
+ * @skb: pointer to socket buffer
+ *
+ * Returns: 0 if conversion succeeded
+ *	    CONV_TO_ETHER_FAILED if conversion failed
+ *	    CONV_TO_ETHER_SKIPPED if frame is ignored
+ */
+static int convert_frame_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
+{
+	struct p80211_hdr_a3 *hdr;
+
+	hdr = (struct p80211_hdr_a3 *) skb->data;
+	if (p80211_rx_typedrop(wlandev, hdr->fc))
+		return CONV_TO_ETHER_SKIPPED;
+
+	/* perform mcast filtering */
+	if (wlandev->netdev->flags & IFF_ALLMULTI) {
+		/* allow my local address through */
+		if (memcmp(hdr->a1, wlandev->netdev->dev_addr, ETH_ALEN) != 0) {
+			/* but reject anything else that isn't multicast */
+			if (!(hdr->a1[0] & 0x01))
+				return CONV_TO_ETHER_SKIPPED;
+		}
+	}
+
+	if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
+		skb->dev->last_rx = jiffies;
+		wlandev->linux_stats.rx_packets++;
+		wlandev->linux_stats.rx_bytes += skb->len;
+		netif_rx_ni(skb);
+		return 0;
+	}
+
+	pr_debug("p80211_to_ether failed.\n");
+	return CONV_TO_ETHER_FAILED;
+}
+
 /**
  * p80211netdev_rx_bh - deferred processing of all received frames
  *
@@ -250,7 +292,6 @@ static void p80211netdev_rx_bh(unsigned long arg)
 	wlandevice_t *wlandev = (wlandevice_t *) arg;
 	struct sk_buff *skb = NULL;
 	netdevice_t *dev = wlandev->netdev;
-	struct p80211_hdr_a3 *hdr;
 
 	/* Let's empty our our queue */
 	while ((skb = skb_dequeue(&wlandev->nsd_rxq))) {
@@ -273,37 +314,8 @@ static void p80211netdev_rx_bh(unsigned long arg)
 				netif_rx_ni(skb);
 				continue;
 			} else {
-				hdr = (struct p80211_hdr_a3 *) skb->data;
-				if (p80211_rx_typedrop(wlandev, hdr->fc)) {
-					dev_kfree_skb(skb);
-					continue;
-				}
-
-				/* perform mcast filtering */
-				if (wlandev->netdev->flags & IFF_ALLMULTI) {
-					/* allow my local address through */
-					if (memcmp
-					    (hdr->a1, wlandev->netdev->dev_addr,
-					     ETH_ALEN) != 0) {
-						/* but reject anything else that
-						   isn't multicast */
-						if (!(hdr->a1[0] & 0x01)) {
-							dev_kfree_skb(skb);
-							continue;
-						}
-					}
-				}
-
-				if (skb_p80211_to_ether
-				    (wlandev, wlandev->ethconv, skb) == 0) {
-					skb->dev->last_rx = jiffies;
-					wlandev->linux_stats.rx_packets++;
-					wlandev->linux_stats.rx_bytes +=
-					    skb->len;
-					netif_rx_ni(skb);
+				if (!convert_frame_to_ether(wlandev, skb))
 					continue;
-				}
-				pr_debug("p80211_to_ether failed.\n");
 			}
 		}
 		dev_kfree_skb(skb);
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/4] staging/wlan-ng: replace printk() with pr_xxx()
  2014-05-12 15:22 [PATCH 1/4] staging/wlan-ng: update function header comment Denis Pithon
  2014-05-12 15:22 ` [PATCH 2/4] staging/wlan-ng: remove function declaration Denis Pithon
  2014-05-12 15:22 ` [PATCH 3/4] staging/wlan-ng: code refactoring Denis Pithon
@ 2014-05-12 15:22 ` Denis Pithon
  2014-05-14 11:57   ` Dan Carpenter
  2014-05-15 21:57   ` Greg KH
  2 siblings, 2 replies; 12+ messages in thread
From: Denis Pithon @ 2014-05-12 15:22 UTC (permalink / raw)
  To: gregkh; +Cc: himangi774, devel, linux-kernel

Fix some coding style issues concerning printk() usage.

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 61a3092..3577d20 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -384,8 +384,9 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
 		 */
 		if (skb->protocol != ETH_P_80211_RAW) {
 			netif_start_queue(wlandev->netdev);
-			printk(KERN_NOTICE
-			       "Tx attempt prior to association, frame dropped.\n");
+			pr_notice(
+			   "Tx attempt prior to association, frame dropped\n"
+			);
 			wlandev->linux_stats.tx_dropped++;
 			result = 0;
 			goto failed;
@@ -684,8 +685,9 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr)
 	 * change the netdev address
 	 */
 	if (result != 0 || resultcode->data != P80211ENUM_resultcode_success) {
-		printk(KERN_ERR
-		       "Low-level driver failed dot11req_mibset(dot11MACAddress).\n");
+		pr_err(
+		  "Low-level driver failed dot11req_mibset(dot11MACAddress)\n"
+		);
 		result = -EADDRNOTAVAIL;
 	} else {
 		/* everything's ok, change the addr in netdev */
@@ -764,7 +766,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device *physdev)
 	/* Allocate and initialize the wiphy struct */
 	wiphy = wlan_create_wiphy(physdev, wlandev);
 	if (wiphy == NULL) {
-		printk(KERN_ERR "Failed to alloc wiphy.\n");
+		pr_err("Failed to alloc wiphy.\n");
 		return 1;
 	}
 
@@ -772,7 +774,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device *physdev)
 	netdev = alloc_netdev(sizeof(struct wireless_dev), "wlan%d",
 				ether_setup);
 	if (netdev == NULL) {
-		printk(KERN_ERR "Failed to alloc netdev.\n");
+		pr_err("Failed to alloc netdev.\n");
 		wlan_free_wiphy(wiphy);
 		result = 1;
 	} else {
@@ -1104,8 +1106,7 @@ static void p80211knetdev_tx_timeout(netdevice_t *netdev)
 	if (wlandev->tx_timeout) {
 		wlandev->tx_timeout(wlandev);
 	} else {
-		printk(KERN_WARNING "Implement tx_timeout for %s\n",
-		       wlandev->nsdname);
+		pr_warn("Implement tx_timeout for %s\n", wlandev->nsdname);
 		netif_wake_queue(wlandev->netdev);
 	}
 }
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] staging/wlan-ng: replace printk() with pr_xxx()
  2014-05-12 15:22 ` [PATCH 4/4] staging/wlan-ng: replace printk() with pr_xxx() Denis Pithon
@ 2014-05-14 11:57   ` Dan Carpenter
  2014-05-15 21:57   ` Greg KH
  1 sibling, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2014-05-14 11:57 UTC (permalink / raw)
  To: Denis Pithon; +Cc: gregkh, devel, himangi774, linux-kernel

On Mon, May 12, 2014 at 05:22:47PM +0200, Denis Pithon wrote:
> @@ -684,8 +685,9 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr)
>  	 * change the netdev address
>  	 */
>  	if (result != 0 || resultcode->data != P80211ENUM_resultcode_success) {
> -		printk(KERN_ERR
> -		       "Low-level driver failed dot11req_mibset(dot11MACAddress).\n");
> +		pr_err(
> +		  "Low-level driver failed dot11req_mibset(dot11MACAddress)\n"
> +		);
>  		result = -EADDRNOTAVAIL;
>  	} else {
>  		/* everything's ok, change the addr in netdev */

This is fine, but in the future, just go over the 80 character limit
instead of doing the unusual line break.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] staging/wlan-ng: replace printk() with pr_xxx()
  2014-05-12 15:22 ` [PATCH 4/4] staging/wlan-ng: replace printk() with pr_xxx() Denis Pithon
  2014-05-14 11:57   ` Dan Carpenter
@ 2014-05-15 21:57   ` Greg KH
  2014-05-16 22:24     ` [PATCH] staging/wlan-ng: log with netdev_xxx and dev_xxx Denis Pithon
  1 sibling, 1 reply; 12+ messages in thread
From: Greg KH @ 2014-05-15 21:57 UTC (permalink / raw)
  To: Denis Pithon; +Cc: devel, himangi774, linux-kernel

On Mon, May 12, 2014 at 05:22:47PM +0200, Denis Pithon wrote:
> Fix some coding style issues concerning printk() usage.
> 
> Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
> ---
>  drivers/staging/wlan-ng/p80211netdev.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
> index 61a3092..3577d20 100644
> --- a/drivers/staging/wlan-ng/p80211netdev.c
> +++ b/drivers/staging/wlan-ng/p80211netdev.c
> @@ -384,8 +384,9 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
>  		 */
>  		if (skb->protocol != ETH_P_80211_RAW) {
>  			netif_start_queue(wlandev->netdev);
> -			printk(KERN_NOTICE
> -			       "Tx attempt prior to association, frame dropped.\n");
> +			pr_notice(
> +			   "Tx attempt prior to association, frame dropped\n"
> +			);

Can't these be netdev messages, or at the least, dev_* messages?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] staging/wlan-ng: code refactoring
  2014-05-12 15:22 ` [PATCH 3/4] staging/wlan-ng: code refactoring Denis Pithon
@ 2014-05-16  7:26   ` Tobias Klauser
  2014-05-16 22:14     ` [PATCH 2/4] staging/wlan-ng: compare using ether_addr_equal_unaligned Denis Pithon
                       ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Tobias Klauser @ 2014-05-16  7:26 UTC (permalink / raw)
  To: Denis Pithon; +Cc: gregkh, devel, himangi774, linux-kernel

On 2014-05-12 at 17:22:46 +0200, Denis Pithon <denis.pithon@gmail.com> wrote:
> Extract new static function from p80211netdev_rx_bh() to fix coding
> style issue (too many leading tabs).
> 
> Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
> ---
>  drivers/staging/wlan-ng/p80211netdev.c | 74 ++++++++++++++++++++--------------
>  1 file changed, 43 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
> index 2da3cbb..61a3092 100644
> --- a/drivers/staging/wlan-ng/p80211netdev.c
> +++ b/drivers/staging/wlan-ng/p80211netdev.c
> @@ -240,6 +240,48 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
>  	tasklet_schedule(&wlandev->rx_bh);
>  }
>  
> +#define CONV_TO_ETHER_SKIPPED	0x01
> +#define CONV_TO_ETHER_FAILED	0x02
> +
> +/**
> + * convert_frame_to_ether - conversion from 802.11 frame to ethernet frame
> + * @wlandev: pointer to WLAN device
> + * @skb: pointer to socket buffer
> + *
> + * Returns: 0 if conversion succeeded
> + *	    CONV_TO_ETHER_FAILED if conversion failed
> + *	    CONV_TO_ETHER_SKIPPED if frame is ignored
> + */
> +static int convert_frame_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)

You should probably add a module/driver specific prefix to the function
name here, to stay consistent with the other functions in the module,
e.g. p80211_convert_frame_to_ether()

> +{
> +	struct p80211_hdr_a3 *hdr;
> +
> +	hdr = (struct p80211_hdr_a3 *) skb->data;
> +	if (p80211_rx_typedrop(wlandev, hdr->fc))
> +		return CONV_TO_ETHER_SKIPPED;
> +
> +	/* perform mcast filtering */
> +	if (wlandev->netdev->flags & IFF_ALLMULTI) {
> +		/* allow my local address through */
> +		if (memcmp(hdr->a1, wlandev->netdev->dev_addr, ETH_ALEN) != 0) {

While at it, you could use one of the ether_addr_equal* functions here
(depending on the address alignment).

> +			/* but reject anything else that isn't multicast */
> +			if (!(hdr->a1[0] & 0x01))
> +				return CONV_TO_ETHER_SKIPPED;

And here you could use !is_multicast_ether_addr() instead of open coding
it.

> +		}
> +	}
> +
> +	if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
> +		skb->dev->last_rx = jiffies;
> +		wlandev->linux_stats.rx_packets++;
> +		wlandev->linux_stats.rx_bytes += skb->len;
> +		netif_rx_ni(skb);
> +		return 0;
> +	}
> +
> +	pr_debug("p80211_to_ether failed.\n");
> +	return CONV_TO_ETHER_FAILED;
> +}
> +
>  /**
>   * p80211netdev_rx_bh - deferred processing of all received frames
>   *
> @@ -250,7 +292,6 @@ static void p80211netdev_rx_bh(unsigned long arg)
>  	wlandevice_t *wlandev = (wlandevice_t *) arg;
>  	struct sk_buff *skb = NULL;
>  	netdevice_t *dev = wlandev->netdev;
> -	struct p80211_hdr_a3 *hdr;
>  
>  	/* Let's empty our our queue */
>  	while ((skb = skb_dequeue(&wlandev->nsd_rxq))) {
> @@ -273,37 +314,8 @@ static void p80211netdev_rx_bh(unsigned long arg)
>  				netif_rx_ni(skb);
>  				continue;
>  			} else {
> -				hdr = (struct p80211_hdr_a3 *) skb->data;
> -				if (p80211_rx_typedrop(wlandev, hdr->fc)) {
> -					dev_kfree_skb(skb);
> -					continue;
> -				}
> -
> -				/* perform mcast filtering */
> -				if (wlandev->netdev->flags & IFF_ALLMULTI) {
> -					/* allow my local address through */
> -					if (memcmp
> -					    (hdr->a1, wlandev->netdev->dev_addr,
> -					     ETH_ALEN) != 0) {
> -						/* but reject anything else that
> -						   isn't multicast */
> -						if (!(hdr->a1[0] & 0x01)) {
> -							dev_kfree_skb(skb);
> -							continue;
> -						}
> -					}
> -				}
> -
> -				if (skb_p80211_to_ether
> -				    (wlandev, wlandev->ethconv, skb) == 0) {
> -					skb->dev->last_rx = jiffies;
> -					wlandev->linux_stats.rx_packets++;
> -					wlandev->linux_stats.rx_bytes +=
> -					    skb->len;
> -					netif_rx_ni(skb);
> +				if (!convert_frame_to_ether(wlandev, skb))
>  					continue;
> -				}
> -				pr_debug("p80211_to_ether failed.\n");
>  			}
>  		}
>  		dev_kfree_skb(skb);
> -- 
> 1.8.1.4
> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/4] staging/wlan-ng: compare using ether_addr_equal_unaligned
  2014-05-16  7:26   ` Tobias Klauser
@ 2014-05-16 22:14     ` Denis Pithon
  2014-05-16 22:14     ` [PATCH 3/4] staging/wlan-ng: multicast address checking Denis Pithon
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Denis Pithon @ 2014-05-16 22:14 UTC (permalink / raw)
  To: gregkh, tklauser; +Cc: himangi774, devel, linux-kernel

Replaced generic memcmp() with dedicated ether_addr_equal_unaligned()
call. I did not find any clue of u16 alignment for both addresses.

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 64dd935..13fe068 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -263,7 +263,8 @@ static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
 	/* perform mcast filtering */
 	if (wlandev->netdev->flags & IFF_ALLMULTI) {
 		/* allow my local address through */
-		if (memcmp(hdr->a1, wlandev->netdev->dev_addr, ETH_ALEN) != 0) {
+		if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
+						hdr->a1)) {
 			/* but reject anything else that isn't multicast */
 			if (!(hdr->a1[0] & 0x01))
 				return CONV_TO_ETHER_SKIPPED;
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] staging/wlan-ng: multicast address checking
  2014-05-16  7:26   ` Tobias Klauser
  2014-05-16 22:14     ` [PATCH 2/4] staging/wlan-ng: compare using ether_addr_equal_unaligned Denis Pithon
@ 2014-05-16 22:14     ` Denis Pithon
  2014-05-16 22:14     ` [PATCH 4/4] staging/wlan-ng: rearrange comments Denis Pithon
  2014-05-16 22:30     ` [PATCH 1/4] staging/wlan-ng: add prefix to function name Denis Pithon
  3 siblings, 0 replies; 12+ messages in thread
From: Denis Pithon @ 2014-05-16 22:14 UTC (permalink / raw)
  To: gregkh, tklauser; +Cc: himangi774, devel, linux-kernel

Used is_multicast_ether_addr() to perform the checking.

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 13fe068..63edc83 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -266,7 +266,7 @@ static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
 		if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
 						hdr->a1)) {
 			/* but reject anything else that isn't multicast */
-			if (!(hdr->a1[0] & 0x01))
+			if (!is_multicast_ether_addr(hdr->a1))
 				return CONV_TO_ETHER_SKIPPED;
 		}
 	}
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/4] staging/wlan-ng: rearrange comments
  2014-05-16  7:26   ` Tobias Klauser
  2014-05-16 22:14     ` [PATCH 2/4] staging/wlan-ng: compare using ether_addr_equal_unaligned Denis Pithon
  2014-05-16 22:14     ` [PATCH 3/4] staging/wlan-ng: multicast address checking Denis Pithon
@ 2014-05-16 22:14     ` Denis Pithon
  2014-05-16 22:30     ` [PATCH 1/4] staging/wlan-ng: add prefix to function name Denis Pithon
  3 siblings, 0 replies; 12+ messages in thread
From: Denis Pithon @ 2014-05-16 22:14 UTC (permalink / raw)
  To: gregkh, tklauser; +Cc: himangi774, devel, linux-kernel

Gathered together comments in front of multicast filtering block.

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 63edc83..21ca17e 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -260,12 +260,12 @@ static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
 	if (p80211_rx_typedrop(wlandev, hdr->fc))
 		return CONV_TO_ETHER_SKIPPED;
 
-	/* perform mcast filtering */
+	/* perform mcast filtering: allow my local address through but reject
+	 * anything else that isn't multicast
+	 */
 	if (wlandev->netdev->flags & IFF_ALLMULTI) {
-		/* allow my local address through */
 		if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
 						hdr->a1)) {
-			/* but reject anything else that isn't multicast */
 			if (!is_multicast_ether_addr(hdr->a1))
 				return CONV_TO_ETHER_SKIPPED;
 		}
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] staging/wlan-ng: log with netdev_xxx and dev_xxx
  2014-05-15 21:57   ` Greg KH
@ 2014-05-16 22:24     ` Denis Pithon
  0 siblings, 0 replies; 12+ messages in thread
From: Denis Pithon @ 2014-05-16 22:24 UTC (permalink / raw)
  To: gregkh; +Cc: himangi774, devel, linux-kernel

Wherever possible, replaced printk() and pr_xxx() calls with
netdev_xxx() / dev_xxx() calls; used pr_xxx() otherwise.

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 45 +++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 21ca17e..00b186c 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -279,7 +279,7 @@ static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
 		return 0;
 	}
 
-	pr_debug("p80211_to_ether failed.\n");
+	netdev_dbg(wlandev->netdev, "p80211_convert_to_ether failed.\n");
 	return CONV_TO_ETHER_FAILED;
 }
 
@@ -365,7 +365,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
 	memset(&p80211_wep, 0, sizeof(struct p80211_metawep));
 
 	if (netif_queue_stopped(netdev)) {
-		pr_debug("called when queue stopped.\n");
+		netdev_dbg(netdev, "called when queue stopped.\n");
 		result = 1;
 		goto failed;
 	}
@@ -385,8 +385,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
 		 */
 		if (skb->protocol != ETH_P_80211_RAW) {
 			netif_start_queue(wlandev->netdev);
-			printk(KERN_NOTICE
-			       "Tx attempt prior to association, frame dropped.\n");
+			netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n");
 			wlandev->linux_stats.tx_dropped++;
 			result = 0;
 			goto failed;
@@ -408,8 +407,8 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
 		    (wlandev, wlandev->ethconv, skb, &p80211_hdr,
 		     &p80211_wep) != 0) {
 			/* convert failed */
-			pr_debug("ether_to_80211(%d) failed.\n",
-				 wlandev->ethconv);
+			netdev_dbg(netdev, "ether_to_80211(%d) failed.\n",
+				   wlandev->ethconv);
 			result = 1;
 			goto failed;
 		}
@@ -434,17 +433,17 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
 		result = NETDEV_TX_OK;
 	} else if (txresult == 1) {
 		/* success, no more avail */
-		pr_debug("txframe success, no more bufs\n");
+		netdev_dbg(netdev, "txframe success, no more bufs\n");
 		/* netdev->tbusy = 1;  don't set here, irqhdlr */
 		/*   may have already cleared it */
 		result = NETDEV_TX_OK;
 	} else if (txresult == 2) {
 		/* alloc failure, drop frame */
-		pr_debug("txframe returned alloc_fail\n");
+		netdev_dbg(netdev, "txframe returned alloc_fail\n");
 		result = NETDEV_TX_BUSY;
 	} else {
 		/* buffer full or queue busy, drop frame. */
-		pr_debug("txframe returned full or busy\n");
+		netdev_dbg(netdev, "txframe returned full or busy\n");
 		result = NETDEV_TX_BUSY;
 	}
 
@@ -564,7 +563,7 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd)
 	wlandevice_t *wlandev = dev->ml_priv;
 	u8 *msgbuf;
 
-	pr_debug("rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len);
+	netdev_dbg(dev, "rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len);
 
 #ifdef SIOCETHTOOL
 	if (cmd == SIOCETHTOOL) {
@@ -685,8 +684,7 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr)
 	 * change the netdev address
 	 */
 	if (result != 0 || resultcode->data != P80211ENUM_resultcode_success) {
-		printk(KERN_ERR
-		       "Low-level driver failed dot11req_mibset(dot11MACAddress).\n");
+		netdev_err(dev, "Low-level driver failed dot11req_mibset(dot11MACAddress).\n");
 		result = -EADDRNOTAVAIL;
 	} else {
 		/* everything's ok, change the addr in netdev */
@@ -765,7 +763,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device *physdev)
 	/* Allocate and initialize the wiphy struct */
 	wiphy = wlan_create_wiphy(physdev, wlandev);
 	if (wiphy == NULL) {
-		printk(KERN_ERR "Failed to alloc wiphy.\n");
+		dev_err(physdev, "Failed to alloc wiphy.\n");
 		return 1;
 	}
 
@@ -773,7 +771,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device *physdev)
 	netdev = alloc_netdev(sizeof(struct wireless_dev), "wlan%d",
 				ether_setup);
 	if (netdev == NULL) {
-		printk(KERN_ERR "Failed to alloc netdev.\n");
+		dev_err(physdev, "Failed to alloc netdev.\n");
 		wlan_free_wiphy(wiphy);
 		result = 1;
 	} else {
@@ -949,7 +947,8 @@ static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc)
 	ftype = WLAN_GET_FC_FTYPE(fc);
 	fstype = WLAN_GET_FC_FSTYPE(fc);
 #if 0
-	pr_debug("rx_typedrop : ftype=%d fstype=%d.\n", ftype, fstype);
+	netdev_dbg(wlandev->netdev, "rx_typedrop : ftype=%d fstype=%d.\n",
+		   ftype, fstype);
 #endif
 	switch (ftype) {
 	case WLAN_FTYPE_MGMT:
@@ -958,7 +957,7 @@ static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc)
 			drop = 1;
 			break;
 		}
-		pr_debug("rx'd mgmt:\n");
+		netdev_dbg(wlandev->netdev, "rx'd mgmt:\n");
 		wlandev->rx.mgmt++;
 		switch (fstype) {
 		case WLAN_FSTYPE_ASSOCREQ:
@@ -1020,7 +1019,7 @@ static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc)
 			drop = 1;
 			break;
 		}
-		pr_debug("rx'd ctl:\n");
+		netdev_dbg(wlandev->netdev, "rx'd ctl:\n");
 		wlandev->rx.ctl++;
 		switch (fstype) {
 		case WLAN_FSTYPE_PSPOLL:
@@ -1072,19 +1071,19 @@ static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc)
 			wlandev->rx.data__cfack_cfpoll++;
 			break;
 		case WLAN_FSTYPE_NULL:
-			pr_debug("rx'd data:null\n");
+			netdev_dbg(wlandev->netdev, "rx'd data:null\n");
 			wlandev->rx.null++;
 			break;
 		case WLAN_FSTYPE_CFACK:
-			pr_debug("rx'd data:cfack\n");
+			netdev_dbg(wlandev->netdev, "rx'd data:cfack\n");
 			wlandev->rx.cfack++;
 			break;
 		case WLAN_FSTYPE_CFPOLL:
-			pr_debug("rx'd data:cfpoll\n");
+			netdev_dbg(wlandev->netdev, "rx'd data:cfpoll\n");
 			wlandev->rx.cfpoll++;
 			break;
 		case WLAN_FSTYPE_CFACK_CFPOLL:
-			pr_debug("rx'd data:cfack_cfpoll\n");
+			netdev_dbg(wlandev->netdev, "rx'd data:cfack_cfpoll\n");
 			wlandev->rx.cfack_cfpoll++;
 			break;
 		default:
@@ -1105,8 +1104,8 @@ static void p80211knetdev_tx_timeout(netdevice_t *netdev)
 	if (wlandev->tx_timeout) {
 		wlandev->tx_timeout(wlandev);
 	} else {
-		printk(KERN_WARNING "Implement tx_timeout for %s\n",
-		       wlandev->nsdname);
+		netdev_warn(netdev, "Implement tx_timeout for %s\n",
+			    wlandev->nsdname);
 		netif_wake_queue(wlandev->netdev);
 	}
 }
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 1/4] staging/wlan-ng: add prefix to function name
  2014-05-16  7:26   ` Tobias Klauser
                       ` (2 preceding siblings ...)
  2014-05-16 22:14     ` [PATCH 4/4] staging/wlan-ng: rearrange comments Denis Pithon
@ 2014-05-16 22:30     ` Denis Pithon
  3 siblings, 0 replies; 12+ messages in thread
From: Denis Pithon @ 2014-05-16 22:30 UTC (permalink / raw)
  To: gregkh, tklauser; +Cc: himangi774, devel, linux-kernel

Renamed convert_frame_to_ether() to p80211_convert_to_ether().

Signed-off-by: Denis Pithon <denis.pithon@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 61a3092..64dd935 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -244,7 +244,7 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
 #define CONV_TO_ETHER_FAILED	0x02
 
 /**
- * convert_frame_to_ether - conversion from 802.11 frame to ethernet frame
+ * p80211_convert_to_ether - conversion from 802.11 frame to ethernet frame
  * @wlandev: pointer to WLAN device
  * @skb: pointer to socket buffer
  *
@@ -252,7 +252,7 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
  *	    CONV_TO_ETHER_FAILED if conversion failed
  *	    CONV_TO_ETHER_SKIPPED if frame is ignored
  */
-static int convert_frame_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
+static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
 {
 	struct p80211_hdr_a3 *hdr;
 
@@ -314,7 +314,7 @@ static void p80211netdev_rx_bh(unsigned long arg)
 				netif_rx_ni(skb);
 				continue;
 			} else {
-				if (!convert_frame_to_ether(wlandev, skb))
+				if (!p80211_convert_to_ether(wlandev, skb))
 					continue;
 			}
 		}
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-05-16 22:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-12 15:22 [PATCH 1/4] staging/wlan-ng: update function header comment Denis Pithon
2014-05-12 15:22 ` [PATCH 2/4] staging/wlan-ng: remove function declaration Denis Pithon
2014-05-12 15:22 ` [PATCH 3/4] staging/wlan-ng: code refactoring Denis Pithon
2014-05-16  7:26   ` Tobias Klauser
2014-05-16 22:14     ` [PATCH 2/4] staging/wlan-ng: compare using ether_addr_equal_unaligned Denis Pithon
2014-05-16 22:14     ` [PATCH 3/4] staging/wlan-ng: multicast address checking Denis Pithon
2014-05-16 22:14     ` [PATCH 4/4] staging/wlan-ng: rearrange comments Denis Pithon
2014-05-16 22:30     ` [PATCH 1/4] staging/wlan-ng: add prefix to function name Denis Pithon
2014-05-12 15:22 ` [PATCH 4/4] staging/wlan-ng: replace printk() with pr_xxx() Denis Pithon
2014-05-14 11:57   ` Dan Carpenter
2014-05-15 21:57   ` Greg KH
2014-05-16 22:24     ` [PATCH] staging/wlan-ng: log with netdev_xxx and dev_xxx Denis Pithon

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.