Re: [Patch net-next] net_sched: add network namespace support for tc actions

2016-02-20 Thread Cong Wang
On Sat, Feb 20, 2016 at 10:36 AM, Daniel Borkmann  wrote:
>
> Do you see a way to reduce the code duplication needed across all
> the action modules? I.e. that each of them now needs to register
> a new per netns subsystem, etc. In other words, is there a way the
> action API could be reworked to handle most of this in the tc core
> framework instead?

I definitely agree.

Initially I made a wrapper macro for the per netns API for each tc
action, but it didn't work as I thought, mostly due to the per net ops and
net_id stuffs.

So it is not as easy as it appears, it needs more work. At least the
current code is more readable than using any macro. We can always
refactor the API in the future, and as I mentioned in the changelog that
is in my plan.

Or do you have any quick and easy way to reduce the code?

Thanks.


Re: [PATCH] jme: remove the jme driver as it is no longer maintained

2016-02-20 Thread Diego Viola
On Sat, Feb 20, 2016 at 10:16 PM, David Miller  wrote:
>
> Sorry, this is not how things work.
>
> You can suggest marking the driver unmaintained in MAINTAINERS if the
> listed developer has been unresponsive for a very long time.
>
> But removing the driver altogether is not prudent at all.
>
> Just because it doesn't work %100 the way you like, and nobody
> has worked on fixing your specific problems, isn't a reason to
> remove an entire driver _nor_ move it to -staging.
>
> In fact, this driver is quite cleanly written, follows all of the
> various coding style rules we have, and uses the vast majority of the
> kernel APIs properly.
>
> And those are the criteria for having something in staging, not that
> it has bugs.
>
> In fact it is so cleanly written, that you should be able to read it
> and figure out what the suspend/resume problem might be.  These are
> exactly the kind of drivers we want to keep in the tree.
>
> I'm sorry that your bugs didn't get fixed, but your response to that
> happening is not reasonable at all.

OK my sincere apologies.

I've been very frustrated trying to deal with this bug and I couldn't
find a solution yet, but I will continue to see what I can do to fix
it.

I would appreciate some hint from someone who is more experienced with drivers.

Anyways, sorry about my behavior.

Diego


Re: [Patch net] net_sched: fix memory leaks when rmmod tc action modules

2016-02-20 Thread Cong Wang
On Fri, Feb 19, 2016 at 4:06 PM, Cong Wang  wrote:
> We only release the memory of the hashtable itself, not its
> entries inside. We need to do both.
>
> Cc: Jamal Hadi Salim 
> Signed-off-by: Cong Wang 

Hmm, after a second thought, actually each action should take
a reference to its module, therefore module will not be removed
until all the actions are gone, so no leak here.

The reason why I saw a leak is tcf_hashinfo_destroy() is called
in netns cleanup in the other patch.

So, this patch should be targeted for net-next only. I will resend it
with an updated changelog with the other patch.

Sorry for the confusion.


Re: [PATCH] jme: remove the jme driver as it is no longer maintained

2016-02-20 Thread David Miller

Sorry, this is not how things work.

You can suggest marking the driver unmaintained in MAINTAINERS if the
listed developer has been unresponsive for a very long time.

But removing the driver altogether is not prudent at all.

Just because it doesn't work %100 the way you like, and nobody
has worked on fixing your specific problems, isn't a reason to
remove an entire driver _nor_ move it to -staging.

In fact, this driver is quite cleanly written, follows all of the
various coding style rules we have, and uses the vast majority of the
kernel APIs properly.

And those are the criteria for having something in staging, not that
it has bugs.

In fact it is so cleanly written, that you should be able to read it
and figure out what the suspend/resume problem might be.  These are
exactly the kind of drivers we want to keep in the tree.

I'm sorry that your bugs didn't get fixed, but your response to that
happening is not reasonable at all.


[PATCH] rtlwifi: pass struct rtl_stats by reference as it is more efficient

2016-02-20 Thread Colin King
From: Colin Ian King 

passing rtl_stats by value is inefficient; the structure is over 300
bytes in size and generally just one field (packet_report_type)
is being accessed, so the pass by value is a relatively large overhead.
This change just affects just the rx_command_packet calls.

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/realtek/rtlwifi/pci.c   | 2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c | 2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h | 2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c | 6 +++---
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h | 2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c | 2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h | 2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c | 4 ++--
 drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h | 2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c | 4 ++--
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h | 2 +-
 drivers/net/wireless/realtek/rtlwifi/wifi.h  | 2 +-
 12 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c 
b/drivers/net/wireless/realtek/rtlwifi/pci.c
index 7f471bf..4153e7f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -855,7 +855,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
}
/* handle command packet here */
if (rtlpriv->cfg->ops->rx_command_packet &&
-   rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) {
+   rtlpriv->cfg->ops->rx_command_packet(hw, &stats, skb)) {
dev_kfree_skb_any(skb);
goto new_trx_end;
}
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
index 791efbe..b4d57da 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
@@ -851,7 +851,7 @@ void rtl88ee_tx_polling(struct ieee80211_hw *hw, u8 
hw_queue)
 }
 
 u32 rtl88ee_rx_command_packet(struct ieee80211_hw *hw,
- struct rtl_stats status,
+ struct rtl_stats *status,
  struct sk_buff *skb)
 {
return 0;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h 
b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
index eab5ae0..26fc12b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
@@ -790,7 +790,7 @@ void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 
*pdesc,
 bool firstseg, bool lastseg,
 struct sk_buff *skb);
 u32 rtl88ee_rx_command_packet(struct ieee80211_hw *hw,
- struct rtl_stats status,
+ struct rtl_stats *status,
  struct sk_buff *skb);
 
 #endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c
index d39ee67..32cb096 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c
@@ -1105,13 +1105,13 @@ void rtl92ee_tx_polling(struct ieee80211_hw *hw, u8 
hw_queue)
 }
 
 u32 rtl92ee_rx_command_packet(struct ieee80211_hw *hw,
- struct rtl_stats status,
+ struct rtl_stats *status,
  struct sk_buff *skb)
 {
u32 result = 0;
struct rtl_priv *rtlpriv = rtl_priv(hw);
 
-   switch (status.packet_report_type) {
+   switch (status->packet_report_type) {
case NORMAL_RX:
result = 0;
break;
@@ -1121,7 +1121,7 @@ u32 rtl92ee_rx_command_packet(struct ieee80211_hw *hw,
break;
default:
RT_TRACE(rtlpriv, COMP_RECV, DBG_TRACE,
-"Unknown packet type %d\n", status.packet_report_type);
+"Unknown packet type %d\n", 
status->packet_report_type);
break;
}
 
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h
index 8f78ac9..b12fc03 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h
@@ -857,6 +857,6 @@ void rtl92ee_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 
*pdesc,
 bool firstseg, bool lastseg,
 struct sk_buff *skb);
 u32 rtl92ee_rx_command_packet(struct ieee80211_hw *hw,
- struct rtl_stats status,
+ struct rtl_stats *status,
  struct sk_buff *skb)

[PATCH] jme: remove the jme driver as it is no longer maintained

2016-02-20 Thread Diego Viola
This driver also breaks my suspend/resume support, see the link below
for details:

https://bugzilla.kernel.org/show_bug.cgi?id=112351

If you choose to keep this garbage, move it to staging at least, where
it belongs.

Signed-off-by: Diego Viola 
---
 MAINTAINERS  |6 -
 drivers/net/ethernet/Kconfig |   12 -
 drivers/net/ethernet/jme.c   | 3368 --
 drivers/net/ethernet/jme.h   | 1278 
 4 files changed, 4664 deletions(-)
 delete mode 100644 drivers/net/ethernet/jme.c
 delete mode 100644 drivers/net/ethernet/jme.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 4978dc1..a29e960 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6014,12 +6014,6 @@ S:   Maintained
 F: Documentation/filesystems/jfs.txt
 F: fs/jfs/
 
-JME NETWORK DRIVER
-M: Guo-Fu Tseng 
-L: netdev@vger.kernel.org
-S: Maintained
-F: drivers/net/ethernet/jme.*
-
 JOURNALLING FLASH FILE SYSTEM V2 (JFFS2)
 M: David Woodhouse 
 L: linux-...@lists.infradead.org
diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index 0b13af8..4a6b747 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -80,18 +80,6 @@ source "drivers/net/ethernet/intel/Kconfig"
 source "drivers/net/ethernet/i825xx/Kconfig"
 source "drivers/net/ethernet/xscale/Kconfig"
 
-config JME
-   tristate "JMicron(R) PCI-Express Gigabit Ethernet support"
-   depends on PCI
-   select CRC32
-   select MII
-   ---help---
- This driver supports the PCI-Express gigabit ethernet adapters
- based on JMicron JMC250 chipset.
-
- To compile this driver as a module, choose M here. The module
- will be called jme.
-
 config KORINA
tristate "Korina (IDT RC32434) Ethernet support"
depends on MIKROTIK_RB532
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
deleted file mode 100644
index b1de7af..000
--- a/drivers/net/ethernet/jme.c
+++ /dev/null
@@ -1,3368 +0,0 @@
-/*
- * JMicron JMC2x0 series PCIe Ethernet Linux Device Driver
- *
- * Copyright 2008 JMicron Technology Corporation
- * http://www.jmicron.com/
- * Copyright (c) 2009 - 2010 Guo-Fu Tseng 
- *
- * Author: Guo-Fu Tseng 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "jme.h"
-
-static int force_pseudohp = -1;
-static int no_pseudohp = -1;
-static int no_extplug = -1;
-module_param(force_pseudohp, int, 0);
-MODULE_PARM_DESC(force_pseudohp,
-   "Enable pseudo hot-plug feature manually by driver instead of BIOS.");
-module_param(no_pseudohp, int, 0);
-MODULE_PARM_DESC(no_pseudohp, "Disable pseudo hot-plug feature.");
-module_param(no_extplug, int, 0);
-MODULE_PARM_DESC(no_extplug,
-   "Do not use external plug signal for pseudo hot-plug.");
-
-static int
-jme_mdio_read(struct net_device *netdev, int phy, int reg)
-{
-   struct jme_adapter *jme = netdev_priv(netdev);
-   int i, val, again = (reg == MII_BMSR) ? 1 : 0;
-
-read_again:
-   jwrite32(jme, JME_SMI, SMI_OP_REQ |
-   smi_phy_addr(phy) |
-   smi_reg_addr(reg));
-
-   wmb();
-   for (i = JME_PHY_TIMEOUT * 50 ; i > 0 ; --i) {
-   udelay(20);
-   val = jread32(jme, JME_SMI);
-   if ((val & SMI_OP_REQ) == 0)
-   break;
-   }
-
-   if (i == 0) {
-   pr_err("phy(%d) read timeout : %d\n", phy, reg);
-   return 0;
-   }
-
-   if (again--)
-   goto read_again;
-
-   return (val & SMI_DATA_MASK) >> SMI_DATA_SHIFT;
-}
-
-static void
-jme_mdio_write(struct net_device *netdev,
-   int phy, int reg, int val)
-{
-   struct jme_adapter *jme = netdev_priv(netdev);
-   int i;
-
-   jwrite32(jme, JME_SMI, SMI_OP_WRITE | SMI_OP_REQ |
-   ((val << SMI_DATA_SHIFT) & SMI_DATA_MASK) |
-   smi_phy_addr(phy) | smi_reg_addr(reg));
-
-   wmb();
-   for (i = JME_PHY_TIMEOUT * 50 ; i > 0 ; --i) {
-   udelay(20);
- 

Re: r8169 nic sometimes doesn't work after changing the mac address

2016-02-20 Thread Maximilian Engelhardt
On Saturday 12 December 2015 22:43:45 Maximilian Engelhardt wrote:
> Hello,
> 
> I'm using a Lenovo TinkPad Edge E135 notebook that has a Realtek wired
> network interface inbuilt. Under some conditions the nic doesn't work after
> changing the mac address.
> 
> It took me some time to figure out that it makes a difference if I (re)boot
> my notebook with or without the power supply plugged in. When I boot the
> system with the power supply plugged in everything does work fine as
> expected. But if I boot with the power supply unplugged and I change the
> mac address the network card doesn't work.
> 
> 
> This is how I am testing and how I can reproduce the behavior on my system:
> 
> * Boot Linux (Debian stable with a newer kernel)
> * Network is still turned off, only loopback is enabled by default in my
> setup. * I run the following commands:
>   ip link set dev eth0 address 00:12:0c:96:a7:2e # a randomly generated mac
>   ip link set dev eth0 up
>   ip addr add dev eth0 10.0.252.50/24
>   ip route add default via 10.0.252.1
> 
> When the notebook is booted with the power supply plugged in the network is
> working as expected, e. g. I can ping the gateway.
> 
> But when the notebook was booted without the power supply attached the
> network is not working e. g. pinging the gateway doesn't get any replies.
> 
> I found two ways to get the network working from this state (beside
> rebooting with power plugged in):
> 
> * If I enable promiscous mode the network connections are working again:
>   # ip link set dev eth0 promisc on
> 
> * Alternatively I can set the same mac address again while the interface is
> up:
>   # ip link set dev eth0 address 00:12:0c:96:a7:2e # same mac as before
> 
> 
> So it seems like a mac filter in the network card is not set up right.
> 
> 
> Attached are dmesg output of a boot with and without power supply attached
> as well as the output of lspci -vvv.
> 
> 
> Please let me know If you need more information.
> 
> Thanks,
> Maxi


Hello,

Anyone had a look at this? I can confirm that the problem is still present in 
kernel 4.4.2.

I just did a quick tcpdump and found out that packets are transmitted fine, but 
the replay of the other end gets lost somewhere in the nic/driver e. i. it 
seems to never reach the kernel network stack.

Please let me know if you need more information from me.

Thanks,
Maxi


signature.asc
Description: This is a digitally signed message part.


[PATCH v3] net: ethernet: davicom: fix devicetree irq resource

2016-02-20 Thread Robert Jarzmik
The dm9000 driver doesn't work in at least one device-tree
configuration, spitting an error message on irq resource :
[1.062495] dm9000 800.ethernet: insufficient resources
[1.068439] dm9000 800.ethernet: not found (-2).
[1.073451] dm9000: probe of 800.ethernet failed with error -2

The reason behind is that the interrupt might be provided by a gpio
controller, not probed when dm9000 is probed, and needing the probe
deferral mechanism to apply.

Currently, the interrupt is directly taken from resources. This patch
changes this to use the more generic platform_get_irq(), which handles
the deferral.

Moreover, since commit Fixes: 7085a7401ba5 ("drivers: platform: parse
IRQ flags from resources"), the interrupt trigger flags are honored in
platform_get_irq(), so remove the needless code in dm9000.

Signed-off-by: Robert Jarzmik 
Acked-by: Marcel Ziswiler 
Cc: Sergei Shtylyov 
---
Since v1: comment style and requested irq test < 0
  David, you should know that Sergei is concerned with the
  subsystem prefix in the patch subject (too long for him).
Since v2: leak of the ethernet device
---
 drivers/net/ethernet/davicom/dm9000.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/davicom/dm9000.c 
b/drivers/net/ethernet/davicom/dm9000.c
index cf94b72dbacd..48d91941408d 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -128,7 +128,6 @@ struct board_info {
struct resource *data_res;
struct resource *addr_req;   /* resources requested */
struct resource *data_req;
-   struct resource *irq_res;
 
int  irq_wake;
 
@@ -1300,22 +1299,16 @@ static int
 dm9000_open(struct net_device *dev)
 {
struct board_info *db = netdev_priv(dev);
-   unsigned long irqflags = db->irq_res->flags & IRQF_TRIGGER_MASK;
 
if (netif_msg_ifup(db))
dev_dbg(db->dev, "enabling %s\n", dev->name);
 
-   /* If there is no IRQ type specified, default to something that
-* may work, and tell the user that this is a problem */
-
-   if (irqflags == IRQF_TRIGGER_NONE)
-   irqflags = irq_get_trigger_type(dev->irq);
-
-   if (irqflags == IRQF_TRIGGER_NONE)
+   /* If there is no IRQ type specified, tell the user that this is a
+* problem
+*/
+   if (irq_get_trigger_type(dev->irq) == IRQF_TRIGGER_NONE)
dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n");
 
-   irqflags |= IRQF_SHARED;
-
/* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */
iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */
mdelay(1); /* delay needs by DM9000B */
@@ -1323,7 +1316,8 @@ dm9000_open(struct net_device *dev)
/* Initialize DM9000 board */
dm9000_init_dm9000(dev);
 
-   if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev))
+   if (request_irq(dev->irq, dm9000_interrupt, IRQF_SHARED,
+   dev->name, dev))
return -EAGAIN;
/* Now that we have an interrupt handler hooked up we can unmask
 * our interrupts
@@ -1500,15 +1494,22 @@ dm9000_probe(struct platform_device *pdev)
 
db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-   db->irq_res  = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 
-   if (db->addr_res == NULL || db->data_res == NULL ||
-   db->irq_res == NULL) {
-   dev_err(db->dev, "insufficient resources\n");
+   if (!db->addr_res || !db->data_res) {
+   dev_err(db->dev, "insufficient resources addr=%p data=%p\n",
+   db->addr_res, db->data_res);
ret = -ENOENT;
goto out;
}
 
+   ndev->irq = platform_get_irq(pdev, 0);
+   if (ndev->irq < 0) {
+   dev_err(db->dev, "interrupt resource unavailable: %d\n",
+   ndev->irq);
+   ret = ndev->irq;
+   goto out;
+   }
+
db->irq_wake = platform_get_irq(pdev, 1);
if (db->irq_wake >= 0) {
dev_dbg(db->dev, "wakeup irq %d\n", db->irq_wake);
@@ -1570,7 +1571,6 @@ dm9000_probe(struct platform_device *pdev)
 
/* fill in parameters for net-dev structure */
ndev->base_addr = (unsigned long)db->io_addr;
-   ndev->irq   = db->irq_res->start;
 
/* ensure at least we have a default set of IO routines */
dm9000_set_io(db, iosize);
-- 
2.1.4



Re: [net-next PATCH 0/2] GENEVE/VXLAN: Enable outer Tx checksum by default

2016-02-20 Thread Tom Herbert
On Fri, Feb 19, 2016 at 6:18 PM, Jesse Gross  wrote:
> On Fri, Feb 19, 2016 at 4:14 PM, Tom Herbert  wrote:
>> On Fri, Feb 19, 2016 at 4:08 PM, Jesse Gross  wrote:
>>> On Fri, Feb 19, 2016 at 3:10 PM, Alex Duyck  wrote:
 On Fri, Feb 19, 2016 at 1:53 PM, Jesse Gross  wrote:
> On Fri, Feb 19, 2016 at 11:26 AM, Alexander Duyck  
> wrote:
>> This patch series makes it so that we enable the outer Tx checksum for 
>> IPv4
>> tunnels by default.  This makes the behavior consistent with how we were
>> handling this for IPv6.  In addition I have updated the internal flags 
>> for
>> these tunnels so that we use a ZERO_CSUM_TX flag for IPv4 which should
>> match up will with the ZERO_CSUM6_TX flag which was already in use for
>> IPv6.
>>
>> For most network devices this should be a net gain in terms of 
>> performance
>> as having the outer header checksum present allows for devices to report
>> CHECKSUM_UNNECESSARY which we can then convert to CHECKSUM_COMPLETE in 
>> order
>> to determine if the inner header checksum is valid.
>>
>> Below is some data I collected with ixgbe with an X540 that demonstrates
>> this.  I located two PFs connected back to back in two different name
>> spaces and then setup a pair of tunnels on each, one with checksum 
>> enabled
>> and one without.
>>
>> Recv   SendSend  Utilization
>> Socket Socket  Message  Elapsed  Send
>> Size   SizeSize Time Throughput  local
>> bytes  bytes   bytessecs.10^6bits/s  % S
>>
>> noudpcsum:
>>  87380  16384  1638430.00  8898.67   12.80
>> udpcsum:
>>  87380  16384  1638430.00  9088.47   5.69
>>
>> The one spot where this may cause a performance regression is if the
>> environment contains devices that can parse the inner headers and a 
>> device
>> supports NETIF_F_GSO_UDP_TUNNEL but not NETIF_F_GSO_UDP_TUNNEL_CSUM.  In
>> the case of such a device we have to fall back to using GSO to segment 
>> the
>> tunnel instead of TSO and as a result we may take a performance hit as 
>> seen
>> below with i40e.
>
> Do you have any numbers from 40G links? Obviously, at 10G the links
> are basically saturated and while I can see a difference in the
> utilization rate, I suspect that the change will be much more apparent
> at higher speeds.

 Unfortunately I don't have any true 40G links to test with.  The
 closest I can get is to run PF to VF on an i40e.  Running that I have
 seen the numbers go from about 20Gb/s to 15Gb/s with almost all the
 difference being related to the fact that we are having to
 allocate/free more skbs and make more trips through the
 i40e_lan_xmit_frame function resulting in more descriptors.
>>>
>>> OK, I guess that is more or less in line with what I would expect off
>>> the top my head. There is a reasonably significant drop in the worst
>>> case.
>>>
> I'm concerned about the drop in performance for devices that currently
> support offloads (almost none of which expose
> NETIF_F_GSO_UDP_TUNNEL_CSUM as a feature). Presumably the people that
> care most about tunnel performance are the ones that already have
> these NICs and will be the most impacted by the drop.

 The problem is being able to transmit fast is kind of pointless if the
 receiving end cannot handle it.  We hadn't gotten around to really
 getting the Rx checksum bits working until the 3.18 kernel which I
 don't suspect many people are running so at this point messing with
 the TSO bits isn't really making much of a difference.  Then on top of
 that most devices have certain limitations on how many ports they can
 handle and such.  I know the i40e is supposed to support something
 like 10 port numbers, but the fm10k and ixgbe are limited to one port
 as I recall.  So this whole thing is already really brittle as it is.
 My goal with this change is to make the behavior more consistent
 across the board.
>>>
>>> That's true to some degree but there are certainly plenty of cases
>>> where TSO makes a difference - lower CPU usage, transmitting to
>>> multiple receivers, people will upgrade their kernels, etc. It's
>>> clearly good to make things more consistent but hopefully not by
>>> reducing existing performance. :)
>>>
> My hope is that we can continue to use TSO on devices that only
> support NETIF_F_GSO_UDP_TUNNEL. The main problem is that the UDP
> length field may vary across segments. However, in practice this is
> the only on the final segment and only in cases where the total length
> is not a multiple of the MSS. If we could detect cases where those
> conditions are met, we could continue to use TSO with the UDP checksum
> field pre-populated. A possible step even further would b

Re: [Patch net-next] net_sched: add network namespace support for tc actions

2016-02-20 Thread Daniel Borkmann

On 02/20/2016 01:43 AM, Cong Wang wrote:

Currently tc actions are stored in a per-module hashtable,
therefore are visible to all network namespaces. This is
probably the last part of the tc subsystem which is not
aware of netns now. This patch makes them per-netns,
several tc action API's need to be adjusted for this.

The tc action API code is ugly due to historical reasons,
we need to refactor that code in the future.

Also this patch is on top of my other patch
"net_sched: fix memory leaks when rmmod tc action modules",
therefore should be applied after -net is merged into
net-next.

Cc: Jamal Hadi Salim 
Signed-off-by: Cong Wang 
---
  include/net/act_api.h|  28 +---
  net/sched/act_api.c  |  88 ++-
  net/sched/act_bpf.c  |  71 +--
  net/sched/act_connmark.c |  73 +--
  net/sched/act_csum.c |  78 +++--
  net/sched/act_gact.c |  74 ++--
  net/sched/act_ipt.c  | 178 +++
  net/sched/act_mirred.c   |  75 ++--
  net/sched/act_nat.c  |  73 +--
  net/sched/act_pedit.c|  73 +--
  net/sched/act_police.c   |  69 --
  net/sched/act_simple.c   |  76 ++--
  net/sched/act_skbedit.c  |  73 +--
  net/sched/act_vlan.c |  73 +--
  14 files changed, 969 insertions(+), 133 deletions(-)


Thanks for working on this!

Do you see a way to reduce the code duplication needed across all
the action modules? I.e. that each of them now needs to register
a new per netns subsystem, etc. In other words, is there a way the
action API could be reworked to handle most of this in the tc core
framework instead?

Cheers,
Daniel


pull request: bluetooth 2016-02-20

2016-02-20 Thread Johan Hedberg
Hi Dave,

Here's an important patch for 4.5 which fixes potential invalid pointer
access when processing completed Bluetooth HCI commands.

Please let me know if there are any issues pulling. Thanks.

Johan

---
The following changes since commit d07c0278da1f4cfc91c3d46d0d07a0d13a949892:

  net: bcmgenet: Fix internal PHY link state (2016-02-19 23:51:40 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git 
for-upstream

for you to fetch changes up to 3bd7594e69bd97c962faa6a5ae15dd8c6c082636:

  Bluetooth: hci_core: Avoid mixing up req_complete and req_complete_skb 
(2016-02-20 08:52:28 +0100)


Douglas Anderson (1):
  Bluetooth: hci_core: Avoid mixing up req_complete and req_complete_skb

 net/bluetooth/hci_core.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)


signature.asc
Description: PGP signature


[PATCH] Add Dell Wireless 5809e Gobi 4G HSPA+ Mobile Broadband Card (rev3) to qmi_wwan

2016-02-20 Thread Patrik Halfar
New revison of Dell Wireless 5809e Gobi 4G HSPA+ Mobile Broadband Card has new 
idProduct

Bus 002 Device 006: ID 413c:81b3 Dell Computer Corp.
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor   0x413c Dell Computer Corp.
  idProduct  0x81b3
  bcdDevice0.06
  iManufacturer   1 Sierra Wireless, Incorporated
  iProduct2 Dell Wireless 5809e Gobiā„¢ 4G HSPA+ Mobile Broadband 
Card
  iSerial 3
  bNumConfigurations  2

Signed-off-by: Patrik Halfar 
---
 drivers/net/usb/qmi_wwan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 23e9880791fc..5ef413305895 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -884,6 +884,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x413c, 0x81a8, 8)},/* Dell Wireless 5808 Gobi(TM) 
4G LTE Mobile Broadband Card */
{QMI_FIXED_INTF(0x413c, 0x81a9, 8)},/* Dell Wireless 5808e Gobi(TM) 
4G LTE Mobile Broadband Card */
{QMI_FIXED_INTF(0x413c, 0x81b1, 8)},/* Dell Wireless 5809e Gobi(TM) 
4G LTE Mobile Broadband Card */
+   {QMI_FIXED_INTF(0x413c, 0x81b3, 8)},/* Dell Wireless 5809e Gobi(TM) 
4G LTE Mobile Broadband Card (rev3) */
{QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)},/* HP lt4111 LTE/EV-DO/HSPA+ 
Gobi 4G Module */
{QMI_FIXED_INTF(0x22de, 0x9061, 3)},/* WeTelecom WPD-600N */
{QMI_FIXED_INTF(0x1e0e, 0x9001, 5)},/* SIMCom 7230E */
-- 
2.4.10



[PATCH V7] netfilter: h323: avoid potential attack

2016-02-20 Thread Zhouyi Zhou
I think hackers chould build a malicious h323 packet to overflow
the pointer p which will panic during the memcpy(addr, p, len)
For example, he may fabricate a very large taddr->ipAddress.ip in
function get_h225_addr.

To avoid above, I add buffer boundary checking both in get addr
functions and set addr functions.

Because the temporary h323 buffer is dynamiclly allocated, I remove
the h323 spin lock in my patch.

Signed-off-by: Zhouyi Zhou 
---
 include/linux/netfilter/nf_conntrack_h323.h |  17 +-
 net/ipv4/netfilter/nf_nat_h323.c|  33 ++-
 net/netfilter/nf_conntrack_h323_main.c  | 328 +---
 3 files changed, 244 insertions(+), 134 deletions(-)

diff --git a/include/linux/netfilter/nf_conntrack_h323.h 
b/include/linux/netfilter/nf_conntrack_h323.h
index 858d9b2..6c6fea1 100644
--- a/include/linux/netfilter/nf_conntrack_h323.h
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -27,11 +27,17 @@ struct nf_ct_h323_master {
};
 };
 
+struct h323_ct_state {
+   unsigned char *buf;
+   unsigned char *data;
+   int buflen;
+};
+
 struct nf_conn;
 
 int get_h225_addr(struct nf_conn *ct, unsigned char *data,
  TransportAddress *taddr, union nf_inet_addr *addr,
- __be16 *port);
+ __be16 *port, struct h323_ct_state *ctstate);
 void nf_conntrack_h245_expect(struct nf_conn *new,
  struct nf_conntrack_expect *this);
 void nf_conntrack_q931_expect(struct nf_conn *new,
@@ -50,12 +56,14 @@ extern int (*set_sig_addr_hook) (struct sk_buff *skb,
 struct nf_conn *ct,
 enum ip_conntrack_info ctinfo,
 unsigned int protoff, unsigned char **data,
-TransportAddress *taddr, int count);
+TransportAddress *taddr, int count,
+struct h323_ct_state *ctstate);
 extern int (*set_ras_addr_hook) (struct sk_buff *skb,
 struct nf_conn *ct,
 enum ip_conntrack_info ctinfo,
 unsigned int protoff, unsigned char **data,
-TransportAddress *taddr, int count);
+TransportAddress *taddr, int count,
+struct h323_ct_state *ctstate);
 extern int (*nat_rtp_rtcp_hook) (struct sk_buff *skb,
 struct nf_conn *ct,
 enum ip_conntrack_info ctinfo,
@@ -90,7 +98,8 @@ extern int (*nat_q931_hook) (struct sk_buff *skb, struct 
nf_conn *ct,
 unsigned int protoff,
 unsigned char **data, TransportAddress *taddr,
 int idx, __be16 port,
-struct nf_conntrack_expect *exp);
+struct nf_conntrack_expect *exp,
+struct h323_ct_state *ctstate);
 
 #endif
 
diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c
index 574f7eb..5ed2d70 100644
--- a/net/ipv4/netfilter/nf_nat_h323.c
+++ b/net/ipv4/netfilter/nf_nat_h323.c
@@ -33,12 +33,20 @@ static int set_addr(struct sk_buff *skb, unsigned int 
protoff,
} __attribute__ ((__packed__)) buf;
const struct tcphdr *th;
struct tcphdr _tcph;
+   int datalen;
+   struct iphdr *iph = ip_hdr(skb);
 
buf.ip = ip;
buf.port = port;
addroff += dataoff;
 
if (ip_hdr(skb)->protocol == IPPROTO_TCP) {
+   th = (void *)iph + iph->ihl * 4;
+   datalen = skb->len - (iph->ihl * 4 + th->doff * 4);
+   /* check offset overflow */
+   if (addroff > datalen)
+   return  -1;
+
if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
  protoff, addroff, sizeof(buf),
  (char *) &buf, sizeof(buf))) {
@@ -53,6 +61,11 @@ static int set_addr(struct sk_buff *skb, unsigned int 
protoff,
return -1;
*data = skb->data + ip_hdrlen(skb) + th->doff * 4 + dataoff;
} else {
+   datalen = skb->len - (iph->ihl * 4 + sizeof(struct udphdr));
+   /* check offset overflow */
+   if (addroff > datalen)
+   return  -1;
+
if (!nf_nat_mangle_udp_packet(skb, ct, ctinfo,
  protoff, addroff, sizeof(buf),
  (char *) &buf, sizeof(buf))) {
@@ -93,7 +106,8 @@ static int set_h245_addr(struct sk_buff *skb, unsigned 
protoff,
 static int set_sig_addr(struct sk_buff *skb, struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
unsigned int protoff, unsigned char **dat

Re: [PATCH] xen-netfront: set real_num_tx_queues to zreo avoid to trigger BUG_ON

2016-02-20 Thread Sergei Shtylyov

On 02/20/2016 04:27 AM, Gonglei wrote:


It's possible for a race condition to exist between xennet_open() and
talk_to_netback(). After invoking netfront_probe() then other
threads or processes invoke xennet_open (such as NetworkManager)
immediately may trigger BUG_ON(). Besides, we also should reset
real_num_tx_queues in xennet_destroy_queues().

 [ 3324.658057] kernel BUG at include/linux/netdevice.h:508!
 [ 3324.658057] invalid opcode:  [#1] SMP
 [ 3324.658057] CPU: 0 PID: 662 Comm: NetworkManager Tainted: G
 [] ? raw_notifier_call_chain+0x16/0x20
 [] __dev_open+0xce/0x150
 [] __dev_change_flags+0xa1/0x170
 [] dev_change_flags+0x29/0x70
 [] do_setlink+0x39f/0xb40
 [] ? nla_parse+0x32/0x120
 [] rtnl_newlink+0x604/0x900
 [] ? netlink_unicast+0x193/0x1c0
 [] ? security_capable+0x18/0x20
 [] ? ns_capable+0x2d/0x60
 [] rtnetlink_rcv_msg+0xf5/0x270
 [] ? rhashtable_lookup_compare+0x5d/0xa0
 [] ? rtnetlink_rcv+0x40/0x40
 [] netlink_rcv_skb+0xb9/0xe0
 [] rtnetlink_rcv+0x2c/0x40
 [] netlink_unicast+0x12d/0x1c0
 [] netlink_sendmsg+0x4d3/0x630
 [] ? sock_has_perm+0x72/0x90
 [] do_sock_sendmsg+0x9f/0xc0
 [ 3324.703482] RIP  [] xennet_open+0x180/0x182 
[xen_netfront]

CC: David S. Miller 
Signed-off-by: Gonglei 


   Full name required for this tag.

[...]

MBR, Sergei



Re: [PATCH] net: smc911x: convert pxa dma to dmaengine

2016-02-20 Thread Guennadi Liakhovetski
Hi,

On Sat, 20 Feb 2016, Hitoshi Mitake wrote:

> 
> Hi Robert,
> 
> At Sat, 06 Feb 2016 10:05:51 +0100,
> Robert Jarzmik wrote:
> > 
> > David Miller  writes:
> > 
> > > From: Robert Jarzmik 
> > > Date: Fri, 05 Feb 2016 22:44:56 +0100
> > >
> > >> Apart from Alberto who answered he cannot test it by lack of hardware, 
> > >> the
> > >> others didn't answer.
> > >> 
> > >> So how can I move forward ? Would you want me to amend the KConfig to 
> > >> add a "&&
> > >> !ARCH_PXA" on the "depend" line ?
> > >
> > > Please just keep pinging people to properly test this.
> > Okay, let's have another try.
> > 
> > Hi Guennadi, Hitoshi, Fabio,
> > 
> > Could any of you try this patch to ensure your board is not broken please ?
> > I've re-added the patch at the end of this mail for easier handling. 
> > Normally no
> > code path in non-PXA board is changed, so the test should be 
> > straightforward.
> > 
> > It's also available in : https://lkml.org/lkml/2015/11/30/768
> > 
> > You're the maintainers of the following boards using smc911x AFAIK:
> >  - sh2007: Guennadi and Hitoshi
> 
> (I noticed my previous mail was bounced, so sending it again)
> 
> Really sorry, currently I don't have the board :(
> Do you have a working board that can be used for testing, Guennadi?

Don't think I have anything, that I could use for testing with a 
reasonable effort.

Thanks
Guennadi

> 
> Thanks,
> Hitoshi
> 
> >  - armadillo5x0: Alberto
> >  - imx v6 and imx v7: Fabio
> > 
> > Cheers.
> > 
> > -- 
> > Robert
> > 
> > 
> > ---8<---
> > From: Robert Jarzmik 
> > Subject: [PATCH] net: smc911x: convert pxa dma to dmaengine
> > To: "David S. Miller" 
> > Cc: netdev@vger.kernel.org, linux-ker...@vger.kernel.org, Robert Jarzmik 
> > 
> > Date: Mon, 30 Nov 2015 22:40:28 +0100 (9 weeks, 4 days, 11 hours ago)
> > Message-Id: <1448919628-13273-1-git-send-email-robert.jarz...@free.fr>
> > X-Mailer: git-send-email 2.1.4
> > 
> > Convert the dma transfers to be dmaengine based, now pxa has a dmaengine
> > slave driver. This makes this driver a bit more PXA agnostic.
> > 
> > The driver was only compile tested. The risk is quite small as no
> > current PXA platform I'm aware of is using smc911x driver.
> > 
> > Signed-off-by: Robert Jarzmik 
> > ---
> >  drivers/net/ethernet/smsc/smc911x.c | 85 
> > -
> >  drivers/net/ethernet/smsc/smc911x.h | 63 ---
> >  2 files changed, 82 insertions(+), 66 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/smsc/smc911x.c 
> > b/drivers/net/ethernet/smsc/smc911x.c
> > index bd64eb982e52..3f5711061432 100644
> > --- a/drivers/net/ethernet/smsc/smc911x.c
> > +++ b/drivers/net/ethernet/smsc/smc911x.c
> > @@ -73,6 +73,9 @@ static const char version[] =
> >  #include 
> >  #include 
> >  
> > +#include 
> > +#include 
> > +
> >  #include 
> >  
> >  #include "smc911x.h"
> > @@ -1174,18 +1177,16 @@ static irqreturn_t smc911x_interrupt(int irq, void 
> > *dev_id)
> >  
> >  #ifdef SMC_USE_DMA
> >  static void
> > -smc911x_tx_dma_irq(int dma, void *data)
> > +smc911x_tx_dma_irq(void *data)
> >  {
> > -   struct net_device *dev = (struct net_device *)data;
> > -   struct smc911x_local *lp = netdev_priv(dev);
> > +   struct smc911x_local *lp = data;
> > +   struct net_device *dev = lp->netdev;
> > struct sk_buff *skb = lp->current_tx_skb;
> > unsigned long flags;
> >  
> > DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
> >  
> > DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, dev, "TX DMA irq handler\n");
> > -   /* Clear the DMA interrupt sources */
> > -   SMC_DMA_ACK_IRQ(dev, dma);
> > BUG_ON(skb == NULL);
> > dma_unmap_single(NULL, tx_dmabuf, tx_dmalen, DMA_TO_DEVICE);
> > dev->trans_start = jiffies;
> > @@ -1208,18 +1209,16 @@ smc911x_tx_dma_irq(int dma, void *data)
> > "TX DMA irq completed\n");
> >  }
> >  static void
> > -smc911x_rx_dma_irq(int dma, void *data)
> > +smc911x_rx_dma_irq(void *data)
> >  {
> > -   struct net_device *dev = (struct net_device *)data;
> > -   struct smc911x_local *lp = netdev_priv(dev);
> > +   struct smc911x_local *lp = data;
> > +   struct net_device *dev = lp->netdev;
> > struct sk_buff *skb = lp->current_rx_skb;
> > unsigned long flags;
> > unsigned int pkts;
> >  
> > DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
> > DBG(SMC_DEBUG_RX | SMC_DEBUG_DMA, dev, "RX DMA irq handler\n");
> > -   /* Clear the DMA interrupt sources */
> > -   SMC_DMA_ACK_IRQ(dev, dma);
> > dma_unmap_single(NULL, rx_dmabuf, rx_dmalen, DMA_FROM_DEVICE);
> > BUG_ON(skb == NULL);
> > lp->current_rx_skb = NULL;
> > @@ -1792,6 +1791,9 @@ static int smc911x_probe(struct net_device *dev)
> > unsigned int val, chip_id, revision;
> > const char *version_string;
> > unsigned long irq_flags;
> > +   struct dma_slave_config config;
> > +   dma_cap_mask_t mask;
> > +   struct pxad_param param;
> >  
> > DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
> >  
> > @@ -1963,11 +1965

RE: [PATCH iproute2] bridge: add support for dynamic fdb entries

2016-02-20 Thread Rosen, Rami
+1

Rami Rosen
Intel Corporation



Re: [PATCH 1/1] net-next: do not store needed_headroom in ip_tunnel_xmit

2016-02-20 Thread Francesco Ruggeri
On Fri, Feb 19, 2016 at 8:26 PM, Francesco Ruggeri  wrote:
> Misconfigurations can result in local tunnel loops being created.
> __dev_queue_xmit catches packets caught in a loop and drops them,
> but the affected tunnels' needed_headroom can be corrupted in the
> process as it is recursively updated.

The problem with the patch is that it might force a pskb_expand_head
in the most common cases.
On the other hand if a loop is created then it may not be enough to
undo the configuration and the tunnel device itself should be
reinitialized.
Anybody have a better suggestion?

Thanks,
Francesco


Re: [PATCH] net: smc911x: convert pxa dma to dmaengine

2016-02-20 Thread Robert Jarzmik
Hitoshi Mitake  writes:

> Hi Robert,
>
> On Sat, Feb 6, 2016 at 6:05 PM, Robert Jarzmik  wrote:
> > Please just keep pinging people to properly test this.
> 
> Okay, let's have another try.
> 
> Hi Guennadi, Hitoshi, Fabio,
> 
> Could any of you try this patch to ensure your board is not broken please 
> ?
> I've re-added the patch at the end of this mail for easier handling.
> Normally no
> code path in non-PXA board is changed, so the test should be
> straightforward.
> 
> It's also available in : https://lkml.org/lkml/2015/11/30/768
> 
> You're the maintainers of the following boards using smc911x AFAIK:
> - sh2007: Guennadi and Hitoshi
>
> Really sorry, currently I don't have the board :(
> Do you have a working board that can be used for testing, Guennadi?
>
> Thanks,
> Hitoshi

Hello,

I'll reping once more, to see if any of you could give this patch a try.
So far Hitoshi doesn't have the hardware anymore, so it leaves only Guennadi and
Fabio.

If you could give it a try it would be great.

For reference, the patch is here : https://lkml.org/lkml/2015/11/30/768

Cheers.

--
Robert


pull-request: can-next 2016-02-20

2016-02-20 Thread Marc Kleine-Budde
Hello David,

this is a pull request of 9 patch for net-next/master.

The first 3 patches are from Damien Riegel, they add support for
Technologic Systems IP core to tje sja100 driver. The next patches 6 by
Marek Vasut (including one my me) first clean sort the CAN driver's
Kconfig and Makefiles and then add support for the IFI CANFD IP core.

Marc

---

The following changes since commit 80c804bfc487c6df783c258b9034b9d81c34f7a0:

  Merge branch 'bpf-get-stackid' (2016-02-20 00:21:44 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git 
tags/linux-can-next-for-4.6-20160220

for you to fetch changes up to 0c4d9c94a1303008b32079991360cea7ab849ef3:

  can: ifi: Add IFI CANFD IP support (2016-02-20 14:56:15 +0100)


linux-can-next-for-4.6-20160220


Damien Riegel (3):
  can: sja1000: of: add per-compatible init hook
  can: sja1000: add documentation for Technologic Systems version
  can: sja1000: of: add compatibility with Technologic Systems version

Marc Kleine-Budde (1):
  can: Kconfig: sort drivers alphabetically

Marek Vasut (5):
  can: Kconfig: Sort the Kconfig includes
  can: Makefile: Sort the Makefile
  of: Add vendor prefix for I/F/I
  can: ifi: Add DT bindings for ifi,canfd
  can: ifi: Add IFI CANFD IP support

 .../devicetree/bindings/net/can/ifi_canfd.txt  |  15 +
 .../devicetree/bindings/net/can/sja1000.txt|   3 +-
 .../devicetree/bindings/vendor-prefixes.txt|   1 +
 drivers/net/can/Kconfig|  64 +-
 drivers/net/can/Makefile   |  17 +-
 drivers/net/can/ifi_canfd/Kconfig  |   8 +
 drivers/net/can/ifi_canfd/Makefile |   5 +
 drivers/net/can/ifi_canfd/ifi_canfd.c  | 917 +
 drivers/net/can/sja1000/sja1000_platform.c |  87 +-
 9 files changed, 1064 insertions(+), 53 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/ifi_canfd.txt
 create mode 100644 drivers/net/can/ifi_canfd/Kconfig
 create mode 100644 drivers/net/can/ifi_canfd/Makefile
 create mode 100644 drivers/net/can/ifi_canfd/ifi_canfd.c

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] net: smc911x: convert pxa dma to dmaengine

2016-02-20 Thread Hitoshi Mitake

Hi Robert,

At Sat, 06 Feb 2016 10:05:51 +0100,
Robert Jarzmik wrote:
> 
> David Miller  writes:
> 
> > From: Robert Jarzmik 
> > Date: Fri, 05 Feb 2016 22:44:56 +0100
> >
> >> Apart from Alberto who answered he cannot test it by lack of hardware, the
> >> others didn't answer.
> >> 
> >> So how can I move forward ? Would you want me to amend the KConfig to add 
> >> a "&&
> >> !ARCH_PXA" on the "depend" line ?
> >
> > Please just keep pinging people to properly test this.
> Okay, let's have another try.
> 
> Hi Guennadi, Hitoshi, Fabio,
> 
> Could any of you try this patch to ensure your board is not broken please ?
> I've re-added the patch at the end of this mail for easier handling. Normally 
> no
> code path in non-PXA board is changed, so the test should be straightforward.
> 
> It's also available in : https://lkml.org/lkml/2015/11/30/768
> 
> You're the maintainers of the following boards using smc911x AFAIK:
>  - sh2007: Guennadi and Hitoshi

(I noticed my previous mail was bounced, so sending it again)

Really sorry, currently I don't have the board :(
Do you have a working board that can be used for testing, Guennadi?

Thanks,
Hitoshi

>  - armadillo5x0: Alberto
>  - imx v6 and imx v7: Fabio
> 
> Cheers.
> 
> -- 
> Robert
> 
> 
> ---8<---
> From: Robert Jarzmik 
> Subject: [PATCH] net: smc911x: convert pxa dma to dmaengine
> To: "David S. Miller" 
> Cc: netdev@vger.kernel.org, linux-ker...@vger.kernel.org, Robert Jarzmik 
> 
> Date: Mon, 30 Nov 2015 22:40:28 +0100 (9 weeks, 4 days, 11 hours ago)
> Message-Id: <1448919628-13273-1-git-send-email-robert.jarz...@free.fr>
> X-Mailer: git-send-email 2.1.4
> 
> Convert the dma transfers to be dmaengine based, now pxa has a dmaengine
> slave driver. This makes this driver a bit more PXA agnostic.
> 
> The driver was only compile tested. The risk is quite small as no
> current PXA platform I'm aware of is using smc911x driver.
> 
> Signed-off-by: Robert Jarzmik 
> ---
>  drivers/net/ethernet/smsc/smc911x.c | 85 
> -
>  drivers/net/ethernet/smsc/smc911x.h | 63 ---
>  2 files changed, 82 insertions(+), 66 deletions(-)
> 
> diff --git a/drivers/net/ethernet/smsc/smc911x.c 
> b/drivers/net/ethernet/smsc/smc911x.c
> index bd64eb982e52..3f5711061432 100644
> --- a/drivers/net/ethernet/smsc/smc911x.c
> +++ b/drivers/net/ethernet/smsc/smc911x.c
> @@ -73,6 +73,9 @@ static const char version[] =
>  #include 
>  #include 
>  
> +#include 
> +#include 
> +
>  #include 
>  
>  #include "smc911x.h"
> @@ -1174,18 +1177,16 @@ static irqreturn_t smc911x_interrupt(int irq, void 
> *dev_id)
>  
>  #ifdef SMC_USE_DMA
>  static void
> -smc911x_tx_dma_irq(int dma, void *data)
> +smc911x_tx_dma_irq(void *data)
>  {
> - struct net_device *dev = (struct net_device *)data;
> - struct smc911x_local *lp = netdev_priv(dev);
> + struct smc911x_local *lp = data;
> + struct net_device *dev = lp->netdev;
>   struct sk_buff *skb = lp->current_tx_skb;
>   unsigned long flags;
>  
>   DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
>  
>   DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, dev, "TX DMA irq handler\n");
> - /* Clear the DMA interrupt sources */
> - SMC_DMA_ACK_IRQ(dev, dma);
>   BUG_ON(skb == NULL);
>   dma_unmap_single(NULL, tx_dmabuf, tx_dmalen, DMA_TO_DEVICE);
>   dev->trans_start = jiffies;
> @@ -1208,18 +1209,16 @@ smc911x_tx_dma_irq(int dma, void *data)
>   "TX DMA irq completed\n");
>  }
>  static void
> -smc911x_rx_dma_irq(int dma, void *data)
> +smc911x_rx_dma_irq(void *data)
>  {
> - struct net_device *dev = (struct net_device *)data;
> - struct smc911x_local *lp = netdev_priv(dev);
> + struct smc911x_local *lp = data;
> + struct net_device *dev = lp->netdev;
>   struct sk_buff *skb = lp->current_rx_skb;
>   unsigned long flags;
>   unsigned int pkts;
>  
>   DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
>   DBG(SMC_DEBUG_RX | SMC_DEBUG_DMA, dev, "RX DMA irq handler\n");
> - /* Clear the DMA interrupt sources */
> - SMC_DMA_ACK_IRQ(dev, dma);
>   dma_unmap_single(NULL, rx_dmabuf, rx_dmalen, DMA_FROM_DEVICE);
>   BUG_ON(skb == NULL);
>   lp->current_rx_skb = NULL;
> @@ -1792,6 +1791,9 @@ static int smc911x_probe(struct net_device *dev)
>   unsigned int val, chip_id, revision;
>   const char *version_string;
>   unsigned long irq_flags;
> + struct dma_slave_config config;
> + dma_cap_mask_t mask;
> + struct pxad_param param;
>  
>   DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
>  
> @@ -1963,11 +1965,40 @@ static int smc911x_probe(struct net_device *dev)
>   goto err_out;
>  
>  #ifdef SMC_USE_DMA
> - lp->rxdma = SMC_DMA_REQUEST(dev, smc911x_rx_dma_irq);
> - lp->txdma = SMC_DMA_REQUEST(dev, smc911x_tx_dma_irq);
> +
> + dma_cap_zero(mask);
> + dma_cap_set(DMA_SLAVE, mask);
> + param.prio = PXAD_PRIO_LOWEST;
> + param.drcmr = -1UL;
> +
> +

[net-next][PATCH 03/13] MAINTAINERS: update RDS entry

2016-02-20 Thread Santosh Shilimkar
Acked-by: Chien Yen 
Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 MAINTAINERS | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 355e1c8..9d79bea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9081,10 +9081,14 @@ S:  Maintained
 F: drivers/net/ethernet/rdc/r6040.c
 
 RDS - RELIABLE DATAGRAM SOCKETS
-M: Chien Yen 
+M: Santosh Shilimkar 
+L: netdev@vger.kernel.org
+L: linux-r...@vger.kernel.org
 L: rds-de...@oss.oracle.com (moderated for non-subscribers)
+W: https://oss.oracle.com/projects/rds/
 S: Supported
 F: net/rds/
+F: Documentation/networking/rds.txt
 
 READ-COPY UPDATE (RCU)
 M: "Paul E. McKenney" 
-- 
1.9.1



[net-next][PATCH 12/13] RDS: IB: allocate extra space on queues for FRMR support

2016-02-20 Thread Santosh Shilimkar
Fastreg MR(FRMR) memory registration and invalidation makes use
of work request and completion queues for its operation. Patch
allocates extra queue space towards these operation(s).

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/ib.h|  4 
 net/rds/ib_cm.c | 16 
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/net/rds/ib.h b/net/rds/ib.h
index c5eddc2..eeb0d6c 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -14,6 +14,7 @@
 
 #define RDS_IB_DEFAULT_RECV_WR 1024
 #define RDS_IB_DEFAULT_SEND_WR 256
+#define RDS_IB_DEFAULT_FR_WR   512
 
 #define RDS_IB_DEFAULT_RETRY_COUNT 2
 
@@ -122,6 +123,9 @@ struct rds_ib_connection {
struct ib_wci_send_wc[RDS_IB_WC_MAX];
struct ib_wci_recv_wc[RDS_IB_WC_MAX];
 
+   /* To control the number of wrs from fastreg */
+   atomic_ti_fastreg_wrs;
+
/* interrupt handling */
struct tasklet_struct   i_send_tasklet;
struct tasklet_struct   i_recv_tasklet;
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 7f68abc..83f4673 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -363,7 +363,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
struct ib_qp_init_attr attr;
struct ib_cq_init_attr cq_attr = {};
struct rds_ib_device *rds_ibdev;
-   int ret;
+   int ret, fr_queue_space;
 
/*
 * It's normal to see a null device if an incoming connection races
@@ -373,6 +373,12 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
if (!rds_ibdev)
return -EOPNOTSUPP;
 
+   /* The fr_queue_space is currently set to 512, to add extra space on
+* completion queue and send queue. This extra space is used for FRMR
+* registration and invalidation work requests
+*/
+   fr_queue_space = (rds_ibdev->use_fastreg ? RDS_IB_DEFAULT_FR_WR : 0);
+
/* add the conn now so that connection establishment has the dev */
rds_ib_add_conn(rds_ibdev, conn);
 
@@ -384,7 +390,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
/* Protection domain and memory range */
ic->i_pd = rds_ibdev->pd;
 
-   cq_attr.cqe = ic->i_send_ring.w_nr + 1;
+   cq_attr.cqe = ic->i_send_ring.w_nr + fr_queue_space + 1;
 
ic->i_send_cq = ib_create_cq(dev, rds_ib_cq_comp_handler_send,
 rds_ib_cq_event_handler, conn,
@@ -424,7 +430,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
attr.event_handler = rds_ib_qp_event_handler;
attr.qp_context = conn;
/* + 1 to allow for the single ack message */
-   attr.cap.max_send_wr = ic->i_send_ring.w_nr + 1;
+   attr.cap.max_send_wr = ic->i_send_ring.w_nr + fr_queue_space + 1;
attr.cap.max_recv_wr = ic->i_recv_ring.w_nr + 1;
attr.cap.max_send_sge = rds_ibdev->max_sge;
attr.cap.max_recv_sge = RDS_IB_RECV_SGE;
@@ -432,6 +438,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
attr.qp_type = IB_QPT_RC;
attr.send_cq = ic->i_send_cq;
attr.recv_cq = ic->i_recv_cq;
+   atomic_set(&ic->i_fastreg_wrs, RDS_IB_DEFAULT_FR_WR);
 
/*
 * XXX this can fail if max_*_wr is too large?  Are we supposed
@@ -751,7 +758,8 @@ void rds_ib_conn_shutdown(struct rds_connection *conn)
 */
wait_event(rds_ib_ring_empty_wait,
   rds_ib_ring_empty(&ic->i_recv_ring) &&
-  (atomic_read(&ic->i_signaled_sends) == 0));
+  (atomic_read(&ic->i_signaled_sends) == 0) &&
+  (atomic_read(&ic->i_fastreg_wrs) == 
RDS_IB_DEFAULT_FR_WR));
tasklet_kill(&ic->i_send_tasklet);
tasklet_kill(&ic->i_recv_tasklet);
 
-- 
1.9.1



[net-next][PATCH 01/13] RDS: Drop stale iWARP RDMA transport

2016-02-20 Thread Santosh Shilimkar
RDS iWarp support code has become stale and non testable. As
indicated earlier, am dropping the support for it.

If new iWarp user(s) shows up in future, we can adapat the RDS IB
transprt for the special RDMA READ sink case. iWarp needs an MR
for the RDMA READ sink.

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 Documentation/networking/rds.txt |   4 +-
 net/rds/Kconfig  |   7 +-
 net/rds/Makefile |   4 +-
 net/rds/iw.c | 312 -
 net/rds/iw.h | 398 
 net/rds/iw_cm.c  | 769 --
 net/rds/iw_rdma.c| 837 -
 net/rds/iw_recv.c| 904 
 net/rds/iw_ring.c| 169 ---
 net/rds/iw_send.c| 981 ---
 net/rds/iw_stats.c   |  95 
 net/rds/iw_sysctl.c  | 123 -
 net/rds/rdma_transport.c |  13 +-
 net/rds/rdma_transport.h |   5 -
 14 files changed, 7 insertions(+), 4614 deletions(-)
 delete mode 100644 net/rds/iw.c
 delete mode 100644 net/rds/iw.h
 delete mode 100644 net/rds/iw_cm.c
 delete mode 100644 net/rds/iw_rdma.c
 delete mode 100644 net/rds/iw_recv.c
 delete mode 100644 net/rds/iw_ring.c
 delete mode 100644 net/rds/iw_send.c
 delete mode 100644 net/rds/iw_stats.c
 delete mode 100644 net/rds/iw_sysctl.c

diff --git a/Documentation/networking/rds.txt b/Documentation/networking/rds.txt
index e1a3d59..9d219d8 100644
--- a/Documentation/networking/rds.txt
+++ b/Documentation/networking/rds.txt
@@ -19,9 +19,7 @@ to N*N if you use a connection-oriented socket transport like 
TCP.
 
 RDS is not Infiniband-specific; it was designed to support different
 transports.  The current implementation used to support RDS over TCP as well
-as IB. Work is in progress to support RDS over iWARP, and using DCE to
-guarantee no dropped packets on Ethernet, it may be possible to use RDS over
-UDP in the future.
+as IB.
 
 The high-level semantics of RDS from the application's point of view are
 
diff --git a/net/rds/Kconfig b/net/rds/Kconfig
index f2c670b..bffde4b 100644
--- a/net/rds/Kconfig
+++ b/net/rds/Kconfig
@@ -4,14 +4,13 @@ config RDS
depends on INET
---help---
  The RDS (Reliable Datagram Sockets) protocol provides reliable,
- sequenced delivery of datagrams over Infiniband, iWARP,
- or TCP.
+ sequenced delivery of datagrams over Infiniband or TCP.
 
 config RDS_RDMA
-   tristate "RDS over Infiniband and iWARP"
+   tristate "RDS over Infiniband"
depends on RDS && INFINIBAND && INFINIBAND_ADDR_TRANS
---help---
- Allow RDS to use Infiniband and iWARP as a transport.
+ Allow RDS to use Infiniband as a transport.
  This transport supports RDMA operations.
 
 config RDS_TCP
diff --git a/net/rds/Makefile b/net/rds/Makefile
index 56d3f60..19e5485 100644
--- a/net/rds/Makefile
+++ b/net/rds/Makefile
@@ -6,9 +6,7 @@ rds-y :=af_rds.o bind.o cong.o connection.o info.o 
message.o   \
 obj-$(CONFIG_RDS_RDMA) += rds_rdma.o
 rds_rdma-y :=  rdma_transport.o \
ib.o ib_cm.o ib_recv.o ib_ring.o ib_send.o ib_stats.o \
-   ib_sysctl.o ib_rdma.o \
-   iw.o iw_cm.o iw_recv.o iw_ring.o iw_send.o iw_stats.o \
-   iw_sysctl.o iw_rdma.o
+   ib_sysctl.o ib_rdma.o
 
 
 obj-$(CONFIG_RDS_TCP) += rds_tcp.o
diff --git a/net/rds/iw.c b/net/rds/iw.c
deleted file mode 100644
index f4a9fff..000
diff --git a/net/rds/iw.h b/net/rds/iw.h
deleted file mode 100644
index 5af01d1..000
diff --git a/net/rds/iw_cm.c b/net/rds/iw_cm.c
deleted file mode 100644
index aea4c91..000
diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c
deleted file mode 100644
index b09a40c..000
diff --git a/net/rds/iw_recv.c b/net/rds/iw_recv.c
deleted file mode 100644
index a66d179..000
diff --git a/net/rds/iw_ring.c b/net/rds/iw_ring.c
deleted file mode 100644
index da8e3b6..000
diff --git a/net/rds/iw_send.c b/net/rds/iw_send.c
deleted file mode 100644
index e20bd50..000
diff --git a/net/rds/iw_stats.c b/net/rds/iw_stats.c
deleted file mode 100644
index 5fe67f6..000
diff --git a/net/rds/iw_sysctl.c b/net/rds/iw_sysctl.c
deleted file mode 100644
index 139239d..000
diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c
index 9c1fed8..4f4b3d8 100644
--- a/net/rds/rdma_transport.c
+++ b/net/rds/rdma_transport.c
@@ -49,9 +49,7 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
rdsdebug("conn %p id %p handling event %u (%s)\n", conn, cm_id,
 event->event, rdma_event_msg(event->event));
 
-   if (cm_id->device->node_type == RDMA_NODE_RNIC)
-   trans = &rds_iw_transport;
-   else
+   if (cm_id->device->node_type == RDMA_NODE_IB

[net-next][PATCH 09/13] RDS: IB: handle the RDMA CM time wait event

2016-02-20 Thread Santosh Shilimkar
Drop the RDS connection on RDMA_CM_EVENT_TIMEWAIT_EXIT so that
it can reconnect and resume.

While testing fastreg, this error happened in couple of tests but
was getting un-noticed.

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/rdma_transport.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c
index 4f4b3d8..7220beb 100644
--- a/net/rds/rdma_transport.c
+++ b/net/rds/rdma_transport.c
@@ -117,6 +117,14 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
rds_conn_drop(conn);
break;
 
+   case RDMA_CM_EVENT_TIMEWAIT_EXIT:
+   if (conn) {
+   pr_info("RDS: RDMA_CM_EVENT_TIMEWAIT_EXIT event: 
dropping connection %pI4->%pI4\n",
+   &conn->c_laddr, &conn->c_faddr);
+   rds_conn_drop(conn);
+   }
+   break;
+
default:
/* things like device disconnect? */
printk(KERN_ERR "RDS: unknown event %u (%s)!\n",
-- 
1.9.1



[net-next][PATCH 10/13] RDS: IB: add mr reused stats

2016-02-20 Thread Santosh Shilimkar
Add MR reuse statistics to RDS IB transport.

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/ib.h   | 2 ++
 net/rds/ib_rdma.c  | 7 ++-
 net/rds/ib_stats.c | 2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/rds/ib.h b/net/rds/ib.h
index c88cb22..62fe7d5 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -259,6 +259,8 @@ struct rds_ib_statistics {
uint64_ts_ib_rdma_mr_1m_pool_flush;
uint64_ts_ib_rdma_mr_1m_pool_wait;
uint64_ts_ib_rdma_mr_1m_pool_depleted;
+   uint64_ts_ib_rdma_mr_8k_reused;
+   uint64_ts_ib_rdma_mr_1m_reused;
uint64_ts_ib_atomic_cswp;
uint64_ts_ib_atomic_fadd;
 };
diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
index 20ff191..00e9064 100644
--- a/net/rds/ib_rdma.c
+++ b/net/rds/ib_rdma.c
@@ -188,8 +188,13 @@ struct rds_ib_mr *rds_ib_reuse_mr(struct rds_ib_mr_pool 
*pool)
flag = this_cpu_ptr(&clean_list_grace);
set_bit(CLEAN_LIST_BUSY_BIT, flag);
ret = llist_del_first(&pool->clean_list);
-   if (ret)
+   if (ret) {
ibmr = llist_entry(ret, struct rds_ib_mr, llnode);
+   if (pool->pool_type == RDS_IB_MR_8K_POOL)
+   rds_ib_stats_inc(s_ib_rdma_mr_8k_reused);
+   else
+   rds_ib_stats_inc(s_ib_rdma_mr_1m_reused);
+   }
 
clear_bit(CLEAN_LIST_BUSY_BIT, flag);
preempt_enable();
diff --git a/net/rds/ib_stats.c b/net/rds/ib_stats.c
index d77e044..7e78dca 100644
--- a/net/rds/ib_stats.c
+++ b/net/rds/ib_stats.c
@@ -73,6 +73,8 @@ static const char *const rds_ib_stat_names[] = {
"ib_rdma_mr_1m_pool_flush",
"ib_rdma_mr_1m_pool_wait",
"ib_rdma_mr_1m_pool_depleted",
+   "ib_rdma_mr_8k_reused",
+   "ib_rdma_mr_1m_reused",
"ib_atomic_cswp",
"ib_atomic_fadd",
 };
-- 
1.9.1



[net-next][PATCH 04/13] RDS: IB: Remove the RDS_IB_SEND_OP dependency

2016-02-20 Thread Santosh Shilimkar
This helps to combine asynchronous fastreg MR completion handler
with send completion handler.

No functional change.

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/ib.h  |  1 -
 net/rds/ib_cm.c   | 42 +++---
 net/rds/ib_send.c |  6 ++
 3 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/net/rds/ib.h b/net/rds/ib.h
index b3fdebb..09cd8e3 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -28,7 +28,6 @@
 #define RDS_IB_RECYCLE_BATCH_COUNT 32
 
 #define RDS_IB_WC_MAX  32
-#define RDS_IB_SEND_OP BIT_ULL(63)
 
 extern struct rw_semaphore rds_ib_devices_lock;
 extern struct list_head rds_ib_devices;
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index da5a7fb..7f68abc 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -236,12 +236,10 @@ static void rds_ib_cq_comp_handler_recv(struct ib_cq *cq, 
void *context)
tasklet_schedule(&ic->i_recv_tasklet);
 }
 
-static void poll_cq(struct rds_ib_connection *ic, struct ib_cq *cq,
-   struct ib_wc *wcs,
-   struct rds_ib_ack_state *ack_state)
+static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,
+struct ib_wc *wcs)
 {
-   int nr;
-   int i;
+   int nr, i;
struct ib_wc *wc;
 
while ((nr = ib_poll_cq(cq, RDS_IB_WC_MAX, wcs)) > 0) {
@@ -251,10 +249,7 @@ static void poll_cq(struct rds_ib_connection *ic, struct 
ib_cq *cq,
 (unsigned long long)wc->wr_id, wc->status,
 wc->byte_len, be32_to_cpu(wc->ex.imm_data));
 
-   if (wc->wr_id & RDS_IB_SEND_OP)
-   rds_ib_send_cqe_handler(ic, wc);
-   else
-   rds_ib_recv_cqe_handler(ic, wc, ack_state);
+   rds_ib_send_cqe_handler(ic, wc);
}
}
 }
@@ -263,14 +258,12 @@ static void rds_ib_tasklet_fn_send(unsigned long data)
 {
struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
struct rds_connection *conn = ic->conn;
-   struct rds_ib_ack_state state;
 
rds_ib_stats_inc(s_ib_tasklet_call);
 
-   memset(&state, 0, sizeof(state));
-   poll_cq(ic, ic->i_send_cq, ic->i_send_wc, &state);
+   poll_scq(ic, ic->i_send_cq, ic->i_send_wc);
ib_req_notify_cq(ic->i_send_cq, IB_CQ_NEXT_COMP);
-   poll_cq(ic, ic->i_send_cq, ic->i_send_wc, &state);
+   poll_scq(ic, ic->i_send_cq, ic->i_send_wc);
 
if (rds_conn_up(conn) &&
(!test_bit(RDS_LL_SEND_FULL, &conn->c_flags) ||
@@ -278,6 +271,25 @@ static void rds_ib_tasklet_fn_send(unsigned long data)
rds_send_xmit(ic->conn);
 }
 
+static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,
+struct ib_wc *wcs,
+struct rds_ib_ack_state *ack_state)
+{
+   int nr, i;
+   struct ib_wc *wc;
+
+   while ((nr = ib_poll_cq(cq, RDS_IB_WC_MAX, wcs)) > 0) {
+   for (i = 0; i < nr; i++) {
+   wc = wcs + i;
+   rdsdebug("wc wr_id 0x%llx status %u byte_len %u 
imm_data %u\n",
+(unsigned long long)wc->wr_id, wc->status,
+wc->byte_len, be32_to_cpu(wc->ex.imm_data));
+
+   rds_ib_recv_cqe_handler(ic, wc, ack_state);
+   }
+   }
+}
+
 static void rds_ib_tasklet_fn_recv(unsigned long data)
 {
struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
@@ -291,9 +303,9 @@ static void rds_ib_tasklet_fn_recv(unsigned long data)
rds_ib_stats_inc(s_ib_tasklet_call);
 
memset(&state, 0, sizeof(state));
-   poll_cq(ic, ic->i_recv_cq, ic->i_recv_wc, &state);
+   poll_rcq(ic, ic->i_recv_cq, ic->i_recv_wc, &state);
ib_req_notify_cq(ic->i_recv_cq, IB_CQ_SOLICITED);
-   poll_cq(ic, ic->i_recv_cq, ic->i_recv_wc, &state);
+   poll_rcq(ic, ic->i_recv_cq, ic->i_recv_wc, &state);
 
if (state.ack_next_valid)
rds_ib_set_ack(ic, state.ack_next, state.ack_required);
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c
index eac30bf..f27d2c8 100644
--- a/net/rds/ib_send.c
+++ b/net/rds/ib_send.c
@@ -195,7 +195,7 @@ void rds_ib_send_init_ring(struct rds_ib_connection *ic)
 
send->s_op = NULL;
 
-   send->s_wr.wr_id = i | RDS_IB_SEND_OP;
+   send->s_wr.wr_id = i;
send->s_wr.sg_list = send->s_sge;
send->s_wr.ex.imm_data = 0;
 
@@ -263,9 +263,7 @@ void rds_ib_send_cqe_handler(struct rds_ib_connection *ic, 
struct ib_wc *wc)
 
oldest = rds_ib_ring_oldest(&ic->i_send_ring);
 
-   completed = rds_ib_ring_completed(&ic->i_send_ring,
- (wc->wr_id & ~RDS_IB_SEND_OP),
- oldest);
+   compl

[net-next][PATCH 07/13] RDS: IB: move FMR code to its own file

2016-02-20 Thread Santosh Shilimkar
No functional change.

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/ib_fmr.c  | 126 +-
 net/rds/ib_mr.h   |   6 +++
 net/rds/ib_rdma.c | 105 ++---
 3 files changed, 133 insertions(+), 104 deletions(-)

diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c
index 74f2c21..4fe8f4f 100644
--- a/net/rds/ib_fmr.c
+++ b/net/rds/ib_fmr.c
@@ -37,61 +37,16 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device 
*rds_ibdev, int npages)
struct rds_ib_mr_pool *pool;
struct rds_ib_mr *ibmr = NULL;
struct rds_ib_fmr *fmr;
-   int err = 0, iter = 0;
+   int err = 0;
 
if (npages <= RDS_MR_8K_MSG_SIZE)
pool = rds_ibdev->mr_8k_pool;
else
pool = rds_ibdev->mr_1m_pool;
 
-   if (atomic_read(&pool->dirty_count) >= pool->max_items / 10)
-   queue_delayed_work(rds_ib_mr_wq, &pool->flush_worker, 10);
-
-   /* Switch pools if one of the pool is reaching upper limit */
-   if (atomic_read(&pool->dirty_count) >=  pool->max_items * 9 / 10) {
-   if (pool->pool_type == RDS_IB_MR_8K_POOL)
-   pool = rds_ibdev->mr_1m_pool;
-   else
-   pool = rds_ibdev->mr_8k_pool;
-   }
-
-   while (1) {
-   ibmr = rds_ib_reuse_mr(pool);
-   if (ibmr)
-   return ibmr;
-
-   /* No clean MRs - now we have the choice of either
-* allocating a fresh MR up to the limit imposed by the
-* driver, or flush any dirty unused MRs.
-* We try to avoid stalling in the send path if possible,
-* so we allocate as long as we're allowed to.
-*
-* We're fussy with enforcing the FMR limit, though. If the
-* driver tells us we can't use more than N fmrs, we shouldn't
-* start arguing with it
-*/
-   if (atomic_inc_return(&pool->item_count) <= pool->max_items)
-   break;
-
-   atomic_dec(&pool->item_count);
-
-   if (++iter > 2) {
-   if (pool->pool_type == RDS_IB_MR_8K_POOL)
-   rds_ib_stats_inc(s_ib_rdma_mr_8k_pool_depleted);
-   else
-   rds_ib_stats_inc(s_ib_rdma_mr_1m_pool_depleted);
-   return ERR_PTR(-EAGAIN);
-   }
-
-   /* We do have some empty MRs. Flush them out. */
-   if (pool->pool_type == RDS_IB_MR_8K_POOL)
-   rds_ib_stats_inc(s_ib_rdma_mr_8k_pool_wait);
-   else
-   rds_ib_stats_inc(s_ib_rdma_mr_1m_pool_wait);
-   rds_ib_flush_mr_pool(pool, 0, &ibmr);
-   if (ibmr)
-   return ibmr;
-   }
+   ibmr = rds_ib_try_reuse_ibmr(pool);
+   if (ibmr)
+   return ibmr;
 
ibmr = kzalloc_node(sizeof(*ibmr), GFP_KERNEL,
rdsibdev_to_node(rds_ibdev));
@@ -218,3 +173,76 @@ out:
 
return ret;
 }
+
+struct rds_ib_mr *rds_ib_reg_fmr(struct rds_ib_device *rds_ibdev,
+struct scatterlist *sg,
+unsigned long nents,
+u32 *key)
+{
+   struct rds_ib_mr *ibmr = NULL;
+   struct rds_ib_fmr *fmr;
+   int ret;
+
+   ibmr = rds_ib_alloc_fmr(rds_ibdev, nents);
+   if (IS_ERR(ibmr))
+   return ibmr;
+
+   ibmr->device = rds_ibdev;
+   fmr = &ibmr->u.fmr;
+   ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents);
+   if (ret == 0)
+   *key = fmr->fmr->rkey;
+   else
+   rds_ib_free_mr(ibmr, 0);
+
+   return ibmr;
+}
+
+void rds_ib_unreg_fmr(struct list_head *list, unsigned int *nfreed,
+ unsigned long *unpinned, unsigned int goal)
+{
+   struct rds_ib_mr *ibmr, *next;
+   struct rds_ib_fmr *fmr;
+   LIST_HEAD(fmr_list);
+   int ret = 0;
+   unsigned int freed = *nfreed;
+
+   /* String all ib_mr's onto one list and hand them to  ib_unmap_fmr */
+   list_for_each_entry(ibmr, list, unmap_list) {
+   fmr = &ibmr->u.fmr;
+   list_add(&fmr->fmr->list, &fmr_list);
+   }
+
+   ret = ib_unmap_fmr(&fmr_list);
+   if (ret)
+   pr_warn("RDS/IB: FMR invalidation failed (err=%d)\n", ret);
+
+   /* Now we can destroy the DMA mapping and unpin any pages */
+   list_for_each_entry_safe(ibmr, next, list, unmap_list) {
+   fmr = &ibmr->u.fmr;
+   *unpinned += ibmr->sg_len;
+   __rds_ib_teardown_mr(ibmr);
+   if (freed < goal ||
+   ibmr->remap_count >= ibmr->pool->fmr_attr.max_maps) {
+   if (ibmr->p

[net-next][PATCH 13/13] RDS: IB: Support Fastreg MR (FRMR) memory registration mode

2016-02-20 Thread Santosh Shilimkar
From: Avinash Repaka 

Fastreg MR(FRMR) is another method with which one can
register memory to HCA. Some of the newer HCAs supports only fastreg
mr mode, so we need to add support for it to RDS to have RDS functional
on them.

Some of the older HCAs support both FMR and FRMR modes. So to try out
FRMR on older HCAs, one can use module parameter 'prefer_frmr'

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Avinash Repaka 
Signed-off-by: Santosh Shilimkar 
---
RDS IB RDMA performance with FRMR is not yet as good as FMR and I do have
some patches in progress to address that. But they are not ready for 4.6
so I left them out of this series. 

 net/rds/Makefile  |   2 +-
 net/rds/ib.h  |   1 +
 net/rds/ib_cm.c   |   7 +-
 net/rds/ib_frmr.c | 376 ++
 net/rds/ib_mr.h   |  24 
 net/rds/ib_rdma.c |  17 ++-
 6 files changed, 422 insertions(+), 5 deletions(-)
 create mode 100644 net/rds/ib_frmr.c

diff --git a/net/rds/Makefile b/net/rds/Makefile
index bcf5591..0e72bec 100644
--- a/net/rds/Makefile
+++ b/net/rds/Makefile
@@ -6,7 +6,7 @@ rds-y :=af_rds.o bind.o cong.o connection.o info.o 
message.o   \
 obj-$(CONFIG_RDS_RDMA) += rds_rdma.o
 rds_rdma-y :=  rdma_transport.o \
ib.o ib_cm.o ib_recv.o ib_ring.o ib_send.o ib_stats.o \
-   ib_sysctl.o ib_rdma.o ib_fmr.o
+   ib_sysctl.o ib_rdma.o ib_fmr.o ib_frmr.o
 
 
 obj-$(CONFIG_RDS_TCP) += rds_tcp.o
diff --git a/net/rds/ib.h b/net/rds/ib.h
index eeb0d6c..627fb79 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -349,6 +349,7 @@ int rds_ib_update_ipaddr(struct rds_ib_device *rds_ibdev, 
__be32 ipaddr);
 void rds_ib_add_conn(struct rds_ib_device *rds_ibdev, struct rds_connection 
*conn);
 void rds_ib_remove_conn(struct rds_ib_device *rds_ibdev, struct rds_connection 
*conn);
 void rds_ib_destroy_nodev_conns(void);
+void rds_ib_mr_cqe_handler(struct rds_ib_connection *ic, struct ib_wc *wc);
 
 /* ib_recv.c */
 int rds_ib_recv_init(void);
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 83f4673..8764970 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -249,7 +249,12 @@ static void poll_scq(struct rds_ib_connection *ic, struct 
ib_cq *cq,
 (unsigned long long)wc->wr_id, wc->status,
 wc->byte_len, be32_to_cpu(wc->ex.imm_data));
 
-   rds_ib_send_cqe_handler(ic, wc);
+   if (wc->wr_id <= ic->i_send_ring.w_nr ||
+   wc->wr_id == RDS_IB_ACK_WR_ID)
+   rds_ib_send_cqe_handler(ic, wc);
+   else
+   rds_ib_mr_cqe_handler(ic, wc);
+
}
}
 }
diff --git a/net/rds/ib_frmr.c b/net/rds/ib_frmr.c
new file mode 100644
index 000..a86de13
--- /dev/null
+++ b/net/rds/ib_frmr.c
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2016 Oracle.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * 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.
+ */
+
+#include "ib_mr.h"
+
+static struct rds_ib_mr *rds_ib_alloc_frmr(struct rds_ib_device *rds_ibdev,
+  int npages)
+{
+   struct rds_ib_mr_pool *pool;
+   struct rds_ib_mr *ibmr = NULL;
+   struct rds_ib_frmr *frmr;
+   int err = 0;
+
+   if (npages <= RDS_MR_8K_MSG_SIZE)
+   pool = rds_ibdev->mr_8k_pool;
+   else
+   pool = rds_ibdev->mr_1m_pool;
+
+   ibmr = rds_ib_try_reuse_ibmr(pool);
+   if (ibmr)
+   return ibmr;
+
+   ibmr = kzalloc_node(sizeof(*ibmr), GFP_KERNEL,
+   rdsibdev

[net-next][PATCH 08/13] RDS: IB: add connection info to ibmr

2016-02-20 Thread Santosh Shilimkar
Preperatory patch for FRMR support. From connection info,
we can retrieve cm_id which contains qp handled needed for
work request posting.

We also need to drop the RDS connection on QP error states
where connection handle becomes useful.

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/ib_mr.h | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/net/rds/ib_mr.h b/net/rds/ib_mr.h
index f5c1fcb..add7725 100644
--- a/net/rds/ib_mr.h
+++ b/net/rds/ib_mr.h
@@ -50,18 +50,19 @@ struct rds_ib_fmr {
 
 /* This is stored as mr->r_trans_private. */
 struct rds_ib_mr {
-   struct rds_ib_device*device;
-   struct rds_ib_mr_pool   *pool;
+   struct rds_ib_device*device;
+   struct rds_ib_mr_pool   *pool;
+   struct rds_ib_connection*ic;
 
-   struct llist_node   llnode;
+   struct llist_node   llnode;
 
/* unmap_list is for freeing */
-   struct list_headunmap_list;
-   unsigned intremap_count;
+   struct list_headunmap_list;
+   unsigned intremap_count;
 
-   struct scatterlist  *sg;
-   unsigned intsg_len;
-   int sg_dma_len;
+   struct scatterlist  *sg;
+   unsigned intsg_len;
+   int sg_dma_len;
 
union {
struct rds_ib_fmr   fmr;
-- 
1.9.1



[net-next][PATCH 06/13] RDS: IB: create struct rds_ib_fmr

2016-02-20 Thread Santosh Shilimkar
Keep fmr related filed in its own struct. Fastreg MR structure
will be added to the union.

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/ib_fmr.c  | 17 ++---
 net/rds/ib_mr.h   | 11 +--
 net/rds/ib_rdma.c | 14 ++
 3 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c
index d4f200d..74f2c21 100644
--- a/net/rds/ib_fmr.c
+++ b/net/rds/ib_fmr.c
@@ -36,6 +36,7 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device 
*rds_ibdev, int npages)
 {
struct rds_ib_mr_pool *pool;
struct rds_ib_mr *ibmr = NULL;
+   struct rds_ib_fmr *fmr;
int err = 0, iter = 0;
 
if (npages <= RDS_MR_8K_MSG_SIZE)
@@ -99,15 +100,16 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device 
*rds_ibdev, int npages)
goto out_no_cigar;
}
 
-   ibmr->fmr = ib_alloc_fmr(rds_ibdev->pd,
+   fmr = &ibmr->u.fmr;
+   fmr->fmr = ib_alloc_fmr(rds_ibdev->pd,
(IB_ACCESS_LOCAL_WRITE |
 IB_ACCESS_REMOTE_READ |
 IB_ACCESS_REMOTE_WRITE |
 IB_ACCESS_REMOTE_ATOMIC),
&pool->fmr_attr);
-   if (IS_ERR(ibmr->fmr)) {
-   err = PTR_ERR(ibmr->fmr);
-   ibmr->fmr = NULL;
+   if (IS_ERR(fmr->fmr)) {
+   err = PTR_ERR(fmr->fmr);
+   fmr->fmr = NULL;
pr_warn("RDS/IB: %s failed (err=%d)\n", __func__, err);
goto out_no_cigar;
}
@@ -122,8 +124,8 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device 
*rds_ibdev, int npages)
 
 out_no_cigar:
if (ibmr) {
-   if (ibmr->fmr)
-   ib_dealloc_fmr(ibmr->fmr);
+   if (fmr->fmr)
+   ib_dealloc_fmr(fmr->fmr);
kfree(ibmr);
}
atomic_dec(&pool->item_count);
@@ -134,6 +136,7 @@ int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, struct 
rds_ib_mr *ibmr,
   struct scatterlist *sg, unsigned int nents)
 {
struct ib_device *dev = rds_ibdev->dev;
+   struct rds_ib_fmr *fmr = &ibmr->u.fmr;
struct scatterlist *scat = sg;
u64 io_addr = 0;
u64 *dma_pages;
@@ -190,7 +193,7 @@ int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, struct 
rds_ib_mr *ibmr,
(dma_addr & PAGE_MASK) + j;
}
 
-   ret = ib_map_phys_fmr(ibmr->fmr, dma_pages, page_cnt, io_addr);
+   ret = ib_map_phys_fmr(fmr->fmr, dma_pages, page_cnt, io_addr);
if (ret)
goto out;
 
diff --git a/net/rds/ib_mr.h b/net/rds/ib_mr.h
index d88724f..309ad59 100644
--- a/net/rds/ib_mr.h
+++ b/net/rds/ib_mr.h
@@ -43,11 +43,15 @@
 #define RDS_MR_8K_SCALE(256 / (RDS_MR_8K_MSG_SIZE + 1))
 #define RDS_MR_8K_POOL_SIZE(RDS_MR_8K_SCALE * (8192 / 2))
 
+struct rds_ib_fmr {
+   struct ib_fmr   *fmr;
+   u64 *dma;
+};
+
 /* This is stored as mr->r_trans_private. */
 struct rds_ib_mr {
struct rds_ib_device*device;
struct rds_ib_mr_pool   *pool;
-   struct ib_fmr   *fmr;
 
struct llist_node   llnode;
 
@@ -57,8 +61,11 @@ struct rds_ib_mr {
 
struct scatterlist  *sg;
unsigned intsg_len;
-   u64 *dma;
int sg_dma_len;
+
+   union {
+   struct rds_ib_fmr   fmr;
+   } u;
 };
 
 /* Our own little MR pool */
diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
index c594519..9e608d9 100644
--- a/net/rds/ib_rdma.c
+++ b/net/rds/ib_rdma.c
@@ -334,6 +334,7 @@ int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
 int free_all, struct rds_ib_mr **ibmr_ret)
 {
struct rds_ib_mr *ibmr, *next;
+   struct rds_ib_fmr *fmr;
struct llist_node *clean_nodes;
struct llist_node *clean_tail;
LIST_HEAD(unmap_list);
@@ -395,8 +396,10 @@ int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
goto out;
 
/* String all ib_mr's onto one list and hand them to ib_unmap_fmr */
-   list_for_each_entry(ibmr, &unmap_list, unmap_list)
-   list_add(&ibmr->fmr->list, &fmr_list);
+   list_for_each_entry(ibmr, &unmap_list, unmap_list) {
+   fmr = &ibmr->u.fmr;
+   list_add(&fmr->fmr->list, &fmr_list);
+   }
 
ret = ib_unmap_fmr(&fmr_list);
if (ret)
@@ -405,6 +408,7 @@ int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
/* Now we can destroy the DMA mapping and unpin any pages */
list_for_each_entry_safe(ibmr, next, &unmap_list, unmap_list) {
unpinned += ibmr->sg_len;
+   fmr = &ibmr->u.fmr;
__rds_ib_teardown_mr(ibmr);
if (nfreed < free_goal ||
ibmr->remap_count >= pool

[net-next][PATCH 00/13] RDS: Major clean-up with couple of new features for 4.6

2016-02-20 Thread Santosh Shilimkar
Series is generated against net-next but also applies against Linus's tip
cleanly. The diff-stat looks bit scary since almost ~4K lines of code is
getting removed.

Brief summary of the series:

- Drop the stale iWARP support:
RDS iWarp support code has become stale and non testable for
sometime.  As discussed and agreed earlier on list [1], am dropping
its support for good. If new iWarp user(s) shows up in future,
the plan is to adapt existing IB RDMA with special sink case.
- RDS gets SO_TIMESTAMP support
- Long due RDS maintainer entry gets updated
- Some RDS IB code refactoring towards new FastReg Memory registration (FRMR)
- Lastly the initial support for FRMR

RDS IB RDMA performance with FRMR is not yet as good as FMR and I do have
some patches in progress to address that. But they are not ready for 4.6
so I left them out of this series. 

Also am keeping eye on new CQ API adaptations like other ULPs doing and
will try to adapt RDS for the same most likely in 4.7 timeframe. 

Entire patchset is available below git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux.git 
for_4.6/net-next/rds

Feedback/comments welcome !!

Santosh Shilimkar (12):
  RDS: Drop stale iWARP RDMA transport
  RDS: Add support for SO_TIMESTAMP for incoming messages
  MAINTAINERS: update RDS entry
  RDS: IB: Remove the RDS_IB_SEND_OP dependency
  RDS: IB: Re-organise ibmr code
  RDS: IB: create struct rds_ib_fmr
  RDS: IB: move FMR code to its own file
  RDS: IB: add connection info to ibmr
  RDS: IB: handle the RDMA CM time wait event
  RDS: IB: add mr reused stats
  RDS: IB: add Fastreg MR (FRMR) detection support
  RDS: IB: allocate extra space on queues for FRMR support

Avinash Repaka (1):
  RDS: IB: Support Fastreg MR (FRMR) memory registration mode

 Documentation/networking/rds.txt |   4 +-
 MAINTAINERS  |   6 +-
 net/rds/Kconfig  |   7 +-
 net/rds/Makefile |   4 +-
 net/rds/af_rds.c |  26 ++
 net/rds/ib.c |  51 +-
 net/rds/ib.h |  37 +-
 net/rds/ib_cm.c  |  59 ++-
 net/rds/ib_fmr.c | 248 ++
 net/rds/ib_frmr.c| 376 +++
 net/rds/ib_mr.h  | 148 ++
 net/rds/ib_rdma.c| 492 ++--
 net/rds/ib_send.c|   6 +-
 net/rds/ib_stats.c   |   2 +
 net/rds/iw.c | 312 -
 net/rds/iw.h | 398 
 net/rds/iw_cm.c  | 769 --
 net/rds/iw_rdma.c| 837 -
 net/rds/iw_recv.c| 904 
 net/rds/iw_ring.c| 169 ---
 net/rds/iw_send.c| 981 ---
 net/rds/iw_stats.c   |  95 
 net/rds/iw_sysctl.c  | 123 -
 net/rds/rdma_transport.c |  21 +-
 net/rds/rdma_transport.h |   5 -
 net/rds/rds.h|   1 +
 net/rds/recv.c   |  20 +-
 27 files changed, 1068 insertions(+), 5033 deletions(-)
 create mode 100644 net/rds/ib_fmr.c
 create mode 100644 net/rds/ib_frmr.c
 create mode 100644 net/rds/ib_mr.h
 delete mode 100644 net/rds/iw.c
 delete mode 100644 net/rds/iw.h
 delete mode 100644 net/rds/iw_cm.c
 delete mode 100644 net/rds/iw_rdma.c
 delete mode 100644 net/rds/iw_recv.c
 delete mode 100644 net/rds/iw_ring.c
 delete mode 100644 net/rds/iw_send.c
 delete mode 100644 net/rds/iw_stats.c
 delete mode 100644 net/rds/iw_sysctl.c


Regards,
Santosh

[1] http://www.spinics.net/lists/linux-rdma/msg30769.html

-- 
1.9.1



[net-next][PATCH 11/13] RDS: IB: add Fastreg MR (FRMR) detection support

2016-02-20 Thread Santosh Shilimkar
Discovere Fast Memmory Registration support using IB device
IB_DEVICE_MEM_MGT_EXTENSIONS. Certain HCA might support just FRMR
or FMR or both FMR and FRWR. In case both mr type are supported,
default FMR is used. Using module parameter 'prefer_frmr',
user can choose its preferred MR method for RDS. Ofcourse the
module parameter has no effect if the HCA support only FRMR
or only FRMR.

Default MR is still kept as FMR against what everyone else
is following. Default will be changed to FRMR once the
RDS performance with FRMR is comparable with FMR. The
work is in progress for the same.

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/ib.c| 14 ++
 net/rds/ib.h|  4 
 net/rds/ib_mr.h |  1 +
 3 files changed, 19 insertions(+)

diff --git a/net/rds/ib.c b/net/rds/ib.c
index bb32cb9..68c94b0 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -47,6 +47,7 @@
 unsigned int rds_ib_mr_1m_pool_size = RDS_MR_1M_POOL_SIZE;
 unsigned int rds_ib_mr_8k_pool_size = RDS_MR_8K_POOL_SIZE;
 unsigned int rds_ib_retry_count = RDS_IB_DEFAULT_RETRY_COUNT;
+bool prefer_frmr;
 
 module_param(rds_ib_mr_1m_pool_size, int, 0444);
 MODULE_PARM_DESC(rds_ib_mr_1m_pool_size, " Max number of 1M mr per HCA");
@@ -54,6 +55,8 @@ module_param(rds_ib_mr_8k_pool_size, int, 0444);
 MODULE_PARM_DESC(rds_ib_mr_8k_pool_size, " Max number of 8K mr per HCA");
 module_param(rds_ib_retry_count, int, 0444);
 MODULE_PARM_DESC(rds_ib_retry_count, " Number of hw retries before reporting 
an error");
+module_param(prefer_frmr, bool, 0444);
+MODULE_PARM_DESC(prefer_frmr, "Preferred MR method if both FMR and FRMR 
supported");
 
 /*
  * we have a clumsy combination of RCU and a rwsem protecting this list
@@ -140,6 +143,13 @@ static void rds_ib_add_one(struct ib_device *device)
rds_ibdev->max_wrs = device->attrs.max_qp_wr;
rds_ibdev->max_sge = min(device->attrs.max_sge, RDS_IB_MAX_SGE);
 
+   rds_ibdev->has_fr = (device->attrs.device_cap_flags &
+ IB_DEVICE_MEM_MGT_EXTENSIONS);
+   rds_ibdev->has_fmr = (device->alloc_fmr && device->dealloc_fmr &&
+   device->map_phys_fmr && device->unmap_fmr);
+   rds_ibdev->use_fastreg = (rds_ibdev->has_fr &&
+(!rds_ibdev->has_fmr || prefer_frmr));
+
rds_ibdev->fmr_max_remaps = device->attrs.max_map_per_fmr?: 32;
rds_ibdev->max_1m_mrs = device->attrs.max_mr ?
min_t(unsigned int, (device->attrs.max_mr / 2),
@@ -178,6 +188,10 @@ static void rds_ib_add_one(struct ib_device *device)
 rds_ibdev->fmr_max_remaps, rds_ibdev->max_1m_mrs,
 rds_ibdev->max_8k_mrs);
 
+   pr_info("RDS/IB: %s: %s supported and preferred\n",
+   device->name,
+   rds_ibdev->use_fastreg ? "FRMR" : "FMR");
+
INIT_LIST_HEAD(&rds_ibdev->ipaddr_list);
INIT_LIST_HEAD(&rds_ibdev->conn_list);
 
diff --git a/net/rds/ib.h b/net/rds/ib.h
index 62fe7d5..c5eddc2 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -200,6 +200,10 @@ struct rds_ib_device {
struct list_headconn_list;
struct ib_device*dev;
struct ib_pd*pd;
+   boolhas_fmr;
+   boolhas_fr;
+   booluse_fastreg;
+
unsigned intmax_mrs;
struct rds_ib_mr_pool   *mr_1m_pool;
struct rds_ib_mr_pool   *mr_8k_pool;
diff --git a/net/rds/ib_mr.h b/net/rds/ib_mr.h
index add7725..2f9b9c3 100644
--- a/net/rds/ib_mr.h
+++ b/net/rds/ib_mr.h
@@ -93,6 +93,7 @@ struct rds_ib_mr_pool {
 extern struct workqueue_struct *rds_ib_mr_wq;
 extern unsigned int rds_ib_mr_1m_pool_size;
 extern unsigned int rds_ib_mr_8k_pool_size;
+extern bool prefer_frmr;
 
 struct rds_ib_mr_pool *rds_ib_create_mr_pool(struct rds_ib_device *rds_dev,
 int npages);
-- 
1.9.1



[net-next][PATCH 05/13] RDS: IB: Re-organise ibmr code

2016-02-20 Thread Santosh Shilimkar
No functional changes. This is in preperation towards adding
fastreg memory resgitration support.

Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/Makefile  |   2 +-
 net/rds/ib.c  |  37 +++---
 net/rds/ib.h  |  25 +---
 net/rds/ib_fmr.c  | 217 +++
 net/rds/ib_mr.h   | 109 
 net/rds/ib_rdma.c | 379 +++---
 6 files changed, 422 insertions(+), 347 deletions(-)
 create mode 100644 net/rds/ib_fmr.c
 create mode 100644 net/rds/ib_mr.h

diff --git a/net/rds/Makefile b/net/rds/Makefile
index 19e5485..bcf5591 100644
--- a/net/rds/Makefile
+++ b/net/rds/Makefile
@@ -6,7 +6,7 @@ rds-y :=af_rds.o bind.o cong.o connection.o info.o 
message.o   \
 obj-$(CONFIG_RDS_RDMA) += rds_rdma.o
 rds_rdma-y :=  rdma_transport.o \
ib.o ib_cm.o ib_recv.o ib_ring.o ib_send.o ib_stats.o \
-   ib_sysctl.o ib_rdma.o
+   ib_sysctl.o ib_rdma.o ib_fmr.o
 
 
 obj-$(CONFIG_RDS_TCP) += rds_tcp.o
diff --git a/net/rds/ib.c b/net/rds/ib.c
index 9481d55..bb32cb9 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -42,15 +42,16 @@
 
 #include "rds.h"
 #include "ib.h"
+#include "ib_mr.h"
 
-unsigned int rds_ib_fmr_1m_pool_size = RDS_FMR_1M_POOL_SIZE;
-unsigned int rds_ib_fmr_8k_pool_size = RDS_FMR_8K_POOL_SIZE;
+unsigned int rds_ib_mr_1m_pool_size = RDS_MR_1M_POOL_SIZE;
+unsigned int rds_ib_mr_8k_pool_size = RDS_MR_8K_POOL_SIZE;
 unsigned int rds_ib_retry_count = RDS_IB_DEFAULT_RETRY_COUNT;
 
-module_param(rds_ib_fmr_1m_pool_size, int, 0444);
-MODULE_PARM_DESC(rds_ib_fmr_1m_pool_size, " Max number of 1M fmr per HCA");
-module_param(rds_ib_fmr_8k_pool_size, int, 0444);
-MODULE_PARM_DESC(rds_ib_fmr_8k_pool_size, " Max number of 8K fmr per HCA");
+module_param(rds_ib_mr_1m_pool_size, int, 0444);
+MODULE_PARM_DESC(rds_ib_mr_1m_pool_size, " Max number of 1M mr per HCA");
+module_param(rds_ib_mr_8k_pool_size, int, 0444);
+MODULE_PARM_DESC(rds_ib_mr_8k_pool_size, " Max number of 8K mr per HCA");
 module_param(rds_ib_retry_count, int, 0444);
 MODULE_PARM_DESC(rds_ib_retry_count, " Number of hw retries before reporting 
an error");
 
@@ -140,13 +141,13 @@ static void rds_ib_add_one(struct ib_device *device)
rds_ibdev->max_sge = min(device->attrs.max_sge, RDS_IB_MAX_SGE);
 
rds_ibdev->fmr_max_remaps = device->attrs.max_map_per_fmr?: 32;
-   rds_ibdev->max_1m_fmrs = device->attrs.max_mr ?
+   rds_ibdev->max_1m_mrs = device->attrs.max_mr ?
min_t(unsigned int, (device->attrs.max_mr / 2),
- rds_ib_fmr_1m_pool_size) : rds_ib_fmr_1m_pool_size;
+ rds_ib_mr_1m_pool_size) : rds_ib_mr_1m_pool_size;
 
-   rds_ibdev->max_8k_fmrs = device->attrs.max_mr ?
+   rds_ibdev->max_8k_mrs = device->attrs.max_mr ?
min_t(unsigned int, ((device->attrs.max_mr / 2) * 
RDS_MR_8K_SCALE),
- rds_ib_fmr_8k_pool_size) : rds_ib_fmr_8k_pool_size;
+ rds_ib_mr_8k_pool_size) : rds_ib_mr_8k_pool_size;
 
rds_ibdev->max_initiator_depth = device->attrs.max_qp_init_rd_atom;
rds_ibdev->max_responder_resources = device->attrs.max_qp_rd_atom;
@@ -172,10 +173,10 @@ static void rds_ib_add_one(struct ib_device *device)
goto put_dev;
}
 
-   rdsdebug("RDS/IB: max_mr = %d, max_wrs = %d, max_sge = %d, 
fmr_max_remaps = %d, max_1m_fmrs = %d, max_8k_fmrs = %d\n",
+   rdsdebug("RDS/IB: max_mr = %d, max_wrs = %d, max_sge = %d, 
fmr_max_remaps = %d, max_1m_mrs = %d, max_8k_mrs = %d\n",
 device->attrs.max_fmr, rds_ibdev->max_wrs, rds_ibdev->max_sge,
-rds_ibdev->fmr_max_remaps, rds_ibdev->max_1m_fmrs,
-rds_ibdev->max_8k_fmrs);
+rds_ibdev->fmr_max_remaps, rds_ibdev->max_1m_mrs,
+rds_ibdev->max_8k_mrs);
 
INIT_LIST_HEAD(&rds_ibdev->ipaddr_list);
INIT_LIST_HEAD(&rds_ibdev->conn_list);
@@ -364,7 +365,7 @@ void rds_ib_exit(void)
rds_ib_sysctl_exit();
rds_ib_recv_exit();
rds_trans_unregister(&rds_ib_transport);
-   rds_ib_fmr_exit();
+   rds_ib_mr_exit();
 }
 
 struct rds_transport rds_ib_transport = {
@@ -400,13 +401,13 @@ int rds_ib_init(void)
 
INIT_LIST_HEAD(&rds_ib_devices);
 
-   ret = rds_ib_fmr_init();
+   ret = rds_ib_mr_init();
if (ret)
goto out;
 
ret = ib_register_client(&rds_ib_client);
if (ret)
-   goto out_fmr_exit;
+   goto out_mr_exit;
 
ret = rds_ib_sysctl_init();
if (ret)
@@ -430,8 +431,8 @@ out_sysctl:
rds_ib_sysctl_exit();
 out_ibreg:
rds_ib_unregister_client();
-out_fmr_exit:
-   rds_ib_fmr_exit();
+out_mr_exit:
+   rds_ib_mr_exit();
 out:
return ret;
 }
diff --git a/net/rds/ib.h b/net/rds/ib.h
index 09cd8e3..c88cb22 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@

[net-next][PATCH 02/13] RDS: Add support for SO_TIMESTAMP for incoming messages

2016-02-20 Thread Santosh Shilimkar
The SO_TIMESTAMP generates time stamp for each incoming RDS messages
User app can enable it by using SO_TIMESTAMP setsocketopt() at
SOL_SOCKET level. CMSG data of cmsg type SO_TIMESTAMP contains the
time stamp in struct timeval format.

Reviewed-by: Sowmini Varadhan 
Signed-off-by: Santosh Shilimkar 
Signed-off-by: Santosh Shilimkar 
---
 net/rds/af_rds.c | 26 ++
 net/rds/rds.h|  1 +
 net/rds/recv.c   | 20 ++--
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index b5476aeb..6beaeb1 100644
--- a/net/rds/af_rds.c
+++ b/net/rds/af_rds.c
@@ -277,6 +277,27 @@ static int rds_set_transport(struct rds_sock *rs, char 
__user *optval,
return rs->rs_transport ? 0 : -ENOPROTOOPT;
 }
 
+static int rds_enable_recvtstamp(struct sock *sk, char __user *optval,
+int optlen)
+{
+   int val, valbool;
+
+   if (optlen != sizeof(int))
+   return -EFAULT;
+
+   if (get_user(val, (int __user *)optval))
+   return -EFAULT;
+
+   valbool = val ? 1 : 0;
+
+   if (valbool)
+   sock_set_flag(sk, SOCK_RCVTSTAMP);
+   else
+   sock_reset_flag(sk, SOCK_RCVTSTAMP);
+
+   return 0;
+}
+
 static int rds_setsockopt(struct socket *sock, int level, int optname,
  char __user *optval, unsigned int optlen)
 {
@@ -312,6 +333,11 @@ static int rds_setsockopt(struct socket *sock, int level, 
int optname,
ret = rds_set_transport(rs, optval, optlen);
release_sock(sock->sk);
break;
+   case SO_TIMESTAMP:
+   lock_sock(sock->sk);
+   ret = rds_enable_recvtstamp(sock->sk, optval, optlen);
+   release_sock(sock->sk);
+   break;
default:
ret = -ENOPROTOOPT;
}
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 0e2797b..80256b0 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -222,6 +222,7 @@ struct rds_incoming {
__be32  i_saddr;
 
rds_rdma_cookie_t   i_rdma_cookie;
+   struct timeval  i_rx_tstamp;
 };
 
 struct rds_mr {
diff --git a/net/rds/recv.c b/net/rds/recv.c
index a00462b..c0be1ec 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -35,6 +35,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "rds.h"
 
@@ -46,6 +48,8 @@ void rds_inc_init(struct rds_incoming *inc, struct 
rds_connection *conn,
inc->i_conn = conn;
inc->i_saddr = saddr;
inc->i_rdma_cookie = 0;
+   inc->i_rx_tstamp.tv_sec = 0;
+   inc->i_rx_tstamp.tv_usec = 0;
 }
 EXPORT_SYMBOL_GPL(rds_inc_init);
 
@@ -228,6 +232,8 @@ void rds_recv_incoming(struct rds_connection *conn, __be32 
saddr, __be32 daddr,
rds_recv_rcvbuf_delta(rs, sk, inc->i_conn->c_lcong,
  be32_to_cpu(inc->i_hdr.h_len),
  inc->i_hdr.h_dport);
+   if (sock_flag(sk, SOCK_RCVTSTAMP))
+   do_gettimeofday(&inc->i_rx_tstamp);
rds_inc_addref(inc);
list_add_tail(&inc->i_item, &rs->rs_recv_queue);
__rds_wake_sk_sleep(sk);
@@ -381,7 +387,8 @@ static int rds_notify_cong(struct rds_sock *rs, struct 
msghdr *msghdr)
 /*
  * Receive any control messages.
  */
-static int rds_cmsg_recv(struct rds_incoming *inc, struct msghdr *msg)
+static int rds_cmsg_recv(struct rds_incoming *inc, struct msghdr *msg,
+struct rds_sock *rs)
 {
int ret = 0;
 
@@ -392,6 +399,15 @@ static int rds_cmsg_recv(struct rds_incoming *inc, struct 
msghdr *msg)
return ret;
}
 
+   if ((inc->i_rx_tstamp.tv_sec != 0) &&
+   sock_flag(rds_rs_to_sk(rs), SOCK_RCVTSTAMP)) {
+   ret = put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP,
+  sizeof(struct timeval),
+  &inc->i_rx_tstamp);
+   if (ret)
+   return ret;
+   }
+
return 0;
 }
 
@@ -474,7 +490,7 @@ int rds_recvmsg(struct socket *sock, struct msghdr *msg, 
size_t size,
msg->msg_flags |= MSG_TRUNC;
}
 
-   if (rds_cmsg_recv(inc, msg)) {
+   if (rds_cmsg_recv(inc, msg, rs)) {
ret = -EFAULT;
goto out;
}
-- 
1.9.1



Re: [PATCHv3 net 5/5] nfp: don't trust netif_running() in debug code

2016-02-20 Thread Jakub Kicinski
On 2/20/16, David Miller  wrote:
> From: Jakub Kicinski 
> Date: Thu, 18 Feb 2016 20:38:13 +
>
>> Since change_mtu() can fail and leave us with netif_running()
>> returning true even though all rings were freed - we should
>> look at NFP_NET_CFG_CTRL_ENABLE flag to determine if device
>> is really opened.
>>
>> Signed-off-by: Jakub Kicinski 
>
> This is exactly why I don't like how you are doing your MTU change at
> all.
>
> You must not make the device inoperative if you simply cannot perform
> the MTU change.  I'm pretty sure I've told you this already, this
> whole ->close(), MTU change, ->open() OOPS THAT FAILED sequence is a
> non-starter.  You can't do this.

OK, I just wanted as little changes as possbile
here since we are at rc5 already. I should've
really caught that before upstreaming the driver :/

> You are leaving the netdev object in an illegal state when this
> happens.

After the net-next series this could only happen
if FW crashed and stopped responding to
commands. Since this is VF driver I dont see
anything I can do with crashed FW :(  Should I
close the device from the driver side?

Could you please look at the net-next series and
tell me if its a step in the right direction? I feel a
bit puzzled, I thought the next series does
exactly what you wanted.

Thank you for your patience...


[PATCH] fmvj18x_cs: fix incorrect indexing of dev->dev_addr[] when copying the MAC address

2016-02-20 Thread Ken Kawasaki

fix incorrect indexing of dev->dev_addr[] when copying the MAC address 
of FMV-J182 at buf[5].

Signed-off-by: Ken Kawasaki 

---

--- linux-4.4.1/drivers/net/ethernet/fujitsu/fmvj18x_cs.c.orig  2016-02-19 
20:48:40.143852346 +0900
+++ linux-4.4.1/drivers/net/ethernet/fujitsu/fmvj18x_cs.c   2016-02-20 
10:33:42.137713831 +0900
@@ -469,8 +469,8 @@ static int fmvj18x_config(struct pcmcia_
goto failed;
}
/* Read MACID from CIS */
-   for (i = 5; i < 11; i++)
-   dev->dev_addr[i] = buf[i];
+   for (i = 0; i < 6; i++)
+   dev->dev_addr[i] = buf[i + 5];
kfree(buf);
} else {
if (pcmcia_get_mac_from_cis(link, dev))


[PATCH net-next] i40e: remove broken link.

2016-02-20 Thread Rami Rosen
This patch removes a broken link from Documentation/networking/i40e.txt.

Signed-off-by: Rami Rosen 
---
 Documentation/networking/i40e.txt | 9 -
 1 file changed, 9 deletions(-)

diff --git a/Documentation/networking/i40e.txt 
b/Documentation/networking/i40e.txt
index a251bf4..09f8f3b 100644
--- a/Documentation/networking/i40e.txt
+++ b/Documentation/networking/i40e.txt
@@ -88,15 +88,6 @@ Additional Configurations
 
   Where n=the VF that attempted to do the spoofing.
 
-
-Performance Tuning
-==
-
-An excellent article on performance tuning can be found at:
-
-http://www.redhat.com/promo/summit/2008/downloads/pdf/Thursday/Mark_Wagner.pdf
-
-
 Known Issues
 
 
-- 
1.9.3



Re: [PATCH] Bluetooth: hci_core: cancel power off delayed work properly

2016-02-20 Thread Marcel Holtmann
Hi Wei-Ning,

> When the HCI_AUTO_OFF flag is cleared, the power_off delayed work need
> to be cancel or HCI will be powered off even if it's managed.
> 
> Signed-off-by: Wei-Ning Huang 
> ---
> net/bluetooth/hci_core.c | 1 +
> 1 file changed, 1 insertion(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel



Re: [PATCH] Bluetooth: hci_core: Avoid mixing up req_complete and req_complete_skb

2016-02-20 Thread Marcel Holtmann
Hi Douglas,

> In commit 44d271377479 ("Bluetooth: Compress the size of struct
> hci_ctrl") we squashed down the size of the structure by using a union
> with the assumption that all users would use the flag to determine
> whether we had a req_complete or a req_complete_skb.
> 
> Unfortunately we had a case in hci_req_cmd_complete() where we weren't
> looking at the flag.  This can result in a situation where we might be
> storing a hci_req_complete_skb_t in a hci_req_complete_t variable, or
> vice versa.
> 
> During some testing I found at least one case where the function
> hci_req_sync_complete() was called improperly because the kernel thought
> that it didn't require an SKB.  Looking through the stack in kgdb I
> found that it was called by hci_event_packet() and that
> hci_event_packet() had both of its locals "req_complete" and
> "req_complete_skb" pointing to the same place: both to
> hci_req_sync_complete().
> 
> Let's make sure we always check the flag.
> 
> For more details on debugging done, see .
> 
> Fixes: 44d271377479 ("Bluetooth: Compress the size of struct hci_ctrl")
> Signed-off-by: Douglas Anderson 
> ---
> Testing was done on a Chrome OS device on kernel 3.14 w/
> bluetooth-next backports.  Since I couldn't reliably reproduce the
> problem, I simply confirmed that existing functionality worked.
> 
> net/bluetooth/hci_core.c | 6 --
> 1 file changed, 4 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-stable tree.

Regards

Marcel