* Re: [PATCH v5] can: Convert to runtime_pm
From: Marc Kleine-Budde @ 2015-01-13 17:17 UTC (permalink / raw)
To: Sören Brinkmann
Cc: Kedareswara rao Appana, wg, michal.simek, grant.likely, robh+dt,
linux-can, netdev, linux-arm-kernel, linux-kernel, devicetree,
Kedareswara rao Appana
In-Reply-To: <6ea3c0ea0f5c4deb9a6e4738a8d94a36@BN1AFFO11FD047.protection.gbl>
[-- Attachment #1: Type: text/plain, Size: 4050 bytes --]
On 01/13/2015 06:08 PM, Sören Brinkmann wrote:
> On Tue, 2015-01-13 at 12:08PM +0100, Marc Kleine-Budde wrote:
>> On 01/12/2015 07:45 PM, Sören Brinkmann wrote:
>>> On Mon, 2015-01-12 at 08:34PM +0530, Kedareswara rao Appana wrote:
>>>> Instead of enabling/disabling clocks at several locations in the driver,
>>>> Use the runtime_pm framework. This consolidates the actions for runtime PM
>>>> In the appropriate callbacks and makes the driver more readable and mantainable.
>>>>
>>>> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
>>>> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
>>>> ---
>>>> Changes for v5:
>>>> - Updated with the review comments.
>>>> Updated the remove fuction to use runtime_pm.
>>>> Chnages for v4:
>>>> - Updated with the review comments.
>>>> Changes for v3:
>>>> - Converted the driver to use runtime_pm.
>>>> Changes for v2:
>>>> - Removed the struct platform_device* from suspend/resume
>>>> as suggest by Lothar.
>>>>
>>>> drivers/net/can/xilinx_can.c | 157 ++++++++++++++++++++++++++++-------------
>>>> 1 files changed, 107 insertions(+), 50 deletions(-)
>>> [..]
>>>> +static int __maybe_unused xcan_runtime_resume(struct device *dev)
>>>> {
>>>> - struct platform_device *pdev = dev_get_drvdata(dev);
>>>> - struct net_device *ndev = platform_get_drvdata(pdev);
>>>> + struct net_device *ndev = dev_get_drvdata(dev);
>>>> struct xcan_priv *priv = netdev_priv(ndev);
>>>> int ret;
>>>> + u32 isr, status;
>>>>
>>>> ret = clk_enable(priv->bus_clk);
>>>> if (ret) {
>>>> @@ -1014,15 +1030,28 @@ static int __maybe_unused xcan_resume(struct device *dev)
>>>> ret = clk_enable(priv->can_clk);
>>>> if (ret) {
>>>> dev_err(dev, "Cannot enable clock.\n");
>>>> - clk_disable_unprepare(priv->bus_clk);
>>>> + clk_disable(priv->bus_clk);
>>> [...]
>>>> @@ -1173,12 +1219,23 @@ static int xcan_remove(struct platform_device *pdev)
>>>> {
>>>> struct net_device *ndev = platform_get_drvdata(pdev);
>>>> struct xcan_priv *priv = netdev_priv(ndev);
>>>> + int ret;
>>>> +
>>>> + ret = pm_runtime_get_sync(&pdev->dev);
>>>> + if (ret < 0) {
>>>> + netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
>>>> + __func__, ret);
>>>> + return ret;
>>>> + }
>>>>
>>>> if (set_reset_mode(ndev) < 0)
>>>> netdev_err(ndev, "mode resetting failed!\n");
>>>>
>>>> unregister_candev(ndev);
>>>> + pm_runtime_disable(&pdev->dev);
>>>> netif_napi_del(&priv->napi);
>>>> + clk_disable_unprepare(priv->bus_clk);
>>>> + clk_disable_unprepare(priv->can_clk);
>>>
>>> Shouldn't pretty much all these occurrences of clk_disable/enable
>>> disappear? This should all be handled by the runtime_pm framework now.
>>
>> We have:
>> - clk_prepare_enable() in probe
>
> This should become something like pm_runtime_get_sync(), shouldn't it?
>
>> - clk_disable_unprepare() in remove
>
> pm_runtime_put()
>
>> - clk_enable() in runtime_resume
>> - clk_disable() in runtime_suspend
>
> These are the ones needed.
>
> The above makes me suspect that the clocks are always on, regardless of
Define "on" :)
The clocks are prepared after probe() exists, but not enabled. The first
pm_runtime_get_sync() will enable the clocks.
> the runtime suspend state since they are enabled in probe and disabled
> in remove, is that right? Ideally, the usage in probe and remove should
> be migrated to runtime_pm and clocks should really only be running when
> needed and not throughout the whole lifetime of the driver.
The clocks are not en/disabled via pm_runtime, because
pm_runtime_get_sync() is called from atomic contect. We can have another
look into the driver and try to change this.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH] mISDN: avoid arch specific __builtin_return_address call
From: Joe Perches @ 2015-01-13 17:17 UTC (permalink / raw)
To: Arnd Bergmann
Cc: isdn4linux, netdev, Karsten Keil, davem, linux-arm-kernel,
linux-kernel
In-Reply-To: <1816278.9Bv8N8K5IB@wuerfel>
On Tue, 2015-01-13 at 17:10 +0100, Arnd Bergmann wrote:
> Not all architectures are able to call __builtin_return_address().
> On ARM, the mISDN code produces this warning:
>
> hardware/mISDN/w6692.c: In function 'w6692_dctrl':
> hardware/mISDN/w6692.c:1181:75: warning: unsupported argument to '__builtin_return_address'
> pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__,
I didn't know that tidbit. Thanks.
^ permalink raw reply
* Re: [PATCH] rtlwifi/rtl8192de: remove redundant else if check
From: Larry Finger @ 2015-01-13 17:19 UTC (permalink / raw)
To: Colin King, Kalle Valo, linux-wireless, netdev; +Cc: linux-kernel
In-Reply-To: <1421158054-22566-1-git-send-email-colin.king@canonical.com>
On 01/13/2015 08:07 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The else if check condition checks for the opposite of the
> if check, hence the else if check is redundant and can be
> replaced with a simple else:
>
> if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) {
> ..
> } else if (rtlpriv->rtlhal.macphymode != SINGLEMAC_SINGLEPHY) {
> ..
> }
>
> replaced with:
>
> if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) {
> ..
> } else {
> ..
> }
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Thanks,
Larry
> ---
> drivers/net/wireless/rtlwifi/rtl8192de/hw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
> index 280c3da..01bcc2d 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
> @@ -546,7 +546,7 @@ static bool _rtl92de_llt_table_init(struct ieee80211_hw *hw)
> txpktbuf_bndy = 246;
> value8 = 0;
> value32 = 0x80bf0d29;
> - } else if (rtlpriv->rtlhal.macphymode != SINGLEMAC_SINGLEPHY) {
> + } else {
> maxPage = 127;
> txpktbuf_bndy = 123;
> value8 = 0;
>
^ permalink raw reply
* [PATCH 2/3] xen-netfront: refactor skb slot counting
From: David Vrabel @ 2015-01-13 17:16 UTC (permalink / raw)
To: netdev; +Cc: David Vrabel, xen-devel, Konrad Rzeszutek Wilk, Boris Ostrovsky
In-Reply-To: <1421169404-27461-1-git-send-email-david.vrabel@citrix.com>
A function to count the number of slots an skb needs is more useful
than one that counts the slots needed for only the frags.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
drivers/net/xen-netfront.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 22bcb4e..6b29b3a 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -521,13 +521,15 @@ static void xennet_make_frags(struct sk_buff *skb, struct netfront_queue *queue,
}
/*
- * Count how many ring slots are required to send the frags of this
- * skb. Each frag might be a compound page.
+ * Count how many ring slots are required to send this skb. Each frag
+ * might be a compound page.
*/
-static int xennet_count_skb_frag_slots(struct sk_buff *skb)
+static int xennet_count_skb_slots(struct sk_buff *skb)
{
int i, frags = skb_shinfo(skb)->nr_frags;
- int pages = 0;
+ int pages;
+
+ pages = PFN_UP(offset_in_page(skb->data) + skb_headlen(skb));
for (i = 0; i < frags; i++) {
skb_frag_t *frag = skb_shinfo(skb)->frags + i;
@@ -597,8 +599,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
goto drop;
}
- slots = DIV_ROUND_UP(offset + len, PAGE_SIZE) +
- xennet_count_skb_frag_slots(skb);
+ slots = xennet_count_skb_slots(skb);
if (unlikely(slots > MAX_SKB_FRAGS + 1)) {
net_dbg_ratelimited("xennet: skb rides the rocket: %d slots, %d bytes\n",
slots, skb->len);
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/3] xen: add page_to_mfn()
From: David Vrabel @ 2015-01-13 17:16 UTC (permalink / raw)
To: netdev; +Cc: David Vrabel, xen-devel, Konrad Rzeszutek Wilk, Boris Ostrovsky
In-Reply-To: <1421169404-27461-1-git-send-email-david.vrabel@citrix.com>
pfn_to_mfn(page_to_pfn(p)) is a common use case so add a generic
helper for it.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
include/xen/page.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/xen/page.h b/include/xen/page.h
index 12765b6..c5ed20b 100644
--- a/include/xen/page.h
+++ b/include/xen/page.h
@@ -3,6 +3,11 @@
#include <asm/xen/page.h>
+static inline unsigned long page_to_mfn(struct page *page)
+{
+ return pfn_to_mfn(page_to_pfn(page));
+}
+
struct xen_memory_region {
phys_addr_t start;
phys_addr_t size;
--
1.7.10.4
^ permalink raw reply related
* [PATCHv1 0/3 net-next] xen-netfront: refactor making Tx requests
From: David Vrabel @ 2015-01-13 17:16 UTC (permalink / raw)
To: netdev; +Cc: David Vrabel, xen-devel, Konrad Rzeszutek Wilk, Boris Ostrovsky
As netfront as evolved to handle different sorts of skbs the code to
fill a Tx requests has been copy and pasted several times. The series
refactors this and a few other areas.
The first patch is to a Xen header but this can be merged via
net-next.
David
^ permalink raw reply
* [PATCH 3/3] xen-netfront: refactor making Tx requests
From: David Vrabel @ 2015-01-13 17:16 UTC (permalink / raw)
To: netdev; +Cc: David Vrabel, xen-devel, Konrad Rzeszutek Wilk, Boris Ostrovsky
In-Reply-To: <1421169404-27461-1-git-send-email-david.vrabel@citrix.com>
Eliminate all the duplicate code for making Tx requests by
consolidating them into a single xennet_make_one_txreq() function.
xennet_make_one_txreq() and xennet_make_txreqs() work with pages and
offsets so it will be easier to make netfront handle highmem frags in
the future.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
drivers/net/xen-netfront.c | 181 ++++++++++++++++----------------------------
1 file changed, 67 insertions(+), 114 deletions(-)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 6b29b3a..68e0e8f 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -425,99 +425,56 @@ static void xennet_tx_buf_gc(struct netfront_queue *queue)
xennet_maybe_wake_tx(queue);
}
-static void xennet_make_frags(struct sk_buff *skb, struct netfront_queue *queue,
- struct xen_netif_tx_request *tx)
-{
- char *data = skb->data;
- unsigned long mfn;
- RING_IDX prod = queue->tx.req_prod_pvt;
- int frags = skb_shinfo(skb)->nr_frags;
- unsigned int offset = offset_in_page(data);
- unsigned int len = skb_headlen(skb);
+static struct xen_netif_tx_request *xennet_make_one_txreq(
+ struct netfront_queue *queue, struct sk_buff *skb,
+ struct page *page, unsigned int offset, unsigned int len)
+{
unsigned int id;
+ struct xen_netif_tx_request *tx;
grant_ref_t ref;
- int i;
- /* While the header overlaps a page boundary (including being
- larger than a page), split it it into page-sized chunks. */
- while (len > PAGE_SIZE - offset) {
- tx->size = PAGE_SIZE - offset;
- tx->flags |= XEN_NETTXF_more_data;
- len -= tx->size;
- data += tx->size;
- offset = 0;
+ len = min_t(unsigned int, PAGE_SIZE - offset, len);
- id = get_id_from_freelist(&queue->tx_skb_freelist, queue->tx_skbs);
- queue->tx_skbs[id].skb = skb_get(skb);
- tx = RING_GET_REQUEST(&queue->tx, prod++);
- tx->id = id;
- ref = gnttab_claim_grant_reference(&queue->gref_tx_head);
- BUG_ON((signed short)ref < 0);
+ id = get_id_from_freelist(&queue->tx_skb_freelist, queue->tx_skbs);
+ tx = RING_GET_REQUEST(&queue->tx, queue->tx.req_prod_pvt++);
+ ref = gnttab_claim_grant_reference(&queue->gref_tx_head);
+ BUG_ON((signed short)ref < 0);
- mfn = virt_to_mfn(data);
- gnttab_grant_foreign_access_ref(ref, queue->info->xbdev->otherend_id,
- mfn, GNTMAP_readonly);
+ gnttab_grant_foreign_access_ref(ref, queue->info->xbdev->otherend_id,
+ page_to_mfn(page), GNTMAP_readonly);
- queue->grant_tx_page[id] = virt_to_page(data);
- tx->gref = queue->grant_tx_ref[id] = ref;
- tx->offset = offset;
- tx->size = len;
- tx->flags = 0;
- }
+ queue->tx_skbs[id].skb = skb;
+ queue->grant_tx_page[id] = page;
+ queue->grant_tx_ref[id] = ref;
- /* Grant backend access to each skb fragment page. */
- for (i = 0; i < frags; i++) {
- skb_frag_t *frag = skb_shinfo(skb)->frags + i;
- struct page *page = skb_frag_page(frag);
+ tx->id = id;
+ tx->gref = ref;
+ tx->offset = offset;
+ tx->size = len;
+ tx->flags = 0;
- len = skb_frag_size(frag);
- offset = frag->page_offset;
+ return tx;
+}
- /* Skip unused frames from start of page */
- page += offset >> PAGE_SHIFT;
- offset &= ~PAGE_MASK;
+static struct xen_netif_tx_request *xennet_make_txreqs(
+ struct netfront_queue *queue, struct xen_netif_tx_request *tx,
+ struct sk_buff *skb, struct page *page,
+ unsigned int offset, unsigned int len)
+{
+ /* Skip unused frames from start of page */
+ page += offset >> PAGE_SHIFT;
+ offset &= ~PAGE_MASK;
- while (len > 0) {
- unsigned long bytes;
-
- bytes = PAGE_SIZE - offset;
- if (bytes > len)
- bytes = len;
-
- tx->flags |= XEN_NETTXF_more_data;
-
- id = get_id_from_freelist(&queue->tx_skb_freelist,
- queue->tx_skbs);
- queue->tx_skbs[id].skb = skb_get(skb);
- tx = RING_GET_REQUEST(&queue->tx, prod++);
- tx->id = id;
- ref = gnttab_claim_grant_reference(&queue->gref_tx_head);
- BUG_ON((signed short)ref < 0);
-
- mfn = pfn_to_mfn(page_to_pfn(page));
- gnttab_grant_foreign_access_ref(ref,
- queue->info->xbdev->otherend_id,
- mfn, GNTMAP_readonly);
-
- queue->grant_tx_page[id] = page;
- tx->gref = queue->grant_tx_ref[id] = ref;
- tx->offset = offset;
- tx->size = bytes;
- tx->flags = 0;
-
- offset += bytes;
- len -= bytes;
-
- /* Next frame */
- if (offset == PAGE_SIZE && len) {
- BUG_ON(!PageCompound(page));
- page++;
- offset = 0;
- }
- }
+ while (len) {
+ tx->flags |= XEN_NETTXF_more_data;
+ tx = xennet_make_one_txreq(queue, skb_get(skb),
+ page, offset, len);
+ page++;
+ offset = 0;
+ len -= tx->size;
}
- queue->tx.req_prod_pvt = prod;
+ return tx;
}
/*
@@ -565,18 +522,15 @@ static u16 xennet_select_queue(struct net_device *dev, struct sk_buff *skb,
static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
- unsigned short id;
struct netfront_info *np = netdev_priv(dev);
struct netfront_stats *stats = this_cpu_ptr(np->stats);
- struct xen_netif_tx_request *tx;
- char *data = skb->data;
- RING_IDX i;
- grant_ref_t ref;
- unsigned long mfn;
+ struct xen_netif_tx_request *tx, *first_tx;
+ unsigned int i;
int notify;
int slots;
- unsigned int offset = offset_in_page(data);
- unsigned int len = skb_headlen(skb);
+ struct page *page;
+ unsigned int offset;
+ unsigned int len;
unsigned long flags;
struct netfront_queue *queue = NULL;
unsigned int num_queues = dev->real_num_tx_queues;
@@ -605,11 +559,12 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
slots, skb->len);
if (skb_linearize(skb))
goto drop;
- data = skb->data;
- offset = offset_in_page(data);
- len = skb_headlen(skb);
}
+ page = virt_to_page(skb->data);
+ offset = offset_in_page(skb->data);
+ len = skb_headlen(skb);
+
spin_lock_irqsave(&queue->tx_lock, flags);
if (unlikely(!netif_carrier_ok(dev) ||
@@ -619,25 +574,13 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
goto drop;
}
- i = queue->tx.req_prod_pvt;
-
- id = get_id_from_freelist(&queue->tx_skb_freelist, queue->tx_skbs);
- queue->tx_skbs[id].skb = skb;
-
- tx = RING_GET_REQUEST(&queue->tx, i);
+ /* First request for the linear area. */
+ first_tx = tx = xennet_make_one_txreq(queue, skb,
+ page, offset, len);
+ page++;
+ offset = 0;
+ len -= tx->size;
- tx->id = id;
- ref = gnttab_claim_grant_reference(&queue->gref_tx_head);
- BUG_ON((signed short)ref < 0);
- mfn = virt_to_mfn(data);
- gnttab_grant_foreign_access_ref(
- ref, queue->info->xbdev->otherend_id, mfn, GNTMAP_readonly);
- queue->grant_tx_page[id] = virt_to_page(data);
- tx->gref = queue->grant_tx_ref[id] = ref;
- tx->offset = offset;
- tx->size = len;
-
- tx->flags = 0;
if (skb->ip_summed == CHECKSUM_PARTIAL)
/* local packet? */
tx->flags |= XEN_NETTXF_csum_blank | XEN_NETTXF_data_validated;
@@ -645,11 +588,12 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* remote but checksummed. */
tx->flags |= XEN_NETTXF_data_validated;
+ /* Optional extra info after the first request. */
if (skb_shinfo(skb)->gso_size) {
struct xen_netif_extra_info *gso;
gso = (struct xen_netif_extra_info *)
- RING_GET_REQUEST(&queue->tx, ++i);
+ RING_GET_REQUEST(&queue->tx, queue->tx.req_prod_pvt++);
tx->flags |= XEN_NETTXF_extra_info;
@@ -664,10 +608,19 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
gso->flags = 0;
}
- queue->tx.req_prod_pvt = i + 1;
+ /* Requests for the rest of the linear area. */
+ tx = xennet_make_txreqs(queue, tx, skb, page, offset, len);
+
+ /* Requests for all the frags. */
+ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
+ tx = xennet_make_txreqs(queue, tx, skb,
+ skb_frag_page(frag), frag->page_offset,
+ skb_frag_size(frag));
+ }
- xennet_make_frags(skb, queue, tx);
- tx->size = skb->len;
+ /* First request has the packet length. */
+ first_tx->size = skb->len;
RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&queue->tx, notify);
if (notify)
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH v5] can: Convert to runtime_pm
From: Sören Brinkmann @ 2015-01-13 17:24 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Kedareswara rao Appana, wg, michal.simek, grant.likely, robh+dt,
linux-can, netdev, linux-arm-kernel, linux-kernel, devicetree,
Kedareswara rao Appana
In-Reply-To: <54B55326.1060606@pengutronix.de>
On Tue, 2015-01-13 at 06:17PM +0100, Marc Kleine-Budde wrote:
> On 01/13/2015 06:08 PM, Sören Brinkmann wrote:
> > On Tue, 2015-01-13 at 12:08PM +0100, Marc Kleine-Budde wrote:
> >> On 01/12/2015 07:45 PM, Sören Brinkmann wrote:
> >>> On Mon, 2015-01-12 at 08:34PM +0530, Kedareswara rao Appana wrote:
> >>>> Instead of enabling/disabling clocks at several locations in the driver,
> >>>> Use the runtime_pm framework. This consolidates the actions for runtime PM
> >>>> In the appropriate callbacks and makes the driver more readable and mantainable.
> >>>>
> >>>> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
> >>>> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> >>>> ---
> >>>> Changes for v5:
> >>>> - Updated with the review comments.
> >>>> Updated the remove fuction to use runtime_pm.
> >>>> Chnages for v4:
> >>>> - Updated with the review comments.
> >>>> Changes for v3:
> >>>> - Converted the driver to use runtime_pm.
> >>>> Changes for v2:
> >>>> - Removed the struct platform_device* from suspend/resume
> >>>> as suggest by Lothar.
> >>>>
> >>>> drivers/net/can/xilinx_can.c | 157 ++++++++++++++++++++++++++++-------------
> >>>> 1 files changed, 107 insertions(+), 50 deletions(-)
> >>> [..]
> >>>> +static int __maybe_unused xcan_runtime_resume(struct device *dev)
> >>>> {
> >>>> - struct platform_device *pdev = dev_get_drvdata(dev);
> >>>> - struct net_device *ndev = platform_get_drvdata(pdev);
> >>>> + struct net_device *ndev = dev_get_drvdata(dev);
> >>>> struct xcan_priv *priv = netdev_priv(ndev);
> >>>> int ret;
> >>>> + u32 isr, status;
> >>>>
> >>>> ret = clk_enable(priv->bus_clk);
> >>>> if (ret) {
> >>>> @@ -1014,15 +1030,28 @@ static int __maybe_unused xcan_resume(struct device *dev)
> >>>> ret = clk_enable(priv->can_clk);
> >>>> if (ret) {
> >>>> dev_err(dev, "Cannot enable clock.\n");
> >>>> - clk_disable_unprepare(priv->bus_clk);
> >>>> + clk_disable(priv->bus_clk);
> >>> [...]
> >>>> @@ -1173,12 +1219,23 @@ static int xcan_remove(struct platform_device *pdev)
> >>>> {
> >>>> struct net_device *ndev = platform_get_drvdata(pdev);
> >>>> struct xcan_priv *priv = netdev_priv(ndev);
> >>>> + int ret;
> >>>> +
> >>>> + ret = pm_runtime_get_sync(&pdev->dev);
> >>>> + if (ret < 0) {
> >>>> + netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
> >>>> + __func__, ret);
> >>>> + return ret;
> >>>> + }
> >>>>
> >>>> if (set_reset_mode(ndev) < 0)
> >>>> netdev_err(ndev, "mode resetting failed!\n");
> >>>>
> >>>> unregister_candev(ndev);
> >>>> + pm_runtime_disable(&pdev->dev);
> >>>> netif_napi_del(&priv->napi);
> >>>> + clk_disable_unprepare(priv->bus_clk);
> >>>> + clk_disable_unprepare(priv->can_clk);
> >>>
> >>> Shouldn't pretty much all these occurrences of clk_disable/enable
> >>> disappear? This should all be handled by the runtime_pm framework now.
> >>
> >> We have:
> >> - clk_prepare_enable() in probe
> >
> > This should become something like pm_runtime_get_sync(), shouldn't it?
> >
> >> - clk_disable_unprepare() in remove
> >
> > pm_runtime_put()
> >
> >> - clk_enable() in runtime_resume
> >> - clk_disable() in runtime_suspend
> >
> > These are the ones needed.
> >
> > The above makes me suspect that the clocks are always on, regardless of
>
> Define "on" :)
> The clocks are prepared after probe() exists, but not enabled. The first
> pm_runtime_get_sync() will enable the clocks.
>
> > the runtime suspend state since they are enabled in probe and disabled
> > in remove, is that right? Ideally, the usage in probe and remove should
> > be migrated to runtime_pm and clocks should really only be running when
> > needed and not throughout the whole lifetime of the driver.
>
> The clocks are not en/disabled via pm_runtime, because
> pm_runtime_get_sync() is called from atomic contect. We can have another
> look into the driver and try to change this.
Wasn't that why the call to pm_runtime_irq_safe() was added?
Also, clk_enable/disable should be okay to be run from atomic context.
And if the clock are already prepared after the exit of probe that
should be enough. Then remove() should just have to do the unprepare.
But I don't see why runtime_pm shouldn't be able to do the
enable/disable.
Sören
^ permalink raw reply
* Re: [3.19-rc3] tg3: BUG: sleeping function called from invalid context
From: Michael Chan @ 2015-01-13 17:25 UTC (permalink / raw)
To: Peter Hurley; +Cc: Prashant Sreedharan, netdev, Linux kernel
In-Reply-To: <54B513F4.5020403@hurleysoftware.com>
On Tue, 2015-01-13 at 07:47 -0500, Peter Hurley wrote:
> > tp->lock is held in this code path. If synchronize_irq() sleeps in
> > wait_event(desc->wait_for_threads, ...), we'll get the warning.
> >
> > The synchronize_irq() call is to wait for any tg3 irq handler to finish
> > so that it is guaranteed that next time it will see the CHIP_RESETTING
> > flag and do nothing.
> >
> > Not sure if we can drop the tp->lock before we call synchronize_irq()
> > and then take it again after synchronize_irq().
>
> Well, this device [1] is using MSI (INTx disabled) so if the synchronize_irq()
> is _only_ for the CHIP_RESETTING logic then it would seem ok to skip it (the
> synchronize_irq()).
It is only for INTx. But any device can operate in INTx mode if
MSI/MSIX is not available, so the fix needs to work in all cases.
Let me review the code some more. If we can guarantee that another
reset, the timer code, etc, cannot come in even if we drop the tp->lock,
the simplest fix will be to drop it before calling synchronize_irq().
Thanks.
^ permalink raw reply
* Re: why are IPv6 addresses removed on link down
From: David Miller @ 2015-01-13 17:25 UTC (permalink / raw)
To: dsahern; +Cc: hannes, hideaki.yoshifuji, stephen, netdev
In-Reply-To: <54B53187.7080306@gmail.com>
From: David Ahern <dsahern@gmail.com>
Date: Tue, 13 Jan 2015 07:53:59 -0700
> Bottom line is there a harm in removing the flush? If there is no harm
> will mainline kernel take a patch to do that or is your backward
> compatibility concern enough to block it?
Backward compatibility trumps all other concerns here, and I say is
enough to block changing the behavior. One which we've had for more
than a decade.
^ permalink raw reply
* Re: [PATCH net-next v2 2/2] vxlan: Remote checksum offload
From: Tom Herbert @ 2015-01-13 17:26 UTC (permalink / raw)
To: Thomas Graf; +Cc: David Miller, Linux Netdev List
In-Reply-To: <20150113164011.GO20387@casper.infradead.org>
On Tue, Jan 13, 2015 at 8:40 AM, Thomas Graf <tgraf@suug.ch> wrote:
> [Moving this discussion to the thread of the respective patch]
>
> On 01/13/15 at 08:16am, Tom Herbert wrote:
>> On 01/13/15 at 11:44am, Thomas Graf wrote:
>> > The major difference here is that we have to consider backwards
>> > compatibility specifically for VXLAN. Your initial feedback on GPE
>> > actually led me to how I implemented GBP.
>> >
>> > I think the axioms we want to establish are as follows:
>> > 1. Extensions need to be explicitly enabled by the user. A previously
>> > dropped frame should only be processed if the user explitly asks
>> > for it.
>> > 2. As a consequence: only share a VLXAN UDP port if the enabled
>> > extensions match (vxlan_sock_add), e.g. user A might want RCO
>> > but user B might be unaware. They cannot share the same UDP port.
>> >
>> > The 2nd lead me to introduce the 'exts' member to vxlan_sock so we can
>> > compare it in vxlan_find_sock() and only share a UDP port if the
>> > enabled extensions match.
>> >
>> RCO is represented in the socket in VXLAN flags (VLXAN_F_*). My patch
>> also adds a flags to vxlan_sock which contains the VLXAN flags. For
>> shared port, I suspect all the receive features must match, including
>> receive checksum settings for instance, but we don't care about
>> transmit side. To facilitate this, I would suggest splitting flags
>> into o_flags and i_flags like ip_tunnel does, and then compare i_flags
>> in vxlan_find_sock.
>
> Not sure I understand why you want to omit the transmit side. If a
> VXLAN socket with RCO TX enabled is found and shared with a user
> who does not want RCO enabled, it will get RCO enabled frames which
> will get dropped by non RCO VXLAN receivers.
Yes, if the transmit parameters are shared between different users
then that is an issue and transmit features should be matched. Since
VLXAN is using the same same socket for TX and RX that would appear to
be the case. However, in other encaps like GRE, FOU, & GUE the receive
and transmit paths are separate where each tunnel can have their own
transmit parameters even if they share a common receive port or path.
This allows for useful asymmetric configurations (like defining two
tunnels that receive packets on same port, but one transmits non-zero
UDP checksums and one with zero checksums).
Tom
^ permalink raw reply
* Re: [RFC PATCH v2 1/2] net: af_packet support for direct ring access in user space
From: David Miller @ 2015-01-13 17:27 UTC (permalink / raw)
To: David.Laight
Cc: john.fastabend, dborkman, hannes, netdev, danny.zhou, nhorman,
john.ronciak, brouer
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CAC6BA5@AcuExch.aculab.com>
From: David Laight <David.Laight@ACULAB.COM>
Date: Tue, 13 Jan 2015 17:15:30 +0000
> How about something like:
>
> struct tpacket_dma_mem_region {
> __u64 addr; /* userspace virtual address */
> __u64 phys_addr; /* physical address */
> __u64 iova; /* IO virtual address used for DMA */
> __u64 size; /* size of region */
> int direction; /* dma data direction */
> } aligned(8);
>
> So that it is independant of 32/64 bits.
> It is a shame that gcc has no way of defining a 64bit 'void *' on 32bit systems.
> You can use a union, but you still need to zero extend the value on LE (worse on BE).
We have an __aligned_u64, please use that.
^ permalink raw reply
* Re: why are IPv6 addresses removed on link down
From: Hannes Frederic Sowa @ 2015-01-13 17:34 UTC (permalink / raw)
To: David Miller; +Cc: dsahern, hideaki.yoshifuji, stephen, netdev
In-Reply-To: <20150113.122542.815831933030545121.davem@davemloft.net>
On Di, 2015-01-13 at 12:25 -0500, David Miller wrote:
> From: David Ahern <dsahern@gmail.com>
> Date: Tue, 13 Jan 2015 07:53:59 -0700
>
> > Bottom line is there a harm in removing the flush? If there is no harm
> > will mainline kernel take a patch to do that or is your backward
> > compatibility concern enough to block it?
>
> Backward compatibility trumps all other concerns here, and I say is
> enough to block changing the behavior. One which we've had for more
> than a decade.
Totally agreed, a new sysctl will definitely be needed and the default
should be the old behavior. Otherwise we cannot do it.
^ permalink raw reply
* Re: [PATCH v5] can: Convert to runtime_pm
From: Marc Kleine-Budde @ 2015-01-13 17:44 UTC (permalink / raw)
To: Sören Brinkmann
Cc: Kedareswara rao Appana, wg-5Yr1BZd7O62+XT7JhA+gdA,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-can-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Kedareswara rao Appana
In-Reply-To: <1ef3e0f060f54c888061514bd2926762-neA4ZlFjCT3DAA6W7k9C4mYJ4DzVTqeXkX/xN29GLwg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 5556 bytes --]
On 01/13/2015 06:24 PM, Sören Brinkmann wrote:
> On Tue, 2015-01-13 at 06:17PM +0100, Marc Kleine-Budde wrote:
>> On 01/13/2015 06:08 PM, Sören Brinkmann wrote:
>>> On Tue, 2015-01-13 at 12:08PM +0100, Marc Kleine-Budde wrote:
>>>> On 01/12/2015 07:45 PM, Sören Brinkmann wrote:
>>>>> On Mon, 2015-01-12 at 08:34PM +0530, Kedareswara rao Appana wrote:
>>>>>> Instead of enabling/disabling clocks at several locations in the driver,
>>>>>> Use the runtime_pm framework. This consolidates the actions for runtime PM
>>>>>> In the appropriate callbacks and makes the driver more readable and mantainable.
>>>>>>
>>>>>> Signed-off-by: Soren Brinkmann <soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
>>>>>> Signed-off-by: Kedareswara rao Appana <appanad-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
>>>>>> ---
>>>>>> Changes for v5:
>>>>>> - Updated with the review comments.
>>>>>> Updated the remove fuction to use runtime_pm.
>>>>>> Chnages for v4:
>>>>>> - Updated with the review comments.
>>>>>> Changes for v3:
>>>>>> - Converted the driver to use runtime_pm.
>>>>>> Changes for v2:
>>>>>> - Removed the struct platform_device* from suspend/resume
>>>>>> as suggest by Lothar.
>>>>>>
>>>>>> drivers/net/can/xilinx_can.c | 157 ++++++++++++++++++++++++++++-------------
>>>>>> 1 files changed, 107 insertions(+), 50 deletions(-)
>>>>> [..]
>>>>>> +static int __maybe_unused xcan_runtime_resume(struct device *dev)
>>>>>> {
>>>>>> - struct platform_device *pdev = dev_get_drvdata(dev);
>>>>>> - struct net_device *ndev = platform_get_drvdata(pdev);
>>>>>> + struct net_device *ndev = dev_get_drvdata(dev);
>>>>>> struct xcan_priv *priv = netdev_priv(ndev);
>>>>>> int ret;
>>>>>> + u32 isr, status;
>>>>>>
>>>>>> ret = clk_enable(priv->bus_clk);
>>>>>> if (ret) {
>>>>>> @@ -1014,15 +1030,28 @@ static int __maybe_unused xcan_resume(struct device *dev)
>>>>>> ret = clk_enable(priv->can_clk);
>>>>>> if (ret) {
>>>>>> dev_err(dev, "Cannot enable clock.\n");
>>>>>> - clk_disable_unprepare(priv->bus_clk);
>>>>>> + clk_disable(priv->bus_clk);
>>>>> [...]
>>>>>> @@ -1173,12 +1219,23 @@ static int xcan_remove(struct platform_device *pdev)
>>>>>> {
>>>>>> struct net_device *ndev = platform_get_drvdata(pdev);
>>>>>> struct xcan_priv *priv = netdev_priv(ndev);
>>>>>> + int ret;
>>>>>> +
>>>>>> + ret = pm_runtime_get_sync(&pdev->dev);
>>>>>> + if (ret < 0) {
>>>>>> + netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
>>>>>> + __func__, ret);
>>>>>> + return ret;
>>>>>> + }
>>>>>>
>>>>>> if (set_reset_mode(ndev) < 0)
>>>>>> netdev_err(ndev, "mode resetting failed!\n");
>>>>>>
>>>>>> unregister_candev(ndev);
>>>>>> + pm_runtime_disable(&pdev->dev);
>>>>>> netif_napi_del(&priv->napi);
>>>>>> + clk_disable_unprepare(priv->bus_clk);
>>>>>> + clk_disable_unprepare(priv->can_clk);
>>>>>
>>>>> Shouldn't pretty much all these occurrences of clk_disable/enable
>>>>> disappear? This should all be handled by the runtime_pm framework now.
>>>>
>>>> We have:
>>>> - clk_prepare_enable() in probe
>>>
>>> This should become something like pm_runtime_get_sync(), shouldn't it?
>>>
>>>> - clk_disable_unprepare() in remove
>>>
>>> pm_runtime_put()
>>>
>>>> - clk_enable() in runtime_resume
>>>> - clk_disable() in runtime_suspend
>>>
>>> These are the ones needed.
>>>
>>> The above makes me suspect that the clocks are always on, regardless of
>>
>> Define "on" :)
>> The clocks are prepared after probe() exists, but not enabled. The first
>> pm_runtime_get_sync() will enable the clocks.
>>
>>> the runtime suspend state since they are enabled in probe and disabled
>>> in remove, is that right? Ideally, the usage in probe and remove should
>>> be migrated to runtime_pm and clocks should really only be running when
>>> needed and not throughout the whole lifetime of the driver.
>>
>> The clocks are not en/disabled via pm_runtime, because
>> pm_runtime_get_sync() is called from atomic contect. We can have another
>> look into the driver and try to change this.
> Wasn't that why the call to pm_runtime_irq_safe() was added?
Good question. That should be investigated.
> Also, clk_enable/disable should be okay to be run from atomic context.
> And if the clock are already prepared after the exit of probe that
> should be enough. Then remove() should just have to do the unprepare.
> But I don't see why runtime_pm shouldn't be able to do the
> enable/disable.
runtime_pm does call the clk_{enable,disable} function. But you mean
clk_prepare() + pm_runtime_get_sync() should be used in probe() instead
of calling clk_prepare_enable(). Good idea! I think the
"pm_runtime_set_active(&pdev->dev);" has to be removed from the patch.
Coming back whether blocking calls are allowed or not.
If you make a call to pm_runtime_irq_safe(), you state that it's okay to
call pm_runtime_get_sync() from atomic context. But it's only called in
open, probe, remove and in xcan_get_berr_counter, which is not called
from atomic either. So let's try to remove the pm_runtime_irq_safe() and
use clk_prepare_enable() clk_disable_unprepare() in the runtime_resume()
runtime_suspend() functions.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* [PATCH net-next] sunvnet: fix rx packet length check to allow for TSO
From: David L Stevens @ 2015-01-13 17:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Sowmini Varadhan
This patch fixes the rx packet length check in the sunvnet driver to allow
for a TSO max packet length greater than the LDC channel negotiated MTU.
These are negotiated separately and there is no requirement that
port->tsolen be less than port->rmtu, but if it isn't, it'll drop packets
with rx length errors.
Signed-off-by: David L Stevens <david.stevens@oracle.com>
---
drivers/net/ethernet/sun/sunvnet.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index d2835bf..b5a1d3d 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -351,10 +351,15 @@ static int vnet_rx_one(struct vnet_port *port, struct vio_net_desc *desc)
unsigned int len = desc->size;
unsigned int copy_len;
struct sk_buff *skb;
+ int maxlen;
int err;
err = -EMSGSIZE;
- if (unlikely(len < ETH_ZLEN || len > port->rmtu)) {
+ if (port->tso && port->tsolen > port->rmtu)
+ maxlen = port->tsolen;
+ else
+ maxlen = port->rmtu;
+ if (unlikely(len < ETH_ZLEN || len > maxlen)) {
dev->stats.rx_length_errors++;
goto out_dropped;
}
--
1.7.1
^ permalink raw reply related
* [PATCH] tipc: correctly handle releasing a not fully initialized sock
From: Sasha Levin @ 2015-01-13 17:46 UTC (permalink / raw)
To: linux-kernel
Cc: ying.xue, Tero.Aho, jon.maloy, Sasha Levin, Allan Stephens,
David S. Miller, open list:TIPC NETWORK LAYER,
open list:TIPC NETWORK LAYER
Commit "tipc: make tipc node table aware of net namespace" has added a
dereference of sock->sk before making sure it's not NULL, which makes
releasing a tipc socket NULL pointer dereference for sockets that are
not fully initialized.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
net/tipc/socket.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 2cec496..694d436 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -472,8 +472,8 @@ static void tipc_sk_callback(struct rcu_head *head)
static int tipc_release(struct socket *sock)
{
struct sock *sk = sock->sk;
- struct net *net = sock_net(sk);
- struct tipc_net *tn = net_generic(net, tipc_net_id);
+ struct net *net;
+ struct tipc_net *tn;
struct tipc_sock *tsk;
struct sk_buff *skb;
u32 dnode, probing_state;
@@ -485,6 +485,9 @@ static int tipc_release(struct socket *sock)
if (sk == NULL)
return 0;
+ net = sock_net(sk);
+ tn = net_generic(net, tipc_net_id);
+
tsk = tipc_sk(sk);
lock_sock(sk);
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH v5] can: Convert to runtime_pm
From: Sören Brinkmann @ 2015-01-13 17:49 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Kedareswara rao Appana, wg-5Yr1BZd7O62+XT7JhA+gdA,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-can-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Kedareswara rao Appana
In-Reply-To: <54B55993.4020806-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
On Tue, 2015-01-13 at 06:44PM +0100, Marc Kleine-Budde wrote:
> On 01/13/2015 06:24 PM, Sören Brinkmann wrote:
> > On Tue, 2015-01-13 at 06:17PM +0100, Marc Kleine-Budde wrote:
> >> On 01/13/2015 06:08 PM, Sören Brinkmann wrote:
> >>> On Tue, 2015-01-13 at 12:08PM +0100, Marc Kleine-Budde wrote:
> >>>> On 01/12/2015 07:45 PM, Sören Brinkmann wrote:
> >>>>> On Mon, 2015-01-12 at 08:34PM +0530, Kedareswara rao Appana wrote:
> >>>>>> Instead of enabling/disabling clocks at several locations in the driver,
> >>>>>> Use the runtime_pm framework. This consolidates the actions for runtime PM
> >>>>>> In the appropriate callbacks and makes the driver more readable and mantainable.
> >>>>>>
> >>>>>> Signed-off-by: Soren Brinkmann <soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
> >>>>>> Signed-off-by: Kedareswara rao Appana <appanad-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
> >>>>>> ---
> >>>>>> Changes for v5:
> >>>>>> - Updated with the review comments.
> >>>>>> Updated the remove fuction to use runtime_pm.
> >>>>>> Chnages for v4:
> >>>>>> - Updated with the review comments.
> >>>>>> Changes for v3:
> >>>>>> - Converted the driver to use runtime_pm.
> >>>>>> Changes for v2:
> >>>>>> - Removed the struct platform_device* from suspend/resume
> >>>>>> as suggest by Lothar.
> >>>>>>
> >>>>>> drivers/net/can/xilinx_can.c | 157 ++++++++++++++++++++++++++++-------------
> >>>>>> 1 files changed, 107 insertions(+), 50 deletions(-)
> >>>>> [..]
> >>>>>> +static int __maybe_unused xcan_runtime_resume(struct device *dev)
> >>>>>> {
> >>>>>> - struct platform_device *pdev = dev_get_drvdata(dev);
> >>>>>> - struct net_device *ndev = platform_get_drvdata(pdev);
> >>>>>> + struct net_device *ndev = dev_get_drvdata(dev);
> >>>>>> struct xcan_priv *priv = netdev_priv(ndev);
> >>>>>> int ret;
> >>>>>> + u32 isr, status;
> >>>>>>
> >>>>>> ret = clk_enable(priv->bus_clk);
> >>>>>> if (ret) {
> >>>>>> @@ -1014,15 +1030,28 @@ static int __maybe_unused xcan_resume(struct device *dev)
> >>>>>> ret = clk_enable(priv->can_clk);
> >>>>>> if (ret) {
> >>>>>> dev_err(dev, "Cannot enable clock.\n");
> >>>>>> - clk_disable_unprepare(priv->bus_clk);
> >>>>>> + clk_disable(priv->bus_clk);
> >>>>> [...]
> >>>>>> @@ -1173,12 +1219,23 @@ static int xcan_remove(struct platform_device *pdev)
> >>>>>> {
> >>>>>> struct net_device *ndev = platform_get_drvdata(pdev);
> >>>>>> struct xcan_priv *priv = netdev_priv(ndev);
> >>>>>> + int ret;
> >>>>>> +
> >>>>>> + ret = pm_runtime_get_sync(&pdev->dev);
> >>>>>> + if (ret < 0) {
> >>>>>> + netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
> >>>>>> + __func__, ret);
> >>>>>> + return ret;
> >>>>>> + }
> >>>>>>
> >>>>>> if (set_reset_mode(ndev) < 0)
> >>>>>> netdev_err(ndev, "mode resetting failed!\n");
> >>>>>>
> >>>>>> unregister_candev(ndev);
> >>>>>> + pm_runtime_disable(&pdev->dev);
> >>>>>> netif_napi_del(&priv->napi);
> >>>>>> + clk_disable_unprepare(priv->bus_clk);
> >>>>>> + clk_disable_unprepare(priv->can_clk);
> >>>>>
> >>>>> Shouldn't pretty much all these occurrences of clk_disable/enable
> >>>>> disappear? This should all be handled by the runtime_pm framework now.
> >>>>
> >>>> We have:
> >>>> - clk_prepare_enable() in probe
> >>>
> >>> This should become something like pm_runtime_get_sync(), shouldn't it?
> >>>
> >>>> - clk_disable_unprepare() in remove
> >>>
> >>> pm_runtime_put()
> >>>
> >>>> - clk_enable() in runtime_resume
> >>>> - clk_disable() in runtime_suspend
> >>>
> >>> These are the ones needed.
> >>>
> >>> The above makes me suspect that the clocks are always on, regardless of
> >>
> >> Define "on" :)
> >> The clocks are prepared after probe() exists, but not enabled. The first
> >> pm_runtime_get_sync() will enable the clocks.
> >>
> >>> the runtime suspend state since they are enabled in probe and disabled
> >>> in remove, is that right? Ideally, the usage in probe and remove should
> >>> be migrated to runtime_pm and clocks should really only be running when
> >>> needed and not throughout the whole lifetime of the driver.
> >>
> >> The clocks are not en/disabled via pm_runtime, because
> >> pm_runtime_get_sync() is called from atomic contect. We can have another
> >> look into the driver and try to change this.
>
> > Wasn't that why the call to pm_runtime_irq_safe() was added?
>
> Good question. That should be investigated.
>
> > Also, clk_enable/disable should be okay to be run from atomic context.
> > And if the clock are already prepared after the exit of probe that
> > should be enough. Then remove() should just have to do the unprepare.
> > But I don't see why runtime_pm shouldn't be able to do the
> > enable/disable.
>
> runtime_pm does call the clk_{enable,disable} function. But you mean
> clk_prepare() + pm_runtime_get_sync() should be used in probe() instead
> of calling clk_prepare_enable(). Good idea! I think the
> "pm_runtime_set_active(&pdev->dev);" has to be removed from the patch.
Right, that's what I was thinking. The proposed changes make sense, IMHO.
>
> Coming back whether blocking calls are allowed or not.
> If you make a call to pm_runtime_irq_safe(), you state that it's okay to
> call pm_runtime_get_sync() from atomic context. But it's only called in
> open, probe, remove and in xcan_get_berr_counter, which is not called
> from atomic either. So let's try to remove the pm_runtime_irq_safe() and
> use clk_prepare_enable() clk_disable_unprepare() in the runtime_resume()
> runtime_suspend() functions.
IIRC, xcan_get_berr_counter() is called from atomic context. I think
that was how this got started.
Sören
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH net-next] sunvnet: fix rx packet length check to allow for TSO
From: Sowmini Varadhan @ 2015-01-13 18:01 UTC (permalink / raw)
To: David L Stevens; +Cc: David Miller, netdev
In-Reply-To: <54B559A1.9010303@oracle.com>
On (01/13/15 12:45), David L Stevens wrote:
>
> This patch fixes the rx packet length check in the sunvnet driver to allow
> for a TSO max packet length greater than the LDC channel negotiated MTU.
> These are negotiated separately and there is no requirement that
> port->tsolen be less than port->rmtu, but if it isn't, it'll drop packets
> with rx length errors.
>
> Signed-off-by: David L Stevens <david.stevens@oracle.com>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
--Sowmini
^ permalink raw reply
* Re: [PATCH v5] can: Convert to runtime_pm
From: Marc Kleine-Budde @ 2015-01-13 18:03 UTC (permalink / raw)
To: Sören Brinkmann
Cc: Kedareswara rao Appana, wg, michal.simek, grant.likely, robh+dt,
linux-can, netdev, linux-arm-kernel, linux-kernel, devicetree,
Kedareswara rao Appana
In-Reply-To: <922ff1827dfb484bbc42dbb56649d4b4@BN1BFFO11FD013.protection.gbl>
[-- Attachment #1: Type: text/plain, Size: 8470 bytes --]
On 01/13/2015 06:49 PM, Sören Brinkmann wrote:
> On Tue, 2015-01-13 at 06:44PM +0100, Marc Kleine-Budde wrote:
>> On 01/13/2015 06:24 PM, Sören Brinkmann wrote:
>>> On Tue, 2015-01-13 at 06:17PM +0100, Marc Kleine-Budde wrote:
>>>> On 01/13/2015 06:08 PM, Sören Brinkmann wrote:
>>>>> On Tue, 2015-01-13 at 12:08PM +0100, Marc Kleine-Budde wrote:
>>>>>> On 01/12/2015 07:45 PM, Sören Brinkmann wrote:
>>>>>>> On Mon, 2015-01-12 at 08:34PM +0530, Kedareswara rao Appana wrote:
>>>>>>>> Instead of enabling/disabling clocks at several locations in the driver,
>>>>>>>> Use the runtime_pm framework. This consolidates the actions for runtime PM
>>>>>>>> In the appropriate callbacks and makes the driver more readable and mantainable.
>>>>>>>>
>>>>>>>> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
>>>>>>>> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
>>>>>>>> ---
>>>>>>>> Changes for v5:
>>>>>>>> - Updated with the review comments.
>>>>>>>> Updated the remove fuction to use runtime_pm.
>>>>>>>> Chnages for v4:
>>>>>>>> - Updated with the review comments.
>>>>>>>> Changes for v3:
>>>>>>>> - Converted the driver to use runtime_pm.
>>>>>>>> Changes for v2:
>>>>>>>> - Removed the struct platform_device* from suspend/resume
>>>>>>>> as suggest by Lothar.
>>>>>>>>
>>>>>>>> drivers/net/can/xilinx_can.c | 157 ++++++++++++++++++++++++++++-------------
>>>>>>>> 1 files changed, 107 insertions(+), 50 deletions(-)
>>>>>>> [..]
>>>>>>>> +static int __maybe_unused xcan_runtime_resume(struct device *dev)
>>>>>>>> {
>>>>>>>> - struct platform_device *pdev = dev_get_drvdata(dev);
>>>>>>>> - struct net_device *ndev = platform_get_drvdata(pdev);
>>>>>>>> + struct net_device *ndev = dev_get_drvdata(dev);
>>>>>>>> struct xcan_priv *priv = netdev_priv(ndev);
>>>>>>>> int ret;
>>>>>>>> + u32 isr, status;
>>>>>>>>
>>>>>>>> ret = clk_enable(priv->bus_clk);
>>>>>>>> if (ret) {
>>>>>>>> @@ -1014,15 +1030,28 @@ static int __maybe_unused xcan_resume(struct device *dev)
>>>>>>>> ret = clk_enable(priv->can_clk);
>>>>>>>> if (ret) {
>>>>>>>> dev_err(dev, "Cannot enable clock.\n");
>>>>>>>> - clk_disable_unprepare(priv->bus_clk);
>>>>>>>> + clk_disable(priv->bus_clk);
>>>>>>> [...]
>>>>>>>> @@ -1173,12 +1219,23 @@ static int xcan_remove(struct platform_device *pdev)
>>>>>>>> {
>>>>>>>> struct net_device *ndev = platform_get_drvdata(pdev);
>>>>>>>> struct xcan_priv *priv = netdev_priv(ndev);
>>>>>>>> + int ret;
>>>>>>>> +
>>>>>>>> + ret = pm_runtime_get_sync(&pdev->dev);
>>>>>>>> + if (ret < 0) {
>>>>>>>> + netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
>>>>>>>> + __func__, ret);
>>>>>>>> + return ret;
>>>>>>>> + }
>>>>>>>>
>>>>>>>> if (set_reset_mode(ndev) < 0)
>>>>>>>> netdev_err(ndev, "mode resetting failed!\n");
>>>>>>>>
>>>>>>>> unregister_candev(ndev);
>>>>>>>> + pm_runtime_disable(&pdev->dev);
>>>>>>>> netif_napi_del(&priv->napi);
>>>>>>>> + clk_disable_unprepare(priv->bus_clk);
>>>>>>>> + clk_disable_unprepare(priv->can_clk);
>>>>>>>
>>>>>>> Shouldn't pretty much all these occurrences of clk_disable/enable
>>>>>>> disappear? This should all be handled by the runtime_pm framework now.
>>>>>>
>>>>>> We have:
>>>>>> - clk_prepare_enable() in probe
>>>>>
>>>>> This should become something like pm_runtime_get_sync(), shouldn't it?
>>>>>
>>>>>> - clk_disable_unprepare() in remove
>>>>>
>>>>> pm_runtime_put()
>>>>>
>>>>>> - clk_enable() in runtime_resume
>>>>>> - clk_disable() in runtime_suspend
>>>>>
>>>>> These are the ones needed.
>>>>>
>>>>> The above makes me suspect that the clocks are always on, regardless of
>>>>
>>>> Define "on" :)
>>>> The clocks are prepared after probe() exists, but not enabled. The first
>>>> pm_runtime_get_sync() will enable the clocks.
>>>>
>>>>> the runtime suspend state since they are enabled in probe and disabled
>>>>> in remove, is that right? Ideally, the usage in probe and remove should
>>>>> be migrated to runtime_pm and clocks should really only be running when
>>>>> needed and not throughout the whole lifetime of the driver.
>>>>
>>>> The clocks are not en/disabled via pm_runtime, because
>>>> pm_runtime_get_sync() is called from atomic contect. We can have another
>>>> look into the driver and try to change this.
>>
>>> Wasn't that why the call to pm_runtime_irq_safe() was added?
>>
>> Good question. That should be investigated.
>>
>>> Also, clk_enable/disable should be okay to be run from atomic context.
>>> And if the clock are already prepared after the exit of probe that
>>> should be enough. Then remove() should just have to do the unprepare.
>>> But I don't see why runtime_pm shouldn't be able to do the
>>> enable/disable.
>>
>> runtime_pm does call the clk_{enable,disable} function. But you mean
>> clk_prepare() + pm_runtime_get_sync() should be used in probe() instead
>> of calling clk_prepare_enable(). Good idea! I think the
>> "pm_runtime_set_active(&pdev->dev);" has to be removed from the patch.
>
> Right, that's what I was thinking. The proposed changes make sense, IMHO.
>
>>
>> Coming back whether blocking calls are allowed or not.
>> If you make a call to pm_runtime_irq_safe(), you state that it's okay to
>> call pm_runtime_get_sync() from atomic context. But it's only called in
>> open, probe, remove and in xcan_get_berr_counter, which is not called
>> from atomic either. So let's try to remove the pm_runtime_irq_safe() and
>> use clk_prepare_enable() clk_disable_unprepare() in the runtime_resume()
>> runtime_suspend() functions.
>
> IIRC, xcan_get_berr_counter() is called from atomic context. I think
> that was how this got started.
In some drivers the get_berr_counter() function is used in the irq
handler, but here it's only called from outside, an thus from non atomic
context.
From an older mail of yours:
> I have the feeling I'm missing something. If I remove the 'must not
> sleep' requirement from the runtime suspend/resume functions, I get
> this:
>
> BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:954
http://lxr.free-electrons.com/source/drivers/base/power/runtime.c#L954
I think it's failing because of the pm_runtime_irq_safe() call.
> in_atomic(): 0, irqs_disabled(): 0, pid: 161, name: ip
> INFO: lockdep is turned off.
> CPU: 0 PID: 161 Comm: ip Not tainted 3.18.0-rc1-xilinx-00059-g21da26693b61-dirty #104
> [<c00186a8>] (unwind_backtrace) from [<c00139f4>] (show_stack+0x20/0x24)
> [<c00139f4>] (show_stack) from [<c055a41c>] (dump_stack+0x8c/0xd0)
> [<c055a41c>] (dump_stack) from [<c0054808>] (__might_sleep+0x1ac/0x1e4)
> [<c0054808>] (__might_sleep) from [<c034f8f0>] (__pm_runtime_resume+0x40/0x9c)
> [<c034f8f0>] (__pm_runtime_resume) from [<c03b48d8>] (xcan_get_berr_counter+0x2c/0x9c)
> [<c03b48d8>] (xcan_get_berr_counter) from [<c03b2ecc>] (can_fill_info+0x160/0x1f4)
> [<c03b2ecc>] (can_fill_info) from [<c049f3b0>] (rtnl_fill_ifinfo+0x794/0x970)
> [<c049f3b0>] (rtnl_fill_ifinfo) from [<c04a0048>] (rtnl_dump_ifinfo+0x1b4/0x2fc)
> [<c04a0048>] (rtnl_dump_ifinfo) from [<c04af9c8>] (netlink_dump+0xe4/0x270)
> [<c04af9c8>] (netlink_dump) from [<c04b0764>] (__netlink_dump_start+0xdc/0x170)
> [<c04b0764>] (__netlink_dump_start) from [<c04a1fc4>] (rtnetlink_rcv_msg+0x154/0x1e0)
> [<c04a1fc4>] (rtnetlink_rcv_msg) from [<c04b1e88>] (netlink_rcv_skb+0x68/0xc4)
> [<c04b1e88>] (netlink_rcv_skb) from [<c04a045c>] (rtnetlink_rcv+0x28/0x34)
> [<c04a045c>] (rtnetlink_rcv) from [<c04b1770>] (netlink_unicast+0x144/0x210)
> [<c04b1770>] (netlink_unicast) from [<c04b1c9c>] (netlink_sendmsg+0x394/0x414)
> [<c04b1c9c>] (netlink_sendmsg) from [<c046ffcc>] (sock_sendmsg+0x8c/0xc0)
> [<c046ffcc>] (sock_sendmsg) from [<c04726bc>] (SyS_sendto+0xd8/0x114)
> [<c04726bc>] (SyS_sendto) from [<c000f3e0>] (ret_fast_syscall+0x0/0x48)
>
> I.e. the core calls this function from atomic context. And in an earlier
> thread you said the core can also call this before/after calling the
> open/close callbacks (which applies here too, I think).
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [RFC PATCH v2 2/2] net: ixgbe: implement af_packet direct queue mappings
From: Daniel Borkmann @ 2015-01-13 18:18 UTC (permalink / raw)
To: John Fastabend; +Cc: netdev, danny.zhou, nhorman, john.ronciak, hannes, brouer
In-Reply-To: <54B53DED.4040502@gmail.com>
On 01/13/2015 04:46 PM, John Fastabend wrote:
> On 01/13/2015 06:26 AM, Daniel Borkmann wrote:
...
>> Anyway, extending Documentation/networking/packet_mmap.txt with
>> API details/examples at least for a non-RFC version is encouraged. ;)
>
> Yep for the non-RFC version I'll add an example to packet_mmap.txt
Cool, alternatively, perhaps a mini library under samples/packet/
would work, similarly as we have with samples/bpf/ which would allow
for a simple starting point for users to rx/tx frames.
^ permalink raw reply
* [PATCH iproute2 0/2] Refactoring for monitoring utils
From: Vadim Kochan @ 2015-01-13 18:14 UTC (permalink / raw)
To: netdev; +Cc: Vadim Kochan
From: Vadim Kochan <vadim4j@gmail.com>
This series is just about refactoring for bridge/ip/rtmon monitoring tools.
Changes:
1) Added #define for nlmsg_type = 15 which is used for log timestamp within
nlmsg for monitoring tools.
2) Using one function to print timestamp from nlmsg for ip/bridge monitor tools.
Vadim Kochan (2):
Add define for nlmsg_types with timestamp
Use one func to print timestamp from nlmsg
bridge/monitor.c | 18 +++---------------
include/libnetlink.h | 4 ++++
include/utils.h | 2 ++
ip/ipmonitor.c | 9 ++-------
ip/rtmon.c | 2 +-
lib/utils.c | 10 ++++++++++
6 files changed, 22 insertions(+), 23 deletions(-)
--
2.1.3
^ permalink raw reply
* [PATCH iproute2 1/2] Add define for nlmsg_types with timestamp
From: Vadim Kochan @ 2015-01-13 18:14 UTC (permalink / raw)
To: netdev; +Cc: Vadim Kochan
In-Reply-To: <1421172864-20853-1-git-send-email-vadim4j@gmail.com>
From: Vadim Kochan <vadim4j@gmail.com>
Add #define for nlmsg_type = 15
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
bridge/monitor.c | 4 +---
include/libnetlink.h | 4 ++++
ip/ipmonitor.c | 2 +-
ip/rtmon.c | 2 +-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/bridge/monitor.c b/bridge/monitor.c
index 76e7d47..f00e0a6 100644
--- a/bridge/monitor.c
+++ b/bridge/monitor.c
@@ -74,14 +74,12 @@ static int accept_msg(const struct sockaddr_nl *who,
fprintf(fp, "[MDB]");
return print_mdb(who, n, arg);
- case 15:
+ case NLMSG_TSTAMP:
return show_mark(fp, n);
default:
return 0;
}
-
-
}
int do_monitor(int argc, char **argv)
diff --git a/include/libnetlink.h b/include/libnetlink.h
index de7c85f..d081e54 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -158,5 +158,9 @@ extern int rtnl_from_file(FILE *, rtnl_filter_t handler,
#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
#endif
+/* User defined nlmsg_type which is used mostly for logging netlink
+ * messages from dump file */
+#define NLMSG_TSTAMP 15
+
#endif /* __LIBNETLINK_H__ */
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 4708e54..f40daac 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -125,7 +125,7 @@ static int accept_msg(const struct sockaddr_nl *who,
print_netconf(who, n, arg);
return 0;
}
- if (n->nlmsg_type == 15) {
+ if (n->nlmsg_type == NLMSG_TSTAMP) {
char *tstr;
time_t secs = ((__u32*)NLMSG_DATA(n))[0];
long usecs = ((__u32*)NLMSG_DATA(n))[1];
diff --git a/ip/rtmon.c b/ip/rtmon.c
index 9227eac..ff685e5 100644
--- a/ip/rtmon.c
+++ b/ip/rtmon.c
@@ -34,7 +34,7 @@ static void write_stamp(FILE *fp)
struct nlmsghdr *n1 = (void*)buf;
struct timeval tv;
- n1->nlmsg_type = 15;
+ n1->nlmsg_type = NLMSG_TSTAMP;
n1->nlmsg_flags = 0;
n1->nlmsg_seq = 0;
n1->nlmsg_pid = 0;
--
2.1.3
^ permalink raw reply related
* [PATCH] tipc: link: Remove unused function
From: Rickard Strandqvist @ 2015-01-13 18:24 UTC (permalink / raw)
To: Jon Maloy, Allan Stephens
Cc: Rickard Strandqvist, David S. Miller, netdev, tipc-discussion,
linux-kernel
Remove the function tipc_link_get_max_pkt() that is not used anywhere.
This was partially found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
net/tipc/link.c | 27 ---------------------------
net/tipc/link.h | 1 -
2 files changed, 28 deletions(-)
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 1db162a..a18f5ce 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2327,33 +2327,6 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s
return buf;
}
-/**
- * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination
- * @dest: network address of destination node
- * @selector: used to select from set of active links
- *
- * If no active link can be found, uses default maximum packet size.
- */
-u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
-{
- struct tipc_node *n_ptr;
- struct tipc_link *l_ptr;
- u32 res = MAX_PKT_DEFAULT;
-
- if (dest == tipc_own_addr)
- return MAX_MSG_SIZE;
-
- n_ptr = tipc_node_find(dest);
- if (n_ptr) {
- tipc_node_lock(n_ptr);
- l_ptr = n_ptr->active_links[selector & 1];
- if (l_ptr)
- res = l_ptr->max_pkt;
- tipc_node_unlock(n_ptr);
- }
- return res;
-}
-
static void link_print(struct tipc_link *l_ptr, const char *str)
{
struct tipc_bearer *b_ptr;
diff --git a/net/tipc/link.h b/net/tipc/link.h
index b567a34..9b91eb6 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -228,7 +228,6 @@ void tipc_link_reset(struct tipc_link *l_ptr);
void tipc_link_reset_list(unsigned int bearer_id);
int tipc_link_xmit(struct sk_buff *buf, u32 dest, u32 selector);
int __tipc_link_xmit(struct tipc_link *link, struct sk_buff *buf);
-u32 tipc_link_get_max_pkt(u32 dest, u32 selector);
void tipc_link_bundle_rcv(struct sk_buff *buf);
void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob,
u32 gap, u32 tolerance, u32 priority, u32 acked_mtu);
--
1.7.10.4
^ permalink raw reply related
* [PATCH iproute2 2/2] Use one func to print timestamp from nlmsg
From: Vadim Kochan @ 2015-01-13 18:14 UTC (permalink / raw)
To: netdev; +Cc: Vadim Kochan
In-Reply-To: <1421172864-20853-1-git-send-email-vadim4j@gmail.com>
From: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
bridge/monitor.c | 14 ++------------
include/utils.h | 2 ++
ip/ipmonitor.c | 7 +------
lib/utils.c | 10 ++++++++++
4 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/bridge/monitor.c b/bridge/monitor.c
index f00e0a6..9e1ed48 100644
--- a/bridge/monitor.c
+++ b/bridge/monitor.c
@@ -35,17 +35,6 @@ static void usage(void)
exit(-1);
}
-static int show_mark(FILE *fp, const struct nlmsghdr *n)
-{
- char *tstr;
- time_t secs = ((__u32*)NLMSG_DATA(n))[0];
- long usecs = ((__u32*)NLMSG_DATA(n))[1];
- tstr = asctime(localtime(&secs));
- tstr[strlen(tstr)-1] = 0;
- fprintf(fp, "Timestamp: %s %lu us\n", tstr, usecs);
- return 0;
-}
-
static int accept_msg(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
@@ -75,7 +64,8 @@ static int accept_msg(const struct sockaddr_nl *who,
return print_mdb(who, n, arg);
case NLMSG_TSTAMP:
- return show_mark(fp, n);
+ print_nlmsg_timestamp(fp, n);
+ return 0;
default:
return 0;
diff --git a/include/utils.h b/include/utils.h
index eecbc39..e1fe7cf 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -148,6 +148,7 @@ static inline __u32 nl_mgrp(__u32 group)
int print_timestamp(FILE *fp);
+void print_nlmsg_timestamp(FILE *fp, const struct nlmsghdr *n);
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -160,4 +161,5 @@ struct iplink_req;
int iplink_parse(int argc, char **argv, struct iplink_req *req,
char **name, char **type, char **link, char **dev,
int *group, int *index);
+
#endif /* __UTILS_H__ */
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index f40daac..5ec8f41 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -126,12 +126,7 @@ static int accept_msg(const struct sockaddr_nl *who,
return 0;
}
if (n->nlmsg_type == NLMSG_TSTAMP) {
- char *tstr;
- time_t secs = ((__u32*)NLMSG_DATA(n))[0];
- long usecs = ((__u32*)NLMSG_DATA(n))[1];
- tstr = asctime(localtime(&secs));
- tstr[strlen(tstr)-1] = 0;
- fprintf(fp, "Timestamp: %s %lu us\n", tstr, usecs);
+ print_nlmsg_timestamp(fp, n);
return 0;
}
if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
diff --git a/lib/utils.c b/lib/utils.c
index 64915f3..f65ceaa 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -868,3 +868,13 @@ int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6)
else
return inet_pton(AF_INET, src, dst);
}
+
+void print_nlmsg_timestamp(FILE *fp, const struct nlmsghdr *n)
+{
+ char *tstr;
+ time_t secs = ((__u32*)NLMSG_DATA(n))[0];
+ long usecs = ((__u32*)NLMSG_DATA(n))[1];
+ tstr = asctime(localtime(&secs));
+ tstr[strlen(tstr)-1] = 0;
+ fprintf(fp, "Timestamp: %s %lu us\n", tstr, usecs);
+}
--
2.1.3
^ permalink raw reply related
* [PATCH] NFC: hci: llc: Remove unused function
From: Rickard Strandqvist @ 2015-01-13 18:28 UTC (permalink / raw)
To: Lauro Ramos Venancio, Aloisio Almeida Jr
Cc: Rickard Strandqvist, Samuel Ortiz, David S. Miller, Axel Lin,
linux-wireless, netdev, linux-kernel
Remove the function nfc_llc_unregister() that is not used anywhere.
This was partially found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
net/nfc/hci/llc.c | 13 -------------
net/nfc/hci/llc.h | 1 -
2 files changed, 14 deletions(-)
diff --git a/net/nfc/hci/llc.c b/net/nfc/hci/llc.c
index 1b90c05..91b71e8 100644
--- a/net/nfc/hci/llc.c
+++ b/net/nfc/hci/llc.c
@@ -85,19 +85,6 @@ static struct nfc_llc_engine *nfc_llc_name_to_engine(const char *name)
return NULL;
}
-void nfc_llc_unregister(const char *name)
-{
- struct nfc_llc_engine *llc_engine;
-
- llc_engine = nfc_llc_name_to_engine(name);
- if (llc_engine == NULL)
- return;
-
- list_del(&llc_engine->entry);
- kfree(llc_engine->name);
- kfree(llc_engine);
-}
-
struct nfc_llc *nfc_llc_allocate(const char *name, struct nfc_hci_dev *hdev,
xmit_to_drv_t xmit_to_drv,
rcv_to_hci_t rcv_to_hci, int tx_headroom,
diff --git a/net/nfc/hci/llc.h b/net/nfc/hci/llc.h
index 5dad4c5..f8ac1dc 100644
--- a/net/nfc/hci/llc.h
+++ b/net/nfc/hci/llc.h
@@ -51,7 +51,6 @@ struct nfc_llc {
void *nfc_llc_get_data(struct nfc_llc *llc);
int nfc_llc_register(const char *name, struct nfc_llc_ops *ops);
-void nfc_llc_unregister(const char *name);
int nfc_llc_nop_register(void);
--
1.7.10.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox