* [PATCH net-next 1/3] caif: Fix compile warning
@ 2012-02-02 11:19 Sjur Brændeland
2012-02-02 11:19 ` [PATCH net-next 2/3] caif: Add drop count for caif_net device Sjur Brændeland
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Sjur Brændeland @ 2012-02-02 11:19 UTC (permalink / raw)
To: netdev, davem; +Cc: sjurbren, Sjur Brændeland
Fix compile warning:
... warning: statement with no effect [-Wunused-value]
This warning is seen when debug-fs is disabled. Fix this
by adding new macro for use when no return value is needed.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
net/caif/caif_socket.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index a986280..543f23c 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -60,11 +60,13 @@ struct debug_fs_counter {
atomic_t num_rx_flow_on;
};
static struct debug_fs_counter cnt;
-#define dbfs_atomic_inc(v) atomic_inc_return(v)
-#define dbfs_atomic_dec(v) atomic_dec_return(v)
+#define dbfs_atomic_inc(v) atomic_inc(v)
+#define dbfs_atomic_dec(v) atomic_dec(v)
+#define dbfs_atomic_inc_ret(v) atomic_inc_return(v)
#else
-#define dbfs_atomic_inc(v) 0
-#define dbfs_atomic_dec(v) 0
+#define dbfs_atomic_inc_ret(v) 0
+#define dbfs_atomic_inc(v)
+#define dbfs_atomic_dec(v)
#endif
struct caifsock {
@@ -1122,7 +1124,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol,
cf_sk->conn_req.protocol = protocol;
/* Increase the number of sockets created. */
dbfs_atomic_inc(&cnt.caif_nr_socks);
- num = dbfs_atomic_inc(&cnt.caif_sock_create);
+ num = dbfs_atomic_inc_ret(&cnt.caif_sock_create);
#ifdef CONFIG_DEBUG_FS
if (!IS_ERR(debugfsdir)) {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/3] caif: Add drop count for caif_net device.
2012-02-02 11:19 [PATCH net-next 1/3] caif: Fix compile warning Sjur Brændeland
@ 2012-02-02 11:19 ` Sjur Brændeland
2012-02-02 11:19 ` [PATCH net-next 3/3] caif: Add wakeline status tracking Sjur Brændeland
2012-02-02 19:29 ` [PATCH net-next 1/3] caif: Fix compile warning David Miller
2 siblings, 0 replies; 5+ messages in thread
From: Sjur Brændeland @ 2012-02-02 11:19 UTC (permalink / raw)
To: netdev, davem; +Cc: sjurbren, Sjur Brændeland
Count dropped packets in CAIF Netdevice.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
net/caif/chnl_net.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c
index 8656909..a751d9b 100644
--- a/net/caif/chnl_net.c
+++ b/net/caif/chnl_net.c
@@ -74,7 +74,6 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
struct sk_buff *skb;
struct chnl_net *priv = container_of(layr, struct chnl_net, chnl);
int pktlen;
- int err = 0;
const u8 *ip_version;
u8 buf;
@@ -95,8 +94,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
/* check the version of IP */
ip_version = skb_header_pointer(skb, 0, 1, &buf);
- if (!ip_version)
- return -EINVAL;
+
switch (*ip_version >> 4) {
case 4:
skb->protocol = htons(ETH_P_IP);
@@ -105,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
skb->protocol = htons(ETH_P_IPV6);
break;
default:
+ priv->netdev->stats.rx_errors++;
return -EINVAL;
}
@@ -123,7 +122,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
priv->netdev->stats.rx_packets++;
priv->netdev->stats.rx_bytes += pktlen;
- return err;
+ return 0;
}
static int delete_device(struct chnl_net *dev)
@@ -221,11 +220,13 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (skb->len > priv->netdev->mtu) {
pr_warn("Size of skb exceeded MTU\n");
+ dev->stats.tx_errors++;
return -ENOSPC;
}
if (!priv->flowenabled) {
pr_debug("dropping packets flow off\n");
+ dev->stats.tx_dropped++;
return NETDEV_TX_BUSY;
}
@@ -240,8 +241,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Send the packet down the stack. */
result = priv->chnl.dn->transmit(priv->chnl.dn, pkt);
if (result) {
- if (result == -EAGAIN)
- result = NETDEV_TX_BUSY;
+ dev->stats.tx_dropped++;
return result;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 3/3] caif: Add wakeline status tracking
2012-02-02 11:19 [PATCH net-next 1/3] caif: Fix compile warning Sjur Brændeland
2012-02-02 11:19 ` [PATCH net-next 2/3] caif: Add drop count for caif_net device Sjur Brændeland
@ 2012-02-02 11:19 ` Sjur Brændeland
2012-02-02 19:30 ` David Miller
2012-02-02 19:29 ` [PATCH net-next 1/3] caif: Fix compile warning David Miller
2 siblings, 1 reply; 5+ messages in thread
From: Sjur Brændeland @ 2012-02-02 11:19 UTC (permalink / raw)
To: netdev, davem; +Cc: sjurbren, Sjur Brændeland
Add initial support for tracking of wake-line status so we at any time
know when we have a timer running and HSI wake-line high.
The cfhsi_notify_rx, and cfhsi_wakeline_aquired/released are
dummies for now.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
drivers/net/caif/caif_hsi.c | 25 +++++++++++++++++++++++--
include/net/caif/caif_hsi.h | 8 ++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c
index 0a4fc62..749586f 100644
--- a/drivers/net/caif/caif_hsi.c
+++ b/drivers/net/caif/caif_hsi.c
@@ -399,6 +399,7 @@ static int cfhsi_rx_desc(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
netif_rx(skb);
else
netif_rx_ni(skb);
+ cfhsi_notify_rx(cfhsi);
/* Update network statistics. */
cfhsi->ndev->stats.rx_packets++;
@@ -500,6 +501,7 @@ static int cfhsi_rx_pld(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
netif_rx(skb);
else
netif_rx_ni(skb);
+ cfhsi_notify_rx(cfhsi);
/* Update network statistics. */
cfhsi->ndev->stats.rx_packets++;
@@ -787,6 +789,9 @@ static void cfhsi_wake_down(struct work_struct *work)
if (test_bit(CFHSI_SHUTDOWN, &cfhsi->bits))
return;
+ /* Clear spurious states (if any) */
+ WARN_ON(test_and_clear_bit(CFHSI_WAKE_DOWN_ACK, &cfhsi->bits));
+
/* Deactivate wake line. */
cfhsi->dev->cfhsi_wake_down(cfhsi->dev);
@@ -836,6 +841,10 @@ static void cfhsi_wake_down(struct work_struct *work)
/* Cancel pending RX requests. */
cfhsi->dev->cfhsi_rx_cancel(cfhsi->dev);
+ spin_lock_bh(&cfhsi->lock);
+ if (!test_bit(CFHSI_WAKE_UP, &cfhsi->bits))
+ cfhsi_wakeline_released(cfhsi);
+ spin_unlock_bh(&cfhsi->lock);
}
static void cfhsi_out_of_sync(struct work_struct *work)
@@ -864,8 +873,12 @@ static void cfhsi_wake_up_cb(struct cfhsi_drv *drv)
return;
/* Schedule wake up work queue if the peer initiates. */
- if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits))
+ spin_lock_bh(&cfhsi->lock);
+ if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits)) {
+ cfhsi_wakeline_aquired(cfhsi);
queue_work(cfhsi->wq, &cfhsi->wake_up_work);
+ }
+ spin_unlock_bh(&cfhsi->lock);
}
static void cfhsi_wake_down_cb(struct cfhsi_drv *drv)
@@ -944,8 +957,12 @@ static int cfhsi_xmit(struct sk_buff *skb, struct net_device *dev)
}
} else {
/* Schedule wake up work queue if the we initiate. */
- if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits))
+ spin_lock_bh(&cfhsi->lock);
+ if (!test_and_set_bit(CFHSI_WAKE_UP, &cfhsi->bits)) {
+ cfhsi_wakeline_aquired(cfhsi);
queue_work(cfhsi->wq, &cfhsi->wake_up_work);
+ }
+ spin_unlock_bh(&cfhsi->lock);
}
return 0;
@@ -1099,6 +1116,8 @@ int cfhsi_probe(struct platform_device *pdev)
cfhsi->rx_slowpath_timer.data = (unsigned long)cfhsi;
cfhsi->rx_slowpath_timer.function = cfhsi_rx_slowpath;
+ cfhsi_wakeline_init();
+
/* Add CAIF HSI device to list. */
spin_lock(&cfhsi_list_lock);
list_add_tail(&cfhsi->list, &cfhsi_list);
@@ -1180,6 +1199,8 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi)
/* Deactivate interface */
cfhsi->dev->cfhsi_down(cfhsi->dev);
+ cfhsi_wakeline_deinit();
+
/* Finally unregister the network device. */
unregister_netdev(cfhsi->ndev);
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 8d55251..5caefc6 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -157,4 +157,12 @@ struct cfhsi {
extern struct platform_driver cfhsi_driver;
+#ifndef CFHSI_WAKELOCKS
+#define cfhsi_wakeline_aquired(dev)
+#define cfhsi_wakeline_released(dev)
+#define cfhsi_notify_rx(dev)
+#define cfhsi_wakeline_init(dev)
+#define cfhsi_wakeline_deinit(dev)
+#endif
+
#endif /* CAIF_HSI_H_ */
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/3] caif: Fix compile warning
2012-02-02 11:19 [PATCH net-next 1/3] caif: Fix compile warning Sjur Brændeland
2012-02-02 11:19 ` [PATCH net-next 2/3] caif: Add drop count for caif_net device Sjur Brændeland
2012-02-02 11:19 ` [PATCH net-next 3/3] caif: Add wakeline status tracking Sjur Brændeland
@ 2012-02-02 19:29 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2012-02-02 19:29 UTC (permalink / raw)
To: sjur.brandeland; +Cc: netdev, sjurbren
From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Date: Thu, 2 Feb 2012 12:19:23 +0100
> Fix compile warning:
> ... warning: statement with no effect [-Wunused-value]
> This warning is seen when debug-fs is disabled. Fix this
> by adding new macro for use when no return value is needed.
>
> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Seriously, just get rid of this debug code.
You'll feel very much relieved afterwards.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 3/3] caif: Add wakeline status tracking
2012-02-02 11:19 ` [PATCH net-next 3/3] caif: Add wakeline status tracking Sjur Brændeland
@ 2012-02-02 19:30 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2012-02-02 19:30 UTC (permalink / raw)
To: sjur.brandeland; +Cc: netdev, sjurbren
From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Date: Thu, 2 Feb 2012 12:19:25 +0100
> Add initial support for tracking of wake-line status so we at any time
> know when we have a timer running and HSI wake-line high.
>
> The cfhsi_notify_rx, and cfhsi_wakeline_aquired/released are
> dummies for now.
>
> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Magic unused ifdefs and empty methods for a new feature not even
implemented.
No thanks on both counts.
I'm not applying this.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-02 19:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-02 11:19 [PATCH net-next 1/3] caif: Fix compile warning Sjur Brændeland
2012-02-02 11:19 ` [PATCH net-next 2/3] caif: Add drop count for caif_net device Sjur Brændeland
2012-02-02 11:19 ` [PATCH net-next 3/3] caif: Add wakeline status tracking Sjur Brændeland
2012-02-02 19:30 ` David Miller
2012-02-02 19:29 ` [PATCH net-next 1/3] caif: Fix compile warning David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).