19 Oct, 2014

3 commits

  • Pull slave-dmaengine updates from Vinod Koul:
    "For dmaengine contributions we have:
    - designware cleanup by Andy
    - my series moving device_control users to dmanegine_xxx APIs for
    later removal of device_control API
    - minor fixes spread over drivers mainly mv_xor, pl330, mmp, imx-sdma
    etc"

    * 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma: (60 commits)
    serial: atmel: add missing dmaengine header
    dmaengine: remove FSLDMA_EXTERNAL_START
    dmaengine: freescale: remove FSLDMA_EXTERNAL_START control method
    carma-fpga: move to fsl_dma_external_start()
    carma-fpga: use dmaengine_xxx() API
    dmaengine: freescale: add and export fsl_dma_external_start()
    dmaengine: add dmaengine_prep_dma_sg() helper
    video: mx3fb: use dmaengine_terminate_all() API
    serial: sh-sci: use dmaengine_terminate_all() API
    net: ks8842: use dmaengine_terminate_all() API
    mtd: sh_flctl: use dmaengine_terminate_all() API
    mtd: fsmc_nand: use dmaengine_terminate_all() API
    V4L2: mx3_camer: use dmaengine_pause() API
    dmaengine: coh901318: use dmaengine_terminate_all() API
    pata_arasan_cf: use dmaengine_terminate_all() API
    dmaengine: edma: check for echan->edesc => NULL in edma_dma_pause()
    dmaengine: dw: export probe()/remove() and Co to users
    dmaengine: dw: enable and disable controller when needed
    dmaengine: dw: always export dw_dma_{en,dis}able
    dmaengine: dw: introduce dw_dma_on() helper
    ...

    Linus Torvalds
     
  • Pull virtio updates from Rusty Russell:
    "One cc: stable commit, the rest are a series of minor cleanups which
    have been sitting in MST's tree during my vacation. I changed a
    function name and made one trivial change, then they spent two days in
    linux-next"

    * tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (25 commits)
    virtio-rng: refactor probe error handling
    virtio_scsi: drop scan callback
    virtio_balloon: enable VQs early on restore
    virtio_scsi: fix race on device removal
    virito_scsi: use freezable WQ for events
    virtio_net: enable VQs early on restore
    virtio_console: enable VQs early on restore
    virtio_scsi: enable VQs early on restore
    virtio_blk: enable VQs early on restore
    virtio_scsi: move kick event out from virtscsi_init
    virtio_net: fix use after free on allocation failure
    9p/trans_virtio: enable VQs early
    virtio_console: enable VQs early
    virtio_blk: enable VQs early
    virtio_net: enable VQs early
    virtio: add API to enable VQs early
    virtio_net: minor cleanup
    virtio-net: drop config_mutex
    virtio_net: drop config_enable
    virtio-blk: drop config_mutex
    ...

    Linus Torvalds
     
  • Pull networking fixes from David Miller:

    1) Include fixes for netrom and dsa (Fabian Frederick and Florian
    Fainelli)

    2) Fix FIXED_PHY support in stmmac, from Giuseppe CAVALLARO.

    3) Several SKB use after free fixes (vxlan, openvswitch, vxlan,
    ip_tunnel, fou), from Li ROngQing.

    4) fec driver PTP support fixes from Luwei Zhou and Nimrod Andy.

    5) Use after free in virtio_net, from Michael S Tsirkin.

    6) Fix flow mask handling for megaflows in openvswitch, from Pravin B
    Shelar.

    7) ISDN gigaset and capi bug fixes from Tilman Schmidt.

    8) Fix route leak in ip_send_unicast_reply(), from Vasily Averin.

    9) Fix two eBPF JIT bugs on x86, from Alexei Starovoitov.

    10) TCP_SKB_CB() reorganization caused a few regressions, fixed by Cong
    Wang and Eric Dumazet.

    11) Don't overwrite end of SKB when parsing malformed sctp ASCONF
    chunks, from Daniel Borkmann.

    12) Don't call sock_kfree_s() with NULL pointers, this function also has
    the side effect of adjusting the socket memory usage. From Cong Wang.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (90 commits)
    bna: fix skb->truesize underestimation
    net: dsa: add includes for ethtool and phy_fixed definitions
    openvswitch: Set flow-key members.
    netrom: use linux/uaccess.h
    dsa: Fix conversion from host device to mii bus
    tipc: fix bug in bundled buffer reception
    ipv6: introduce tcp_v6_iif()
    sfc: add support for skb->xmit_more
    r8152: return -EBUSY for runtime suspend
    ipv4: fix a potential use after free in fou.c
    ipv4: fix a potential use after free in ip_tunnel_core.c
    hyperv: Add handling of IP header with option field in netvsc_set_hash()
    openvswitch: Create right mask with disabled megaflows
    vxlan: fix a free after use
    openvswitch: fix a use after free
    ipv4: dst_entry leak in ip_send_unicast_reply()
    ipv4: clean up cookie_v4_check()
    ipv4: share tcp_v4_save_options() with cookie_v4_check()
    ipv4: call __ip_options_echo() in cookie_v4_check()
    atm: simplify lanai.c by using module_pci_driver
    ...

    Linus Torvalds
     

18 Oct, 2014

6 commits

  • skb->truesize is not meant to be tracking amount of used bytes
    in an skb, but amount of reserved/consumed bytes in memory.

    For instance, if we use a single byte in last page fragment,
    we have to account the full size of the fragment.

    skb->truesize can be very different from skb->len, that has
    a very specific safety purpose.

    Signed-off-by: Eric Dumazet
    Cc: Rasesh Mody
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • Commit b4d2394d01bc ("dsa: Replace mii_bus with a generic host device")
    replaces mii_bus with a generic host_dev, and introduces
    dsa_host_dev_to_mii_bus() to support conversion from host_dev to mii_bus.
    However, in some cases it uses to_mii_bus to perform that conversion.
    Since host_dev is not the phy bus device but typically a platform device,
    this fails and results in a crash with the affected drivers.

    BUG: unable to handle kernel NULL pointer dereference at (null)
    IP: [] __mutex_lock_slowpath+0x75/0x100
    PGD 406783067 PUD 406784067 PMD 0
    Oops: 0002 [#1] SMP
    ...
    Call Trace:
    [] ? pick_next_task_fair+0x61b/0x880
    [] mutex_lock+0x23/0x37
    [] mdiobus_read+0x34/0x60
    [] __mv88e6xxx_reg_read+0x8a/0xa0
    [] mv88e6xxx_reg_read+0x4c/0xa0

    Fixes: b4d2394d01bc ("dsa: Replace mii_bus with a generic host device")
    Cc: Alexander Duyck
    Signed-off-by: Guenter Roeck
    Acked-by: Alexander Duyck
    Acked-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Guenter Roeck
     
  • Don't ring the doorbell, and don't do PIO. This will also prevent
    TX Push, because there will be more than one buffer waiting when
    the doorbell is rung.

    Signed-off-by: Edward Cree
    Signed-off-by: David S. Miller

    Edward Cree
     
  • Remove calling cancel_delayed_work_sync() for runtime suspend,
    because it would cause dead lock. Instead, return -EBUSY to
    avoid the device enters suspending if the net is running and
    the delayed work is pending or running. The delayed work would
    try to wake up the device later, so the suspending is not
    necessary.

    Signed-off-by: Hayes Wang
    Signed-off-by: David S. Miller

    hayeswang
     
  • In case that the IP header has optional field at the end, this patch will
    get the port numbers after that field, and compute the hash. The general
    parser skb_flow_dissect() is used here.

    Signed-off-by: Haiyang Zhang
    Reviewed-by: K. Y. Srinivasan
    Signed-off-by: David S. Miller

    Haiyang Zhang
     
  • pskb_may_pull maybe change skb->data and make eth pointer oboslete,
    so eth needs to reload

    Fixes: 91269e390d062 ("vxlan: using pskb_may_pull as early as possible")
    Cc: Eric Dumazet
    Signed-off-by: Li RongQing
    Signed-off-by: David S. Miller

    Li RongQing
     

16 Oct, 2014

11 commits

  • The check for vfinfo is not sufficient because it does not protect
    against specifying vf that is outside of sriov_num_vfs range.
    All of the ndo functions have a check for it except for
    ixgbevf_ndo_set_spoofcheck().

    The following patch is all we need to protect against this panic:

    ip link set p96p1 vf 0 spoofchk off
    BUG: unable to handle kernel NULL pointer dereference at 0000000000000052
    IP: []
    ixgbe_ndo_set_vf_spoofchk+0x51/0x150 [ixgbe]

    Reported-by: Thierry Herbelot
    Signed-off-by: Emil Tantilov
    Acked-by: Thierry Herbelot
    Signed-off-by: Jeff Kirsher

    Emil Tantilov
     
  • Compiling with CONFIG_FM10K=y and VXLAN=m resulting in linking error:

    drivers/built-in.o: In function `fm10k_open':
    (.text+0x1f9d7a): undefined reference to `vxlan_get_rx_port'
    make: *** [vmlinux] Error 1

    The fix follows the same strategy as I40E.

    Signed-off-by: Andy Zhou
    Acked-by: Alexander Duyck
    Tested-by: Aaron Brown
    Signed-off-by: Jeff Kirsher

    Andy Zhou
     
  • After grabbing the mailbox lock and detecting an error, the lock must be
    released before the error code can be returned.

    Signed-off-by: Matthew Vick
    Tested-by: Aaron Brown
    Signed-off-by: Jeff Kirsher

    Matthew Vick
     
  • Set the flag to fetch the host state before kicking off the service task
    that reads the host state when bringing the interface back up.

    Signed-off-by: Matthew Vick
    Tested-by: Aaron Brown
    Signed-off-by: Jeff Kirsher

    Matthew Vick
     
  • pskb_may_pull should be used to check if skb->data has enough space,
    skb->len can not ensure that.

    Cc: Cong Wang
    Signed-off-by: Li RongQing
    Signed-off-by: David S. Miller

    Li RongQing
     
  • when netif_rx() is done, the netif_rx handled skb maybe be freed,
    and should not be used.

    Signed-off-by: Li RongQing
    Signed-off-by: David S. Miller

    Li RongQing
     
  • For each Rx frame the eTSEC writes its FCS (Frame Check Sequence)
    to the Rx buffer.

    The eTSEC h/w manual states in the "Receive Buffer Descriptor Field
    Descriptions" table:
    "Data length is the number of octets written by the eTSEC into this BD's
    data buffer if L is cleared (the value is equal to MRBLR), or, if L is
    set, the length of the frame including *CRC*, FCB (if RCTRL[PRSDEP > 00),
    preamble (if MACCFG2[PreAmRxEn]=1), time stamp (if RCTRL[TS] = 1) and
    any padding (RCTRL[PAL])."

    Though the FCS bytes are removed by the driver before passing the skb
    to the net stack, the Rx buffer size computation does not currently
    take into account the FCS bytes (4 bytes).
    Because the Rx buffer size is multiple of 512 bytes, leaving out the
    FCS is not a problem for the default MTU of 1500, as the Rx buffer size
    is 1536 in this case. However, for custom MTUs, where the difference
    between the MTU size and the Rx buffer size is less, this can be a
    problem as the computed Rx buffer size won't be enough to accomodate
    the FCS for a received frame that is big enough (close to MTU size).
    In such case the received frame is considered to be incomplete (L flag
    not set in the RxBD status) and silently dropped.

    Note that the driver does not currently support S/G on Rx, so it has to
    compute its Rx buffer size based on the MTU of the device.

    Reported-by: Kristian Otnes
    Signed-off-by: Claudiu Manoil
    Signed-off-by: David S. Miller

    Claudiu Manoil
     
  • commit 0b725a2ca61bedc33a2a63d0451d528b268cf975
    net: Remove ndo_xmit_flush netdev operation, use signalling instead.

    added code that looks at skb->xmit_more after the skb has
    been put in TX VQ. Since some paths process the ring and free the skb
    immediately, this can cause use after free.

    Fix by storing xmit_more in a local variable.

    Cc: David S. Miller
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: David S. Miller

    Michael S. Tsirkin
     
  • iMX6SX IEEE 1588 module has one hw issue in capturing the ATVR register.
    The current SW flow is:
    ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK;
    ts_counter_ns = ENET0->ATVR;
    The ATVR value is not expected value that cause LinuxPTP stack cannot be convergent.

    ENET Block Guide/ Chapter for the iMX6SX (PELE) address the issue:
    After set ENET_ATCR[Capture], there need some time cycles before the counter
    value is capture in the register clock domain. The wait-time-cycles is at least
    6 clock cycles of the slower clock between the register clock and the 1588 clock.
    So need something like:
    ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK;
    wait();
    ts_counter_ns = ENET0->ATVR;

    For iMX6SX, the 1588 ts_clk is fixed to 25Mhz, register clock is 66Mhz, so the
    wait-time-cycles must be greater than 240ns (40ns * 6). The patch add 1us delay
    before cpu read ATVR register.

    Changes V2:
    Modify the commit/comments log to describe the issue clearly.

    Signed-off-by: Fugang Duan
    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller

    Nimrod Andy
     
  • Add ndo_gso_check which a device can define to indicate whether is
    is capable of doing GSO on a packet. This funciton would be called from
    the stack to determine whether software GSO is needed to be done. A
    driver should populate this function if it advertises GSO types for
    which there are combinations that it wouldn't be able to handle. For
    instance a device that performs UDP tunneling might only implement
    support for transparent Ethernet bridging type of inner packets
    or might have limitations on lengths of inner headers.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     
  • The drivers should use dmaengine_terminate_all() API instead of
    accessing the device_control which will be deprecated soon

    Signed-off-by: Vinod Koul

    Vinod Koul
     

15 Oct, 2014

20 commits

  • this patch is to fix the stmmac data compatibilities for
    all the SoCs inside the platform file.

    Reported-by: Stephen Rothwell
    Signed-off-by: Giuseppe Cavallaro
    Signed-off-by: David S. Miller

    Giuseppe CAVALLARO
     
  • Pull percpu consistent-ops changes from Tejun Heo:
    "Way back, before the current percpu allocator was implemented, static
    and dynamic percpu memory areas were allocated and handled separately
    and had their own accessors. The distinction has been gone for many
    years now; however, the now duplicate two sets of accessors remained
    with the pointer based ones - this_cpu_*() - evolving various other
    operations over time. During the process, we also accumulated other
    inconsistent operations.

    This pull request contains Christoph's patches to clean up the
    duplicate accessor situation. __get_cpu_var() uses are replaced with
    with this_cpu_ptr() and __this_cpu_ptr() with raw_cpu_ptr().

    Unfortunately, the former sometimes is tricky thanks to C being a bit
    messy with the distinction between lvalues and pointers, which led to
    a rather ugly solution for cpumask_var_t involving the introduction of
    this_cpu_cpumask_var_ptr().

    This converts most of the uses but not all. Christoph will follow up
    with the remaining conversions in this merge window and hopefully
    remove the obsolete accessors"

    * 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (38 commits)
    irqchip: Properly fetch the per cpu offset
    percpu: Resolve ambiguities in __get_cpu_var/cpumask_var_t -fix
    ia64: sn_nodepda cannot be assigned to after this_cpu conversion. Use __this_cpu_write.
    percpu: Resolve ambiguities in __get_cpu_var/cpumask_var_t
    Revert "powerpc: Replace __get_cpu_var uses"
    percpu: Remove __this_cpu_ptr
    clocksource: Replace __this_cpu_ptr with raw_cpu_ptr
    sparc: Replace __get_cpu_var uses
    avr32: Replace __get_cpu_var with __this_cpu_write
    blackfin: Replace __get_cpu_var uses
    tile: Use this_cpu_ptr() for hardware counters
    tile: Replace __get_cpu_var uses
    powerpc: Replace __get_cpu_var uses
    alpha: Replace __get_cpu_var
    ia64: Replace __get_cpu_var uses
    s390: cio driver &__get_cpu_var replacements
    s390: Replace __get_cpu_var uses
    mips: Replace __get_cpu_var uses
    MIPS: Replace __get_cpu_var uses in FPU emulator.
    arm: Replace __this_cpu_ptr with raw_cpu_ptr
    ...

    Linus Torvalds
     
  • cxgb4 ipv6 does not guard against ipv6 being disabled, or the standard
    ipv6 module vs inbuilt tri-state issue. This was fixed for cxgb4i & iw_cxgb4
    but missed for cxgb4.

    Signed-off-by: Anish Bhatt
    Signed-off-by: David S. Miller

    Anish Bhatt
     
  • cxgb4 already handles CLIP updates from a previous changeset for iw_cxgb4,
    there is no need to have this functionality in cxgb4i. Remove duplicated code

    Signed-off-by: Anish Bhatt
    Signed-off-by: David S. Miller

    Anish Bhatt
     
  • virtio spec requires drivers to set DRIVER_OK before using VQs.
    This is set automatically after restore returns, virtio net violated this
    rule by using receive VQs within restore.

    To fix, call virtio_device_ready before using VQs.

    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: Cornelia Huck
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • In the extremely unlikely event that driver initialization fails after
    RX buffers are added, virtio net frees RX buffers while VQs are
    still active, potentially causing device to use a freed buffer.

    To fix, reset device first - same as we do on device removal.

    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: Cornelia Huck
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • virtio spec requires drivers to set DRIVER_OK before using VQs.
    This is set automatically after probe returns, virtio net violated this
    rule by using receive VQs within probe.

    To fix, call virtio_device_ready before using VQs.

    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: Cornelia Huck
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • goto done;
    done:
    return;
    is ugly, it was put there to make diff review easier.
    replace by open-coded return.

    Signed-off-by: Michael S. Tsirkin
    Acked-by: Cornelia Huck
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • config_mutex served two purposes: prevent multiple concurrent config
    change handlers, and synchronize access to config_enable flag.

    Since commit dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1
    workqueue: make all workqueues non-reentrant
    all workqueues are non-reentrant, and config_enable
    is now gone.

    Get rid of the unnecessary lock.

    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: Cornelia Huck
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • Now that virtio core ensures config changes don't arrive during probing,
    drop config_enable flag in virtio net.
    On removal, flush is now sufficient to guarantee that no change work is
    queued.

    This help simplify the driver, and will allow setting DRIVER_OK earlier
    without losing config change notifications.

    Signed-off-by: Michael S. Tsirkin
    Reviewed-by: Cornelia Huck
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • o Number of arguments taken by destroy tx command is three
    instead of two.

    Signed-off-by: Rajesh Borundia
    Signed-off-by: David S. Miller

    Rajesh Borundia
     
  • o Initially we were programming maximum number of arguments.
    Instead we should program number of arguments required in
    a command.
    o Maximum number of arguments for 82xx adapter is four. Fix it
    for GET_ESWITCH_STATS command.

    Signed-off-by: Rajesh Borundia
    Signed-off-by: David S. Miller

    Rajesh Borundia
     
  • Use t4_fw_upgrade instead of t4_load_fw to write firmware into FLASH, since
    t4_load_fw doesn't co-ordinate with the firmware and the adapter can get hosed
    enough to require a power cycle of the system.

    Based on original work by Casey Leedom

    Signed-off-by: Hariprasad Shenai
    Signed-off-by: David S. Miller

    Hariprasad Shenai
     
  • This patch is to review the whole glue logic adopted on STi SoCs that
    was bugged.

    In the old glue-logic there was a lot of confusion when setup the
    retiming especially for STiD127 where, for example, the bits 6 and 7
    (in the GMAC control register) have a different meaning of what is
    used for STiH4xx SoCs. So we cannot adopt the same glue for all these
    SoCs.
    Moreover, GiGa on STiD127 didn't work and, for all the SoCs, the RGMII
    couldn't run when the speed was 10Mbps (because the clock was not properly
    managed).
    Note that the phy clock needs to be provided by the platform as well as
    documented in the related binding file (updated as consequence).

    The old code supported too many configurations never adopted and validated.
    This made the code very complex to maintain and debug in case of issues.

    The patch simplifies all the configurations as commented in the tables
    inside the file and obviously it has been tested on all the boards
    based on the SoCs mentioned.

    With this patch, the dwmac-sti is also ready to support new configurations that
    will be available on next SoC generations.

    Signed-off-by: Giuseppe Cavallaro
    Cc: Srinivas Kandagatla
    Signed-off-by: David S. Miller

    Giuseppe CAVALLARO
     
  • This adds the missing compatibility to the STiH407 SoC.

    Signed-off-by: Giuseppe Cavallaro
    Signed-off-by: David S. Miller

    Giuseppe CAVALLARO
     
  • On several STi platforms: e.g. stihxxx-b2120 an Ethernet switch is
    embedded and connected to the stmmac via RGMII mode. So this is managed
    by using the FIXED_PHY. In that case, the support in the platform needs
    to be fixed to allow the stmmac to dialog with the switch via fixed-link
    by using phy_bus_name property.

    Signed-off-by: Giuseppe Cavallaro
    Signed-off-by: David S. Miller

    Giuseppe CAVALLARO
     
  • tag_protocol is now an enum, so drivers have to check against it.

    Cc: Andrew Lunn
    Signed-off-by: Guenter Roeck
    Acked-by: Florian Fainelli
    Acked-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Guenter Roeck
     
  • Signed-off-by: Iyappan Subramanian
    Signed-off-by: Keyur Chudgar
    Signed-off-by: David S. Miller

    Iyappan Subramanian
     
  • Signed-off-by: Iyappan Subramanian
    Signed-off-by: Keyur Chudgar
    Signed-off-by: David S. Miller

    Iyappan Subramanian
     
  • - Added link_state function pointer to the xgene__mac_ops structure
    - Moved ring manager (pdata->rm) assignment to xgene_enet_setup_ops
    - Removed unused variable (pdata->phy_addr) and macro (FULL_DUPLEX)

    Signed-off-by: Iyappan Subramanian
    Signed-off-by: Keyur Chudgar
    Signed-off-by: David S. Miller

    Iyappan Subramanian