* Re: [PATCH net-next 1/2] net: sctp: convert sctp_checksum_disable module param into sctp sysctl
From: Vlad Yasevich @ 2013-08-09 18:50 UTC (permalink / raw)
To: David Miller; +Cc: dborkman, netdev, linux-sctp
In-Reply-To: <20130809.113320.681399334989952629.davem@davemloft.net>
On 08/09/2013 02:33 PM, David Miller wrote:
> From: Daniel Borkmann <dborkman@redhat.com>
> Date: Tue, 6 Aug 2013 21:18:12 +0200
>
>> Get rid of the last module parameter for SCTP and make this
>> configurable via sysctl for SCTP like all the rest of SCTP's
>> configuration knobs.
>>
>> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
>
> Applied.
David
Please revert this. This isn't a knob that that should be
so freely exposed. I thought my response to Daniel made
that clear.
Thanks
-vlad
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH][net-next v1] gianfar: Add flow control support
From: Joe Perches @ 2013-08-09 19:09 UTC (permalink / raw)
To: Claudiu Manoil; +Cc: netdev, David S. Miller, Ben Hutchings, Lutz Jaenicke
In-Reply-To: <1376068786-29868-1-git-send-email-claudiu.manoil@freescale.com>
On Fri, 2013-08-09 at 20:19 +0300, Claudiu Manoil wrote:
> eTSEC has Rx and Tx flow control capabilities that may be enabled
> through MACCFG1[Rx_Flow, Tx_Flow] bits.
Trivial note:
> diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
[]
> @@ -3043,6 +3050,7 @@ static void adjust_link(struct net_device *dev)
[]
> + u32 tempval1 = gfar_read(®s->maccfg1);
[]
> @@ -3091,6 +3099,32 @@ static void adjust_link(struct net_device *dev)
> priv->oldspeed = phydev->speed;
> }
>
> + tempval1 &= ~(MACCFG1_TX_FLOW | MACCFG1_RX_FLOW);
> + if (phydev->duplex) {
> + if (!priv->pause_aneg_en) {
> + if (priv->tx_pause_en)
> + tempval1 |= MACCFG1_TX_FLOW;
> + if (priv->rx_pause_en)
> + tempval1 |= MACCFG1_RX_FLOW;
> + } else {
> + u8 flowctrl;
> + u16 lcl_adv = mii_advertise_flowctrl(
> + phydev->advertising);
> + u16 rmt_adv = 0;
> + if (phydev->pause)
> + rmt_adv = LPA_PAUSE_CAP;
> + if (phydev->asym_pause)
> + rmt_adv |= LPA_PAUSE_ASYM;
> + flowctrl = mii_resolve_flowctrl_fdx(
> + lcl_adv, rmt_adv);
> + if (flowctrl & FLOW_CTRL_TX)
> + tempval1 |= MACCFG1_TX_FLOW;
> + if (flowctrl & FLOW_CTRL_RX)
> + tempval1 |= MACCFG1_RX_FLOW;
> + }
> + }
I think this bit would be nicer as a static function.
Something like: (uncompiled/untested)
static int gfar_get_cfg1(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
struct gfar __iomem *regs = priv->gfargrp[0].regs;
struct phy_device *phydev = priv->phydev;
int val;
val = gfar_read(®s->maccfg1);
val &= ~(MACCFG1_TX_FLOW | MACCFG1_RX_FLOW);
if (!phydev->duplex)
return val;
if (!priv->pause_aneg_en) {
if (priv->tx_pause_en)
val |= MACCFG1_TX_FLOW;
if (priv->rx_pause_en)
val |= MACCFG1_RX_FLOW;
} else {
u8 flowctrl;
u16 lcl_adv = mii_advertise_flowctrl(phydev->advertising);
u16 rmt_adv = 0;
if (phydev->pause)
rmt_adv = LPA_PAUSE_CAP;
if (phydev->asym_pause)
rmt_adv |= LPA_PAUSE_ASYM;
flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv);
if (flowctrl & FLOW_CTRL_TX)
val |= MACCFG1_TX_FLOW;
if (flowctrl & FLOW_CTRL_RX)
val |= MACCFG1_RX_FLOW;
}
return val;
}
^ permalink raw reply
* Re: [PATCH 17/17] net:ethernet:lantiq_etop.c: Removed deprecated IRQF_DISABLED
From: Sergei Shtylyov @ 2013-08-09 19:38 UTC (permalink / raw)
To: Kumar Gaurav
Cc: davem, jiri, gregkh, yongjun_wei, konszert, netdev, linux-kernel,
kernel-janitors
In-Reply-To: <1376072759-11814-1-git-send-email-kumargauravgupta3@gmail.com>
Hello.
On 08/09/2013 10:25 PM, Kumar Gaurav wrote:
> Removed IRQF_DISABLED as it is deprecated and fixed a coding style issue
> of more than 80 chars on single line by sliting the line in two.
That's clearly a material for 2 separate patches.
> Signed-off-by: Kumar Gaurav <kumargauravgupta3@gmail.com>
> ---
> drivers/net/ethernet/lantiq_etop.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
> diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
> index bfdb0686..04c3a82 100644
> --- a/drivers/net/ethernet/lantiq_etop.c
> +++ b/drivers/net/ethernet/lantiq_etop.c
[...]
> @@ -653,7 +653,9 @@ ltq_etop_init(struct net_device *dev)
> if (err)
> goto err_netdev;
>
> - /* Set addr_assign_type here, ltq_etop_set_mac_address would reset it. */
> + /* Set addr_assign_type here,
> + *ltq_etop_set_mac_address would reset it.
You forgot space after * here.
WBR, Sergei
^ permalink raw reply
* Re: [PATCH] stmmac: fix init_dma_desc_rings() to handle errors
From: Denis Kirjanov @ 2013-08-09 19:51 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: Giuseppe Cavallaro, netdev
In-Reply-To: <1392383.ZcinuGX9SF@amdc1032>
On 8/9/13, Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> wrote:
> In stmmac_init_rx_buffers():
> * add missing handling of dma_map_single() error
> * remove superfluous unlikely() optimization while at it
>
> Add stmmac_free_rx_buffers() helper and use it in dma_free_rx_skbufs().
>
> In init_dma_desc_rings():
> * add missing handling of kmalloc_array() errors
> * fix handling of dma_alloc_coherent() and stmmac_init_rx_buffers() errors
> * make function return an error value on error and 0 on success
>
> In stmmac_open():
> * add handling of init_dma_desc_rings() return value
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 111
> ++++++++++++++++++----
> 1 file changed, 92 insertions(+), 19 deletions(-)
>
> Index: b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> ===================================================================
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 2013-08-08
> 14:36:44.000000000 +0200
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 2013-08-08
> 15:31:27.015438117 +0200
> @@ -939,15 +939,20 @@ static int stmmac_init_rx_buffers(struct
>
> skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN,
> GFP_KERNEL);
> - if (unlikely(skb == NULL)) {
> + if (!skb) {
> pr_err("%s: Rx init fails; skb is NULL\n", __func__);
> - return 1;
> + return -ENOMEM;
> }
> skb_reserve(skb, NET_IP_ALIGN);
> priv->rx_skbuff[i] = skb;
> priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data,
> priv->dma_buf_sz,
> DMA_FROM_DEVICE);
> + if (dma_mapping_error(priv->device, priv->rx_skbuff_dma[i])) {
> + pr_err("%s: DMA mapping error\n", __func__);
> + dev_kfree_skb_any(skb);
> + return -EINVAL;
> + }
If dma fail here then you can crash in stmmac_free_rx_buffers()
while touching priv->rx_skbuff[i]
> p->des2 = priv->rx_skbuff_dma[i];
>
> @@ -958,6 +963,16 @@ static int stmmac_init_rx_buffers(struct
> return 0;
> }
>
> +static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i)
> +{
> + if (priv->rx_skbuff[i]) {
> + dma_unmap_single(priv->device, priv->rx_skbuff_dma[i],
> + priv->dma_buf_sz, DMA_FROM_DEVICE);
> + dev_kfree_skb_any(priv->rx_skbuff[i]);
> + }
> + priv->rx_skbuff[i] = NULL;
> +}
> +
> /**
> * init_dma_desc_rings - init the RX/TX descriptor rings
> * @dev: net device structure
> @@ -965,13 +980,14 @@ static int stmmac_init_rx_buffers(struct
> * and allocates the socket buffers. It suppors the chained and ring
> * modes.
> */
> -static void init_dma_desc_rings(struct net_device *dev)
> +static int init_dma_desc_rings(struct net_device *dev)
> {
> int i;
> struct stmmac_priv *priv = netdev_priv(dev);
> unsigned int txsize = priv->dma_tx_size;
> unsigned int rxsize = priv->dma_rx_size;
> unsigned int bfsize = 0;
> + int ret = -ENOMEM;
>
> /* Set the max buffer size according to the DESC mode
> * and the MTU. Note that RING mode allows 16KiB bsize.
> @@ -992,34 +1008,60 @@ static void init_dma_desc_rings(struct n
> dma_extended_desc),
> &priv->dma_rx_phy,
> GFP_KERNEL);
> + if (!priv->dma_erx)
> + goto err_dma;
> +
> priv->dma_etx = dma_alloc_coherent(priv->device, txsize *
> sizeof(struct
> dma_extended_desc),
> &priv->dma_tx_phy,
> GFP_KERNEL);
> - if ((!priv->dma_erx) || (!priv->dma_etx))
> - return;
> + if (!priv->dma_etx) {
> + dma_free_coherent(priv->device, priv->dma_rx_size *
> + sizeof(struct dma_extended_desc),
> + priv->dma_erx, priv->dma_rx_phy);
> + goto err_dma;
> + }
> } else {
> priv->dma_rx = dma_alloc_coherent(priv->device, rxsize *
> sizeof(struct dma_desc),
> &priv->dma_rx_phy,
> GFP_KERNEL);
> + if (!priv->dma_rx)
> + goto err_dma;
> +
> priv->dma_tx = dma_alloc_coherent(priv->device, txsize *
> sizeof(struct dma_desc),
> &priv->dma_tx_phy,
> GFP_KERNEL);
> - if ((!priv->dma_rx) || (!priv->dma_tx))
> - return;
> + if (!priv->dma_tx) {
> + dma_free_coherent(priv->device, priv->dma_rx_size *
> + sizeof(struct dma_desc),
> + priv->dma_rx, priv->dma_rx_phy);
> + goto err_dma;
> + }
> }
>
> priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t),
> GFP_KERNEL);
> + if (!priv->rx_skbuff_dma)
> + goto err_rx_skbuff_dma;
> +
> priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *),
> GFP_KERNEL);
> + if (!priv->rx_skbuff)
> + goto err_rx_skbuff;
> +
> priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t),
> GFP_KERNEL);
> + if (!priv->tx_skbuff_dma)
> + goto err_tx_skbuff_dma;
> +
> priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *),
> GFP_KERNEL);
> + if (!priv->tx_skbuff)
> + goto err_tx_skbuff;
> +
> if (netif_msg_probe(priv)) {
> pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__,
> (u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy);
> @@ -1034,8 +1076,9 @@ static void init_dma_desc_rings(struct n
> else
> p = priv->dma_rx + i;
>
> - if (stmmac_init_rx_buffers(priv, p, i))
> - break;
> + ret = stmmac_init_rx_buffers(priv, p, i);
> + if (ret)
> + goto err_init_rx_buffers;
>
> if (netif_msg_probe(priv))
> pr_debug("[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i],
> @@ -1081,20 +1124,44 @@ static void init_dma_desc_rings(struct n
>
> if (netif_msg_hw(priv))
> stmmac_display_rings(priv);
> +
> + return 0;
> +err_init_rx_buffers:
> + while (--i >= 0)
> + stmmac_free_rx_buffers(priv, i);
> + kfree(priv->tx_skbuff);
> +err_tx_skbuff:
> + kfree(priv->tx_skbuff_dma);
> +err_tx_skbuff_dma:
> + kfree(priv->rx_skbuff);
> +err_rx_skbuff:
> + kfree(priv->rx_skbuff_dma);
> +err_rx_skbuff_dma:
> + if (priv->extend_desc) {
> + dma_free_coherent(priv->device, priv->dma_tx_size *
> + sizeof(struct dma_extended_desc),
> + priv->dma_etx, priv->dma_tx_phy);
> + dma_free_coherent(priv->device, priv->dma_rx_size *
> + sizeof(struct dma_extended_desc),
> + priv->dma_erx, priv->dma_rx_phy);
> + } else {
> + dma_free_coherent(priv->device,
> + priv->dma_tx_size * sizeof(struct dma_desc),
> + priv->dma_tx, priv->dma_tx_phy);
> + dma_free_coherent(priv->device,
> + priv->dma_rx_size * sizeof(struct dma_desc),
> + priv->dma_rx, priv->dma_rx_phy);
> + }
> +err_dma:
> + return ret;
> }
>
> static void dma_free_rx_skbufs(struct stmmac_priv *priv)
> {
> int i;
>
> - for (i = 0; i < priv->dma_rx_size; i++) {
> - if (priv->rx_skbuff[i]) {
> - dma_unmap_single(priv->device, priv->rx_skbuff_dma[i],
> - priv->dma_buf_sz, DMA_FROM_DEVICE);
> - dev_kfree_skb_any(priv->rx_skbuff[i]);
> - }
> - priv->rx_skbuff[i] = NULL;
> - }
> + for (i = 0; i < priv->dma_rx_size; i++)
> + stmmac_free_rx_buffers(priv, i);
> }
>
> static void dma_free_tx_skbufs(struct stmmac_priv *priv)
> @@ -1560,12 +1627,17 @@ static int stmmac_open(struct net_device
> priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
> priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
> priv->dma_buf_sz = STMMAC_ALIGN(buf_sz);
> - init_dma_desc_rings(dev);
> +
> + ret = init_dma_desc_rings(dev);
> + if (ret < 0) {
> + pr_err("%s: DMA descriptors initialization failed\n", __func__);
> + goto dma_desc_error;
> + }
>
> /* DMA initialization and SW reset */
> ret = stmmac_init_dma_engine(priv);
> if (ret < 0) {
> - pr_err("%s: DMA initialization failed\n", __func__);
> + pr_err("%s: DMA engine initialization failed\n", __func__);
> goto init_error;
> }
>
> @@ -1672,6 +1744,7 @@ wolirq_error:
>
> init_error:
> free_dma_desc_resources(priv);
> +dma_desc_error:
> if (priv->phydev)
> phy_disconnect(priv->phydev);
> phy_error:
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH 17/17] net:ethernet:lantiq_etop.c: Removed deprecated IRQF_DISABLED
From: Kumar Gaurav @ 2013-08-09 20:00 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: davem, jiri, gregkh, yongjun_wei, konszert, netdev, linux-kernel,
kernel-janitors
In-Reply-To: <52054527.8080907@cogentembedded.com>
On Saturday 10 August 2013 01:08 AM, Sergei Shtylyov wrote:
> Hello.
>
> On 08/09/2013 10:25 PM, Kumar Gaurav wrote:
>
>> Removed IRQF_DISABLED as it is deprecated and fixed a coding style issue
>> of more than 80 chars on single line by sliting the line in two.
>
> That's clearly a material for 2 separate patches.
>
>> Signed-off-by: Kumar Gaurav <kumargauravgupta3@gmail.com>
>> ---
>> drivers/net/ethernet/lantiq_etop.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>> diff --git a/drivers/net/ethernet/lantiq_etop.c
>> b/drivers/net/ethernet/lantiq_etop.c
>> index bfdb0686..04c3a82 100644
>> --- a/drivers/net/ethernet/lantiq_etop.c
>> +++ b/drivers/net/ethernet/lantiq_etop.c
> [...]
>> @@ -653,7 +653,9 @@ ltq_etop_init(struct net_device *dev)
>> if (err)
>> goto err_netdev;
>>
>> - /* Set addr_assign_type here, ltq_etop_set_mac_address would
>> reset it. */
>> + /* Set addr_assign_type here,
>> + *ltq_etop_set_mac_address would reset it.
>
> You forgot space after * here.
>
> WBR, Sergei
>
Okay i'll be sending them in separate and correcting a space issue as told.
thanks
Regards
Kumar Gaurav
^ permalink raw reply
* Re: [PATCH net-next 1/2] net: sctp: convert sctp_checksum_disable module param into sctp sysctl
From: David Miller @ 2013-08-09 20:10 UTC (permalink / raw)
To: vyasevich; +Cc: dborkman, netdev, linux-sctp
In-Reply-To: <52053A00.80808@gmail.com>
From: Vlad Yasevich <vyasevich@gmail.com>
Date: Fri, 09 Aug 2013 14:50:40 -0400
> Please revert this. This isn't a knob that that should be
> so freely exposed. I thought my response to Daniel made
> that clear.
Done, sorry about that.
^ permalink raw reply
* Re: [PATCH 1/2] net: wan: sbni: Fix incorrect placement of __initdata
From: David Miller @ 2013-08-09 20:24 UTC (permalink / raw)
To: sachin.kamat; +Cc: netdev, rl
In-Reply-To: <1375871896-25821-1-git-send-email-sachin.kamat@linaro.org>
From: Sachin Kamat <sachin.kamat@linaro.org>
Date: Wed, 7 Aug 2013 16:08:15 +0530
> __initdata should be placed between the variable name and equal
> sign for the variable to be placed in the intended section.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied.
^ permalink raw reply
* Re: [PATCH 2/2] net: via-rhine: Fix incorrect placement of __initdata
From: David Miller @ 2013-08-09 20:24 UTC (permalink / raw)
To: sachin.kamat; +Cc: netdev, rl
In-Reply-To: <1375871896-25821-2-git-send-email-sachin.kamat@linaro.org>
From: Sachin Kamat <sachin.kamat@linaro.org>
Date: Wed, 7 Aug 2013 16:08:16 +0530
> __initdata should be placed between the variable name and equal
> sign for the variable to be placed in the intended section.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net: sctp: sctp_set_owner_w: fix panic during skb orphaning
From: David Miller @ 2013-08-09 20:37 UTC (permalink / raw)
To: dborkman; +Cc: netdev, linux-sctp
In-Reply-To: <1375872121-12429-1-git-send-email-dborkman@redhat.com>
From: Daniel Borkmann <dborkman@redhat.com>
Date: Wed, 7 Aug 2013 12:42:01 +0200
> This patch fixes the following triggered bug ...
...
> ... that is triggered after commit 376c7311b ("net: add a temporary sanity
> check in skb_orphan()"). What is happening is that we call sctp_set_owner_w()
> for chunks in the SCTP output path from sctp_sendmsg(). Such chunks eventually
> origin from constructors like sctp_make_chunk() where skb->sk = sk is being
> set for socket accounting. Doing a git grep -n "skb->sk" net/sctp/ shows that
> also in other places the socket pointer is being set, before issuing a
> SCTP_CMD_SEND_PKT command and the like. Since SCTP is doing it's own memory
> accounting anyway and has its own skb destructor functions, we should
> customize sctp_set_owner_w() and call skb_orphan() if we set a different
> owner of the skb than the current one in order to properly call their
> destructor function, but not run into a panic due to our non-exisiting one as
> we set sctp_wfree() destructor right after that. Otherwise, we can just skip
> orphaning and reassignment to the very same socket and only set the destructor
> handler.
This debugging check is exactly trying to catch what SCTP is doing,
setting skb->sk without also setting the destructor.
I would much rather see you reorganize and fix SCTP to behave properly
rather than coding up a check which is essentially "if skb_orphan() bug
won't trigger, call it" That defeats the whole purpose of the check.
Thanks.
^ permalink raw reply
* Re: [PATCH 1/2] net/usb: catc: allocate URB setup_packet as separate buffer
From: David Miller @ 2013-08-09 20:42 UTC (permalink / raw)
To: jussi.kivilinna-X3B1VOXEql0
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20130807132629.14001.2370.stgit-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
From: Jussi Kivilinna <jussi.kivilinna-X3B1VOXEql0@public.gmane.org>
Date: Wed, 07 Aug 2013 16:26:29 +0300
> URB setup packet must not be allocated as part of larger structure
> because DMA coherence issues.
>
> Patch changes catc to allocate ctrl_dr member as separate buffer.
>
> Patch is only compile tested.
>
> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
> Signed-off-by: Jussi Kivilinna <jussi.kivilinna-X3B1VOXEql0@public.gmane.org>
I absolutely do not agree with your adding the stable CC: tag for
a patch which has only been compile tested.
This applies to all of your other patches you submitted in this
cluster too.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" 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: stmmac: Fixed the condition of extend_desc for jumbo frame
From: David Miller @ 2013-08-09 20:44 UTC (permalink / raw)
To: bh74.an; +Cc: netdev, peppe.cavallaro, kgene.kim, cpgs
In-Reply-To: <004701ce9400$c4ba2f10$4e2e8d30$%an@samsung.com>
From: Byungho An <bh74.an@samsung.com>
Date: Thu, 08 Aug 2013 15:30:26 +0900
> This patch fixed the condition of extend_desc for jumbo frame.
> There is no check routine for extend_desc in the stmmac_jumbo_frm function.
> Even though extend_desc is set if dma_tx is used instead of dma_etx.
> It causes kernel panic.
>
> Signed-off-by: Byungho An <bh74.an@samsung.com>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH net-next] net: sctp: sctp_set_owner_w: fix panic during skb orphaning
From: Daniel Borkmann @ 2013-08-09 20:47 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-sctp
In-Reply-To: <20130809.133720.232424253997869104.davem@davemloft.net>
On 08/09/2013 10:37 PM, David Miller wrote:
> From: Daniel Borkmann <dborkman@redhat.com>
> Date: Wed, 7 Aug 2013 12:42:01 +0200
>
>> This patch fixes the following triggered bug ...
> ...
>> ... that is triggered after commit 376c7311b ("net: add a temporary sanity
>> check in skb_orphan()"). What is happening is that we call sctp_set_owner_w()
>> for chunks in the SCTP output path from sctp_sendmsg(). Such chunks eventually
>> origin from constructors like sctp_make_chunk() where skb->sk = sk is being
>> set for socket accounting. Doing a git grep -n "skb->sk" net/sctp/ shows that
>> also in other places the socket pointer is being set, before issuing a
>> SCTP_CMD_SEND_PKT command and the like. Since SCTP is doing it's own memory
>> accounting anyway and has its own skb destructor functions, we should
>> customize sctp_set_owner_w() and call skb_orphan() if we set a different
>> owner of the skb than the current one in order to properly call their
>> destructor function, but not run into a panic due to our non-exisiting one as
>> we set sctp_wfree() destructor right after that. Otherwise, we can just skip
>> orphaning and reassignment to the very same socket and only set the destructor
>> handler.
>
> This debugging check is exactly trying to catch what SCTP is doing,
> setting skb->sk without also setting the destructor.
>
> I would much rather see you reorganize and fix SCTP to behave properly
> rather than coding up a check which is essentially "if skb_orphan() bug
> won't trigger, call it" That defeats the whole purpose of the check.
Ok, will try to come up with a patch next week. Thanks.
^ permalink raw reply
* Re: [PATCH 01/16] bnx2: clean up unnecessary MSI/MSI-X capability find
From: David Miller @ 2013-08-09 20:50 UTC (permalink / raw)
To: wangyijing; +Cc: guohanjun, jiang.liu, mchan, netdev
In-Reply-To: <1375966942-2052-1-git-send-email-wangyijing@huawei.com>
From: Yijing Wang <wangyijing@huawei.com>
Date: Thu, 8 Aug 2013 21:02:22 +0800
> PCI core will initialize device MSI/MSI-X capability in
> pci_msi_init_pci_dev(). So device driver should use
> pci_dev->msi_cap/msix_cap to determine whether the device
> support MSI/MSI-X instead of using
> pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
> Access to PCIe device config space again will consume more time.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Applied.
^ permalink raw reply
* Re: [PATCH 02/16] bnx2x: clean up unnecessary MSI/MSI-X capability find
From: David Miller @ 2013-08-09 20:50 UTC (permalink / raw)
To: wangyijing; +Cc: guohanjun, jiang.liu, eilong, netdev
In-Reply-To: <1375966956-36436-1-git-send-email-wangyijing@huawei.com>
From: Yijing Wang <wangyijing@huawei.com>
Date: Thu, 8 Aug 2013 21:02:36 +0800
> PCI core will initialize device MSI/MSI-X capability in
> pci_msi_init_pci_dev(). So device driver should use
> pci_dev->msi_cap/msix_cap to determine whether the device
> support MSI/MSI-X instead of using
> pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
> Access to PCIe device config space again will consume more time.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Applied.
^ permalink raw reply
* Re: [PATCH 08/16] myri10ge: clean up unnecessary MSI/MSI-X capability find
From: David Miller @ 2013-08-09 20:50 UTC (permalink / raw)
To: wangyijing; +Cc: guohanjun, jiang.liu, gallatin, netdev
In-Reply-To: <1375966964-24156-1-git-send-email-wangyijing@huawei.com>
From: Yijing Wang <wangyijing@huawei.com>
Date: Thu, 8 Aug 2013 21:02:44 +0800
> PCI core will initialize device MSI/MSI-X capability in
> pci_msi_init_pci_dev(). So device driver should use
> pci_dev->msi_cap/msix_cap to determine whether the device
> support MSI/MSI-X instead of using
> pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
> Access to PCIe device config space again will consume more time.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Applied.
^ permalink raw reply
* Re: [PATCH 09/16] netxen: clean up unnecessary MSI/MSI-X capability find
From: David Miller @ 2013-08-09 20:50 UTC (permalink / raw)
To: wangyijing
Cc: guohanjun, jiang.liu, manish.chopra, sony.chacko, rajesh.borundia,
netdev
In-Reply-To: <1375966976-33428-1-git-send-email-wangyijing@huawei.com>
From: Yijing Wang <wangyijing@huawei.com>
Date: Thu, 8 Aug 2013 21:02:56 +0800
> PCI core will initialize device MSI/MSI-X capability in
> pci_msi_init_pci_dev(). So device driver should use
> pci_dev->msi_cap/msix_cap to determine whether the device
> support MSI/MSI-X instead of using
> pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
> Access to PCIe device config space again will consume more time.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Applied.
^ permalink raw reply
* Re: [PATCH 16/16] tg3: clean up unnecessary MSI/MSI-X capability find
From: David Miller @ 2013-08-09 20:51 UTC (permalink / raw)
To: wangyijing; +Cc: guohanjun, jiang.liu, nsujir, mchan, netdev, linux-kernel
In-Reply-To: <1375966992-33236-1-git-send-email-wangyijing@huawei.com>
From: Yijing Wang <wangyijing@huawei.com>
Date: Thu, 8 Aug 2013 21:03:12 +0800
> PCI core will initialize device MSI/MSI-X capability in
> pci_msi_init_pci_dev(). So device driver should use
> pci_dev->msi_cap/msix_cap to determine whether the device
> support MSI/MSI-X instead of using
> pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
> Access to PCIe device config space again will consume more time.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Applied.
^ permalink raw reply
* :
From: JOEL SULLINS @ 2013-08-09 20:55 UTC (permalink / raw)
--
Avaliable: 3% interest rate Loan Offer + you having the chance to choose your duration. Are you interested?
^ permalink raw reply
* Re: [PATCH net-next] tcp:elapsed variable calculated twice while keepalive working
From: Eric Dumazet @ 2013-08-09 21:06 UTC (permalink / raw)
To: David Miller; +Cc: tingw.liu, netdev, kuznet
In-Reply-To: <20130809.111229.1955078847385749897.davem@davemloft.net>
On Fri, 2013-08-09 at 11:12 -0700, David Miller wrote:
> From: Tingwei Liu <tingw.liu@gmail.com>
> Date: Tue, 6 Aug 2013 20:38:58 +0800
>
> > When tcp keepalive working elapsed calculated twice while the first time is not needed!
> >
> > CC: Eric Dumazet <eric.dumazet@gmail.com>
> > CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> > Signed-off-by: Tingwei Liu <tingw.liu@gmail.com>
>
>
> Please put a space after "tcp:" in your Subject line prefixes, it looks
> awful the way you've done it here.
>
> > @@ -591,11 +591,11 @@ static void tcp_keepalive_timer (unsigned long data)
> > if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_CLOSE)
> > goto out;
> >
> > - elapsed = keepalive_time_when(tp);
> > -
> > /* It is alive without keepalive 8) */
> > - if (tp->packets_out || tcp_send_head(sk))
> > + if (tp->packets_out || tcp_send_head(sk)) {
> > + elapsed = keepalive_time_when(tp);
> > goto resched;
> > + }
> >
> > elapsed = keepalive_time_elapsed(tp);
>
> This is overkill, just delete the second assignment. Your version makes
> the code look less elegant and also makes it harder to audit.
> --
As a matter of fact,
keepalive_time_when(tp) and keepalive_time_elapsed(tp) are different ;)
This is very slow path in TCP stack, so it should not matter a lot.
^ permalink raw reply
* Re: [PATCH v4 0/4] USB & USBNET: loose SG check and support usbnet DMA SG
From: David Miller @ 2013-08-09 21:12 UTC (permalink / raw)
To: ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw
Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, oneukum-l3A5Bk7waGM,
sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1375969705-24877-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
From: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Date: Thu, 8 Aug 2013 21:48:21 +0800
> This patchset allows drivers to pass sg buffers which size can't be divided
> by max packet size of endpoint if the host controllers(such ax xHCI) support
> this kind of sg buffers.
>
> Previously we added check[1] on the situation and don't allow these sg buffers
> passed to USB HCD, looks the check is too strict to make use of new feature of
> new hardware(xHCI) for some applications(such as network stack) which can't
> provide this kind of sg buffers to usbnet driver, so the patch looses the check
> in case that the host controller supports it.
>
> Patch 3/4 implements DMA SG on usbnet driver, and patch 4/4 uses it on ax88179_178a
> USB3 NIC for supporting TSO, so both CPU utilization and tx throughput can be
> improved with TSO and DMA SG in case of the USB NIC is attached to xHCI controller.
>
> This patchset depends on both net-next and usb-next tree, so hope David and Greg
> to figure out one elegent way to merge it.
Greg feel free to merge this in via your USB tree with my:
Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" 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 v4 0/4] USB & USBNET: loose SG check and support usbnet DMA SG
From: Greg KH @ 2013-08-09 21:13 UTC (permalink / raw)
To: David Miller; +Cc: ming.lei, oneukum, sarah.a.sharp, netdev, linux-usb
In-Reply-To: <20130809.141217.555889385998745188.davem@davemloft.net>
On Fri, Aug 09, 2013 at 02:12:17PM -0700, David Miller wrote:
> From: Ming Lei <ming.lei@canonical.com>
> Date: Thu, 8 Aug 2013 21:48:21 +0800
>
> > This patchset allows drivers to pass sg buffers which size can't be divided
> > by max packet size of endpoint if the host controllers(such ax xHCI) support
> > this kind of sg buffers.
> >
> > Previously we added check[1] on the situation and don't allow these sg buffers
> > passed to USB HCD, looks the check is too strict to make use of new feature of
> > new hardware(xHCI) for some applications(such as network stack) which can't
> > provide this kind of sg buffers to usbnet driver, so the patch looses the check
> > in case that the host controller supports it.
> >
> > Patch 3/4 implements DMA SG on usbnet driver, and patch 4/4 uses it on ax88179_178a
> > USB3 NIC for supporting TSO, so both CPU utilization and tx throughput can be
> > improved with TSO and DMA SG in case of the USB NIC is attached to xHCI controller.
> >
> > This patchset depends on both net-next and usb-next tree, so hope David and Greg
> > to figure out one elegent way to merge it.
>
> Greg feel free to merge this in via your USB tree with my:
>
> Acked-by: David S. Miller <davem@davemloft.net>
Thanks, will do.
greg k-h
^ permalink raw reply
* Re: [PATCH net-next] pptp: fix sparse pointer warning
From: David Miller @ 2013-08-09 21:15 UTC (permalink / raw)
To: stephen; +Cc: xeb, netdev
In-Reply-To: <20130808102714.6f16ff43@nehalam.linuxnetplumber.net>
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 8 Aug 2013 10:27:14 -0700
> callid_sock array is referenced via rcu_dereference and
> sparse rcu checks complains about address space mismatch.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Applied, thanks.
^ permalink raw reply
* [PATCH] net: sctp: fix panic during skb_orphan()
From: Vlad Yasevich @ 2013-08-09 21:58 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-sctp, dborkman, Vlad Yasevich
In-Reply-To: <20130809.133720.232424253997869104.davem@davemloft.net>
This patch fixes the following triggered bug ...
[ 553.109742] kernel BUG at include/linux/skbuff.h:1813!
[ 553.109766] invalid opcode: 0000 [#1] SMP
[ 553.109789] Modules linked in: sctp libcrc32c rfcomm [...]
[ 553.110259] uinput i915 i2c_algo_bit drm_kms_helper e1000e drm ptp
pps_core i2c_core wmi video sunrpc
[ 553.110320] CPU: 0 PID: 1636 Comm: lt-test_1_to_1_ Not tainted
3.11.0-rc3+ #2
[ 553.110350] Hardware name: LENOVO 74597D6/74597D6, BIOS 6DET60WW
(3.10 ) 09/17/2009
[ 553.110381] task: ffff88020a01dd40 ti: ffff880204ed0000 task.ti:
ffff880204ed0000
[ 553.110411] RIP: 0010:[<ffffffffa0698017>] [<ffffffffa0698017>]
skb_orphan.part.9+0x4/0x6 [sctp]
[ 553.110459] RSP: 0018:ffff880204ed1bb8 EFLAGS: 00010286
[ 553.110483] RAX: ffff8802086f5a40 RBX: ffff880204303300 RCX:
0000000000000000
[ 553.110487] RDX: ffff880204303c28 RSI: ffff8802086f5a40 RDI:
ffff880202158000
[ 553.110487] RBP: ffff880204ed1bb8 R08: 0000000000000000 R09:
0000000000000000
[ 553.110487] R10: ffff88022f2d9a04 R11: ffff880233001600 R12:
0000000000000000
[ 553.110487] R13: ffff880204303c00 R14: ffff8802293d0000 R15:
ffff880202158000
[ 553.110487] FS: 00007f31b31fe740(0000) GS:ffff88023bc00000(0000)
knlGS:0000000000000000
[ 553.110487] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 553.110487] CR2: 000000379980e3e0 CR3: 000000020d225000 CR4:
00000000000407f0
[ 553.110487] Stack:
[ 553.110487] ffff880204ed1ca8 ffffffffa068d7fc 0000000000000000
0000000000000000
[ 553.110487] 0000000000000000 ffff8802293d0000 ffff880202158000
ffffffff81cb7900
[ 553.110487] 0000000000000000 0000400000001c68 ffff8802086f5a40
000000000000000f
[ 553.110487] Call Trace:
[ 553.110487] [<ffffffffa068d7fc>] sctp_sendmsg+0x6bc/0xc80 [sctp]
[ 553.110487] [<ffffffff8128f185>] ? sock_has_perm+0x75/0x90
[ 553.110487] [<ffffffff815a3593>] inet_sendmsg+0x63/0xb0
[ 553.110487] [<ffffffff8128f2b3>] ? selinux_socket_sendmsg+0x23/0x30
[ 553.110487] [<ffffffff8151c5d6>] sock_sendmsg+0xa6/0xd0
[ 553.110487] [<ffffffff81637b05>] ? _raw_spin_unlock_bh+0x15/0x20
[ 553.110487] [<ffffffff8151cd38>] SYSC_sendto+0x128/0x180
[ 553.110487] [<ffffffff8151ce6b>] ? SYSC_connect+0xdb/0x100
[ 553.110487] [<ffffffffa0690031>] ? sctp_inet_listen+0x71/0x1f0
[sctp]
[ 553.110487] [<ffffffff8151d35e>] SyS_sendto+0xe/0x10
[ 553.110487] [<ffffffff81640202>] system_call_fastpath+0x16/0x1b
[ 553.110487] Code: e0 48 c7 c7 00 22 6a a0 e8 67 a3 f0 e0 48 c7 [...]
[ 553.110487] RIP [<ffffffffa0698017>] skb_orphan.part.9+0x4/0x6
[sctp]
[ 553.110487] RSP <ffff880204ed1bb8>
[ 553.121578] ---[ end trace 46c20c5903ef5be2 ]---
When a SCTP data chunk is created, skb->sk is set by sctp_make_chunk().
At a later time, sctp_sendmg() calls sctp_set_owner_w() which will attempt
to orphan the skb and correctly set the skb->sk. The skb_orphan call result
in the above crash since skb->sk was set the the destructor was not.
The simple solution is to not set skb->sk for DATA chunks (since it
will be done later). Continue to do it for control chunks since
sctp needs the sk at a later timer and control chunks are not currently
accouted agains socket memory.
Signed-off-by: Vlad Yasevich <vyasevich@gmail.com>
---
net/sctp/sm_make_chunk.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 780a2d4..4ff7803 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1385,8 +1385,12 @@ static struct sctp_chunk *sctp_make_chunk(const struct sctp_association *asoc,
if (sctp_auth_send_cid(type, asoc))
retval->auth = 1;
- /* Set the skb to the belonging sock for accounting. */
- skb->sk = sk;
+ /* Set the skb to the belonging sock for accounting. Do not
+ * do this for data chunks as that will be properly set
+ * up later.
+ */
+ if (type != SCTP_CID_DATA)
+ skb->sk = sk;
return retval;
nodata:
--
1.8.1.4
^ permalink raw reply related
* [PATCH 1/4 v2] drivers/net: enic: Adding support for Cisco Low Latency NIC
From: Neel Patel @ 2013-08-09 22:00 UTC (permalink / raw)
To: netdev; +Cc: Neel Patel
In-Reply-To: <1376073939.2087.146.camel@joe-AO722>
This patch,
- Adds new firmware commands for the new Cisco Low Latency NIC
(aka. USNIC).
- Enables descriptor prefetch on the hardware. This feature
reduces latency for small packet transmit.
Signed-off-by: Neel Patel <neepatel@cisco.com>
Signed-off-by: Nishank Trivedi <nistrive@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
---
drivers/net/ethernet/cisco/enic/enic.h | 2 +-
drivers/net/ethernet/cisco/enic/enic_res.h | 9 +-
drivers/net/ethernet/cisco/enic/vnic_dev.c | 5 +
drivers/net/ethernet/cisco/enic/vnic_dev.h | 1 +
drivers/net/ethernet/cisco/enic/vnic_devcmd.h | 176 +++++++++++++++++++++++++-
drivers/net/ethernet/cisco/enic/vnic_rq.c | 9 +-
drivers/net/ethernet/cisco/enic/vnic_rq.h | 5 +-
drivers/net/ethernet/cisco/enic/vnic_wq.c | 7 +-
drivers/net/ethernet/cisco/enic/vnic_wq.h | 86 ++++++++++++-
9 files changed, 281 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
index 2e37c63..75e842d 100644
--- a/drivers/net/ethernet/cisco/enic/enic.h
+++ b/drivers/net/ethernet/cisco/enic/enic.h
@@ -33,7 +33,7 @@
#define DRV_NAME "enic"
#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
#define DRV_VERSION "2.1.1.39"
-#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc"
+#define DRV_COPYRIGHT "Copyright 2008-2013 Cisco Systems, Inc"
#define ENIC_BARS_MAX 6
diff --git a/drivers/net/ethernet/cisco/enic/enic_res.h b/drivers/net/ethernet/cisco/enic/enic_res.h
index 25be273..69f60af 100644
--- a/drivers/net/ethernet/cisco/enic/enic_res.h
+++ b/drivers/net/ethernet/cisco/enic/enic_res.h
@@ -47,6 +47,9 @@ static inline void enic_queue_wq_desc_ex(struct vnic_wq *wq,
int offload_mode, int cq_entry, int sop, int eop, int loopback)
{
struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
+ u8 desc_skip_cnt = 1;
+ u8 compressed_send = 0;
+ u64 wrid = 0;
wq_enet_desc_enc(desc,
(u64)dma_addr | VNIC_PADDR_TARGET,
@@ -59,7 +62,8 @@ static inline void enic_queue_wq_desc_ex(struct vnic_wq *wq,
(u16)vlan_tag,
(u8)loopback);
- vnic_wq_post(wq, os_buf, dma_addr, len, sop, eop);
+ vnic_wq_post(wq, os_buf, dma_addr, len, sop, eop, desc_skip_cnt,
+ (u8)cq_entry, compressed_send, wrid);
}
static inline void enic_queue_wq_desc_cont(struct vnic_wq *wq,
@@ -120,6 +124,7 @@ static inline void enic_queue_rq_desc(struct vnic_rq *rq,
dma_addr_t dma_addr, unsigned int len)
{
struct rq_enet_desc *desc = vnic_rq_next_desc(rq);
+ u64 wrid = 0;
u8 type = os_buf_index ?
RQ_ENET_TYPE_NOT_SOP : RQ_ENET_TYPE_ONLY_SOP;
@@ -127,7 +132,7 @@ static inline void enic_queue_rq_desc(struct vnic_rq *rq,
(u64)dma_addr | VNIC_PADDR_TARGET,
type, (u16)len);
- vnic_rq_post(rq, os_buf, os_buf_index, dma_addr, len);
+ vnic_rq_post(rq, os_buf, os_buf_index, dma_addr, len, wrid);
}
struct enic;
diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.c b/drivers/net/ethernet/cisco/enic/vnic_dev.c
index 97455c5..1b436b3 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_dev.c
+++ b/drivers/net/ethernet/cisco/enic/vnic_dev.c
@@ -970,6 +970,11 @@ err_out:
return NULL;
}
+struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev)
+{
+ return vdev->pdev;
+}
+
int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len)
{
u64 a0, a1 = len;
diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.h b/drivers/net/ethernet/cisco/enic/vnic_dev.h
index f3d9b79..e670029 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_dev.h
+++ b/drivers/net/ethernet/cisco/enic/vnic_dev.h
@@ -127,6 +127,7 @@ int vnic_dev_set_ig_vlan_rewrite_mode(struct vnic_dev *vdev,
struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
void *priv, struct pci_dev *pdev, struct vnic_dev_bar *bar,
unsigned int num_bars);
+struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev);
int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len);
int vnic_dev_enable2(struct vnic_dev *vdev, int active);
int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status);
diff --git a/drivers/net/ethernet/cisco/enic/vnic_devcmd.h b/drivers/net/ethernet/cisco/enic/vnic_devcmd.h
index 23d5552..b9a0d78 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_devcmd.h
+++ b/drivers/net/ethernet/cisco/enic/vnic_devcmd.h
@@ -281,11 +281,25 @@ enum vnic_devcmd_cmd {
* 0 if no VIF-CONFIG-INFO TLV was ever received. */
CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44),
+ /* INT13 API: (u64)a0=paddr to vnic_int13_params struct
+ * (u32)a1=INT13_CMD_xxx
+ */
+ CMD_INT13_ALL = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 45),
+
+ /* Set default vlan:
+ * in: (u16)a0=new default vlan
+ * (u16)a1=zero for overriding vlan with param a0,
+ * non-zero for resetting vlan to the default
+ * out: (u16)a0=old default vlan
+ */
+ CMD_SET_DEFAULT_VLAN = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 46),
+
/* init_prov_info2:
* Variant of CMD_INIT_PROV_INFO, where it will not try to enable
* the vnic until CMD_ENABLE2 is issued.
* (u64)a0=paddr of vnic_devcmd_provinfo
- * (u32)a1=sizeof provision info */
+ * (u32)a1=sizeof provision info
+ */
CMD_INIT_PROV_INFO2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 47),
/* enable2:
@@ -339,16 +353,57 @@ enum vnic_devcmd_cmd {
CMD_INTR_COAL_CONVERT = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 50),
/*
- * cmd_set_mac_addr
- * set mac address
+ * Set the predefined mac address as default
* in:
* (u48)a0 = mac addr
- *
*/
CMD_SET_MAC_ADDR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 55),
+
+ /* Update the provisioning info of the given VIF
+ * (u64)a0=paddr of vnic_devcmd_provinfo
+ * (u32)a1=sizeof provision info
+ */
+ CMD_PROV_INFO_UPDATE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 56),
+
+ /* Add a filter.
+ * in: (u64) a0= filter address
+ * (u32) a1= size of filter
+ * out: (u32) a0=filter identifier
+ */
+ CMD_ADD_FILTER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 58),
+
+ /* Delete a filter.
+ * in: (u32) a0=filter identifier
+ */
+ CMD_DEL_FILTER = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 59),
+
+ /* Enable a Queue Pair in User space NIC
+ * in: (u32) a0=Queue Pair number
+ * (u32) a1= command
+ */
+ CMD_QP_ENABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 60),
+
+ /* Disable a Queue Pair in User space NIC
+ * in: (u32) a0=Queue Pair number
+ * (u32) a1= command
+ */
+ CMD_QP_DISABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 61),
+
+ /* Stats dump Queue Pair in User space NIC
+ * in: (u32) a0=Queue Pair number
+ * (u64) a1=host buffer addr for status dump
+ * (u32) a2=length of the buffer
+ */
+ CMD_QP_STATS_DUMP = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 62),
+
+ /* Clear stats for Queue Pair in User space NIC
+ * in: (u32) a0=Queue Pair number
+ */
+ CMD_QP_STATS_CLEAR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 63),
};
/* CMD_ENABLE2 flags */
+#define CMD_ENABLE2_STANDBY 0x0
#define CMD_ENABLE2_ACTIVE 0x1
/* flags for CMD_OPEN */
@@ -364,6 +419,9 @@ enum vnic_devcmd_cmd {
#define CMD_PFILTER_PROMISCUOUS 0x08
#define CMD_PFILTER_ALL_MULTICAST 0x10
+/* Commands for CMD_QP_ENABLE/CM_QP_DISABLE */
+#define CMD_QP_RQWQ 0x0
+
/* rewrite modes for CMD_IG_VLAN_REWRITE_MODE */
#define IG_VLAN_REWRITE_MODE_DEFAULT_TRUNK 0
#define IG_VLAN_REWRITE_MODE_UNTAG_DEFAULT_VLAN 1
@@ -390,6 +448,7 @@ enum vnic_devcmd_error {
ERR_EMAXRES = 10,
ERR_ENOTSUPPORTED = 11,
ERR_EINPROGRESS = 12,
+ ERR_MAX
};
/*
@@ -435,6 +494,115 @@ struct vnic_devcmd_provinfo {
u8 data[0];
};
+/* These are used in flags field of different filters to denote
+ * valid fields used.
+ */
+#define FILTER_FIELD_VALID(fld) (1 << (fld - 1))
+
+#define FILTER_FIELDS_USNIC ( \
+ FILTER_FIELD_VALID(1) | \
+ FILTER_FIELD_VALID(2) | \
+ FILTER_FIELD_VALID(3) | \
+ FILTER_FIELD_VALID(4))
+
+#define FILTER_FIELDS_IPV4_5TUPLE ( \
+ FILTER_FIELD_VALID(1) | \
+ FILTER_FIELD_VALID(2) | \
+ FILTER_FIELD_VALID(3) | \
+ FILTER_FIELD_VALID(4) | \
+ FILTER_FIELD_VALID(5))
+
+#define FILTER_FIELDS_MAC_VLAN ( \
+ FILTER_FIELD_VALID(1) | \
+ FILTER_FIELD_VALID(2))
+
+#define FILTER_FIELD_USNIC_VLAN FILTER_FIELD_VALID(1)
+#define FILTER_FIELD_USNIC_ETHTYPE FILTER_FIELD_VALID(2)
+#define FILTER_FIELD_USNIC_PROTO FILTER_FIELD_VALID(3)
+#define FILTER_FIELD_USNIC_ID FILTER_FIELD_VALID(4)
+
+struct filter_usnic_id {
+ u32 flags;
+ u16 vlan;
+ u16 ethtype;
+ u8 proto_version;
+ u32 usnic_id;
+} __packed;
+
+#define FILTER_FIELD_5TUP_PROTO FILTER_FIELD_VALID(1)
+#define FILTER_FIELD_5TUP_SRC_AD FILTER_FIELD_VALID(2)
+#define FILTER_FIELD_5TUP_DST_AD FILTER_FIELD_VALID(3)
+#define FILTER_FIELD_5TUP_SRC_PT FILTER_FIELD_VALID(4)
+#define FILTER_FIELD_5TUP_DST_PT FILTER_FIELD_VALID(5)
+
+/* Enums for the protocol field. */
+enum protocol_e {
+ PROTO_UDP = 0,
+ PROTO_TCP = 1,
+};
+
+struct filter_ipv4_5tuple {
+ u32 flags;
+ u32 protocol;
+ u32 src_addr;
+ u32 dst_addr;
+ u16 src_port;
+ u16 dst_port;
+} __packed;
+
+#define FILTER_FIELD_VMQ_VLAN FILTER_FIELD_VALID(1)
+#define FILTER_FIELD_VMQ_MAC FILTER_FIELD_VALID(2)
+
+struct filter_mac_vlan {
+ u32 flags;
+ u16 vlan;
+ u8 mac_addr[6];
+} __packed;
+
+/* Specifies the filter_action type. */
+enum {
+ FILTER_ACTION_RQ_STEERING = 0,
+ FILTER_ACTION_MAX
+};
+
+struct filter_action {
+ u32 type;
+ union {
+ u32 rq_idx;
+ } u;
+} __packed;
+
+/* Specifies the filter type. */
+enum filter_type {
+ FILTER_USNIC_ID = 0,
+ FILTER_IPV4_5TUPLE = 1,
+ FILTER_MAC_VLAN = 2,
+ FILTER_MAX
+};
+
+struct filter {
+ u32 type;
+ union {
+ struct filter_usnic_id usnic;
+ struct filter_ipv4_5tuple ipv4;
+ struct filter_mac_vlan mac_vlan;
+ } u;
+} __packed;
+
+enum {
+ CLSF_TLV_FILTER = 0,
+ CLSF_TLV_ACTION = 1,
+};
+
+/* Maximum size of buffer to CMD_ADD_FILTER */
+#define FILTER_MAX_BUF_SIZE 100
+
+struct filter_tlv {
+ u_int32_t type;
+ u_int32_t length;
+ u_int32_t val[0];
+};
+
/*
* Writing cmd register causes STAT_BUSY to get set in status register.
* When cmd completes, STAT_BUSY will be cleared.
diff --git a/drivers/net/ethernet/cisco/enic/vnic_rq.c b/drivers/net/ethernet/cisco/enic/vnic_rq.c
index 7e1488f..e003b48 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_rq.c
+++ b/drivers/net/ethernet/cisco/enic/vnic_rq.c
@@ -30,16 +30,13 @@
static int vnic_rq_alloc_bufs(struct vnic_rq *rq)
{
struct vnic_rq_buf *buf;
- struct vnic_dev *vdev;
unsigned int i, j, count = rq->ring.desc_count;
unsigned int blks = VNIC_RQ_BUF_BLKS_NEEDED(count);
- vdev = rq->vdev;
-
for (i = 0; i < blks; i++) {
rq->bufs[i] = kzalloc(VNIC_RQ_BUF_BLK_SZ(count), GFP_ATOMIC);
if (!rq->bufs[i])
return -ENOMEM;
}
for (i = 0; i < blks; i++) {
@@ -141,7 +140,7 @@ void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index,
unsigned int error_interrupt_enable,
unsigned int error_interrupt_offset)
{
- u32 fetch_index;
+ u32 fetch_index = 0;
/* Use current fetch_index as the ring starting point */
fetch_index = ioread32(&rq->ctrl->fetch_index);
diff --git a/drivers/net/ethernet/cisco/enic/vnic_rq.h b/drivers/net/ethernet/cisco/enic/vnic_rq.h
index 2056586..ee7bc95 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_rq.h
+++ b/drivers/net/ethernet/cisco/enic/vnic_rq.h
@@ -72,6 +72,7 @@ struct vnic_rq_buf {
unsigned int len;
unsigned int index;
void *desc;
+ uint64_t wr_id;
};
struct vnic_rq {
@@ -110,7 +111,8 @@ static inline unsigned int vnic_rq_next_index(struct vnic_rq *rq)
static inline void vnic_rq_post(struct vnic_rq *rq,
void *os_buf, unsigned int os_buf_index,
- dma_addr_t dma_addr, unsigned int len)
+ dma_addr_t dma_addr, unsigned int len,
+ uint64_t wrid)
{
struct vnic_rq_buf *buf = rq->to_use;
@@ -118,6 +120,7 @@ static inline void vnic_rq_post(struct vnic_rq *rq,
buf->os_buf_index = os_buf_index;
buf->dma_addr = dma_addr;
buf->len = len;
+ buf->wr_id = wrid;
buf = buf->next;
rq->to_use = buf;
diff --git a/drivers/net/ethernet/cisco/enic/vnic_wq.c b/drivers/net/ethernet/cisco/enic/vnic_wq.c
index 5e0d7a2..fff35d4 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_wq.c
+++ b/drivers/net/ethernet/cisco/enic/vnic_wq.c
@@ -30,16 +30,13 @@
static int vnic_wq_alloc_bufs(struct vnic_wq *wq)
{
struct vnic_wq_buf *buf;
- struct vnic_dev *vdev;
unsigned int i, j, count = wq->ring.desc_count;
unsigned int blks = VNIC_WQ_BUF_BLKS_NEEDED(count);
- vdev = wq->vdev;
-
for (i = 0; i < blks; i++) {
wq->bufs[i] = kzalloc(VNIC_WQ_BUF_BLK_SZ(count), GFP_ATOMIC);
if (!wq->bufs[i])
return -ENOMEM;
}
for (i = 0; i < blks; i++) {
diff --git a/drivers/net/ethernet/cisco/enic/vnic_wq.h b/drivers/net/ethernet/cisco/enic/vnic_wq.h
index 7dd937a..b655667 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_wq.h
+++ b/drivers/net/ethernet/cisco/enic/vnic_wq.h
@@ -58,6 +58,10 @@ struct vnic_wq_buf {
unsigned int index;
int sop;
void *desc;
+ uint64_t wr_id; /* Cookie */
+ uint8_t cq_entry; /* Gets completion event from hw */
+ uint8_t desc_skip_cnt; /* Num descs to occupy */
+ uint8_t compressed_send; /* Both hdr and payload in one desc */
};
/* Break the vnic_wq_buf allocations into blocks of 32/64 entries */
@@ -100,16 +104,94 @@ static inline void *vnic_wq_next_desc(struct vnic_wq *wq)
return wq->to_use->desc;
}
+#define PI_LOG2_CACHE_LINE_SIZE 5
+#define PI_INDEX_BITS 12
+#define PI_INDEX_MASK ((1U << PI_INDEX_BITS) - 1)
+#define PI_PREFETCH_LEN_MASK ((1U << PI_LOG2_CACHE_LINE_SIZE) - 1)
+#define PI_PREFETCH_LEN_OFF 16
+#define PI_PREFETCH_ADDR_BITS 43
+#define PI_PREFETCH_ADDR_MASK ((1ULL << PI_PREFETCH_ADDR_BITS) - 1)
+#define PI_PREFETCH_ADDR_OFF 21
+
+/* How many cache lines are touched by buffer (addr, len). */
+static inline unsigned int num_cache_lines_touched(dma_addr_t addr,
+ unsigned int len)
+{
+ const unsigned long mask = PI_PREFETCH_LEN_MASK;
+ const unsigned long laddr = (unsigned long)addr;
+ unsigned long lines, equiv_len;
+ /* A. If addr is aligned, our solution is just to round up len to the
+ * next boundary.
+ *
+ * e.g. addr = 0, len = 48
+ * +--------------------+
+ * |XXXXXXXXXXXXXXXXXXXX| 32-byte cacheline a
+ * +--------------------+
+ * |XXXXXXXXXX | cacheline b
+ * +--------------------+
+ *
+ * B. If addr is not aligned, however, we may use an extra
+ * cacheline. e.g. addr = 12, len = 22
+ *
+ * +--------------------+
+ * | XXXXXXXXXXXXX|
+ * +--------------------+
+ * |XX |
+ * +--------------------+
+ *
+ * Our solution is to make the problem equivalent to case A
+ * above by adding the empty space in the first cacheline to the length:
+ * unsigned long len;
+ *
+ * +--------------------+
+ * |eeeeeeeXXXXXXXXXXXXX| "e" is empty space, which we add to len
+ * +--------------------+
+ * |XX |
+ * +--------------------+
+ */
+ equiv_len = len + (laddr & mask);
+
+ /* Now we can just round up this len to the next 32-byte boundary. */
+ lines = (equiv_len + mask) & (~mask);
+
+ /* Scale bytes -> cachelines. */
+ return lines >> PI_LOG2_CACHE_LINE_SIZE;
+}
+
+static inline u64 vnic_cached_posted_index(dma_addr_t addr,
+ unsigned int len, unsigned int index)
+{
+ unsigned int num_cache_lines = num_cache_lines_touched(addr, len);
+ /* Wish we could avoid a branch here. We could have separate
+ * vnic_wq_post() and vinc_wq_post_inline(), the latter
+ * only supporting < 1k (2^5 * 2^5) sends, I suppose. This would
+ * eliminate the if (eop) branch as well.
+ */
+ if (num_cache_lines > PI_PREFETCH_LEN_MASK)
+ num_cache_lines = 0;
+ return (index & PI_INDEX_MASK) |
+ ((num_cache_lines & PI_PREFETCH_LEN_MASK)
+ << PI_PREFETCH_LEN_OFF) |
+ (((addr >> PI_LOG2_CACHE_LINE_SIZE) &
+ PI_PREFETCH_ADDR_MASK) << PI_PREFETCH_ADDR_OFF);
+}
+
static inline void vnic_wq_post(struct vnic_wq *wq,
void *os_buf, dma_addr_t dma_addr,
- unsigned int len, int sop, int eop)
+ unsigned int len, int sop, int eop,
+ uint8_t desc_skip_cnt, uint8_t cq_entry,
+ uint8_t compressed_send, uint64_t wrid)
{
struct vnic_wq_buf *buf = wq->to_use;
buf->sop = sop;
+ buf->cq_entry = cq_entry;
+ buf->compressed_send = compressed_send;
+ buf->desc_skip_cnt = desc_skip_cnt;
buf->os_buf = eop ? os_buf : NULL;
buf->dma_addr = dma_addr;
buf->len = len;
+ buf->wr_id = wrid;
buf = buf->next;
if (eop) {
@@ -123,7 +205,7 @@ static inline void vnic_wq_post(struct vnic_wq *wq,
}
wq->to_use = buf;
- wq->ring.desc_avail--;
+ wq->ring.desc_avail -= desc_skip_cnt;
}
static inline void vnic_wq_service(struct vnic_wq *wq,
--
1.8.4-rc0
^ permalink raw reply related
* Re: [PATCH 3/4] drivers/net: enic: Make ASIC information available to USNIC
From: Stephen Hemminger @ 2013-08-09 22:21 UTC (permalink / raw)
To: Neel Patel; +Cc: netdev, Nishank Trivedi, Christian Benvenuti
In-Reply-To: <1376071941-17001-4-git-send-email-neepatel@cisco.com>
On Fri, 9 Aug 2013 11:12:20 -0700
Neel Patel <neepatel@cisco.com> wrote:
> This patch provides asic information via ethtool.
>
> Signed-off-by: Neel Patel <neepatel@cisco.com>
> Signed-off-by: Nishank Trivedi <nistrive@cisco.com>
> Signed-off-by: Christian Benvenuti <benve@cisco.com>
> ---
> drivers/net/ethernet/cisco/enic/driver_utils.h | 49 ++++++++++++++++++++++++++
> drivers/net/ethernet/cisco/enic/enic_ethtool.c | 4 +++
> 2 files changed, 53 insertions(+)
> create mode 100644 drivers/net/ethernet/cisco/enic/driver_utils.h
>
> diff --git a/drivers/net/ethernet/cisco/enic/driver_utils.h b/drivers/net/ethernet/cisco/enic/driver_utils.h
> new file mode 100644
> index 0000000..e654b4d
> --- /dev/null
> +++ b/drivers/net/ethernet/cisco/enic/driver_utils.h
> @@ -0,0 +1,49 @@
> +/**
> + * Copyright 2013 Cisco Systems, Inc. All rights reserved.
> + *
> + * This program is free software; you may redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + *
> + */
> +
> +#ifndef __DRIVER_UTILS_H__
> +#define __DRIVER_UTILS_H__
> +
> +#include <linux/string.h>
> +
> +static inline int driver_encode_asic_info(char *str, int strlen, u16 asic_type,
> + u16 asic_rev)
> +{
> + if (strlen < sizeof(asic_type) + sizeof(asic_rev))
> + return -EINVAL;
> +
> + memcpy(str, &asic_type, sizeof(asic_type));
> + memcpy(str + sizeof(asic_type), &asic_rev, sizeof(asic_rev));
> +
> + return 0;
> +}
> +
> +static inline int driver_decode_asic_info(char *str, int strlen, u16 *asic_type,
> + u16 *asic_rev)
> +{
> + if (strlen < sizeof(*asic_type) + sizeof(*asic_rev))
> + return -EINVAL;
> +
> + if (asic_type)
> + memcpy(asic_type, str, sizeof(*asic_type));
> + if (asic_rev)
> + memcpy(asic_rev, str + sizeof(*asic_type), sizeof(*asic_rev));
> + return 0;
> +}
> +
> +#endif /*!__DRIVER_UTILS_H__*/
> diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
> index 47e3562..c5d938a 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
> @@ -19,6 +19,7 @@
> #include <linux/netdevice.h>
> #include <linux/ethtool.h>
>
> +#include "driver_utils.h"
> #include "enic_res.h"
> #include "enic.h"
> #include "enic_dev.h"
> @@ -116,6 +117,9 @@ static void enic_get_drvinfo(struct net_device *netdev,
> sizeof(drvinfo->fw_version));
> strlcpy(drvinfo->bus_info, pci_name(enic->pdev),
> sizeof(drvinfo->bus_info));
> + memset(drvinfo->reserved1, 0, sizeof(drvinfo->reserved1));
> + driver_encode_asic_info(drvinfo->reserved1, sizeof(drvinfo->reserved1),
> + fw_info->asic_type, fw_info->asic_rev);
> }
If you want to use a reserved field, then make it a first class citizen.
Rename it to asic_info, make sure the result is okay for other drivers
and add send patch so Ben can make it part of normal ethtool support.
Otherwise, this code is likely to break when someone else actually unreserves
that field.
^ permalink raw reply
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