[PATCH] rtlwifi:rtl_watchdog_wq_callback: fix calling rtl_lps_enter|rtl_lps_leave in opposite condition
Commit a269913c52ad37952a4d9953bb6d748f7299c304 ("rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue") make a mistake, change the meaning of num_tx|rx_inperiod comparison test. Commit fd09ff958777cf583d7541f180991c0fc50bd2f7 ("rtlwifi: Remove extra workqueue for enter/leave power state") follow previous mistake, bring us to current code. This patch fix it. Signed-off-by: Wang YanQing--- I think this patch should be ported back to stable kernels, 3.10+. In my machine, I will lost wifi connection after minutes if I enable fwlps. drivers/net/wireless/realtek/rtlwifi/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c index c74eb13..264466f 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -1660,9 +1660,9 @@ void rtl_watchdog_wq_callback(void *data) if (((rtlpriv->link_info.num_rx_inperiod + rtlpriv->link_info.num_tx_inperiod) > 8) || (rtlpriv->link_info.num_rx_inperiod > 2)) - rtl_lps_enter(hw); - else rtl_lps_leave(hw); + else + rtl_lps_enter(hw); } rtlpriv->link_info.num_rx_inperiod = 0; -- 1.8.5.6.2.g3d8a54e.dirty
Re: Q: How to disable vlan strip in Intel igb driver ?
On Sun, May 1, 2016 at 11:51 PM, Peter Palúchwrote: > Hi Ran, > > >> Alex, >> I don't see rx-vlan-offload option in my ethtool. strange, maybe it is >> not available in all ethtool versions ? > > > According to my manpage for ethtool v4.5, the relevant -K option is > "rxvlan". > >> Hi Peter, >> Yes, I'm using AF_PACKET (I can't validate it now for 100%, but I >> quite sure about it). > > > Okay - but I assume that you are writing a userspace application, not a > kernelspace driver or module, right? > >> I'm accessing the ethernet header, and it always gives me non extended >> ethernet header (without vlan information). > > > It seems that this behavior has been around for a long time, and is > intentional. See the following thread for more information: > > http://www.spinics.net/lists/netdev/msg244668.html > > The only legit way of accessing VLAN tag info on an AF_PACKET socket I know > about is by setting the PACKET_AUXDATA socket option, and reading the > auxiliary data as a struct tpacket_auxdata using recvmsg(). > > In addition, however, there seems to be a bug in the kernel in that the > tp_vlan_tci member of the struct tpacket_auxdata is filled in only if the > AF_PACKET socket is bound to htons(ETH_P_ALL). If the socket is bound to any > other specific protocol, the tp_vlan_tci is set to 0. I have raised this > issue recently in the following thread(s) but have not received a response > yet: > > http://www.spinics.net/lists/netdev/msg372830.html > http://www.spinics.net/lists/netdev/msg373112.html > > >> I can see the vlan tag in vlan_tci field in sk_buff, but this is not >> exactly what I need, I need the header AS-IS with the original >> (extended) ethernet header. > > > How are you accessing the vlan_tci field from your software? > > In any case, with AF_PACKET sockets, I am afraid you don't have much choice. > Even libpcap reconstructs VLAN-tagged frames by reading the VLAN tag from an > auxiliary structure and then re-inserting it into the frame, because the > frame delivered through an AF_PACKET socket does not have the VLAN tag > present anymore. > Hi Peter, I have a patch (hook) in the igb (Intel) driver which reads the skb buffer into our buffer, this is without using socket actually. ipstack is not involved, so socket as I mentioned before are not relevant (AF_PACKET not relevant). the problem seems in the driver that the driver strip vlan information (there is a lot of mention of strip and vlan in the igb driver, and I tried many things, but still it always strip this information from the data in the sk_buff.) will ethtool assist in this case ? I don;t see any vlan option in my ethtool. Does ethtool communicated with the driver and command it not to strip the vlan info ? Thanks, Ran
[GIT] Networking
1) MODULE_FIRMWARE firmware string not correct for iwlwifi 8000 chips, from Sara Sharon. 2) Fix SKB size checks in batman-adv stack on receive, from Sven Eckelmann. 3) Leak fix on mac80211 interface add error paths, from Johannes Berg. 4) Cannot invoke napi_disable() with BH disabled in myri10ge driver, fix from Stanislaw Gruszka. 5) Fix sign extension problem when computing feature masks in net_gso_ok(), from Marcelo Ricardo Leitner. 6) lan78xx driver doesn't count packets and packet lengths in it's statistics properly, fix from Woojung Huh. 7) Fix the buffer allocation sizes in pegasus USB driver, from Petko Manolov. 8) Fix refcount overflows in bpf, from Alexei Starovoitov. 9) Unified dst cache handling introduced a preempt warning in ip_tunnel, fix by resetting rather then setting the cached route. From Paolo Abeni. 10) Listener hash collision test fix in soreuseport, from Craig Gallak. Please pull, thanks a lot! The following changes since commit f28f20da704d399fb1e4d8838ffd697a357d9cc8: Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2016-04-26 16:25:51 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git for you to fetch changes up to b7f8fe251e4609e2a437bd2c2dea01e61db6849c: gre: do not pull header in ICMP error processing (2016-05-02 00:19:58 -0400) Alexei Starovoitov (3): bpf: fix refcnt overflow bpf: fix check_map_func_compatibility logic samples/bpf: fix trace_output example Andreas Larsson (1): MAINTAINERS: net: Change maintainer for GRETH 10/100/1G Ethernet MAC device driver Arnd Bergmann (1): net/smscx5xx: use the device tree for mac address Ayala Beker (1): iwlwifi: mvm: avoid to WARN about gscan capabilities Bert Kenward (1): MAINTAINERS: net: update sfc maintainers Christophe Jaillet (1): ps3_gelic: fix memcpy parameter Colin Ian King (1): net: dsa: mv88e6xxx: fix uninitialized error return Craig Gallek (1): soreuseport: Fix TCP listener hash collision David Rivshin (5): drivers: net: cpsw: fix parsing of phy-handle DT property in dual_emac config drivers: net: cpsw: fix segfault in case of bad phy-handle drivers: net: cpsw: don't ignore phy-mode if phy-handle is used dt: cpsw: phy-handle, phy_id, and fixed-link are mutually exclusive drivers: net: cpsw: use of_phy_connect() in fixed-link case David S. Miller (8): Merge branch 'bnxt_en-fixes' Merge tag 'wireless-drivers-for-davem-2016-04-25' of git://git.kernel.org/.../kvalo/wireless-drivers Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge Merge tag 'mac80211-for-davem-2016-04-27' of git://git.kernel.org/.../jberg/mac80211 Merge branch 'gre-lwt-fixes' Merge branch 'pegasus-sizes' Merge branch 'cpsw-phy-handle-fixes' Merge branch 'bpf-fixes' Eric Engestrom (1): Documentation: networking: fix spelling mistakes Hamish Martin (1): tipc: only process unicast on intended node Jiri Benc (4): gre: do not assign header_ops in collect metadata mode gre: build header correctly for collect metadata tunnels gre: reject GUE and FOU in collect metadata mode gre: do not pull header in ICMP error processing Johannes Berg (1): mac80211: fix statistics leak if dev_alloc_name() fails Jon Cooper (1): sfc: disable RSS when unsupported Kalle Valo (1): Merge tag 'iwlwifi-for-kalle-2016-04-12_2' of https://git.kernel.org/.../iwlwifi/iwlwifi-fixes Linus Lüssing (1): batman-adv: Fix broadcast/ogm queue limit on a removed interface Marcelo Ricardo Leitner (1): net: fix net_gso_ok for new GSO types. Marek Lindner (1): batman-adv: init neigh node last seen field Matti Gottlieb (1): iwlwifi: mvm: fix accessing Null pointer during fw dump collection Michael Chan (3): bnxt_en: Don't fallback to INTA on VF. bnxt_en: Limit RX BD pages to be no bigger than 32K. bnxt_en: Divide a page into 32K buffers for the aggregation ring if necessary. Michal Schmidt (1): cxgb3: fix out of bounds read Neil Armstrong (1): net: ethernet: davinci_emac: Fix devioctl while in fixed link Oleksij Rempel (1): ath9k: ar5008_hw_cmn_spur_mitigate: add missing mask_m & mask_p initialisation Oren Givon (1): iwlwifi: add device IDs for the 8265 device Paolo Abeni (1): ip_tunnel: fix preempt warning in ip tunnel creation/updating Petko Manolov (2): pegasus: fixes URB buffer allocation size; pegasus: fixes reported packet length Sara Sharon (1): iwlwifi: 8000: fix MODULE_FIRMWARE input Stanislaw Gruszka (1): myri10ge: fix sleeping with bh disabled Sven Eckelmann (3): batman-adv: Check skb size before using encapsulated ETH+VLAN header batman-adv: Deactivate
Re: [PATCH net] gre: do not pull header in ICMP error processing
From: Jiri BencDate: Fri, 29 Apr 2016 23:31:32 +0200 > iptunnel_pull_header expects that IP header was already pulled; with this > expectation, it pulls the tunnel header. This is not true in gre_err. > Furthermore, ipv4_update_pmtu and ipv4_redirect expect that skb->data points > to the IP header. > > We cannot pull the tunnel header in this path. It's just a matter of not > calling iptunnel_pull_header - we don't need any of its effects. > > Fixes: bda7bb463436 ("gre: Allow multiple protocol listener for gre > protocol.") > Signed-off-by: Jiri Benc Applied and queued up for -stable, thanks Jiri.
Re: [net-next 00/15][pull request] 40GbE Intel Wired LAN Driver Updates 2016-05-01
From: Jeff KirsherDate: Sun, 1 May 2016 17:06:06 -0700 > This series contains updates to i40e and i40evf. Looks good, pulled, thanks Jeff.
Re: [net-next PATCH v2 5/9] mlx4: Add support for UDP tunnel segmentation with outer checksum offload
On Sun, May 1, 2016 at 1:35 PM, Or Gerlitzwrote: > On Sat, Apr 30, 2016 at 1:43 AM, Alexander Duyck wrote: >> This patch assumes that the mlx4 hardware will ignore existing IPv4/v6 >> header fields for length and checksum as well as the length and checksum >> fields for outer UDP headers. > > Hi Alex, > > I see now the above text appearing in bunch of similar commit of > yours, specifically to Intel drivers and mlx5... could you please > elaborate a bit more what you mean here and what are the practical > consequences of that characteristics? > > I got that right NETIF_F_GSO_UDP_TUNNEL_CSUM means that the HW can do > segmentation for TCP packets encapsulated by UDP tunnel e.g VXLAN > where the outer checksum is not zero. AFAIK, any other outer checksum > value can't correctly be a constant... are you assuming here RCO or > LCO? Actually it is really easy for outer UDP checksum to be constant as long as we keep the length of all segments constant. This all ties back into LCO. As long as the fields between the start of the UDP header and the start of the TCP header are either constant, as in the case of IPv6, or have their own checksum as in the case of IPv4 we will end up with the checksum of the outer header being constant. So in effect as long as we can trust the hardware to segment every frame to the specified size and that it won't insert any extra data anywhere in that region that we aren't expecting we can guarantee that each frame will have the same checksum for the outer UDP header. - Alex
Re: [net-next PATCH v2 1/9] net: Disable segmentation if checksumming is not supported
On Sun, May 1, 2016 at 1:30 PM, Or Gerlitzwrote: > On Sat, Apr 30, 2016 at 1:43 AM, Alexander Duyck wrote: >> In the case of the mlx4 and mlx5 driver they do not support IPv6 checksum >> offload for tunnels. > > Alex, > > To clarify, when you say "not support IPv6 checksum for tunnels", you > refer to the offloading of the outer or inner checksum? In the case of mlx4 it was an issue with both inner and outer due to IPv6 checksum. The issue was that the feature was not exposed and yet the stack was attempting to make use of it in various ways. The fixes that resolved the issues are in patches 1 and 4. If we wanted to we could move those to net, but then it would be difficult to test the existing patches on the mlx4 until the net tree containing those patches was merged back in. > Still (me and I think also Tariq from our driver team) catching up on > the series, the primitives and conventions you are introducing using > and how this applies on mlx5. I saw that Saeed acked the the mlx5e > patches (7 and 8). The concept for all this is pretty simple. What I am doing is restricting TSO so that we have a fixed size that is used for all outgoing frames. Then we precompute the outer headers and use those values when performing GSO. By doing this we can populate the UDP checksum field instead of forcing it to 0 which allows us to perform TSO for tunnels with outer checksums. > Specifically, the mlx4 patches are practically fixes so if they don't > land in 4.7 via net-next we can get them there through net, lets give > us the few more days needed to catch up from our side. Actually the mlx4 specific portion of these patches are not really fixes, they are enabling features. Specifically IPv6 checksum, TSOv6, and TSO for VXLAN tunnels with outer checksums. It is patches 1 and 4 that contain the fix and it likely applies to more than just the mlx4 driver as I believe there is a qlogic driver with a similar feature flag layout. If we want we could recommend those patches for stable and they could probably be back ported into 4.6 after it is released because I don't see the urgency to push a fix in for something that has obviously been broken for quite some time now that likely nobody is ever testing. - Alex
Re: [PATCH] net: Implement net_dbg_ratelimited() for CONFIG_DYNAMIC_DEBUG case
From: Tim BinghamDate: Fri, 29 Apr 2016 13:30:23 -0400 > Prior to commit d92cff89a0c8 ("net_dbg_ratelimited: turn into no-op > when !DEBUG") the implementation of net_dbg_ratelimited() was buggy > for both the DEBUG and CONFIG_DYNAMIC_DEBUG cases. > > The bug was that net_ratelimit() was being called and, despite > returning true, nothing was being printed to the console. This > resulted in messages like the following - > > "net_ratelimit: %d callbacks suppressed" > > with no other output nearby. > > After commit d92cff89a0c8 ("net_dbg_ratelimited: turn into no-op when > !DEBUG") the bug is fixed for the DEBUG case. However, there's no > output at all for CONFIG_DYNAMIC_DEBUG case. > > This patch restores debug output (if enabled) for the > CONFIG_DYNAMIC_DEBUG case. > > Add a definition of net_dbg_ratelimited() for the CONFIG_DYNAMIC_DEBUG > case. The implementation takes care to check that dynamic debugging is > enabled before calling net_ratelimit(). > > Fixes: d92cff89a0c8 ("net_dbg_ratelimited: turn into no-op when !DEBUG") > Signed-off-by: Tim Bingham Looks good, applied and queued up for -stable, thanks.
Re: [PATCH] sctp: signal sk_data_ready earlier on data chunks reception
From: Marcelo Ricardo LeitnerDate: Fri, 29 Apr 2016 14:17:08 -0300 > Dave Miller pointed out that fb586f25300f ("sctp: delay calls to > sk_data_ready() as much as possible") may insert latency specially if > the receiving application is running on another CPU and that it would be > better if we signalled as early as possible. > > This patch thus basically inverts the logic on fb586f25300f and signals > it as early as possible, similar to what we had before. > > Fixes: fb586f25300f ("sctp: delay calls to sk_data_ready() as much as > possible") > Reported-by: Dave Miller > Signed-off-by: Marcelo Ricardo Leitner Applied, thanks Marcelo.
Re: [PATCH net v2 1/1] tipc: only process unicast on intended node
From: Jon MaloyDate: Fri, 29 Apr 2016 10:40:24 -0400 > From: Hamish Martin > > We have observed complete lock up of broadcast-link transmission due to > unacknowledged packets never being removed from the 'transmq' queue. This > is traced to nodes having their ack field set beyond the sequence number > of packets that have actually been transmitted to them. > Consider an example where node 1 has sent 10 packets to node 2 on a > link and node 3 has sent 20 packets to node 2 on another link. We > see examples of an ack from node 2 destined for node 3 being treated as > an ack from node 2 at node 1. This leads to the ack on the node 1 to node > 2 link being increased to 20 even though we have only sent 10 packets. > When node 1 does get around to sending further packets, none of the > packets with sequence numbers less than 21 are actually removed from the > transmq. > To resolve this we reinstate some code lost in commit d999297c3dbb ("tipc: > reduce locking scope during packet reception") which ensures that only > messages destined for the receiving node are processed by that node. This > prevents the sequence numbers from getting out of sync and resolves the > packet leakage, thereby resolving the broadcast-link transmission > lock-ups we observed. > > While we are aware that this change only patches over a root problem that > we still haven't identified, this is a sanity test that it is always > legitimate to do. It will remain in the code even after we identify and > fix the real problem. > > Reviewed-by: Chris Packham > Reviewed-by: John Thompson > Signed-off-by: Hamish Martin > Signed-off-by: Jon Maloy Applied.
Re: [PATCH net] cxgb3: fix out of bounds read
From: Michal SchmidtDate: Fri, 29 Apr 2016 11:06:50 +0200 > An out of bounds read of 2 bytes was discovered in cxgb3 with KASAN. > > t3_config_rss() expects both arrays it gets as parameters to have > terminators. setup_rss(), the caller, forgets to add a terminator to > one of the arrays. Thankfully the iteration in t3_config_rss() stops > anyway, but in the last iteration the check for the terminator > is an out of bounds read. > > Add the missing terminator to rspq_map[]. > > Reported-by: Jan Stancek > Signed-off-by: Michal Schmidt Applied.
Re: [PATCH] net/smscx5xx: use the device tree for mac address
From: Lubomir RintelDate: Fri, 29 Apr 2016 09:05:59 +0200 > From: Arnd Bergmann > > This takes the MAC address for smsc75xx/smsc95xx USB network devices > from a the device tree. This is required to get a usable persistent > address on the popular beagleboard, whose hardware designers > accidentally forgot that an ethernet device really requires an a > MAC address to be functional. > > The Raspberry Pi also ships smsc9514 without a serial EEPROM, stores > the MAC address in ROM accessible via VC4 firmware. > > The smsc75xx and smsc95xx drivers are just two copies of the > same code, so better fix both. > > [lkund...@v3.sk: updated to use of_get_property() as per suggestion from > Arnd, reworded the message and comments a bit] > > Tested-by: Lubomir Rintel > Signed-off-by: Arnd Bergmann > Signed-off-by: Lubomir Rintel Applied, thanks.
Re: [PATCH V2] mdio_bus: Fix MDIO bus scanning in __mdiobus_register()
From: Marek VasutDate: Mon, 2 May 2016 02:47:31 +0200 > Since commit b74766a0a0fe ("phylib: don't return NULL > from get_phy_device()") in linux-next, phy_get_device() will return > ERR_PTR(-ENODEV) instead of NULL if the PHY device ID is all ones. > > This causes problem with stmmac driver and likely some other drivers > which call mdiobus_register(). I triggered this bug on SoCFPGA MCVEVK > board with linux-next 20160427 and 20160428. In case of the stmmac, if > there is no PHY node specified in the DT for the stmmac block, the stmmac > driver ( drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c function > stmmac_mdio_register() ) will call mdiobus_register() , which will > register the MDIO bus and probe for the PHY. > > The mdiobus_register() resp. __mdiobus_register() iterates over all of > the addresses on the MDIO bus and calls mdiobus_scan() for each of them, > which invokes get_phy_device(). Before the aforementioned patch, the > mdiobus_scan() would return NULL if no PHY was found on a given address > and mdiobus_register() would continue and try the next PHY address. Now, > mdiobus_scan() returns ERR_PTR(-ENODEV), which is caught by the > 'if (IS_ERR(phydev))' condition and the loop exits immediately if the > PHY address does not contain PHY. > > Repair this by explicitly checking for the ERR_PTR(-ENODEV) and if this > error comes around, continue with the next PHY address. > > Signed-off-by: Marek Vasut > Acked-by: Florian Fainelli Applied, thanks.
Re: [PATCH] mdio_bus: Fix MDIO bus scanning in __mdiobus_register()
On 05/02/2016 01:49 AM, David Miller wrote: > > Please respin this with the checkpatch errors fixed. Done and sent. > I don't have any opinion about the conditional parenthesis, so > don't worry about that. > OK Thanks! -- Best regards, Marek Vasut
[PATCH V2] mdio_bus: Fix MDIO bus scanning in __mdiobus_register()
Since commit b74766a0a0fe ("phylib: don't return NULL from get_phy_device()") in linux-next, phy_get_device() will return ERR_PTR(-ENODEV) instead of NULL if the PHY device ID is all ones. This causes problem with stmmac driver and likely some other drivers which call mdiobus_register(). I triggered this bug on SoCFPGA MCVEVK board with linux-next 20160427 and 20160428. In case of the stmmac, if there is no PHY node specified in the DT for the stmmac block, the stmmac driver ( drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c function stmmac_mdio_register() ) will call mdiobus_register() , which will register the MDIO bus and probe for the PHY. The mdiobus_register() resp. __mdiobus_register() iterates over all of the addresses on the MDIO bus and calls mdiobus_scan() for each of them, which invokes get_phy_device(). Before the aforementioned patch, the mdiobus_scan() would return NULL if no PHY was found on a given address and mdiobus_register() would continue and try the next PHY address. Now, mdiobus_scan() returns ERR_PTR(-ENODEV), which is caught by the 'if (IS_ERR(phydev))' condition and the loop exits immediately if the PHY address does not contain PHY. Repair this by explicitly checking for the ERR_PTR(-ENODEV) and if this error comes around, continue with the next PHY address. Signed-off-by: Marek VasutCc: Arnd Bergmann Cc: David S. Miller Cc: Dinh Nguyen Cc: Florian Fainelli Cc: Sergei Shtylyov Acked-by: Florian Fainelli --- V2: Fixed checkpatch warning in the commit message Added Ack from Florian --- drivers/net/phy/mdio_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 499003ee..388f992 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -333,7 +333,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) struct phy_device *phydev; phydev = mdiobus_scan(bus, i); - if (IS_ERR(phydev)) { + if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) { err = PTR_ERR(phydev); goto error; } -- 2.7.0
[net-next 15/15] i40e/i40evf: Add support for GSO partial with UDP_TUNNEL_CSUM and GRE_CSUM
From: Alexander DuyckThis patch makes it so that i40e and i40evf can use GSO_PARTIAL to support segmentation for frames with checksums enabled in outer headers. As a result we can now send data over these types of tunnels at over 20Gb/s versus the 12Gb/s that was previously possible on my system. The advantage with the i40e parts is that this offload is mostly transparent as the hardware still deals with the inner and/or outer IPv4 headers so the IP ID is still incrementing for both when this offload is performed. Signed-off-by: Alexander Duyck Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_main.c | 10 -- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 7 ++- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 7 ++- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 10 -- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 19a2d30..8e6c0f2 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -9130,20 +9130,25 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GSO_GRE | + NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_PARTIAL | NETIF_F_SCTP_CRC | NETIF_F_RXHASH | NETIF_F_RXCSUM | 0; if (!(pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE)) - netdev->hw_enc_features ^= NETIF_F_GSO_UDP_TUNNEL_CSUM; + netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; + + netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM; /* record features VLANs can make use of */ - netdev->vlan_features |= netdev->hw_enc_features; + netdev->vlan_features |= netdev->hw_enc_features | +NETIF_F_TSO_MANGLEID; if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) netdev->hw_features |= NETIF_F_NTUPLE; @@ -9153,6 +9158,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) NETIF_F_HW_VLAN_CTAG_RX; netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; + netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID; if (vsi->type == I40E_VSI_MAIN) { SET_NETDEV_DEV(netdev, >pdev->dev); diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 285efe9..2765d7e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -2301,11 +2301,15 @@ static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64 *cd_type_cmd_tso_mss) } if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE | +SKB_GSO_GRE_CSUM | SKB_GSO_IPIP | SKB_GSO_SIT | SKB_GSO_UDP_TUNNEL | SKB_GSO_UDP_TUNNEL_CSUM)) { - if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM) { + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) && + (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM)) { + l4.udp->len = 0; + /* determine offset of outer transport header */ l4_offset = l4.hdr - skb->data; @@ -2482,6 +2486,7 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags, /* indicate if we need to offload outer UDP header */ if ((*tx_flags & I40E_TX_FLAGS_TSO) && + !(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) && (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM)) tunnel |= I40E_TXD_CTX_QW0_L4T_CS_MASK; diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c index 4633235..ede8dfc 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c @@ -1566,11 +1566,15 @@ static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64
[net-next 08/15] i40e: Use consistent type for vf_id
From: Jesse BrandeburgThe driver was all over the place using signed or unsigned types for vf_id, when it should always be signed. This fixes warnings of type unsafe comparisons from gcc with W=2. Change-Id: I2cb681f83d0f68ca124d2e4131e4ac0d9f8a6b22 Signed-off-by: Jesse Brandeburg Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 13 +++-- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index e312adf..00c4738 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -554,7 +554,7 @@ struct i40e_vsi { u16 num_queue_pairs; /* Used tx and rx pairs */ u16 num_desc; enum i40e_vsi_type type; /* VSI type, e.g., LAN, FCoE, etc */ - u16 vf_id; /* Virtual function ID for SRIOV VSIs */ + s16 vf_id; /* Virtual function ID for SRIOV VSIs */ struct i40e_tc_configuration tc_config; struct i40e_aqc_vsi_properties_data info; diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index a534fe6..6b9db79 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -48,7 +48,7 @@ static void i40e_vc_vf_broadcast(struct i40e_pf *pf, int i; for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { - int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; + int abs_vf_id = vf->vf_id + (int)hw->func_caps.vf_base_id; /* Not all vfs are enabled so skip the ones that are not */ if (!test_bit(I40E_VF_STAT_INIT, >vf_states) && !test_bit(I40E_VF_STAT_ACTIVE, >vf_states)) @@ -74,7 +74,7 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf) struct i40e_pf *pf = vf->pf; struct i40e_hw *hw = >hw; struct i40e_link_status *ls = >hw.phy.link_info; - int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; + int abs_vf_id = vf->vf_id + (int)hw->func_caps.vf_base_id; pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE; pfe.severity = I40E_PF_EVENT_SEVERITY_INFO; @@ -141,7 +141,7 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf) !test_bit(I40E_VF_STAT_ACTIVE, >vf_states)) return; - abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id; + abs_vf_id = vf->vf_id + (int)vf->pf->hw.func_caps.vf_base_id; pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING; pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM; @@ -2516,11 +2516,11 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode, * called from the common aeq/arq handler to * process request from VF **/ -int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode, +int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, u32 v_retval, u8 *msg, u16 msglen) { struct i40e_hw *hw = >hw; - unsigned int local_vf_id = vf_id - hw->func_caps.vf_base_id; + int local_vf_id = vf_id - (s16)hw->func_caps.vf_base_id; struct i40e_vf *vf; int ret; @@ -2622,9 +2622,10 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode, **/ int i40e_vc_process_vflr_event(struct i40e_pf *pf) { - u32 reg, reg_idx, bit_idx, vf_id; struct i40e_hw *hw = >hw; + u32 reg, reg_idx, bit_idx; struct i40e_vf *vf; + int vf_id; if (!test_bit(__I40E_VFLR_EVENT_PENDING, >state)) return 0; diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h index bf54873..8751741 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h @@ -77,7 +77,7 @@ struct i40e_vf { struct i40e_pf *pf; /* VF id in the PF space */ - u16 vf_id; + s16 vf_id; /* all VF vsis connect to the same parent */ enum i40e_switch_element_types parent_type; struct i40e_virtchnl_version_info vf_ver; @@ -121,7 +121,7 @@ struct i40e_vf { void i40e_free_vfs(struct i40e_pf *pf); int i40e_pci_sriov_configure(struct pci_dev *dev, int num_vfs); int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs); -int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode, +int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, u32 v_retval, u8 *msg, u16 msglen); int i40e_vc_process_vflr_event(struct i40e_pf *pf); void
[net-next 09/15] i40e: Drop extra copy of function
From: Jesse Brandeburgi40e_release_rx_desc was in two files, but was only used and needed in txrx.c. Get rid of the extra copy. Change-Id: I86e18239aa03531fc198b6c052847475084a9200 Signed-off-by: Jesse Brandeburg Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_main.c | 18 -- 1 file changed, 18 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index a45748e..d6b1b98 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -397,24 +397,6 @@ static void i40e_tx_timeout(struct net_device *netdev) } /** - * i40e_release_rx_desc - Store the new tail and head values - * @rx_ring: ring to bump - * @val: new head index - **/ -static inline void i40e_release_rx_desc(struct i40e_ring *rx_ring, u32 val) -{ - rx_ring->next_to_use = val; - - /* Force memory writes to complete before letting h/w -* know there are new descriptors to fetch. (Only -* applicable for weak-ordered memory model archs, -* such as IA-64). -*/ - wmb(); - writel(val, rx_ring->tail); -} - -/** * i40e_get_vsi_stats_struct - Get System Network Statistics * @vsi: the VSI we care about * -- 2.5.5
[net-next 11/15] i40e/i40evf : Bump driver version from 1.5.5 to 1.5.10
From: Harshitha RamamurthySigned-off-by: Harshitha Ramamurthy Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index cab639b..19a2d30 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -46,7 +46,7 @@ static const char i40e_driver_string[] = #define DRV_VERSION_MAJOR 1 #define DRV_VERSION_MINOR 5 -#define DRV_VERSION_BUILD 5 +#define DRV_VERSION_BUILD 10 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ __stringify(DRV_VERSION_MINOR) "." \ __stringify(DRV_VERSION_BUILD)DRV_KERN diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c index d1c4afd..b9b1dd8 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c @@ -38,7 +38,7 @@ static const char i40evf_driver_string[] = #define DRV_VERSION_MAJOR 1 #define DRV_VERSION_MINOR 5 -#define DRV_VERSION_BUILD 5 +#define DRV_VERSION_BUILD 10 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ __stringify(DRV_VERSION_MINOR) "." \ __stringify(DRV_VERSION_BUILD) \ -- 2.5.5
[net-next 00/15][pull request] 40GbE Intel Wired LAN Driver Updates 2016-05-01
This series contains updates to i40e and i40evf. The theme of this series is code reduction, with several code cleanups in this series. Starting with Neerav's removal of the code that implemented the HMC AQ APIs and calls, since they are now obsolete and not supported by firmware. Anjali changes the default of VFs to make sure they are not trusted or privileged until its explicitly set for trust through the new NDO op interface. Also limited the number of MAC and VLAN addresses a VF can add if it is untrusted/privileged. Carolyn syncs the VF code for the changes made to the PF for the RSS hash tuple settings, which ends up cleaning up much of the existing code. Jesse cleans up compiler warnings which were found with gcc's W=2 option. Then removed duplicate code, especially since only one copy was actually being used. Jacob addresses an issue which was found when testing GCC 6's which happens to produce new warnings when you left shift a signed value beyond the storage sizeof the type. The converts i40e & i40evf to use the BIT() macro more consistently. Alex actually bucks the trend of code removal by adding support for both drivers to use GSO_PARTIAL so that segmentation of frames with checksums enabled in outer headers is supported. Fortunately it does not take much to add this support! The following are changes since commit 3cfef195212976032ce7bcd6b4d0b9f1e4741725: Merge branch 'mlx5-aRFS' and are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 40GbE Alexander Duyck (1): i40e/i40evf: Add support for GSO partial with UDP_TUNNEL_CSUM and GRE_CSUM Anjali Singhai Jain (3): i40e: Change the default for VFs to be not privileged i40e: Limit the number of MAC and VLAN addresses that can be added for VFs i40e: Prevent falling to promiscuous if the VF is not trusted Carolyn Wyborny (1): i40evf: RSS Hash Option parameters Catherine Sullivan (2): i40e: Fix uninitialized variable i40e: Update device ids for X722 Harshitha Ramamurthy (1): i40e/i40evf : Bump driver version from 1.5.5 to 1.5.10 Jacob Keller (3): i40e/i40evf: fix I40E_MASK signed shift overflow warnings i40e: make use of BIT() macro to prevent left shift of signed values i40evf: make use of BIT() macro to avoid signed left shift Jesse Brandeburg (3): i40e: PTP - avoid aggregate return warnings i40e: Use consistent type for vf_id i40e: Drop extra copy of function Neerav Parikh (1): i40e: Remove HMC AQ API implementation drivers/net/ethernet/intel/i40e/i40e.h | 2 +- drivers/net/ethernet/intel/i40e/i40e_adminq.c | 4 - drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 78 +++- drivers/net/ethernet/intel/i40e/i40e_common.c | 30 --- drivers/net/ethernet/intel/i40e/i40e_main.c| 37 ++-- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 4 - drivers/net/ethernet/intel/i40e/i40e_ptp.c | 3 +- drivers/net/ethernet/intel/i40e/i40e_txrx.c| 7 +- drivers/net/ethernet/intel/i40e/i40e_type.h| 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 64 --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 7 +- .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h| 69 +++ drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 7 +- drivers/net/ethernet/intel/i40evf/i40e_type.h | 2 +- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 201 + drivers/net/ethernet/intel/i40evf/i40evf_main.c| 12 +- 16 files changed, 137 insertions(+), 392 deletions(-) -- 2.5.5
[net-next 07/15] i40e: PTP - avoid aggregate return warnings
From: Jesse BrandeburgAggregate return warnings are when struct types are returned and must be copied to the lvalue with a struct copy by the compiler. This fixes warnings of type aggregate-return from gcc with W=2. Change-Id: I896b1bf514544bf0faeb458869d79914b9f1b168 Signed-off-by: Jesse Brandeburg Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_ptp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c index 565ca7c..a1b878a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c @@ -158,9 +158,10 @@ static int i40e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) static int i40e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) { struct i40e_pf *pf = container_of(ptp, struct i40e_pf, ptp_caps); - struct timespec64 now, then = ns_to_timespec64(delta); + struct timespec64 now, then; unsigned long flags; + then = ns_to_timespec64(delta); spin_lock_irqsave(>tmreg_lock, flags); i40e_ptp_read(pf, ); -- 2.5.5
[net-next 13/15] i40e: make use of BIT() macro to prevent left shift of signed values
From: Jacob KellerSigned-off-by: Jacob Keller Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 53 +++ 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h index 48c0c00..eacbe74 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h @@ -78,17 +78,17 @@ struct i40e_aq_desc { #define I40E_AQ_FLAG_EI_SHIFT 14 #define I40E_AQ_FLAG_FE_SHIFT 15 -#define I40E_AQ_FLAG_DD(1 << I40E_AQ_FLAG_DD_SHIFT) /* 0x1 */ -#define I40E_AQ_FLAG_CMP (1 << I40E_AQ_FLAG_CMP_SHIFT) /* 0x2*/ -#define I40E_AQ_FLAG_ERR (1 << I40E_AQ_FLAG_ERR_SHIFT) /* 0x4*/ -#define I40E_AQ_FLAG_VFE (1 << I40E_AQ_FLAG_VFE_SHIFT) /* 0x8*/ -#define I40E_AQ_FLAG_LB(1 << I40E_AQ_FLAG_LB_SHIFT) /* 0x200 */ -#define I40E_AQ_FLAG_RD(1 << I40E_AQ_FLAG_RD_SHIFT) /* 0x400 */ -#define I40E_AQ_FLAG_VFC (1 << I40E_AQ_FLAG_VFC_SHIFT) /* 0x800 */ -#define I40E_AQ_FLAG_BUF (1 << I40E_AQ_FLAG_BUF_SHIFT) /* 0x1000 */ -#define I40E_AQ_FLAG_SI(1 << I40E_AQ_FLAG_SI_SHIFT) /* 0x2000 */ -#define I40E_AQ_FLAG_EI(1 << I40E_AQ_FLAG_EI_SHIFT) /* 0x4000 */ -#define I40E_AQ_FLAG_FE(1 << I40E_AQ_FLAG_FE_SHIFT) /* 0x8000 */ +#define I40E_AQ_FLAG_DDBIT(I40E_AQ_FLAG_DD_SHIFT) /* 0x1*/ +#define I40E_AQ_FLAG_CMP BIT(I40E_AQ_FLAG_CMP_SHIFT) /* 0x2*/ +#define I40E_AQ_FLAG_ERR BIT(I40E_AQ_FLAG_ERR_SHIFT) /* 0x4*/ +#define I40E_AQ_FLAG_VFE BIT(I40E_AQ_FLAG_VFE_SHIFT) /* 0x8*/ +#define I40E_AQ_FLAG_LBBIT(I40E_AQ_FLAG_LB_SHIFT) /* 0x200 */ +#define I40E_AQ_FLAG_RDBIT(I40E_AQ_FLAG_RD_SHIFT) /* 0x400 */ +#define I40E_AQ_FLAG_VFC BIT(I40E_AQ_FLAG_VFC_SHIFT) /* 0x800 */ +#define I40E_AQ_FLAG_BUF BIT(I40E_AQ_FLAG_BUF_SHIFT) /* 0x1000 */ +#define I40E_AQ_FLAG_SIBIT(I40E_AQ_FLAG_SI_SHIFT) /* 0x2000 */ +#define I40E_AQ_FLAG_EIBIT(I40E_AQ_FLAG_EI_SHIFT) /* 0x4000 */ +#define I40E_AQ_FLAG_FEBIT(I40E_AQ_FLAG_FE_SHIFT) /* 0x8000 */ /* error codes */ enum i40e_admin_queue_err { @@ -1628,11 +1628,11 @@ enum i40e_aq_phy_type { enum i40e_aq_link_speed { I40E_LINK_SPEED_UNKNOWN = 0, - I40E_LINK_SPEED_100MB = (1 << I40E_LINK_SPEED_100MB_SHIFT), - I40E_LINK_SPEED_1GB = (1 << I40E_LINK_SPEED_1000MB_SHIFT), - I40E_LINK_SPEED_10GB= (1 << I40E_LINK_SPEED_10GB_SHIFT), - I40E_LINK_SPEED_40GB= (1 << I40E_LINK_SPEED_40GB_SHIFT), - I40E_LINK_SPEED_20GB= (1 << I40E_LINK_SPEED_20GB_SHIFT) + I40E_LINK_SPEED_100MB = BIT(I40E_LINK_SPEED_100MB_SHIFT), + I40E_LINK_SPEED_1GB = BIT(I40E_LINK_SPEED_1000MB_SHIFT), + I40E_LINK_SPEED_10GB= BIT(I40E_LINK_SPEED_10GB_SHIFT), + I40E_LINK_SPEED_40GB= BIT(I40E_LINK_SPEED_40GB_SHIFT), + I40E_LINK_SPEED_20GB= BIT(I40E_LINK_SPEED_20GB_SHIFT) }; struct i40e_aqc_module_desc { @@ -1903,9 +1903,9 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write); /* Used for 0x0704 as well as for 0x0705 commands */ #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT1 #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_MASK \ - (1 << I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT) + BIT(I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT) #define I40E_AQ_ANVM_FEATURE 0 -#define I40E_AQ_ANVM_IMMEDIATE_FIELD (1 << FEATURE_OR_IMMEDIATE_SHIFT) +#define I40E_AQ_ANVM_IMMEDIATE_FIELD BIT(FEATURE_OR_IMMEDIATE_SHIFT) struct i40e_aqc_nvm_config_data_feature { __le16 feature_id; #define I40E_AQ_ANVM_FEATURE_OPTION_OEM_ONLY 0x01 @@ -2202,13 +2202,11 @@ I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_cee_dcb_cfg_resp); */ struct i40e_aqc_lldp_set_local_mib { #define SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT 0 -#define SET_LOCAL_MIB_AC_TYPE_DCBX_MASK(1 << SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT) -#define SET_LOCAL_MIB_AC_TYPE_DCBX_MASK(1 << \ - SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT) +#define SET_LOCAL_MIB_AC_TYPE_DCBX_MASK BIT(SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT) #define SET_LOCAL_MIB_AC_TYPE_LOCAL_MIB0x0 #define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_SHIFT (1) -#define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_MASK(1 << \ - SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_SHIFT) +#define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_MASK \ + BIT(SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_SHIFT) #define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS 0x1 u8
[net-next 04/15] i40e: Remove HMC AQ API implementation
From: Neerav ParikhRemove the code that implements the HMC AQ APIs and call these APIs. This is done because these are obsolete APIs and are not supported by firmware. Change-ID: I5d771d8f37c3e16e7b0a972ff9b27e75aa2d05d4 Signed-off-by: Neerav Parikh Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_adminq.c | 4 --- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 25 -- drivers/net/ethernet/intel/i40e/i40e_common.c | 30 -- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 4 --- .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h| 25 -- 5 files changed, 88 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c index 43bb413..738b42a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c @@ -617,10 +617,6 @@ i40e_status i40e_init_adminq(struct i40e_hw *hw) hw->nvm_release_on_done = false; hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; - ret_code = i40e_aq_set_hmc_resource_profile(hw, - I40E_HMC_PROFILE_DEFAULT, - 0, - NULL); ret_code = 0; /* success! */ diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h index 5179b3b..48c0c00 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h @@ -205,10 +205,6 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_resume_port_tx = 0x041C, i40e_aqc_opc_configure_partition_bw = 0x041D, - /* hmc */ - i40e_aqc_opc_query_hmc_resource_profile = 0x0500, - i40e_aqc_opc_set_hmc_resource_profile = 0x0501, - /* phy commands*/ i40e_aqc_opc_get_phy_abilities = 0x0600, i40e_aqc_opc_set_phy_config = 0x0601, @@ -1586,27 +1582,6 @@ struct i40e_aqc_configure_partition_bw_data { I40E_CHECK_STRUCT_LEN(0x22, i40e_aqc_configure_partition_bw_data); -/* Get and set the active HMC resource profile and status. - * (direct 0x0500) and (direct 0x0501) - */ -struct i40e_aq_get_set_hmc_resource_profile { - u8 pm_profile; - u8 pe_vf_enabled; - u8 reserved[14]; -}; - -I40E_CHECK_CMD_LENGTH(i40e_aq_get_set_hmc_resource_profile); - -enum i40e_aq_hmc_profile { - /* I40E_HMC_PROFILE_NO_CHANGE= 0, reserved */ - I40E_HMC_PROFILE_DEFAULT= 1, - I40E_HMC_PROFILE_FAVOR_VF = 2, - I40E_HMC_PROFILE_EQUAL = 3, -}; - -#define I40E_AQ_GET_HMC_RESOURCE_PROFILE_PM_MASK 0xF -#define I40E_AQ_GET_HMC_RESOURCE_PROFILE_COUNT_MASK0x3F - /* Get PHY Abilities (indirect 0x0600) uses the generic indirect struct */ /* set in param0 for get phy abilities to report qualified modules */ diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index 0e8552b..4a934e1 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c @@ -2855,36 +2855,6 @@ i40e_status i40e_aq_debug_write_register(struct i40e_hw *hw, } /** - * i40e_aq_set_hmc_resource_profile - * @hw: pointer to the hw struct - * @profile: type of profile the HMC is to be set as - * @pe_vf_enabled_count: the number of PE enabled VFs the system has - * @cmd_details: pointer to command details structure or NULL - * - * set the HMC profile of the device. - **/ -i40e_status i40e_aq_set_hmc_resource_profile(struct i40e_hw *hw, - enum i40e_aq_hmc_profile profile, - u8 pe_vf_enabled_count, - struct i40e_asq_cmd_details *cmd_details) -{ - struct i40e_aq_desc desc; - struct i40e_aq_get_set_hmc_resource_profile *cmd = - (struct i40e_aq_get_set_hmc_resource_profile *) - i40e_status status; - - i40e_fill_default_direct_cmd_desc(, - i40e_aqc_opc_set_hmc_resource_profile); - - cmd->pm_profile = (u8)profile; - cmd->pe_vf_enabled = pe_vf_enabled_count; - - status = i40e_asq_send_command(hw, , NULL, 0, cmd_details); - - return status; -} - -/** * i40e_aq_request_resource * @hw: pointer to the hw struct * @resource: resource id diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h index 8afb237..4c8977c 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h +++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h @@ -236,10 +236,6 @@ i40e_status
[net-next 06/15] i40e: Fix uninitialized variable
From: Catherine SullivanWe have an uninitialized variable warning for valid_len for one case in validate_vf_mesg. To fix this, just initialize it to 0 at the top of the function and remove all of the now redundant assignments to 0 in the individual cases. Change-Id: Iacbd97f4c521ed8d662eef803a598d8707708cfd Signed-off-by: Catherine Sullivan Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index a8a65e0..a534fe6 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -2356,7 +2356,7 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode, u32 v_retval, u8 *msg, u16 msglen) { bool err_msg_format = false; - int valid_len; + int valid_len = 0; /* Check if VF is disabled. */ if (test_bit(I40E_VF_STAT_DISABLED, >vf_states)) @@ -2368,13 +2368,10 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode, valid_len = sizeof(struct i40e_virtchnl_version_info); break; case I40E_VIRTCHNL_OP_RESET_VF: - valid_len = 0; break; case I40E_VIRTCHNL_OP_GET_VF_RESOURCES: if (VF_IS_V11(vf)) valid_len = sizeof(u32); - else - valid_len = 0; break; case I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE: valid_len = sizeof(struct i40e_virtchnl_txq_info); @@ -2489,7 +2486,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode, } break; case I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS: - valid_len = 0; break; case I40E_VIRTCHNL_OP_SET_RSS_HENA: valid_len = sizeof(struct i40e_virtchnl_rss_hena); -- 2.5.5
[net-next 03/15] i40e: Prevent falling to promiscuous if the VF is not trusted
From: Anjali Singhai JainWith this change a non trusted VF can never fall to promiscuous mode when there is no room for a MAC/VLAN filter. Change-Id: I8a155aa25c0bcdc6093414920c9ade4ee0bd20e8 Signed-off-by: Anjali Singhai Jain Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 39b3b56..a45748e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -2098,6 +2098,12 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) } } + /* if the VF is not trusted do not do promisc */ + if ((vsi->type == I40E_VSI_SRIOV) && !pf->vf[vsi->vf_id].trusted) { + clear_bit(__I40E_FILTER_OVERFLOW_PROMISC, >state); + goto out; + } + /* check for changes in promiscuous modes */ if (changed_flags & IFF_ALLMULTI) { bool cur_multipromisc; -- 2.5.5
[net-next 14/15] i40evf: make use of BIT() macro to avoid signed left shift
From: Jacob KellerSigned-off-by: Jacob Keller Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h| 44 +++--- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h index 180ae57..3114dcf 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h @@ -78,17 +78,17 @@ struct i40e_aq_desc { #define I40E_AQ_FLAG_EI_SHIFT 14 #define I40E_AQ_FLAG_FE_SHIFT 15 -#define I40E_AQ_FLAG_DD(1 << I40E_AQ_FLAG_DD_SHIFT) /* 0x1 */ -#define I40E_AQ_FLAG_CMP (1 << I40E_AQ_FLAG_CMP_SHIFT) /* 0x2*/ -#define I40E_AQ_FLAG_ERR (1 << I40E_AQ_FLAG_ERR_SHIFT) /* 0x4*/ -#define I40E_AQ_FLAG_VFE (1 << I40E_AQ_FLAG_VFE_SHIFT) /* 0x8*/ -#define I40E_AQ_FLAG_LB(1 << I40E_AQ_FLAG_LB_SHIFT) /* 0x200 */ -#define I40E_AQ_FLAG_RD(1 << I40E_AQ_FLAG_RD_SHIFT) /* 0x400 */ -#define I40E_AQ_FLAG_VFC (1 << I40E_AQ_FLAG_VFC_SHIFT) /* 0x800 */ -#define I40E_AQ_FLAG_BUF (1 << I40E_AQ_FLAG_BUF_SHIFT) /* 0x1000 */ -#define I40E_AQ_FLAG_SI(1 << I40E_AQ_FLAG_SI_SHIFT) /* 0x2000 */ -#define I40E_AQ_FLAG_EI(1 << I40E_AQ_FLAG_EI_SHIFT) /* 0x4000 */ -#define I40E_AQ_FLAG_FE(1 << I40E_AQ_FLAG_FE_SHIFT) /* 0x8000 */ +#define I40E_AQ_FLAG_DDBIT(I40E_AQ_FLAG_DD_SHIFT) /* 0x1*/ +#define I40E_AQ_FLAG_CMP BIT(I40E_AQ_FLAG_CMP_SHIFT) /* 0x2*/ +#define I40E_AQ_FLAG_ERR BIT(I40E_AQ_FLAG_ERR_SHIFT) /* 0x4*/ +#define I40E_AQ_FLAG_VFE BIT(I40E_AQ_FLAG_VFE_SHIFT) /* 0x8*/ +#define I40E_AQ_FLAG_LBBIT(I40E_AQ_FLAG_LB_SHIFT) /* 0x200 */ +#define I40E_AQ_FLAG_RDBIT(I40E_AQ_FLAG_RD_SHIFT) /* 0x400 */ +#define I40E_AQ_FLAG_VFC BIT(I40E_AQ_FLAG_VFC_SHIFT) /* 0x800 */ +#define I40E_AQ_FLAG_BUF BIT(I40E_AQ_FLAG_BUF_SHIFT) /* 0x1000 */ +#define I40E_AQ_FLAG_SIBIT(I40E_AQ_FLAG_SI_SHIFT) /* 0x2000 */ +#define I40E_AQ_FLAG_EIBIT(I40E_AQ_FLAG_EI_SHIFT) /* 0x4000 */ +#define I40E_AQ_FLAG_FEBIT(I40E_AQ_FLAG_FE_SHIFT) /* 0x8000 */ /* error codes */ enum i40e_admin_queue_err { @@ -1625,11 +1625,11 @@ enum i40e_aq_phy_type { enum i40e_aq_link_speed { I40E_LINK_SPEED_UNKNOWN = 0, - I40E_LINK_SPEED_100MB = (1 << I40E_LINK_SPEED_100MB_SHIFT), - I40E_LINK_SPEED_1GB = (1 << I40E_LINK_SPEED_1000MB_SHIFT), - I40E_LINK_SPEED_10GB= (1 << I40E_LINK_SPEED_10GB_SHIFT), - I40E_LINK_SPEED_40GB= (1 << I40E_LINK_SPEED_40GB_SHIFT), - I40E_LINK_SPEED_20GB= (1 << I40E_LINK_SPEED_20GB_SHIFT) + I40E_LINK_SPEED_100MB = BIT(I40E_LINK_SPEED_100MB_SHIFT), + I40E_LINK_SPEED_1GB = BIT(I40E_LINK_SPEED_1000MB_SHIFT), + I40E_LINK_SPEED_10GB= BIT(I40E_LINK_SPEED_10GB_SHIFT), + I40E_LINK_SPEED_40GB= BIT(I40E_LINK_SPEED_40GB_SHIFT), + I40E_LINK_SPEED_20GB= BIT(I40E_LINK_SPEED_20GB_SHIFT) }; struct i40e_aqc_module_desc { @@ -1900,9 +1900,9 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write); /* Used for 0x0704 as well as for 0x0705 commands */ #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT1 #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_MASK \ - (1 << I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT) + BIT(I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT) #define I40E_AQ_ANVM_FEATURE 0 -#define I40E_AQ_ANVM_IMMEDIATE_FIELD (1 << FEATURE_OR_IMMEDIATE_SHIFT) +#define I40E_AQ_ANVM_IMMEDIATE_FIELD BIT(FEATURE_OR_IMMEDIATE_SHIFT) struct i40e_aqc_nvm_config_data_feature { __le16 feature_id; #define I40E_AQ_ANVM_FEATURE_OPTION_OEM_ONLY 0x01 @@ -2171,7 +2171,7 @@ struct i40e_aqc_del_udp_tunnel_completion { I40E_CHECK_CMD_LENGTH(i40e_aqc_del_udp_tunnel_completion); struct i40e_aqc_get_set_rss_key { -#define I40E_AQC_SET_RSS_KEY_VSI_VALID (0x1 << 15) +#define I40E_AQC_SET_RSS_KEY_VSI_VALID BIT(15) #define I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT 0 #define I40E_AQC_SET_RSS_KEY_VSI_ID_MASK (0x3FF << \ I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT) @@ -2191,14 +2191,14 @@ struct i40e_aqc_get_set_rss_key_data { I40E_CHECK_STRUCT_LEN(0x34, i40e_aqc_get_set_rss_key_data); struct i40e_aqc_get_set_rss_lut { -#define I40E_AQC_SET_RSS_LUT_VSI_VALID (0x1 << 15) +#define I40E_AQC_SET_RSS_LUT_VSI_VALID BIT(15) #define I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT 0 #define I40E_AQC_SET_RSS_LUT_VSI_ID_MASK (0x3FF << \ I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT)
[net-next 10/15] i40e: Update device ids for X722
From: Catherine SullivanAdd a device ID for X722. Change-Id: I574f2345ab341de98a6a1c212d0603af853e48b0 Signed-off-by: Catherine Sullivan Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index d6b1b98..cab639b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -91,6 +91,7 @@ static const struct pci_device_id i40e_pci_tbl[] = { {PCI_VDEVICE(INTEL, I40E_DEV_ID_1G_BASE_T_X722), 0}, {PCI_VDEVICE(INTEL, I40E_DEV_ID_10G_BASE_T_X722), 0}, {PCI_VDEVICE(INTEL, I40E_DEV_ID_SFP_I_X722), 0}, + {PCI_VDEVICE(INTEL, I40E_DEV_ID_QSFP_I_X722), 0}, {PCI_VDEVICE(INTEL, I40E_DEV_ID_20G_KR2), 0}, {PCI_VDEVICE(INTEL, I40E_DEV_ID_20G_KR2_A), 0}, /* required last entry */ -- 2.5.5
[net-next 12/15] i40e/i40evf: fix I40E_MASK signed shift overflow warnings
From: Jacob KellerGCC 6 has a new warning which will display when you attempt to left shift a signed value beyond the storage size of the type. I40E_MASK generates a mask value for 32bit registers. Properly typecast the mask value and place the values in parenthesis to prevent macro expansion issues. Signed-off-by: Jacob Keller Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_type.h | 2 +- drivers/net/ethernet/intel/i40evf/i40e_type.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h index 8aa14aa..bd5f13b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_type.h +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h @@ -36,7 +36,7 @@ #include "i40e_devids.h" /* I40E_MASK is a macro used on 32 bit registers */ -#define I40E_MASK(mask, shift) (mask << shift) +#define I40E_MASK(mask, shift) ((u32)(mask) << (shift)) #define I40E_MAX_VSI_QP16 #define I40E_MAX_VF_VSI3 diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h index bfc97c2..97f96e0 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_type.h +++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h @@ -36,7 +36,7 @@ #include "i40e_devids.h" /* I40E_MASK is a macro used on 32 bit registers */ -#define I40E_MASK(mask, shift) (mask << shift) +#define I40E_MASK(mask, shift) ((u32)(mask) << (shift)) #define I40E_MAX_VSI_QP16 #define I40E_MAX_VF_VSI3 -- 2.5.5
[net-next 05/15] i40evf: RSS Hash Option parameters
From: Carolyn WybornyThis patch syncs the VF code for the changes made to the PF for the RSS hash tuple settings. Since the VF still cannot change the RSS hash settings, change the code to make this clear to the user. Previously, the default settings were returned in this function. However, the default can be changed by the PF so this does not make sense anymore. Change-Id: I085eaf005fc7978b440d2a1bf2b2dd7cadaff39b Signed-off-by: Carolyn Wyborny Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 201 + 1 file changed, 2 insertions(+), 199 deletions(-) diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c index 9f7657c..5a48ee0 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c @@ -378,59 +378,6 @@ static int i40evf_set_coalesce(struct net_device *netdev, } /** - * i40e_get_rss_hash_opts - Get RSS hash Input Set for each flow type - * @adapter: board private structure - * @cmd: ethtool rxnfc command - * - * Returns Success if the flow is supported, else Invalid Input. - **/ -static int i40evf_get_rss_hash_opts(struct i40evf_adapter *adapter, - struct ethtool_rxnfc *cmd) -{ - /* We always hash on IP src and dest addresses */ - cmd->data = RXH_IP_SRC | RXH_IP_DST; - - switch (cmd->flow_type) { - case TCP_V4_FLOW: - if (adapter->hena & BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP)) - cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - break; - case UDP_V4_FLOW: - if (adapter->hena & BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP)) - cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - break; - - case SCTP_V4_FLOW: - case AH_ESP_V4_FLOW: - case AH_V4_FLOW: - case ESP_V4_FLOW: - case IPV4_FLOW: - break; - - case TCP_V6_FLOW: - if (adapter->hena & BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP)) - cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - break; - case UDP_V6_FLOW: - if (adapter->hena & BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP)) - cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - break; - - case SCTP_V6_FLOW: - case AH_ESP_V6_FLOW: - case AH_V6_FLOW: - case ESP_V6_FLOW: - case IPV6_FLOW: - break; - default: - cmd->data = 0; - return -EINVAL; - } - - return 0; -} - -/** * i40evf_get_rxnfc - command to get RX flow classification rules * @netdev: network interface device structure * @cmd: ethtool rxnfc command @@ -450,150 +397,8 @@ static int i40evf_get_rxnfc(struct net_device *netdev, ret = 0; break; case ETHTOOL_GRXFH: - ret = i40evf_get_rss_hash_opts(adapter, cmd); - break; - default: - break; - } - - return ret; -} - -/** - * i40evf_set_rss_hash_opt - Enable/Disable flow types for RSS hash - * @adapter: board private structure - * @cmd: ethtool rxnfc command - * - * Returns Success if the flow input set is supported. - **/ -static int i40evf_set_rss_hash_opt(struct i40evf_adapter *adapter, - struct ethtool_rxnfc *nfc) -{ - struct i40e_hw *hw = >hw; - u32 flags = adapter->vf_res->vf_offload_flags; - - /* RSS does not support anything other than hashing -* to queues on src and dst IPs and ports -*/ - if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | - RXH_L4_B_0_1 | RXH_L4_B_2_3)) - return -EINVAL; - - /* We need at least the IP SRC and DEST fields for hashing */ - if (!(nfc->data & RXH_IP_SRC) || - !(nfc->data & RXH_IP_DST)) - return -EINVAL; - - switch (nfc->flow_type) { - case TCP_V4_FLOW: - if (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { - if (flags & I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2) - adapter->hena |= - BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK); - - adapter->hena |= -BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP); - } else { - return -EINVAL; - } - break; - case TCP_V6_FLOW: - if (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { - if (flags & I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2) - adapter->hena |= - BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK); - -
[net-next 01/15] i40e: Change the default for VFs to be not privileged
From: Anjali Singhai JainMake sure a VF is not trusted/privileged until its explicitly set for trust through the new NDO op interface. Change-Id: I476385c290d2b4901d8fceb29de43546accdc499 Signed-off-by: Anjali Singhai Jain Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index c226c2d..4c365d7 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -860,7 +860,11 @@ static int i40e_alloc_vf_res(struct i40e_vf *vf) if (ret) goto error_alloc; total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; - set_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps); + + if (vf->trusted) + set_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps); + else + clear_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps); /* store the total qps number for the runtime * VF req validation @@ -1847,15 +1851,17 @@ static inline int i40e_check_vf_permission(struct i40e_vf *vf, u8 *macaddr) dev_err(>pdev->dev, "invalid VF MAC addr %pM\n", macaddr); ret = I40E_ERR_INVALID_MAC_ADDR; } else if (vf->pf_set_mac && !is_multicast_ether_addr(macaddr) && + !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps) && !ether_addr_equal(macaddr, vf->default_lan_addr.addr)) { /* If the host VMM administrator has set the VF MAC address * administratively via the ndo_set_vf_mac command then deny * permission to the VF to add or delete unicast MAC addresses. +* Unless the VF is privileged and then it can do whatever. * The VF may request to set the MAC address filter already * assigned to it so do not return an error in that case. */ dev_err(>pdev->dev, - "VF attempting to override administratively set MAC address\nPlease reload the VF driver to resume normal operation\n"); + "VF attempting to override administratively set MAC address, reload the VF driver to resume normal operation\n"); ret = -EPERM; } return ret; @@ -1880,7 +1886,6 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) int i; if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states) || - !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps) || !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { ret = I40E_ERR_PARAM; goto error_param; @@ -1954,7 +1959,6 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) int i; if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states) || - !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps) || !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { ret = I40E_ERR_PARAM; goto error_param; @@ -2207,7 +2211,6 @@ static int i40e_vc_config_rss_key(struct i40e_vf *vf, u8 *msg, u16 msglen) i40e_status aq_ret = 0; if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states) || - !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps) || !i40e_vc_isvalid_vsi_id(vf, vsi_id) || (vrk->key_len != I40E_HKEY_ARRAY_SIZE)) { aq_ret = I40E_ERR_PARAM; @@ -2240,7 +2243,6 @@ static int i40e_vc_config_rss_lut(struct i40e_vf *vf, u8 *msg, u16 msglen) i40e_status aq_ret = 0; if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states) || - !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps) || !i40e_vc_isvalid_vsi_id(vf, vsi_id) || (vrl->lut_entries != I40E_VF_HLUT_ARRAY_SIZE)) { aq_ret = I40E_ERR_PARAM; @@ -2270,8 +2272,7 @@ static int i40e_vc_get_rss_hena(struct i40e_vf *vf, u8 *msg, u16 msglen) i40e_status aq_ret = 0; int len = 0; - if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states) || - !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps)) { + if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states)) { aq_ret = I40E_ERR_PARAM; goto err; } @@ -2307,8 +2308,7 @@ static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg, u16 msglen) struct i40e_hw *hw = >hw; i40e_status aq_ret = 0; - if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states) || - !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps)) { + if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states)) { aq_ret = I40E_ERR_PARAM; goto err; } -- 2.5.5
[net-next 02/15] i40e: Limit the number of MAC and VLAN addresses that can be added for VFs
From: Anjali Singhai JainIf the VF is privileged/trusted it can do as it may please including but not limited to hogging resources and playing unfair. But if the VF is not privileged/trusted it still can add some number (8) of MAC and VLAN addresses. Other restrictions with respect to Port VLAN and normal VLAN still apply to not privileged/trusted VF. Change-Id: I3a9529201b184c8873e1ad2e300aff468c9e6296 Signed-off-by: Anjali Singhai Jain Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 25 -- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 3 +++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 4c365d7..a8a65e0 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -1831,6 +1831,10 @@ error_param: (u8 *), sizeof(stats)); } +/* If the VF is not trusted restrict the number of MAC/VLAN it can program */ +#define I40E_VC_MAX_MAC_ADDR_PER_VF 8 +#define I40E_VC_MAX_VLAN_PER_VF 8 + /** * i40e_check_vf_permission * @vf: pointer to the VF info @@ -1863,6 +1867,11 @@ static inline int i40e_check_vf_permission(struct i40e_vf *vf, u8 *macaddr) dev_err(>pdev->dev, "VF attempting to override administratively set MAC address, reload the VF driver to resume normal operation\n"); ret = -EPERM; + } else if ((vf->num_mac >= I40E_VC_MAX_MAC_ADDR_PER_VF) && + !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps)) { + dev_err(>pdev->dev, + "VF is not trusted, switch the VF to trusted to add more functionality\n"); + ret = -EPERM; } return ret; } @@ -1924,6 +1933,8 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) ret = I40E_ERR_PARAM; spin_unlock_bh(>mac_filter_list_lock); goto error_param; + } else { + vf->num_mac++; } } spin_unlock_bh(>mac_filter_list_lock); @@ -1982,6 +1993,8 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) ret = I40E_ERR_INVALID_MAC_ADDR; spin_unlock_bh(>mac_filter_list_lock); goto error_param; + } else { + vf->num_mac--; } spin_unlock_bh(>mac_filter_list_lock); @@ -2016,8 +2029,13 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) i40e_status aq_ret = 0; int i; + if ((vf->num_vlan >= I40E_VC_MAX_VLAN_PER_VF) && + !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps)) { + dev_err(>pdev->dev, + "VF is not trusted, switch the VF to trusted to add more VLAN addresses\n"); + goto error_param; + } if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states) || - !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps) || !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { aq_ret = I40E_ERR_PARAM; goto error_param; @@ -2041,6 +2059,8 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) for (i = 0; i < vfl->num_elements; i++) { /* add new VLAN filter */ int ret = i40e_vsi_add_vlan(vsi, vfl->vlan_id[i]); + if (!ret) + vf->num_vlan++; if (test_bit(I40E_VF_STAT_UC_PROMISC, >vf_states)) i40e_aq_set_vsi_uc_promisc_on_vlan(>hw, vsi->seid, @@ -2083,7 +2103,6 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) int i; if (!test_bit(I40E_VF_STAT_ACTIVE, >vf_states) || - !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, >vf_caps) || !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { aq_ret = I40E_ERR_PARAM; goto error_param; @@ -2104,6 +2123,8 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) for (i = 0; i < vfl->num_elements; i++) { int ret = i40e_vsi_kill_vlan(vsi, vfl->vlan_id[i]); + if (!ret) + vf->num_vlan--; if (test_bit(I40E_VF_STAT_UC_PROMISC, >vf_states)) i40e_aq_set_vsi_uc_promisc_on_vlan(>hw, vsi->seid, diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h index 8cbf579..bf54873 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +++
Re: [PATCH net-next] net: dsa: mv88e6xxx: replace ds with ps where possible
From: Vivien DidelotDate: Thu, 28 Apr 2016 21:24:06 -0400 > From: Andrew Lunn > > The dsa_switch structure ds is actually needed in very few places, > mostly during setup of the switch. The private structure ps is however > needed nearly everywhere. Pass ps, not ds internally. > > [vd: rebased Andrew's patch.] > > Signed-off-by: Andrew Lunn > Signed-off-by: Vivien Didelot Applied, thanks Vivien. Andrew, please, when replying to a patch posting do not quote the entire patch when you're just commenting about the commit message or a small part of the change. Thanks.
Re: [PATCH] mdio_bus: Fix MDIO bus scanning in __mdiobus_register()
Please respin this with the checkpatch errors fixed. I don't have any opinion about the conditional parenthesis, so don't worry about that.
[PATCH net-next] fq_codel: add batch ability to fq_codel_drop()
From: Eric DumazetIn presence of inelastic flows and stress, we can call fq_codel_drop() for every packet entering fq_codel qdisc. fq_codel_drop() is quite expensive, as it does a linear scan of 4 KB of memory to find a fat flow. Once found, it drops the oldest packet of this flow. Instead of dropping a single packet, try to drop 50% of the backlog of this fat flow, with a configurable limit of 64 packets per round. TCA_FQ_CODEL_DROP_BATCH_SIZE is the new attribute to make this limit configurable. With this strategy the 4 KB search is amortized to a single cache line per drop [1], so fq_codel_drop() no longer appears at the top of kernel profile in presence of few inelastic flows. [1] Assuming a 64byte cache line, and 1024 buckets Signed-off-by: Eric Dumazet Reported-by: Dave Taht Cc: Jonathan Morton --- include/uapi/linux/pkt_sched.h |1 net/sched/sch_fq_codel.c | 64 +-- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index 1c78c7454c7c..a11afecd4482 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h @@ -718,6 +718,7 @@ enum { TCA_FQ_CODEL_FLOWS, TCA_FQ_CODEL_QUANTUM, TCA_FQ_CODEL_CE_THRESHOLD, + TCA_FQ_CODEL_DROP_BATCH_SIZE, __TCA_FQ_CODEL_MAX }; diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index a5e420b3d4ab..e7b42b0d5145 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c @@ -59,6 +59,7 @@ struct fq_codel_sched_data { u32 flows_cnt; /* number of flows */ u32 perturbation; /* hash perturbation */ u32 quantum;/* psched_mtu(qdisc_dev(sch)); */ + u32 drop_batch_size; struct codel_params cparams; struct codel_stats cstats; u32 drop_overlimit; @@ -135,17 +136,20 @@ static inline void flow_queue_add(struct fq_codel_flow *flow, skb->next = NULL; } -static unsigned int fq_codel_drop(struct Qdisc *sch) +static unsigned int fq_codel_drop(struct Qdisc *sch, unsigned int max_packets) { struct fq_codel_sched_data *q = qdisc_priv(sch); struct sk_buff *skb; unsigned int maxbacklog = 0, idx = 0, i, len; struct fq_codel_flow *flow; + unsigned int threshold; - /* Queue is full! Find the fat flow and drop packet from it. + /* Queue is full! Find the fat flow and drop packet(s) from it. * This might sound expensive, but with 1024 flows, we scan * 4KB of memory, and we dont need to handle a complex tree * in fast path (packet queue/enqueue) with many cache misses. +* In stress mode, we'll try to drop 64 packets from the flow, +* amortizing this linear lookup to one cache line per drop. */ for (i = 0; i < q->flows_cnt; i++) { if (q->backlogs[i] > maxbacklog) { @@ -153,15 +157,24 @@ static unsigned int fq_codel_drop(struct Qdisc *sch) idx = i; } } + + /* Our goal is to drop half of this fat flow backlog */ + threshold = maxbacklog >> 1; + flow = >flows[idx]; - skb = dequeue_head(flow); - len = qdisc_pkt_len(skb); + len = 0; + i = 0; + do { + skb = dequeue_head(flow); + len += qdisc_pkt_len(skb); + kfree_skb(skb); + } while (++i < max_packets && len < threshold); + + flow->dropped += i; q->backlogs[idx] -= len; - sch->q.qlen--; - qdisc_qstats_drop(sch); - qdisc_qstats_backlog_dec(sch, skb); - kfree_skb(skb); - flow->dropped++; + sch->qstats.drops += i; + sch->qstats.backlog -= len; + sch->q.qlen -= i; return idx; } @@ -170,14 +183,14 @@ static unsigned int fq_codel_qdisc_drop(struct Qdisc *sch) unsigned int prev_backlog; prev_backlog = sch->qstats.backlog; - fq_codel_drop(sch); + fq_codel_drop(sch, 1U); return prev_backlog - sch->qstats.backlog; } static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) { struct fq_codel_sched_data *q = qdisc_priv(sch); - unsigned int idx, prev_backlog; + unsigned int idx, prev_backlog, prev_qlen; struct fq_codel_flow *flow; int uninitialized_var(ret); @@ -206,16 +219,22 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) return NET_XMIT_SUCCESS; prev_backlog = sch->qstats.backlog; - q->drop_overlimit++; - /* Return Congestion Notification only if we dropped a packet -* from this flow. + prev_qlen = sch->q.qlen; + + /* fq_codel_drop() is quite expensive, as it performs a linear search +* in q->backlogs[] to find a
Re: [PATCH net-next 0/3] qed/qede: ethtool selftests support.
From: Sudarsana Reddy KalluruDate: Thu, 28 Apr 2016 20:20:51 -0400 > This series adds the driver support for following selftests: > 1. Register test > 2. Memory test > 3. Clock test > 4. Interrupt test > 5. Internal loopback test > Patch (1) adds the qed driver infrastructure for selftests. Patches (2) and > (3) add qede driver support for ethtool selftests. > > Please consider applying this series to "net-next". Series applied, thanks.
Re: [PATCH net-next 1/1] tipc: set 'active' state correctly for first established link
From: Jon MaloyDate: Thu, 28 Apr 2016 20:16:08 -0400 > When we are displaying statistics for the first link established between > two peers, it will always be presented as STANDBY although it in reality > is ACTIVE. > > This happens because we forget to set the 'active' flag in the link > instance at the moment it is established. Although this is a bug, it only > has impact on the presentation view of the link, not on its actual > functionality. > > Signed-off-by: Jon Maloy Applied, thanks Jon.
Re: [PATCH net-next] ila: ipv6/ila: fix nlsize calculation for lwtunnel
From: Tom HerbertDate: Thu, 28 Apr 2016 17:12:29 -0700 > @@ -144,8 +144,12 @@ nla_put_failure: > > static int ila_encap_nlsize(struct lwtunnel_state *lwtstate) > { > - /* No encapsulation overhead */ > - return 0; > + return > + /* ILA_ATTR_LOCATOR */ > + nla_total_size(sizeof(u64)) + As Nicolas stated, you need to use the 64-bit sizing helper here.
Re: [PATCH v3 net] soreuseport: Fix TCP listener hash collision
From: Craig GallekDate: Thu, 28 Apr 2016 19:24:32 -0400 > From: Craig Gallek > > I forgot to include a check for listener port equality when deciding > if two sockets should belong to the same reuseport group. This was > not caught previously because it's only necessary when two listening > sockets for the same user happen to hash to the same listener bucket. > The same error does not exist in the UDP path. > > Fixes: c125e80b8868("soreuseport: fast reuseport TCP socket selection") > Signed-off-by: Craig Gallek Applied.
Re: [PATCH net-next] of: of_mdio: Check if MDIO bus controller is available
From: Florian FainelliDate: Thu, 28 Apr 2016 14:55:10 -0700 > Add a check whether the 'struct device_node' pointer passed to > of_mdiobus_register() is an available (aka enabled) node in the Device > Tree. > > Rationale for doing this are cases where an Ethernet MAC provides a MDIO > bus controller and node, and an additional Ethernet MAC might be > connecting its PHY/switches to that first MDIO bus controller, while > still embedding one internally which is therefore marked as "disabled". > > Instead of sprinkling checks like these in callers of > of_mdiobus_register(), do this in a central location. > > Signed-off-by: Florian Fainelli Applied, thanks Florian.
Re: [PATCH] net: l2tp: fix reversed udp6 checksum flags
From: Wang ShankerDate: Fri, 29 Apr 2016 01:29:43 +0800 > This patch fixes a bug which causes the behavior of whether to ignore > udp6 checksum of udp6 encapsulated l2tp tunnel contrary to what > userspace program requests. > > When the flag `L2TP_ATTR_UDP_ZERO_CSUM6_RX` is set by userspace, it is > expected that udp6 checksums of received packets of the l2tp tunnel > to create should be ignored. In `l2tp_netlink.c`: > `l2tp_nl_cmd_tunnel_create()`, `cfg.udp6_zero_rx_checksums` is set > according to the flag, and then passed to `l2tp_core.c`: > `l2tp_tunnel_create()` and then `l2tp_tunnel_sock_create()`. In > `l2tp_tunnel_sock_create()`, `udp_conf.use_udp6_rx_checksums` is set > the same to `cfg.udp6_zero_rx_checksums`. However, if we want the > checksum to be ignored, `udp_conf.use_udp6_rx_checksums` should be set > to `false`, i.e. be set to the contrary. Similarly, the same should be > done to `udp_conf.use_udp6_tx_checksums`. > > Signed-off-by: Miao Wang Applied, thanks.
[PATCH net 0/2] RDS: TCP: sychronization during connection startup
This patch series ensures that the passive (accept) side of the TCP connection used for RDS-TCP is correctly synchronized with any concurrent active (connect) attempts for a given pair of peers. Patch 1 in the series makes sure that the t_sock in struct rds_tcp_connection is only reset after any threads in rds_tcp_xmit have completed (otherwise a null-ptr deref may be encountered). Patch 2 synchronizes rds_tcp_accept_one() with the rds_tcp*connect() path. Sowmini Varadhan (2): RDS:TCP: Synchronize rds_tcp_accept_one with rds_send_xmit when resetting t_sock RDS: TCP: Synchrnozize accept() and connect() paths on t_conn_lock. net/rds/tcp.c |3 +- net/rds/tcp.h |4 +++ net/rds/tcp_connect.c |8 +++ net/rds/tcp_listen.c | 54 4 files changed, 50 insertions(+), 19 deletions(-)
[PATCH net 2/2] RDS: TCP: Synchrnozize accept() and connect() paths on t_conn_lock.
An arbitration scheme for duelling SYNs is implemented as part of commit 241b271952eb ("RDS-TCP: Reset tcp callbacks if re-using an outgoing socket in rds_tcp_accept_one()") which ensures that both nodes involved will arrive at the same arbitration decision. However, this needs to be synchronized with an outgoing SYN to be generated by rds_tcp_conn_connect(). This commit achieves the synchronization through the t_conn_lock mutex in struct rds_tcp_connection. The rds_conn_state is checked in rds_tcp_conn_connect() after acquiring the t_conn_lock mutex. A SYN is sent out only if the RDS connection is not already UP (an UP would indicate that rds_tcp_accept_one() has completed 3WH, so no SYN needs to be generated). Similarly, the rds_conn_state is checked in rds_tcp_accept_one() after acquiring the t_conn_lock mutex. The only acceptable states (to allow continuation of the arbitration logic) are UP (i.e., outgoing SYN was SYN-ACKed by peer after it sent us the SYN) or CONNECTING (we sent outgoing SYN before we saw incoming SYN). Signed-off-by: Sowmini Varadhan--- net/rds/tcp.c |1 + net/rds/tcp.h |4 net/rds/tcp_connect.c |8 net/rds/tcp_listen.c | 30 -- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/net/rds/tcp.c b/net/rds/tcp.c index 9134544..86187da 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -216,6 +216,7 @@ static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp) if (!tc) return -ENOMEM; + mutex_init(>t_conn_lock); tc->t_sock = NULL; tc->t_tinc = NULL; tc->t_tinc_hdr_rem = sizeof(struct rds_header); diff --git a/net/rds/tcp.h b/net/rds/tcp.h index 64f873c..41c2283 100644 --- a/net/rds/tcp.h +++ b/net/rds/tcp.h @@ -12,6 +12,10 @@ struct rds_tcp_connection { struct list_headt_tcp_node; struct rds_connection *conn; + /* t_conn_lock synchronizes the connection establishment between +* rds_tcp_accept_one and rds_tcp_conn_connect +*/ + struct mutext_conn_lock; struct socket *t_sock; void*t_orig_write_space; void*t_orig_data_ready; diff --git a/net/rds/tcp_connect.c b/net/rds/tcp_connect.c index 5cb1687..49a3fcf 100644 --- a/net/rds/tcp_connect.c +++ b/net/rds/tcp_connect.c @@ -78,7 +78,14 @@ int rds_tcp_conn_connect(struct rds_connection *conn) struct socket *sock = NULL; struct sockaddr_in src, dest; int ret; + struct rds_tcp_connection *tc = conn->c_transport_data; + + mutex_lock(>t_conn_lock); + if (rds_conn_up(conn)) { + mutex_unlock(>t_conn_lock); + return 0; + } ret = sock_create_kern(rds_conn_net(conn), PF_INET, SOCK_STREAM, IPPROTO_TCP, ); if (ret < 0) @@ -120,6 +127,7 @@ int rds_tcp_conn_connect(struct rds_connection *conn) } out: + mutex_unlock(>t_conn_lock); if (sock) sock_release(sock); return ret; diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index 0896187..cc8496f 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c @@ -76,7 +76,9 @@ int rds_tcp_accept_one(struct socket *sock) struct rds_connection *conn; int ret; struct inet_sock *inet; - struct rds_tcp_connection *rs_tcp; + struct rds_tcp_connection *rs_tcp = NULL; + int conn_state; + struct sock *nsk; ret = sock_create_kern(sock_net(sock->sk), sock->sk->sk_family, sock->sk->sk_type, sock->sk->sk_protocol, @@ -116,6 +118,10 @@ int rds_tcp_accept_one(struct socket *sock) */ rs_tcp = (struct rds_tcp_connection *)conn->c_transport_data; rds_conn_transition(conn, RDS_CONN_DOWN, RDS_CONN_CONNECTING); + mutex_lock(_tcp->t_conn_lock); + conn_state = rds_conn_state(conn); + if (conn_state != RDS_CONN_CONNECTING && conn_state != RDS_CONN_UP) + goto rst_nsk; if (rs_tcp->t_sock) { /* Need to resolve a duelling SYN between peers. * We have an outstanding SYN to this peer, which may @@ -126,14 +132,7 @@ int rds_tcp_accept_one(struct socket *sock) wait_event(conn->c_waitq, !test_bit(RDS_IN_XMIT, >c_flags)); if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) { - struct sock *nsk = new_sock->sk; - - nsk->sk_user_data = NULL; - nsk->sk_prot->disconnect(nsk, 0); - tcp_done(nsk); - new_sock = NULL; - ret = 0; - goto out; + goto rst_nsk; } else if (rs_tcp->t_sock) {
Re: [PATCH v1 net] net/mlx4: Avoid wrong virtual mappings
From: Sinan KayaDate: Sun, 1 May 2016 16:12:13 -0400 > I just wanted to make sure that this patch is moving in the right > direction. You never need to wonder about this. If the patch is in an active state in the patchwork queue, which this one is, there is absolutely nothing you need to do nor ask about the patch.
[PATCH net 1/2] RDS:TCP: Synchronize rds_tcp_accept_one with rds_send_xmit when resetting t_sock
There is a race condition between rds_send_xmit -> rds_tcp_xmit and the code that deals with resolution of duelling syns added by commit 241b271952eb ("RDS-TCP: Reset tcp callbacks if re-using an outgoing socket in rds_tcp_accept_one()"). Specifically, we may end up derefencing a null pointer in rds_send_xmit if we have the interleaving sequencee: rds_tcp_accept_one rds_send_xmit conn is RDS_CONN_UP, so invoke rds_tcp_xmit tc = conn->c_transport_data rds_tcp_restore_callbacks /* reset t_sock */ null ptr deref from tc->t_sock The race condition can be avoided without adding the overhead of additional locking in the xmit path: have rds_tcp_accept_one wait for rds_tcp_xmit threads to complete before resetting callbacks. The synchronization can be done in the same manner as rds_conn_shutdown(). First set the rds_conn_state to something other than RDS_CONN_UP (so that new threads cannot get into rds_tcp_xmit()), then wait for RDS_IN_XMIT to be cleared in the conn->c_flags indicating that any threads in rds_tcp_xmit are done. Fixes: 241b271952eb ("RDS-TCP: Reset tcp callbacks if re-using an outgoing socket in rds_tcp_accept_one()") Signed-off-by: Sowmini Varadhan--- net/rds/tcp.c|2 +- net/rds/tcp_listen.c | 40 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/net/rds/tcp.c b/net/rds/tcp.c index 61ed2a8..9134544 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -127,7 +127,7 @@ void rds_tcp_restore_callbacks(struct socket *sock, /* * This is the only path that sets tc->t_sock. Send and receive trust that - * it is set. The RDS_CONN_CONNECTED bit protects those paths from being + * it is set. The RDS_CONN_UP bit protects those paths from being * called while it isn't set. */ void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn) diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index 0936a4a..0896187 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c @@ -115,24 +115,32 @@ int rds_tcp_accept_one(struct socket *sock) * rds_tcp_state_change() will do that cleanup */ rs_tcp = (struct rds_tcp_connection *)conn->c_transport_data; - if (rs_tcp->t_sock && - ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) { - struct sock *nsk = new_sock->sk; - - nsk->sk_user_data = NULL; - nsk->sk_prot->disconnect(nsk, 0); - tcp_done(nsk); - new_sock = NULL; - ret = 0; - goto out; - } else if (rs_tcp->t_sock) { - rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp); - conn->c_outgoing = 0; - } - rds_conn_transition(conn, RDS_CONN_DOWN, RDS_CONN_CONNECTING); + if (rs_tcp->t_sock) { + /* Need to resolve a duelling SYN between peers. +* We have an outstanding SYN to this peer, which may +* potentially have transitioned to the RDS_CONN_UP state, +* so we must quiesce any send threads before resetting +* c_transport_data. +*/ + wait_event(conn->c_waitq, + !test_bit(RDS_IN_XMIT, >c_flags)); + if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) { + struct sock *nsk = new_sock->sk; + + nsk->sk_user_data = NULL; + nsk->sk_prot->disconnect(nsk, 0); + tcp_done(nsk); + new_sock = NULL; + ret = 0; + goto out; + } else if (rs_tcp->t_sock) { + rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp); + conn->c_outgoing = 0; + } + } rds_tcp_set_callbacks(new_sock, conn); - rds_connect_complete(conn); + rds_connect_complete(conn); /* marks RDS_CONN_UP */ new_sock = NULL; ret = 0; -- 1.7.1
Re: [PATCH] drivers: net: xgene: constify xgene_cle_ops structure
On Sun, May 1, 2016 at 5:36 AM, Julia Lawallwrote: > The xgene_cle_ops structure is never modified, so declare it as const. > > Done with the help of Coccinelle. > > Signed-off-by: Julia Lawall > > --- > drivers/net/ethernet/apm/xgene/xgene_enet_cle.c |2 +- > drivers/net/ethernet/apm/xgene/xgene_enet_cle.h |2 +- > drivers/net/ethernet/apm/xgene/xgene_enet_main.h |2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c > b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c > index b2124886..6479288 100644 > --- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c > +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c > @@ -729,6 +729,6 @@ static int xgene_enet_cle_init(struct xgene_enet_pdata > *pdata) > return xgene_cle_setup_ptree(pdata, enet_cle); > } > > -struct xgene_cle_ops xgene_cle3in_ops = { > +const struct xgene_cle_ops xgene_cle3in_ops = { > .cle_init = xgene_enet_cle_init, > }; > diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h > b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h > index 29a17ab..13e829a 100644 > --- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h > +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h > @@ -290,6 +290,6 @@ struct xgene_enet_cle { > u32 jump_bytes; > }; > > -extern struct xgene_cle_ops xgene_cle3in_ops; > +extern const struct xgene_cle_ops xgene_cle3in_ops; > > #endif /* __XGENE_ENET_CLE_H__ */ > diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h > b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h > index 175d188..0a2887b 100644 > --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h > +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h > @@ -191,7 +191,7 @@ struct xgene_enet_pdata { > const struct xgene_mac_ops *mac_ops; > const struct xgene_port_ops *port_ops; > struct xgene_ring_ops *ring_ops; > - struct xgene_cle_ops *cle_ops; > + const struct xgene_cle_ops *cle_ops; > struct delayed_work link_work; > u32 port_id; > u8 cpu_bufnum; > Thanks Julia. Acked-by: Iyappan Subramanian
[net-next PATCH v2 2/5] stmmac: dwmac-socfpga: add PM ops and resume function
Implement the needed PM callbacks in the driver instead of relying on the init/exit hooks in stmmac_platform. This gives the driver more flexibility in how the code is organized. Eventually the init/exit callbacks will be deprecated in favor of the standard PM callbacks and driver remove function. Signed-off-by: Joachim EastwoodTested-by: Marek Vasut --- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 784eb53..789013a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -261,7 +261,6 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) } plat_dat->bsp_priv = dwmac; - plat_dat->init = socfpga_dwmac_init; plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed; ret = stmmac_dvr_probe(>dev, plat_dat, _res); @@ -271,6 +270,21 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) return ret; } +#ifdef CONFIG_PM_SLEEP +static int socfpga_dwmac_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct net_device *ndev = dev_get_drvdata(dev); + struct stmmac_priv *priv = netdev_priv(ndev); + + socfpga_dwmac_init(pdev, priv->plat->bsp_priv); + + return stmmac_resume(dev); +} +#endif /* CONFIG_PM_SLEEP */ + +SIMPLE_DEV_PM_OPS(socfpga_dwmac_pm_ops, stmmac_suspend, socfpga_dwmac_resume); + static const struct of_device_id socfpga_dwmac_match[] = { { .compatible = "altr,socfpga-stmmac" }, { } @@ -282,7 +296,7 @@ static struct platform_driver socfpga_dwmac_driver = { .remove = stmmac_pltfr_remove, .driver = { .name = "socfpga-dwmac", - .pm = _pltfr_pm_ops, + .pm = _dwmac_pm_ops, .of_match_table = socfpga_dwmac_match, }, }; -- 2.8.0
[net-next PATCH v2 5/5] stmmac: dwmac-socfpga: kill init() and rename setup() to set_phy_mode()
Remove old init callback which now contains only a call to socfpga_dwmac_setup(). Also rename socfpga_dwmac_setup() to indicate what the function really does. Signed-off-by: Joachim EastwoodTested-by: Marek Vasut --- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index ba49d8c..cd9764a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -136,7 +136,7 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device * return 0; } -static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac) +static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac) { struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr; int phymode = dwmac->interface; @@ -195,16 +195,6 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac) return 0; } -static int socfpga_dwmac_init(struct platform_device *pdev, void *priv) -{ - struct socfpga_dwmac *dwmac = priv; - - /* Setup the phy mode in the system manager registers according to -* devicetree configuration -*/ - return socfpga_dwmac_setup(dwmac); -} - static int socfpga_dwmac_probe(struct platform_device *pdev) { struct plat_stmmacenet_data *plat_dat; @@ -245,7 +235,7 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) */ dwmac->stmmac_rst = stpriv->stmmac_rst; - ret = socfpga_dwmac_init(pdev, dwmac); + ret = socfpga_dwmac_set_phy_mode(dwmac); } return ret; @@ -254,11 +244,10 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) #ifdef CONFIG_PM_SLEEP static int socfpga_dwmac_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); struct net_device *ndev = dev_get_drvdata(dev); struct stmmac_priv *priv = netdev_priv(ndev); - socfpga_dwmac_init(pdev, priv->plat->bsp_priv); + socfpga_dwmac_set_phy_mode(priv->plat->bsp_priv); /* Before the enet controller is suspended, the phy is suspended. * This causes the phy clock to be gated. The enet controller is -- 2.8.0
[net-next PATCH v2 3/5] stmmac: dwmac-socfpga: keep a copy of stmmac_rst in driver priv data
The dwmac-socfpga driver needs to control the reset usually managed by the core driver to set the PHY mode. Take a copy of the reset handle from core priv data so it can be used by the driver later. This also allow us to move reset handling into socfpga_dwmac_setup() where the code that needs it is located. Signed-off-by: Joachim EastwoodTested-by: Marek Vasut --- .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c| 33 ++ 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 789013a..ba0b793 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -49,6 +49,7 @@ struct socfpga_dwmac { u32 reg_shift; struct device *dev; struct regmap *sys_mgr_base_addr; + struct reset_control *stmmac_rst; void __iomem *splitter_base; bool f2h_ptp_ref_clk; }; @@ -164,6 +165,10 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac) if (dwmac->splitter_base) val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII; + /* Assert reset to the enet controller before changing the phy mode */ + if (dwmac->stmmac_rst) + reset_control_assert(dwmac->stmmac_rst); + regmap_read(sys_mgr_base_addr, reg_offset, ); ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift); ctrl |= val << reg_shift; @@ -181,6 +186,12 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac) regmap_write(sys_mgr_base_addr, reg_offset, ctrl); + /* Deassert reset for the phy configuration to be sampled by +* the enet controller, and operation to start in requested mode +*/ + if (dwmac->stmmac_rst) + reset_control_deassert(dwmac->stmmac_rst); + return 0; } @@ -198,21 +209,11 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv) if (!stpriv) return -EINVAL; - /* Assert reset to the enet controller before changing the phy mode */ - if (stpriv->stmmac_rst) - reset_control_assert(stpriv->stmmac_rst); - /* Setup the phy mode in the system manager registers according to * devicetree configuration */ ret = socfpga_dwmac_setup(dwmac); - /* Deassert reset for the phy configuration to be sampled by -* the enet controller, and operation to start in requested mode -*/ - if (stpriv->stmmac_rst) - reset_control_deassert(stpriv->stmmac_rst); - /* Before the enet controller is suspended, the phy is suspended. * This causes the phy clock to be gated. The enet controller is * resumed before the phy, so the clock is still gated "off" when @@ -264,8 +265,18 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed; ret = stmmac_dvr_probe(>dev, plat_dat, _res); - if (!ret) + if (!ret) { + struct net_device *ndev = platform_get_drvdata(pdev); + struct stmmac_priv *stpriv = netdev_priv(ndev); + + /* The socfpga driver needs to control the stmmac reset to +* set the phy mode. Create a copy of the core reset handel +* so it can be used by the driver later. +*/ + dwmac->stmmac_rst = stpriv->stmmac_rst; + ret = socfpga_dwmac_init(pdev, dwmac); + } return ret; } -- 2.8.0
[net-next PATCH v2 1/5] stmmac: let remove/resume/suspend functions take device pointer
Change stmmac_remove/resume/suspend to take a device pointer so they can be used directly by drivers that doesn't need to perform anything device specific. This lets us remove the PCI pm functions and later simplifiy the platform drivers. Signed-off-by: Joachim EastwoodTested-by: Marek Vasut --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 6 +++--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 -- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 24 ++ .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 6 +++--- 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index ff67506..59ae608 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -148,9 +148,9 @@ void stmmac_set_ethtool_ops(struct net_device *netdev); int stmmac_ptp_register(struct stmmac_priv *priv); void stmmac_ptp_unregister(struct stmmac_priv *priv); -int stmmac_resume(struct net_device *ndev); -int stmmac_suspend(struct net_device *ndev); -int stmmac_dvr_remove(struct net_device *ndev); +int stmmac_resume(struct device *dev); +int stmmac_suspend(struct device *dev); +int stmmac_dvr_remove(struct device *dev); int stmmac_dvr_probe(struct device *device, struct plat_stmmacenet_data *plat_dat, struct stmmac_resources *res); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index b87edb7..fd5ab7b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3350,12 +3350,13 @@ EXPORT_SYMBOL_GPL(stmmac_dvr_probe); /** * stmmac_dvr_remove - * @ndev: net device pointer + * @dev: device pointer * Description: this function resets the TX/RX processes, disables the MAC RX/TX * changes the link status, releases the DMA descriptor rings. */ -int stmmac_dvr_remove(struct net_device *ndev) +int stmmac_dvr_remove(struct device *dev) { + struct net_device *ndev = dev_get_drvdata(dev); struct stmmac_priv *priv = netdev_priv(ndev); pr_info("%s:\n\tremoving driver", __func__); @@ -3381,13 +3382,14 @@ EXPORT_SYMBOL_GPL(stmmac_dvr_remove); /** * stmmac_suspend - suspend callback - * @ndev: net device pointer + * @dev: device pointer * Description: this is the function to suspend the device and it is called * by the platform driver to stop the network queue, release the resources, * program the PMT register (for WoL), clean and release driver resources. */ -int stmmac_suspend(struct net_device *ndev) +int stmmac_suspend(struct device *dev) { + struct net_device *ndev = dev_get_drvdata(dev); struct stmmac_priv *priv = netdev_priv(ndev); unsigned long flags; @@ -3430,12 +3432,13 @@ EXPORT_SYMBOL_GPL(stmmac_suspend); /** * stmmac_resume - resume callback - * @ndev: net device pointer + * @dev: device pointer * Description: when resume this function is invoked to setup the DMA and CORE * in a usable state. */ -int stmmac_resume(struct net_device *ndev) +int stmmac_resume(struct device *dev) { + struct net_device *ndev = dev_get_drvdata(dev); struct stmmac_priv *priv = netdev_priv(ndev); unsigned long flags; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index ae43887..56c8a23 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -231,30 +231,10 @@ static int stmmac_pci_probe(struct pci_dev *pdev, */ static void stmmac_pci_remove(struct pci_dev *pdev) { - struct net_device *ndev = pci_get_drvdata(pdev); - - stmmac_dvr_remove(ndev); -} - -#ifdef CONFIG_PM_SLEEP -static int stmmac_pci_suspend(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct net_device *ndev = pci_get_drvdata(pdev); - - return stmmac_suspend(ndev); -} - -static int stmmac_pci_resume(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct net_device *ndev = pci_get_drvdata(pdev); - - return stmmac_resume(ndev); + stmmac_dvr_remove(>dev); } -#endif -static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume); +static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_suspend, stmmac_resume); #define STMMAC_VENDOR_ID 0x700 #define STMMAC_QUARK_ID 0x0937 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index effaa4f..409db91 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -386,7 +386,7 @@ int stmmac_pltfr_remove(struct platform_device *pdev) { struct net_device
[net-next PATCH v2 0/5] stmmac: dwmac-socfpga refactor+cleanup
This patch aims to remove the init/exit callbacks from the dwmac- socfpga driver and instead use standard PM callbacks. Doing this will also allow us to cleanup the driver. Eventually the init/exit callbacks will be deprecated and removed from all drivers dwmac-* except for dwmac-generic. Drivers will be refactored to use standard PM and remove callbacks. This patch set should not change the behavior of the driver itself, it only moves code around. The only exception to this is patch number 4 which restores the resume callback behavior which was changed in the "net: stmmac: socfpga: Remove re-registration of reset controller" patch. I belive calling phy_resume() only from the resume callback and not probe is the right thing to do. Changes from v1: - Rebase on net-next One heads-up here: The first patch changes the prototype of a couple of functions used in Alexandre's "add Ethernet glue logic for stm32 chip" patch [1] and will cause build failures for dwmac-stm32.c if not fixed up! If Alexandre's patch set is applied first I will gladly rebase my patch set to account for his driver as well. [1] https://patchwork.ozlabs.org/patch/614405/ Dave: To avoid the build failure mentioned above you can apply the changes below to the stm32 driver or Alexandre can use it if he creates a new version of his patch set. diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c @@ -133,7 +133,7 @@ static int stm32_dwmac_remove(struct platform_device *pdev) { struct net_device *ndev = platform_get_drvdata(pdev); struct stmmac_priv *priv = netdev_priv(ndev); - int ret = stmmac_dvr_remove(ndev); + int ret = stmmac_dvr_remove(>dev); stm32_dwmac_clk_disable(priv->plat->bsp_priv); @@ -147,7 +147,7 @@ static int stm32_dwmac_suspend(struct device *dev) struct stmmac_priv *priv = netdev_priv(ndev); int ret; - ret = stmmac_suspend(ndev); + ret = stmmac_suspend(dev); stm32_dwmac_clk_disable(priv->plat->bsp_priv); return ret; @@ -163,7 +163,7 @@ static int stm32_dwmac_resume(struct device *dev) if (ret) return ret; - ret = stmmac_resume(ndev); + ret = stmmac_resume(dev); return ret; } Joachim Eastwood (5): stmmac: let remove/resume/suspend functions take device pointer stmmac: dwmac-socfpga: add PM ops and resume function stmmac: dwmac-socfpga: keep a copy of stmmac_rst in driver priv data stmmac: dwmac-socfpga: call phy_resume() only in resume callback stmmac: dwmac-socfpga: kill init() and rename setup() to set_phy_mode() .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c| 106 +++-- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 6 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +-- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 24 + .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 6 +- 5 files changed, 71 insertions(+), 86 deletions(-) -- 2.8.0
[net-next PATCH v2 4/5] stmmac: dwmac-socfpga: call phy_resume() only in resume callback
Calling phy_resume() should only be need during driver resume to workaround a hardware errata. Signed-off-by: Joachim EastwoodTested-by: Marek Vasut --- .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c| 50 -- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index ba0b793..ba49d8c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -198,41 +198,11 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac) static int socfpga_dwmac_init(struct platform_device *pdev, void *priv) { struct socfpga_dwmac *dwmac = priv; - struct net_device *ndev = platform_get_drvdata(pdev); - struct stmmac_priv *stpriv = NULL; - int ret = 0; - - if (!ndev) - return -EINVAL; - - stpriv = netdev_priv(ndev); - if (!stpriv) - return -EINVAL; /* Setup the phy mode in the system manager registers according to * devicetree configuration */ - ret = socfpga_dwmac_setup(dwmac); - - /* Before the enet controller is suspended, the phy is suspended. -* This causes the phy clock to be gated. The enet controller is -* resumed before the phy, so the clock is still gated "off" when -* the enet controller is resumed. This code makes sure the phy -* is "resumed" before reinitializing the enet controller since -* the enet controller depends on an active phy clock to complete -* a DMA reset. A DMA reset will "time out" if executed -* with no phy clock input on the Synopsys enet controller. -* Verified through Synopsys Case #8000711656. -* -* Note that the phy clock is also gated when the phy is isolated. -* Phy "suspend" and "isolate" controls are located in phy basic -* control register 0, and can be modified by the phy driver -* framework. -*/ - if (stpriv->phydev) - phy_resume(stpriv->phydev); - - return ret; + return socfpga_dwmac_setup(dwmac); } static int socfpga_dwmac_probe(struct platform_device *pdev) @@ -290,6 +260,24 @@ static int socfpga_dwmac_resume(struct device *dev) socfpga_dwmac_init(pdev, priv->plat->bsp_priv); + /* Before the enet controller is suspended, the phy is suspended. +* This causes the phy clock to be gated. The enet controller is +* resumed before the phy, so the clock is still gated "off" when +* the enet controller is resumed. This code makes sure the phy +* is "resumed" before reinitializing the enet controller since +* the enet controller depends on an active phy clock to complete +* a DMA reset. A DMA reset will "time out" if executed +* with no phy clock input on the Synopsys enet controller. +* Verified through Synopsys Case #8000711656. +* +* Note that the phy clock is also gated when the phy is isolated. +* Phy "suspend" and "isolate" controls are located in phy basic +* control register 0, and can be modified by the phy driver +* framework. +*/ + if (priv->phydev) + phy_resume(priv->phydev); + return stmmac_resume(dev); } #endif /* CONFIG_PM_SLEEP */ -- 2.8.0
Re: Q: How to disable vlan strip in Intel igb driver ?
Hi Ran, Alex, I don't see rx-vlan-offload option in my ethtool. strange, maybe it is not available in all ethtool versions ? According to my manpage for ethtool v4.5, the relevant -K option is "rxvlan". Hi Peter, Yes, I'm using AF_PACKET (I can't validate it now for 100%, but I quite sure about it). Okay - but I assume that you are writing a userspace application, not a kernelspace driver or module, right? I'm accessing the ethernet header, and it always gives me non extended ethernet header (without vlan information). It seems that this behavior has been around for a long time, and is intentional. See the following thread for more information: http://www.spinics.net/lists/netdev/msg244668.html The only legit way of accessing VLAN tag info on an AF_PACKET socket I know about is by setting the PACKET_AUXDATA socket option, and reading the auxiliary data as a struct tpacket_auxdata using recvmsg(). In addition, however, there seems to be a bug in the kernel in that the tp_vlan_tci member of the struct tpacket_auxdata is filled in only if the AF_PACKET socket is bound to htons(ETH_P_ALL). If the socket is bound to any other specific protocol, the tp_vlan_tci is set to 0. I have raised this issue recently in the following thread(s) but have not received a response yet: http://www.spinics.net/lists/netdev/msg372830.html http://www.spinics.net/lists/netdev/msg373112.html I can see the vlan tag in vlan_tci field in sk_buff, but this is not exactly what I need, I need the header AS-IS with the original (extended) ethernet header. How are you accessing the vlan_tci field from your software? In any case, with AF_PACKET sockets, I am afraid you don't have much choice. Even libpcap reconstructs VLAN-tagged frames by reading the VLAN tag from an auxiliary structure and then re-inserting it into the frame, because the frame delivered through an AF_PACKET socket does not have the VLAN tag present anymore. Best regards, Peter
Re: [net-next PATCH v2 5/9] mlx4: Add support for UDP tunnel segmentation with outer checksum offload
On Sat, Apr 30, 2016 at 1:43 AM, Alexander Duyckwrote: > This patch assumes that the mlx4 hardware will ignore existing IPv4/v6 > header fields for length and checksum as well as the length and checksum > fields for outer UDP headers. Hi Alex, I see now the above text appearing in bunch of similar commit of yours, specifically to Intel drivers and mlx5... could you please elaborate a bit more what you mean here and what are the practical consequences of that characteristics? I got that right NETIF_F_GSO_UDP_TUNNEL_CSUM means that the HW can do segmentation for TCP packets encapsulated by UDP tunnel e.g VXLAN where the outer checksum is not zero. AFAIK, any other outer checksum value can't correctly be a constant... are you assuming here RCO or LCO? Or.
Re: [net-next PATCH v2 1/9] net: Disable segmentation if checksumming is not supported
On Sat, Apr 30, 2016 at 1:43 AM, Alexander Duyckwrote: > In the case of the mlx4 and mlx5 driver they do not support IPv6 checksum > offload for tunnels. Alex, To clarify, when you say "not support IPv6 checksum for tunnels", you refer to the offloading of the outer or inner checksum? Still (me and I think also Tariq from our driver team) catching up on the series, the primitives and conventions you are introducing using and how this applies on mlx5. I saw that Saeed acked the the mlx5e patches (7 and 8). Specifically, the mlx4 patches are practically fixes so if they don't land in 4.7 via net-next we can get them there through net, lets give us the few more days needed to catch up from our side. Or.
Re: [PATCH] pxa168_eth: fix mdiobus_scan() error check
On 05/01/2016 11:25 PM, Sergei Shtylyov wrote: Since mdiobus_scan() returns either an error code or NULL on error, the driver should check for both, not only for NULL, otherwise a crash is imminent... Reported-by: Arnd BergmannSigned-off-by: Sergei Shtylyov --- The patch is against DaveM's 'net.git' repo. drivers/net/ethernet/marvell/pxa168_eth.c |2 ++ 1 file changed, 2 insertions(+) Index: net/drivers/net/ethernet/marvell/pxa168_eth.c === --- net.orig/drivers/net/ethernet/marvell/pxa168_eth.c +++ net/drivers/net/ethernet/marvell/pxa168_eth.c @@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_de return 0; pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr); +if (IS_ERR(pep->phy)) +return PTR_ERR(pep->phy); if (!pep->phy) return -ENODEV; Should not this check be removed too and That's my next move -- for now I'm fixing the existing bug in this driver only. In fact, it can't be removed yet as mdiobus_scan() may return NULL on other error path. There's certainly a space for improvements yet... [...] MBR, Sergei
Re: [PATCH] pxa168_eth: fix mdiobus_scan() error check
Hello. On 05/01/2016 07:05 PM, Florian Fainelli wrote: Since mdiobus_scan() returns either an error code or NULL on error, the driver should check for both, not only for NULL, otherwise a crash is imminent... Reported-by: Arnd BergmannSigned-off-by: Sergei Shtylyov --- The patch is against DaveM's 'net.git' repo. drivers/net/ethernet/marvell/pxa168_eth.c |2 ++ 1 file changed, 2 insertions(+) Index: net/drivers/net/ethernet/marvell/pxa168_eth.c === --- net.orig/drivers/net/ethernet/marvell/pxa168_eth.c +++ net/drivers/net/ethernet/marvell/pxa168_eth.c @@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_de return 0; pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr); + if (IS_ERR(pep->phy)) + return PTR_ERR(pep->phy); if (!pep->phy) return -ENODEV; Should not this check be removed too and That's my next move -- for now I'm fixing the existing bug in this driver only. converted to a PTR_ERR(pep->phy) != -ENODEV? I don't see what that would achieve, IMO it's enough to just drop this *if* altogether. MBR, Sergei
Re: [net-next PATCH v2 6/9] mlx4: Add support for inner IPv6 checksum offloads and TSO
On Sat, Apr 30, 2016 at 1:43 AM, Alexander Duyckwrote: > >From what I can tell the ConnectX-3 will support an inner IPv6 checksum and > segmentation offload, however it cannot support outer IPv6 headers. This > assumption is based on the fact that I could see the checksum being > offloaded for inner header on IPv4 tunnels, but not on IPv6 tunnels. > > For this reason I am adding the feature to the hw_enc_features and adding > an extra check to the features_check call that will disable GSO and > checksum offload in the case that the encapsulated frame has an outer IP > version of that is not 4. The check in mlx4_en_features_check could be > removed if at some point in the future a fix is found that allows the > hardware to offload segmentation/checksum on tunnels with an outer IPv6 > header. > > Signed-off-by: Alexander Duyck Reviewed-by: Saeed Mahameed
[PATCH] rtlwifi: rtl818x: constify rtl_intf_ops structures
The rtl_intf_ops structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall--- drivers/net/wireless/realtek/rtlwifi/pci.c |2 +- drivers/net/wireless/realtek/rtlwifi/pci.h |2 +- drivers/net/wireless/realtek/rtlwifi/usb.c |2 +- drivers/net/wireless/realtek/rtlwifi/wifi.h |2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c index 1ac41b8..66030ea 100644 --- a/drivers/net/wireless/realtek/rtlwifi/pci.c +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c @@ -2456,7 +2456,7 @@ int rtl_pci_resume(struct device *dev) EXPORT_SYMBOL(rtl_pci_resume); #endif /* CONFIG_PM_SLEEP */ -struct rtl_intf_ops rtl_pci_ops = { +const struct rtl_intf_ops rtl_pci_ops = { .read_efuse_byte = read_efuse_byte, .adapter_start = rtl_pci_start, .adapter_stop = rtl_pci_stop, diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.h b/drivers/net/wireless/realtek/rtlwifi/pci.h index 5da6703..b951eba 100644 --- a/drivers/net/wireless/realtek/rtlwifi/pci.h +++ b/drivers/net/wireless/realtek/rtlwifi/pci.h @@ -286,7 +286,7 @@ struct rtl_pci_priv { int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw); -extern struct rtl_intf_ops rtl_pci_ops; +extern const struct rtl_intf_ops rtl_pci_ops; int rtl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id); diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c index aac1ed3..41617b7 100644 --- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c @@ -1049,7 +1049,7 @@ static void rtl_fill_h2c_cmd_work_callback(struct work_struct *work) rtlpriv->cfg->ops->fill_h2c_cmd(hw, H2C_RA_MASK, 5, rtlpriv->rate_mask); } -static struct rtl_intf_ops rtl_usb_ops = { +static const struct rtl_intf_ops rtl_usb_ops = { .adapter_start = rtl_usb_start, .adapter_stop = rtl_usb_stop, .adapter_tx = rtl_usb_tx, diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 11d9c23..4e0ab4d 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -2593,7 +2593,7 @@ struct rtl_priv { *intf_ops : for diff interrface usb/pcie */ struct rtl_hal_cfg *cfg; - struct rtl_intf_ops *intf_ops; + const struct rtl_intf_ops *intf_ops; /*this var will be set by set_bit, and was used to indicate status of
Re: [PATCH v1 net] net/mlx4: Avoid wrong virtual mappings
On 5/1/2016 4:07 PM, David Miller wrote: > From: Sinan Kaya> Date: Sun, 1 May 2016 11:43:54 -0400 > >> Can we get this queued for 4.7? Mellanox with arm64 has been broken over 1.5 >> years. > > Can you not quote an entire huge patch just to say something like > this? > > I'm waiting for the people involved all to give feedback. > > If it's been broken for more than a year, waiting for a few more > days to get the fix right is not going to be the end of the world. > Sure, I thought there is a common consensus. The original patch posted was from Christoph Hellwig. This patch does the same thing like Christoph Hellwig proposed + a fallback approach for the infiniband case where fragmented buffers are still supported. The patch is actually a copy/paste from the MLX5 driver into MLX4. I'm OK with waiitng for a few more days. I just wanted to make sure that this patch is moving in the right direction. If not, let's list the open issues. -- Sinan Kaya Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [net-next PATCH v2 8/9] mlx5e: Fix IPv6 tunnel checksum offload
On Sat, Apr 30, 2016 at 1:43 AM, Alexander Duyckwrote: > The mlx5 driver exposes support for TSO6 but not IPv6 csum for hardware > encapsulated tunnels. This leads to issues as it triggers warnings in > skb_checksum_help as it ends up being called as we report supporting the > segmentation but not the checksumming for IPv6 frames. > > This patch corrects that and drops 2 features that don't actually need to > be supported in hw_enc_features since they are Rx features and don't > actually impact anything by being present in hw_enc_features. > > Signed-off-by: Alexander Duyck Reviewed-by: Saeed Mahameed
Re: [net-next PATCH v2 7/9] mlx5e: Add support for UDP tunnel segmentation with outer checksum offload
On Sat, Apr 30, 2016 at 1:43 AM, Alexander Duyckwrote: > This patch assumes that the mlx5 hardware will ignore existing IPv4/v6 > header fields for length and checksum as well as the length and checksum > fields for outer UDP headers. > > Signed-off-by: Alexander Duyck Reviewed-by: Saeed Mahameed
Re: [PATCH v1 net] net/mlx4: Avoid wrong virtual mappings
From: Sinan KayaDate: Sun, 1 May 2016 11:43:54 -0400 > Can we get this queued for 4.7? Mellanox with arm64 has been broken over 1.5 > years. Can you not quote an entire huge patch just to say something like this? I'm waiting for the people involved all to give feedback. If it's been broken for more than a year, waiting for a few more days to get the fix right is not going to be the end of the world.
[PATCH net 1/4] net/mlx5: Unmap only the relevant IO memory mapping
From: Gal PressmanWhen freeing UAR the driver tries to unmap uar->map and uar->bf_map which are mutually exclusive thus always unmapping a NULL pointer. Make sure we only call iounmap() once, for the actual mapping. Fixes: 0ba422410bbf ('net/mlx5: Fix global UAR mapping') Signed-off-by: Gal Pressman Reported-by: Doron Tsur Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c index 8ba080e..5ff8af4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c @@ -269,8 +269,10 @@ EXPORT_SYMBOL(mlx5_alloc_map_uar); void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar) { - iounmap(uar->map); - iounmap(uar->bf_map); + if (uar->map) + iounmap(uar->map); + else + iounmap(uar->bf_map); mlx5_cmd_free_uar(mdev, uar->index); } EXPORT_SYMBOL(mlx5_unmap_free_uar); -- 2.8.0
[PATCH net 3/4] net/mlx5e: Implement a mlx5e workqueue
From: Matthew FinlayImplement a mlx5e workqueue to handle all mlx5e specific tasks. Move all tasks currently using the system workqueue to the new workqueue. This is in preparation for vxlan using the mlx5e workqueue in order to schedule port add/remove operations. Signed-off-by: Matthew Finlay Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 30 ++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index e80ce94..3881dce 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -567,6 +567,7 @@ struct mlx5e_priv { struct mlx5e_vxlan_db vxlan; struct mlx5e_paramsparams; + struct workqueue_struct*wq; struct work_struct update_carrier_work; struct work_struct set_rx_mode_work; struct delayed_workupdate_stats_work; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 67d548b..9ab0841 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -262,9 +262,8 @@ static void mlx5e_update_stats_work(struct work_struct *work) mutex_lock(>state_lock); if (test_bit(MLX5E_STATE_OPENED, >state)) { mlx5e_update_stats(priv); - schedule_delayed_work(dwork, - msecs_to_jiffies( - MLX5E_UPDATE_STATS_INTERVAL)); + queue_delayed_work(priv->wq, dwork, + msecs_to_jiffies(MLX5E_UPDATE_STATS_INTERVAL)); } mutex_unlock(>state_lock); } @@ -280,7 +279,7 @@ static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv, switch (event) { case MLX5_DEV_EVENT_PORT_UP: case MLX5_DEV_EVENT_PORT_DOWN: - schedule_work(>update_carrier_work); + queue_work(priv->wq, >update_carrier_work); break; default: @@ -1505,7 +1504,7 @@ int mlx5e_open_locked(struct net_device *netdev) mlx5e_update_carrier(priv); mlx5e_timestamp_init(priv); - schedule_delayed_work(>update_stats_work, 0); + queue_delayed_work(priv->wq, >update_stats_work, 0); return 0; @@ -1961,7 +1960,7 @@ static void mlx5e_set_rx_mode(struct net_device *dev) { struct mlx5e_priv *priv = netdev_priv(dev); - schedule_work(>set_rx_mode_work); + queue_work(priv->wq, >set_rx_mode_work); } static int mlx5e_set_mac(struct net_device *netdev, void *addr) @@ -1976,7 +1975,7 @@ static int mlx5e_set_mac(struct net_device *netdev, void *addr) ether_addr_copy(netdev->dev_addr, saddr->sa_data); netif_addr_unlock_bh(netdev); - schedule_work(>set_rx_mode_work); + queue_work(priv->wq, >set_rx_mode_work); return 0; } @@ -2498,10 +2497,14 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev) priv = netdev_priv(netdev); + priv->wq = create_singlethread_workqueue("mlx5e"); + if (!priv->wq) + goto err_free_netdev; + err = mlx5_alloc_map_uar(mdev, >cq_uar, false); if (err) { mlx5_core_err(mdev, "alloc_map uar failed, %d\n", err); - goto err_free_netdev; + goto err_destroy_wq; } err = mlx5_core_alloc_pd(mdev, >pdn); @@ -2580,7 +2583,7 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev) vxlan_get_rx_port(netdev); mlx5e_enable_async_events(priv); - schedule_work(>set_rx_mode_work); + queue_work(priv->wq, >set_rx_mode_work); return priv; @@ -2617,6 +2620,9 @@ err_dealloc_pd: err_unmap_free_uar: mlx5_unmap_free_uar(mdev, >cq_uar); +err_destroy_wq: + destroy_workqueue(priv->wq); + err_free_netdev: free_netdev(netdev); @@ -2630,9 +2636,9 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) set_bit(MLX5E_STATE_DESTROYING, >state); - schedule_work(>set_rx_mode_work); + queue_work(priv->wq, >set_rx_mode_work); mlx5e_disable_async_events(priv); - flush_scheduled_work(); + flush_workqueue(priv->wq); if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, >intf_state)) { netif_device_detach(netdev); mutex_lock(>state_lock); @@ -2655,6 +2661,8 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn); mlx5_core_dealloc_pd(priv->mdev, priv->pdn); mlx5_unmap_free_uar(priv->mdev,
[PATCH net 2/4] net/mlx5: Kconfig: Fix MLX5_EN/VXLAN build issue
From: Matthew FinlayWhen MLX5_EN=y MLX5_CORE=y and VXLAN=m there is a linker error for vxlan_get_rx_port() due to the fact that VXLAN is a module. Change Kconfig to select VXLAN when MLX5_CORE=y. When MLX5_CORE=m there is no dependency on the value of VXLAN. Fixes: b3f63c3d5e2c ('net/mlx5e: Add netdev support for VXLAN tunneling') Signed-off-by: Matthew Finlay Reported-by: Arnd Bergmann Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig index 1cf722e..559d11a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig @@ -14,6 +14,7 @@ config MLX5_CORE_EN bool "Mellanox Technologies ConnectX-4 Ethernet support" depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE select PTP_1588_CLOCK + select VXLAN if MLX5_CORE=y default n ---help--- Ethernet support in Mellanox Technologies ConnectX-4 NIC. -- 2.8.0
[PATCH net 4/4] net/mlx5e: Use workqueue for vxlan ops
From: Matthew FinlayThe vxlan add/delete port NDOs are called under rcu lock. The current mlx5e implementation can potentially block in these calls, which is not allowed. Move to using the mlx5e workqueue to handle these NDOs. Fixes: b3f63c3d5e2c ('net/mlx5e: Add netdev support for VXLAN tunneling') Signed-off-by: Matthew Finlay Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/vxlan.c | 50 +-- drivers/net/ethernet/mellanox/mlx5/core/vxlan.h | 11 - 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 9ab0841..d4dfc5c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -2157,7 +2157,7 @@ static void mlx5e_add_vxlan_port(struct net_device *netdev, if (!mlx5e_vxlan_allowed(priv->mdev)) return; - mlx5e_vxlan_add_port(priv, be16_to_cpu(port)); + mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 1); } static void mlx5e_del_vxlan_port(struct net_device *netdev, @@ -2168,7 +2168,7 @@ static void mlx5e_del_vxlan_port(struct net_device *netdev, if (!mlx5e_vxlan_allowed(priv->mdev)) return; - mlx5e_vxlan_del_port(priv, be16_to_cpu(port)); + mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 0); } static netdev_features_t mlx5e_vxlan_features_check(struct mlx5e_priv *priv, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c index 9f10df2..f2fd1ef 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c @@ -95,21 +95,22 @@ struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port) return vxlan; } -int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port) +static void mlx5e_vxlan_add_port(struct work_struct *work) { + struct mlx5e_vxlan_work *vxlan_work = + container_of(work, struct mlx5e_vxlan_work, work); + struct mlx5e_priv *priv = vxlan_work->priv; struct mlx5e_vxlan_db *vxlan_db = >vxlan; + u16 port = vxlan_work->port; struct mlx5e_vxlan *vxlan; int err; - err = mlx5e_vxlan_core_add_port_cmd(priv->mdev, port); - if (err) - return err; + if (mlx5e_vxlan_core_add_port_cmd(priv->mdev, port)) + goto free_work; vxlan = kzalloc(sizeof(*vxlan), GFP_KERNEL); - if (!vxlan) { - err = -ENOMEM; + if (!vxlan) goto err_delete_port; - } vxlan->udp_port = port; @@ -119,13 +120,14 @@ int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port) if (err) goto err_free; - return 0; + goto free_work; err_free: kfree(vxlan); err_delete_port: mlx5e_vxlan_core_del_port_cmd(priv->mdev, port); - return err; +free_work: + kfree(vxlan_work); } static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port) @@ -145,12 +147,36 @@ static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port) kfree(vxlan); } -void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port) +static void mlx5e_vxlan_del_port(struct work_struct *work) { - if (!mlx5e_vxlan_lookup_port(priv, port)) - return; + struct mlx5e_vxlan_work *vxlan_work = + container_of(work, struct mlx5e_vxlan_work, work); + struct mlx5e_priv *priv = vxlan_work->priv; + u16 port = vxlan_work->port; __mlx5e_vxlan_core_del_port(priv, port); + + kfree(vxlan_work); +} + +void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family, + u16 port, int add) +{ + struct mlx5e_vxlan_work *vxlan_work; + + vxlan_work = kmalloc(sizeof(*vxlan_work), GFP_ATOMIC); + if (!vxlan_work) + return; + + if (add) + INIT_WORK(_work->work, mlx5e_vxlan_add_port); + else + INIT_WORK(_work->work, mlx5e_vxlan_del_port); + + vxlan_work->priv = priv; + vxlan_work->port = port; + vxlan_work->sa_family = sa_family; + queue_work(priv->wq, _work->work); } void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h index a016850..129f352 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h @@ -39,6 +39,13 @@ struct mlx5e_vxlan { u16 udp_port; }; +struct mlx5e_vxlan_work { + struct work_struct work; + struct mlx5e_priv *priv; +
[PATCH net 0/4] Mellanox 100G mlx5 fixes for 4.6-rc
Hi Dave, This small series provides some bug fixes for mlx5 driver. A small bug fix for iounmap of a null pointer, which dumps a warning on some archs. One patch to fix the VXLAN/MLX5_EN dependency issue reported by Arnd. Two patches to fix the scheduling while atomic issue for ndo_add/del_vxlan_port NDOs. The first will add an internal mlx5e workqueue and the second will delegate vxlan ports add/del requests to that workqueue. Note: ('net/mlx5: Kconfig: Fix MLX5_EN/VXLAN build issue') is only needed for net and not net-next as the issue was globally fixed for all device drivers by: b7aade15485a ('vxlan: break dependency with netdev drivers') in net-next. Applied on top: f27337e16f2d ('ip_tunnel: fix preempt warning in ip tunnel creation/updating') Gal Pressman (1): net/mlx5: Unmap only the relevant IO memory mapping Matthew Finlay (3): net/mlx5: Kconfig: Fix MLX5_EN/VXLAN build issue net/mlx5e: Implement a mlx5e workqueue net/mlx5e: Use workqueue for vxlan ops drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 1 + drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 34 +-- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 6 ++- drivers/net/ethernet/mellanox/mlx5/core/vxlan.c | 50 +-- drivers/net/ethernet/mellanox/mlx5/core/vxlan.h | 11 - 6 files changed, 74 insertions(+), 29 deletions(-) -- 2.8.0
Re: [PATCH net-next] drivers/net: add 6WIND SHULTI support
Thu, Apr 28, 2016 at 05:54:19PM CEST, da...@davemloft.net wrote: >From: Nicolas Dichtel>Date: Thu, 28 Apr 2016 13:59:34 +0200 > >> Le 27/04/2016 18:55, David Miller a écrit : >>> From: Jiri Pirko >> [snip] The difference is that it this tries to allow userspace crap to mirror setting user does for bridge/ovs. Basically this looks to me like an attempt to enable userspace SDKs and such. >>> >>> +1 >> I don't think so because a userspace can receive all the bridge/ovs settings >> by >> mean of netlink mirror, without the need for this driver at all. > >You can say whatever you want, but the facilities you are adding to >this driver enables proprietary userland SDK components. > >And this is precisely what we are trying to avoid by having a clean, >fully featured switch device model in the kernel. > >It is against your interestes of upstreaming your driver to continue >denying what your changes facilitate. +1 Nicolas, your driver is big a step back. Just do what you need to do, properly, in kernel. There's a lot of people to help you with that around.
Re: Cannot use NFS with linux-next 20160429
Hi Fabio- > On Apr 29, 2016, at 7:18 PM, Fabio Estevamwrote: > > Hi, > > NFS is not working on a imx6q-sabresd board running linux-next 20160429: > > [ 15.753317] #0: wm8962-audio > [ 15.759437] Root-NFS: no NFS server address At a glance, that looks like the NFSROOT mount options are invalid? First, confirm what is specified on the kernel cmdline. I'm not aware of any recent changes to NFSROOT. Often these NFSROOT problems turn out to be related to churn in the underlying Ethernet drivers or the generic code that handles mounting the root filesystem at boot time. Thus a second suggestion would be to use "git bisect". > [ 15.763649] VFS: Unable to mount root fs via NFS, trying floppy. > [ 15.774223] VFS: Cannot open root device "nfs" or > unknown-block(2,0): error -6 > [ 15.781540] Please append a correct "root=" boot option; here are > the available partitions: > [ 15.790145] 0100 65536 ram0 (driver?) > [ 15.794837] 0101 65536 ram1 (driver?) > [ 15.799576] 0102 65536 ram2 (driver?) > [ 15.804262] 0103 65536 ram3 (driver?) > [ 15.809023] 0104 65536 ram4 (driver?) > [ 15.813710] 0105 65536 ram5 (driver?) > [ 15.818392] 0106 65536 ram6 (driver?) > [ 15.823121] 0107 65536 ram7 (driver?) > [ 15.827804] 0108 65536 ram8 (driver?) > [ 15.832531] 0109 65536 ram9 (driver?) > [ 15.837213] 010a 65536 ram10 (driver?) > [ 15.841989] 010b 65536 ram11 (driver?) > [ 15.846729] 010c 65536 ram12 (driver?) > [ 15.851491] 010d 65536 ram13 (driver?) > [ 15.856228] 010e 65536 ram14 (driver?) > [ 15.860992] 010f 65536 ram15 (driver?) > [ 15.865742] 1f004096 mtdblock0 (driver?) > [ 15.870853] b300 3872256 mmcblk1 driver: mmcblk > [ 15.876199] b308 7757824 mmcblk2 driver: mmcblk > [ 15.881570] b320 128 mmcblk2rpmb (driver?) > [ 15.886830] b3181024 mmcblk2boot1 (driver?) > [ 15.892201] b3101024 mmcblk2boot0 (driver?) > [ 15.897541] Kernel panic - not syncing: VFS: Unable to mount root > fs on unknown-block(2,0) > [ 15.905978] CPU0: stopping > [ 15.908704] CPU: 0 PID: 0 Comm: swapper/0 Not tainted > 4.6.0-rc5-next-20160429 #349 > [ 15.916284] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) > [ 15.922818] Backtrace: > [ 15.925316] [] (dump_backtrace) from [] > (show_stack+0x18/0x1c) > [ 15.932893] r6:6193 r5: r4: r3: > [ 15.938649] [] (show_stack) from [] > (dump_stack+0xb0/0xe8) > [ 15.945889] [] (dump_stack) from [] > (handle_IPI+0x174/0x1a4) > [ 15.953292] r8:c0d01f08 r7:c0c746ec r6: r5:c0d02b10 > r4: r3:c0d05e80 > [ 15.961147] [] (handle_IPI) from [] > (gic_handle_irq+0x8c/0x9c) > [ 15.968722] r8:c0d21f80 r7:c0d02c58 r6:c0d01f08 r5:f400010c > r4:f4000100 r3:0c04 > [ 15.976573] [] (gic_handle_irq) from [] > (__irq_svc+0x58/0x78) > [ 15.984065] Exception stack(0xc0d01f08 to 0xc0d01f50) > [ 15.989129] 1f00: 0001 0001 > c011b920 c0d02984 > [ 15.997318] 1f20: c0c757b8 c0d029d8 c0d029d0 > c0d01f64 c0d01f28 c0d01f58 > [ 16.005505] 1f40: c016d120 c01089e0 2013 > [ 16.010563] r10:c0d029d0 r9:c0d029d8 r8:c0c757b8 r7:c0d01f3c > r6: r5:2013 > [ 16.018495] r4:c01089e0 r3:c0d05e80 > [ 16.022130] [] (arch_cpu_idle) from [] > (default_idle_call+0x28/0x38) > [ 16.030236] [] (default_idle_call) from [] > (cpu_startup_entry+0x1c8/0x24c) > [ 16.038864] [] (cpu_startup_entry) from [] > (rest_init+0x12c/0x16c) > [ 16.046788] r7:c0c5da48 r3: > [ 16.050417] [] (rest_init) from [] > (start_kernel+0x340/0x3b0) > [ 16.057906] r5: r4:c0d6e050 > [ 16.061532] [] (start_kernel) from [<1000807c>] (0x1000807c) > [ 16.068067] r10: r8:1000406a r7:c0d0780c r6:c0c5da44 > r5:c0d0296c r4:c0d6e294 > [ 16.076002] CPU2: stopping > [ 16.078725] CPU: 2 PID: 0 Comm: swapper/2 Not tainted > 4.6.0-rc5-next-20160429 #349 > [ 16.086302] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) > [ 16.092836] Backtrace: > [ 16.095320] [] (dump_backtrace) from [] > (show_stack+0x18/0x1c) > [ 16.102897] r6:6193 r5: r4: r3: > [ 16.108646] [] (show_stack) from [] > (dump_stack+0xb0/0xe8) > [ 16.115883] [] (dump_stack) from [] > (handle_IPI+0x174/0x1a4) > [ 16.123286] r8:ef0a5f58 r7:c0c746ec r6: r5:c0d02b10 > r4:0002 r3:ef0a8000 > [ 16.131138] [] (handle_IPI) from [] > (gic_handle_irq+0x8c/0x9c) > [ 16.138713] r8:c0d21f80 r7:c0d02c58 r6:ef0a5f58 r5:f400010c > r4:f4000100 r3:0c04 > [ 16.146562] [] (gic_handle_irq) from [] > (__irq_svc+0x58/0x78) > [ 16.154052] Exception stack(0xef0a5f58 to 0xef0a5fa0) > [ 16.159112] 5f40: >0001 0001 > [
Re: Q: How to disable vlan strip in Intel igb driver ?
>> Ran > > You should be able to turn off the offload by setting > "rx-vlan-offload" to "off" via "ethtool -K". > > - Alex Alex, I don't see rx-vlan-offload option in my ethtool. strange, maybe it is not available in all ethtool versions ? On Sun, May 1, 2016 at 9:22 PM, Peter Palúchwrote: > Ran, > > How are you accessing the VLAN tag information - and how do you know that > the VLAN tag is not being passed through? Are you using AF_PACKET socket in > your application? > > Best regards, > Peter > > Hi Peter, Yes, I'm using AF_PACKET (I can't validate it now for 100%, but I quite sure about it). I'm accessing the ethernet header, and it always gives me non extended ethernet header (without vlan information). I can see the vlan tag in vlan_tci field in sk_buff, but this is not exactly what I need, I need the header AS-IS with the original (extended) ethernet header. Thanks. Ran > > On 01.05.2016 15:13, Ran Shalit wrote: >> >> Hello, >> >> >> I am using intel igb driver in Linux. >> >> The driver strip the packet from vlan inofmation. But we need this >> information in the packet. >> >> We tried to change build flag, or see if there is any feature with >> ethtool that can disable this feature, but nothing helps. >> >> >> Is there any way to achive this ? >> >> Regards, >> >> Ran > >
Re: Q: How to disable vlan strip in Intel igb driver ?
Ran, How are you accessing the VLAN tag information - and how do you know that the VLAN tag is not being passed through? Are you using AF_PACKET socket in your application? Best regards, Peter On 01.05.2016 15:13, Ran Shalit wrote: Hello, I am using intel igb driver in Linux. The driver strip the packet from vlan inofmation. But we need this information in the packet. We tried to change build flag, or see if there is any feature with ethtool that can disable this feature, but nothing helps. Is there any way to achive this ? Regards, Ran
Re: Q: How to disable vlan strip in Intel igb driver ?
On Sun, May 1, 2016 at 6:13 AM, Ran Shalitwrote: > Hello, > > > I am using intel igb driver in Linux. > > The driver strip the packet from vlan inofmation. But we need this > information in the packet. > > We tried to change build flag, or see if there is any feature with > ethtool that can disable this feature, but nothing helps. > > > Is there any way to achive this ? > > Regards, > > Ran You should be able to turn off the offload by setting "rx-vlan-offload" to "off" via "ethtool -K". - Alex
Re: [PATCH] pxa168_eth: fix mdiobus_scan() error check
Le 30/04/2016 13:35, Sergei Shtylyov a écrit : > Since mdiobus_scan() returns either an error code or NULL on error, the > driver should check for both, not only for NULL, otherwise a crash is > imminent... > > Reported-by: Arnd Bergmann> Signed-off-by: Sergei Shtylyov > > --- > The patch is against DaveM's 'net.git' repo. > > drivers/net/ethernet/marvell/pxa168_eth.c |2 ++ > 1 file changed, 2 insertions(+) > > Index: net/drivers/net/ethernet/marvell/pxa168_eth.c > === > --- net.orig/drivers/net/ethernet/marvell/pxa168_eth.c > +++ net/drivers/net/ethernet/marvell/pxa168_eth.c > @@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_de > return 0; > > pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr); > + if (IS_ERR(pep->phy)) > + return PTR_ERR(pep->phy); > if (!pep->phy) > return -ENODEV; Should not this check be removed too and converted to a PTR_ERR(pep->phy) != -ENODEV? -- Florian
Re: [PATCH] macb: fix mdiobus_scan() error check
Le 30/04/2016 15:47, Sergei Shtylyov a écrit : > Now mdiobus_scan() returns ERR_PTR(-ENODEV) instead of NULL if the PHY > device ID was read as all ones. As this was not an error before, this > value should be filtered out now in this driver. > > Fixes: b74766a0a0fe ("phylib: don't return NULL from get_phy_device()") > Signed-off-by: Sergei ShtylyovReviewed-by: Florian Fainelli -- Florian
Re: [PATCH v1 net] net/mlx4: Avoid wrong virtual mappings
On 4/27/2016 3:07 AM, Haggai Abramovsky wrote: > The dma_alloc_coherent() function returns a virtual address which can > be used for coherent access to the underlying memory. On some > architectures, like arm64, undefined behavior results if this memory is > also accessed via virtual mappings that are not coherent. Because of > their undefined nature, operations like virt_to_page() return garbage > when passed virtual addresses obtained from dma_alloc_coherent(). Any > subsequent mappings via vmap() of the garbage page values are unusable > and result in bad things like bus errors (synchronous aborts in ARM64 > speak). > > The mlx4 driver contains code that does the equivalent of: > vmap(virt_to_page(dma_alloc_coherent)), this results in an OOPs when the > device is opened. > > Prevent Ethernet driver to run this problematic code by forcing it to > allocate contiguous memory. As for the Infiniband driver, at first we > are trying to allocate contiguous memory, but in case of failure roll > back to work with fragmented memory. > > Signed-off-by: Haggai Abramovsky> Signed-off-by: Yishai Hadas > Reported-by: David Daney > Tested-by: Sinan Kaya > --- > Changes from v0: > Fix indentation error raised by LeonR > > drivers/infiniband/hw/mlx4/qp.c | 26 +-- > drivers/net/ethernet/mellanox/mlx4/alloc.c| 93 > ++- > drivers/net/ethernet/mellanox/mlx4/en_cq.c| 9 +-- > drivers/net/ethernet/mellanox/mlx4/en_netdev.c| 2 +- > drivers/net/ethernet/mellanox/mlx4/en_resources.c | 31 > drivers/net/ethernet/mellanox/mlx4/en_rx.c| 11 +-- > drivers/net/ethernet/mellanox/mlx4/en_tx.c| 14 +--- > drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 2 - > include/linux/mlx4/device.h | 4 +- > 9 files changed, 67 insertions(+), 125 deletions(-) > > diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c > index fd97534..842a6da 100644 > --- a/drivers/infiniband/hw/mlx4/qp.c > +++ b/drivers/infiniband/hw/mlx4/qp.c > @@ -419,7 +419,8 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct > ib_qp_cap *cap, > } > > static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, > - enum mlx4_ib_qp_type type, struct mlx4_ib_qp *qp) > + enum mlx4_ib_qp_type type, struct mlx4_ib_qp *qp, > + int shrink_wqe) > { > int s; > > @@ -477,7 +478,7 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, > struct ib_qp_cap *cap, >* We set WQE size to at least 64 bytes, this way stamping >* invalidates each WQE. >*/ > - if (dev->dev->caps.fw_ver >= MLX4_FW_VER_WQE_CTRL_NEC && > + if (shrink_wqe && dev->dev->caps.fw_ver >= MLX4_FW_VER_WQE_CTRL_NEC && > qp->sq_signal_bits && BITS_PER_LONG == 64 && > type != MLX4_IB_QPT_SMI && type != MLX4_IB_QPT_GSI && > !(type & (MLX4_IB_QPT_PROXY_SMI_OWNER | MLX4_IB_QPT_PROXY_SMI | > @@ -642,6 +643,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, > struct ib_pd *pd, > { > int qpn; > int err; > + struct ib_qp_cap backup_cap; > struct mlx4_ib_sqp *sqp; > struct mlx4_ib_qp *qp; > enum mlx4_ib_qp_type qp_type = (enum mlx4_ib_qp_type) > init_attr->qp_type; > @@ -775,7 +777,8 @@ static int create_qp_common(struct mlx4_ib_dev *dev, > struct ib_pd *pd, > goto err; > } > > - err = set_kernel_sq_size(dev, _attr->cap, qp_type, qp); > + memcpy(_cap, _attr->cap, sizeof(backup_cap)); > + err = set_kernel_sq_size(dev, _attr->cap, qp_type, qp, 1); > if (err) > goto err; > > @@ -787,9 +790,20 @@ static int create_qp_common(struct mlx4_ib_dev *dev, > struct ib_pd *pd, > *qp->db.db = 0; > } > > - if (mlx4_buf_alloc(dev->dev, qp->buf_size, PAGE_SIZE * 2, > >buf, gfp)) { > - err = -ENOMEM; > - goto err_db; > + if (mlx4_buf_alloc(dev->dev, qp->buf_size, qp->buf_size, > +>buf, gfp)) { > + memcpy(_attr->cap, _cap, > +sizeof(backup_cap)); > + err = set_kernel_sq_size(dev, _attr->cap, qp_type, > + qp, 0); > + if (err) > + goto err_db; > + > + if (mlx4_buf_alloc(dev->dev, qp->buf_size, > +PAGE_SIZE * 2, >buf, gfp)) { > + err = -ENOMEM; > + goto err_db; > + } > } > > err = mlx4_mtt_init(dev->dev,
Re: [PATCH net-next] drivers/net: add 6WIND SHULTI support
Fri, Apr 29, 2016 at 10:48:17AM CEST, nicolas.dich...@6wind.com wrote: >Le 28/04/2016 17:54, David Miller a écrit : >[snip] >> You can say whatever you want, but the facilities you are adding to >> this driver enables proprietary userland SDK components. >> >> And this is precisely what we are trying to avoid by having a clean, >> fully featured switch device model in the kernel. >> >> It is against your interestes of upstreaming your driver to continue >> denying what your changes facilitate. >Ok, I will rework this patch to remove the controversial parts and custom APIs. I'm pretty sure that means removing the whole patch... Seriously, this is wrong.
Re: [PATCH net-next] drivers/net: add 6WIND SHULTI support
Thu, Apr 28, 2016 at 01:59:34PM CEST, nicolas.dich...@6wind.com wrote: >Le 27/04/2016 18:55, David Miller a écrit : >> From: Jiri Pirko>[snip] >>> The difference is that it this tries to allow userspace crap to mirror >>> setting user does for bridge/ovs. Basically this looks to me like an >>> attempt to enable userspace SDKs and such. >> >> +1 >I don't think so because a userspace can receive all the bridge/ovs settings by >mean of netlink mirror, without the need for this driver at all. Okay, so what is the different is your words? I asked about purpose and userspace for this "driver", but you didn't provide that. I see what I see. Also, if you say you don't need this driver at all, why are you pushing it? Userspace apps can glean on netlink messages and act accordingly. In fact, this is what people are doing (for example Cumulus). I must be missing something there... (unfortunatelly, I'm pretty sure I'm not).
[PATCH net-next v2] ravb: Remove rx buffer ALIGN
From: Kazuya MizuguchiAligning the reception data size is not required. Signed-off-by: Kazuya Mizuguchi Signed-off-by: Yoshihiro Kaneko Tested-by: Simon Horman --- This patch is based on the master branch of David Miller's next networking tree. v2 [Yoshihiro Kaneko] * As suggested by Sergei Shtylyov remove re-formattings which is not related to the subject of this patch. drivers/net/ethernet/renesas/ravb_main.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 238b56f..34066e0 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -246,10 +246,9 @@ static void ravb_ring_format(struct net_device *ndev, int q) for (i = 0; i < priv->num_rx_ring[q]; i++) { /* RX descriptor */ rx_desc = >rx_ring[q][i]; - /* The size of the buffer should be on 16-byte boundary. */ - rx_desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16)); + rx_desc->ds_cc = cpu_to_le16(PKT_BUF_SZ); dma_addr = dma_map_single(ndev->dev.parent, priv->rx_skb[q][i]->data, - ALIGN(PKT_BUF_SZ, 16), + PKT_BUF_SZ, DMA_FROM_DEVICE); /* We just set the data size to 0 for a failed mapping which * should prevent DMA from happening... @@ -558,7 +557,7 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q) skb = priv->rx_skb[q][entry]; priv->rx_skb[q][entry] = NULL; dma_unmap_single(ndev->dev.parent, le32_to_cpu(desc->dptr), -ALIGN(PKT_BUF_SZ, 16), +PKT_BUF_SZ, DMA_FROM_DEVICE); get_ts &= (q == RAVB_NC) ? RAVB_RXTSTAMP_TYPE_V2_L2_EVENT : @@ -588,8 +587,7 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q) for (; priv->cur_rx[q] - priv->dirty_rx[q] > 0; priv->dirty_rx[q]++) { entry = priv->dirty_rx[q] % priv->num_rx_ring[q]; desc = >rx_ring[q][entry]; - /* The size of the buffer should be on 16-byte boundary. */ - desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16)); + desc->ds_cc = cpu_to_le16(PKT_BUF_SZ); if (!priv->rx_skb[q][entry]) { skb = netdev_alloc_skb(ndev, -- 1.9.1
[PATCH 4/4] net: ethernet: fec_mpc52xx: move to new ethtool api {get|set}_link_ksettings
The ethtool api {get|set}_settings is deprecated. We move the fec_mpc52xx driver to new api {get|set}_link_ksettings. Signed-off-by: Philippe Reynes--- drivers/net/ethernet/freescale/fec_mpc52xx.c | 16 ++-- 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c index 25553ee..f444714 100644 --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c @@ -763,24 +763,28 @@ static void mpc52xx_fec_reset(struct net_device *dev) /* ethtool interface */ -static int mpc52xx_fec_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +static int mpc52xx_fec_get_ksettings(struct net_device *dev, +struct ethtool_link_ksettings *cmd) { struct mpc52xx_fec_priv *priv = netdev_priv(dev); + struct phy_device *phydev = priv->phydev; if (!priv->phydev) return -ENODEV; - return phy_ethtool_gset(priv->phydev, cmd); + return phy_ethtool_ksettings_get(phydev, cmd); } -static int mpc52xx_fec_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) +static int mpc52xx_fec_set_ksettings(struct net_device *dev, +const struct ethtool_link_ksettings *cmd) { struct mpc52xx_fec_priv *priv = netdev_priv(dev); + struct phy_device *phydev = priv->phydev; if (!priv->phydev) return -ENODEV; - return phy_ethtool_sset(priv->phydev, cmd); + return phy_ethtool_ksettings_set(phydev, cmd); } static u32 mpc52xx_fec_get_msglevel(struct net_device *dev) @@ -796,12 +800,12 @@ static void mpc52xx_fec_set_msglevel(struct net_device *dev, u32 level) } static const struct ethtool_ops mpc52xx_fec_ethtool_ops = { - .get_settings = mpc52xx_fec_get_settings, - .set_settings = mpc52xx_fec_set_settings, .get_link = ethtool_op_get_link, .get_msglevel = mpc52xx_fec_get_msglevel, .set_msglevel = mpc52xx_fec_set_msglevel, .get_ts_info = ethtool_op_get_ts_info, + .get_link_ksettings = mpc52xx_fec_get_ksettings, + .set_link_ksettings = mpc52xx_fec_set_ksettings, }; -- 1.7.4.4
[PATCH 2/4] net: ethernet: ucc: move to new ethtool api {get|set}_link_ksettings
The ethtool api {get|set}_settings is deprecated. We move the ucc driver to new api {get|set}_link_ksettings. Signed-off-by: Philippe Reynes--- drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 17 +++-- 1 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c index 89714f5..812a968 100644 --- a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c +++ b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c @@ -105,23 +105,20 @@ static const char rx_fw_stat_gstrings[][ETH_GSTRING_LEN] = { #define UEC_RX_FW_STATS_LEN ARRAY_SIZE(rx_fw_stat_gstrings) static int -uec_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) +uec_get_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *cmd) { struct ucc_geth_private *ugeth = netdev_priv(netdev); struct phy_device *phydev = ugeth->phydev; - struct ucc_geth_info *ug_info = ugeth->ug_info; if (!phydev) return -ENODEV; - ecmd->maxtxpkt = 1; - ecmd->maxrxpkt = ug_info->interruptcoalescingmaxvalue[0]; - - return phy_ethtool_gset(phydev, ecmd); + return phy_ethtool_ksettings_get(phydev, cmd); } static int -uec_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) +uec_set_ksettings(struct net_device *netdev, + const struct ethtool_link_ksettings *cmd) { struct ucc_geth_private *ugeth = netdev_priv(netdev); struct phy_device *phydev = ugeth->phydev; @@ -129,7 +126,7 @@ uec_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) if (!phydev) return -ENODEV; - return phy_ethtool_sset(phydev, ecmd); + return phy_ethtool_ksettings_set(phydev, cmd); } static void @@ -392,8 +389,6 @@ static int uec_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) #endif /* CONFIG_PM */ static const struct ethtool_ops uec_ethtool_ops = { - .get_settings = uec_get_settings, - .set_settings = uec_set_settings, .get_drvinfo= uec_get_drvinfo, .get_regs_len = uec_get_regs_len, .get_regs = uec_get_regs, @@ -411,6 +406,8 @@ static const struct ethtool_ops uec_ethtool_ops = { .get_wol= uec_get_wol, .set_wol= uec_set_wol, .get_ts_info= ethtool_op_get_ts_info, + .get_link_ksettings = uec_get_ksettings, + .set_link_ksettings = uec_set_ksettings, }; void uec_set_ethtool_ops(struct net_device *netdev) -- 1.7.4.4
[PATCH 1/4] net: ethernet: gianfar: move to new ethtool api {get|set}_link_ksettings
The ethtool api {get|set}_settings is deprecated. We move the gianfar driver to new api {get|set}_link_ksettings. Signed-off-by: Philippe Reynes--- drivers/net/ethernet/freescale/gianfar_ethtool.c | 25 +++--- 1 files changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index 4b0ee85..2c45c80 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -185,7 +185,8 @@ static void gfar_gdrvinfo(struct net_device *dev, } -static int gfar_ssettings(struct net_device *dev, struct ethtool_cmd *cmd) +static int gfar_set_ksettings(struct net_device *dev, + const struct ethtool_link_ksettings *cmd) { struct gfar_private *priv = netdev_priv(dev); struct phy_device *phydev = priv->phydev; @@ -193,29 +194,19 @@ static int gfar_ssettings(struct net_device *dev, struct ethtool_cmd *cmd) if (NULL == phydev) return -ENODEV; - return phy_ethtool_sset(phydev, cmd); + return phy_ethtool_ksettings_set(phydev, cmd); } - -/* Return the current settings in the ethtool_cmd structure */ -static int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd) +static int gfar_get_ksettings(struct net_device *dev, + struct ethtool_link_ksettings *cmd) { struct gfar_private *priv = netdev_priv(dev); struct phy_device *phydev = priv->phydev; - struct gfar_priv_rx_q *rx_queue = NULL; - struct gfar_priv_tx_q *tx_queue = NULL; if (NULL == phydev) return -ENODEV; - tx_queue = priv->tx_queue[0]; - rx_queue = priv->rx_queue[0]; - - /* etsec-1.7 and older versions have only one txic -* and rxic regs although they support multiple queues */ - cmd->maxtxpkt = get_icft_value(tx_queue->txic); - cmd->maxrxpkt = get_icft_value(rx_queue->rxic); - return phy_ethtool_gset(phydev, cmd); + return phy_ethtool_ksettings_get(phydev, cmd); } /* Return the length of the register structure */ @@ -1565,8 +1556,6 @@ static int gfar_get_ts_info(struct net_device *dev, } const struct ethtool_ops gfar_ethtool_ops = { - .get_settings = gfar_gsettings, - .set_settings = gfar_ssettings, .get_drvinfo = gfar_gdrvinfo, .get_regs_len = gfar_reglen, .get_regs = gfar_get_regs, @@ -1589,4 +1578,6 @@ const struct ethtool_ops gfar_ethtool_ops = { .set_rxnfc = gfar_set_nfc, .get_rxnfc = gfar_get_nfc, .get_ts_info = gfar_get_ts_info, + .get_link_ksettings = gfar_get_ksettings, + .set_link_ksettings = gfar_set_ksettings, }; -- 1.7.4.4
[PATCH 3/4] net: ethernet: fs-enet: move to new ethtool api {get|set}_link_ksettings
The ethtool api {get|set}_settings is deprecated. We move the fs-enet driver to new api {get|set}_link_ksettings. Signed-off-by: Philippe Reynes--- .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 16 ++-- 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index 48a9c17..da90b5a 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c @@ -847,24 +847,28 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs, regs->version = 0; } -static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +static int fs_get_ksettings(struct net_device *dev, + struct ethtool_link_ksettings *cmd) { struct fs_enet_private *fep = netdev_priv(dev); + struct phy_device *phydev = fep->phydev; if (!fep->phydev) return -ENODEV; - return phy_ethtool_gset(fep->phydev, cmd); + return phy_ethtool_ksettings_get(phydev, cmd); } -static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) +static int fs_set_ksettings(struct net_device *dev, + const struct ethtool_link_ksettings *cmd) { struct fs_enet_private *fep = netdev_priv(dev); + struct phy_device *phydev = fep->phydev; if (!fep->phydev) return -ENODEV; - return phy_ethtool_sset(fep->phydev, cmd); + return phy_ethtool_ksettings_set(phydev, cmd); } static int fs_nway_reset(struct net_device *dev) @@ -887,14 +891,14 @@ static void fs_set_msglevel(struct net_device *dev, u32 value) static const struct ethtool_ops fs_ethtool_ops = { .get_drvinfo = fs_get_drvinfo, .get_regs_len = fs_get_regs_len, - .get_settings = fs_get_settings, - .set_settings = fs_set_settings, .nway_reset = fs_nway_reset, .get_link = ethtool_op_get_link, .get_msglevel = fs_get_msglevel, .set_msglevel = fs_set_msglevel, .get_regs = fs_get_regs, .get_ts_info = ethtool_op_get_ts_info, + .get_link_ksettings = fs_get_ksettings, + .set_link_ksettings = fs_set_ksettings, }; static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -- 1.7.4.4
Re: [PATCH net-next] ravb: Remove rx buffer ALIGN
Hi Simon-san, Thank you for testing this patch! Thanks, kaneko 2016-04-29 8:34 GMT+09:00 Simon Horman: > Hi Sergei, Hi Kaneko-san, > > On Tue, Apr 26, 2016 at 10:14:41PM +0300, Sergei Shtylyov wrote: >> Hello. >> >> On 04/24/2016 07:16 PM, Yoshihiro Kaneko wrote: >> >> >From: Kazuya Mizuguchi >> > >> >Aligning the reception data size is not required. >> >>OK, the gen 2/3 manuals indeed don't require this. I assume the patch has >> been tested... > > This morning I tested this patch applied on net-next using the > r8a7795/salvator-x (Gen-3). My test was to boot to a user-space prompt > using NFS root which was successful. I can run further tests on this setup > if it would be useful. > > Unfortunately I do not have access to hardware to allow me to test this > on Gen-2. > >> >Signed-off-by: Kazuya Mizuguchi >> >Signed-off-by: Yoshihiro Kaneko > > Tested-by: Simon Horman > >>I have a few comments though... > > [...]
Re: [PATCH net-next] ravb: Remove rx buffer ALIGN
Hi Sergei, Sorry for the late reply. 2016-04-27 4:14 GMT+09:00 Sergei Shtylyov: > Hello. > > On 04/24/2016 07:16 PM, Yoshihiro Kaneko wrote: > >> From: Kazuya Mizuguchi >> >> Aligning the reception data size is not required. > > >OK, the gen 2/3 manuals indeed don't require this. I assume the patch has > been tested... > >> Signed-off-by: Kazuya Mizuguchi >> Signed-off-by: Yoshihiro Kaneko > > >I have a few comments though... > >> diff --git a/drivers/net/ethernet/renesas/ravb_main.c >> b/drivers/net/ethernet/renesas/ravb_main.c >> index 238b56f..66ed80c 100644 >> --- a/drivers/net/ethernet/renesas/ravb_main.c >> +++ b/drivers/net/ethernet/renesas/ravb_main.c >> @@ -246,10 +246,10 @@ static void ravb_ring_format(struct net_device >> *ndev, int q) >> for (i = 0; i < priv->num_rx_ring[q]; i++) { >> /* RX descriptor */ >> rx_desc = >rx_ring[q][i]; >> - /* The size of the buffer should be on 16-byte boundary. >> */ >> - rx_desc->ds_cc = cpu_to_le16(ALIGN(PKT_BUF_SZ, 16)); >> - dma_addr = dma_map_single(ndev->dev.parent, >> priv->rx_skb[q][i]->data, >> - ALIGN(PKT_BUF_SZ, 16), >> + rx_desc->ds_cc = cpu_to_le16(PKT_BUF_SZ); >> + dma_addr = dma_map_single(ndev->dev.parent, >> + priv->rx_skb[q][i]->data, > > >Please don't reformat the lines above. Got it. > >> + PKT_BUF_SZ, >> DMA_FROM_DEVICE); >> /* We just set the data size to 0 for a failed mapping >> which >> * should prevent DMA from happening... >> @@ -557,8 +557,9 @@ static bool ravb_rx(struct net_device *ndev, int >> *quota, int q) >> >> skb = priv->rx_skb[q][entry]; >> priv->rx_skb[q][entry] = NULL; >> - dma_unmap_single(ndev->dev.parent, >> le32_to_cpu(desc->dptr), >> -ALIGN(PKT_BUF_SZ, 16), >> + dma_unmap_single(ndev->dev.parent, >> +le32_to_cpu(desc->dptr), > > > Same here. Likewise. > > [...] > > MBR, Sergei > Thanks, kaneko
[Question] Should `CAP_NET_ADMIN` be needed when opening `/dev/ppp`?
Hi, all. I’ve recently met some problems when trying to create a pppoe network link inside a unprivileged container. There is a uid namespace which maps root inside to a normal user outside. There is also a separate net namespace in the container. I create a dev node inside the container and set right permission. However, `/dev/ppp` cannot get opened since the mapped normal user does not have `CAP_NET_ADMIN`. The related code is in `drivers/net/ppp/ppp_generic.c`: `int ppp_open()` ``` static int ppp_open(struct inode *inode, struct file *file) { /* * This could (should?) be enforced by the permissions on /dev/ppp. */ if (!capable(CAP_NET_ADMIN)) return -EPERM; return 0; } ``` I wonder why CAP_NET_ADMIN is needed here, rather than leaving it to the permission of the device node. If there is no need, I suggest that the CAP_NET_ADMIN check be removed.
Q: How to disable vlan strip in Intel igb driver ?
Hello, I am using intel igb driver in Linux. The driver strip the packet from vlan inofmation. But we need this information in the packet. We tried to change build flag, or see if there is any feature with ethtool that can disable this feature, but nothing helps. Is there any way to achive this ? Regards, Ran
[PATCH] VSOCK: constify vsock_transport structure
The vsock_transport structure is never modified, so declare it as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall--- net/vmw_vsock/vmci_transport.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index 5621473..4120b7a 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c @@ -2051,7 +2051,7 @@ static u32 vmci_transport_get_local_cid(void) return vmci_get_context_id(); } -static struct vsock_transport vmci_transport = { +static const struct vsock_transport vmci_transport = { .init = vmci_transport_socket_init, .destruct = vmci_transport_destruct, .release = vmci_transport_release,
[PATCH] drivers: net: xgene: constify xgene_cle_ops structure
The xgene_cle_ops structure is never modified, so declare it as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall--- drivers/net/ethernet/apm/xgene/xgene_enet_cle.c |2 +- drivers/net/ethernet/apm/xgene/xgene_enet_cle.h |2 +- drivers/net/ethernet/apm/xgene/xgene_enet_main.h |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c index b2124886..6479288 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.c @@ -729,6 +729,6 @@ static int xgene_enet_cle_init(struct xgene_enet_pdata *pdata) return xgene_cle_setup_ptree(pdata, enet_cle); } -struct xgene_cle_ops xgene_cle3in_ops = { +const struct xgene_cle_ops xgene_cle3in_ops = { .cle_init = xgene_enet_cle_init, }; diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h index 29a17ab..13e829a 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_cle.h @@ -290,6 +290,6 @@ struct xgene_enet_cle { u32 jump_bytes; }; -extern struct xgene_cle_ops xgene_cle3in_ops; +extern const struct xgene_cle_ops xgene_cle3in_ops; #endif /* __XGENE_ENET_CLE_H__ */ diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h index 175d188..0a2887b 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h @@ -191,7 +191,7 @@ struct xgene_enet_pdata { const struct xgene_mac_ops *mac_ops; const struct xgene_port_ops *port_ops; struct xgene_ring_ops *ring_ops; - struct xgene_cle_ops *cle_ops; + const struct xgene_cle_ops *cle_ops; struct delayed_work link_work; u32 port_id; u8 cpu_bufnum;
[PATCH] i40e: constify i40e_client_ops structure
The i40e_client_ops structure is never modified, so declare it as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall--- drivers/infiniband/hw/i40iw/i40iw_main.c |2 +- drivers/net/ethernet/intel/i40e/i40e_client.h |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c index 90e5af2..e41fae24 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_main.c +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c @@ -1863,7 +1863,7 @@ static enum i40iw_status_code i40iw_virtchnl_send(struct i40iw_sc_dev *dev, } /* client interface functions */ -static struct i40e_client_ops i40e_ops = { +static const struct i40e_client_ops i40e_ops = { .open = i40iw_open, .close = i40iw_close, .l2_param_change = i40iw_l2param_change, diff --git a/drivers/net/ethernet/intel/i40e/i40e_client.h b/drivers/net/ethernet/intel/i40e/i40e_client.h index bf6b453..a4601d9 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_client.h +++ b/drivers/net/ethernet/intel/i40e/i40e_client.h @@ -217,7 +217,7 @@ struct i40e_client { #define I40E_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0) #define I40E_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2) enum i40e_client_type type; - struct i40e_client_ops *ops;/* client ops provided by the client */ + const struct i40e_client_ops *ops; /* client ops provided by the client */ }; static inline bool i40e_client_is_registered(struct i40e_client *client)
Re: [PATCH net-next 10/12] net/mlx5e: Create aRFS flow tables
On Sun, May 1, 2016 at 5:18 AM, Alexei Starovoitovwrote: > On Fri, Apr 29, 2016 at 01:36:40AM +0300, Saeed Mahameed wrote: >> From: Maor Gottlieb >> mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o >> +mlx5_core-$(CONFIG_RFS_ACCEL) += en_arfs.o > > this line breaks the build when RFS is on > and CONFIG_MLX5_CORE_EN is off. > Will Fix. Thank you Alexei.