22 Jan, 2014

1 commit

  • These changes correct the following issues with jumbo frames on the
    stmmac driver:

    1) The Synopsys EMAC can be configured to support different FIFO
    sizes at core configuration time. There's no way to query the
    controller and know the FIFO size, so the driver needs to get this
    information from the device tree in order to know how to correctly
    handle MTU changes and setting up dma buffers. The default
    max-frame-size is as currently used, which is the size of a jumbo
    frame.

    2) The driver was enabling Jumbo frames by default, but was not allocating
    dma buffers of sufficient size to handle the maximum possible packet
    size that could be received. This led to memory corruption since DMAs were
    occurring beyond the extent of the allocated receive buffers for certain types
    of network traffic.

    kernel BUG at net/core/skbuff.c:126!
    Internal error: Oops - BUG: 0 [#1] SMP ARM
    Modules linked in:
    CPU: 0 PID: 563 Comm: sockperf Not tainted 3.13.0-rc6-01523-gf7111b9 #31
    task: ef35e580 ti: ef252000 task.ti: ef252000
    PC is at skb_panic+0x60/0x64
    LR is at skb_panic+0x60/0x64
    pc : [] lr : [] psr: 60000113
    sp : ef253c18 ip : 60000113 fp : 00000000
    r10: ef3a5400 r9 : 00000ebc r8 : ef3a546c
    r7 : ee59f000 r6 : ee59f084 r5 : ee59ff40 r4 : ee59f140
    r3 : 000003e2 r2 : 00000007 r1 : c0b9c420 r0 : 0000007d
    Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    Control: 10c5387d Table: 2e8ac04a DAC: 00000015
    Process sockperf (pid: 563, stack limit = 0xef252248)
    Stack: (0xef253c18 to 0xef254000)
    3c00: 00000ebc ee59f000
    3c20: ee59f084 ee59ff40 ee59f140 c04a9cd8 ee8c50c0 00000ebc ee59ff40 00000000
    3c40: ee59f140 c02d0ef0 00000056 ef1eda80 ee8c50c0 00000ebc 22bbef29 c0318f8c
    3c60: 00000056 ef3a547c ffe2c716 c02c9c90 c0ba1298 ef3a5838 ef3a5838 ef3a5400
    3c80: 000020c0 ee573840 000055cb ef3f2050 c053f0e0 c0319214 22b9b085 22d92813
    3ca0: 00001c80 004b8e00 ef3a5400 ee573840 ef3f2064 22d92813 ef3f2064 000055cb
    3cc0: ef3f2050 c031a19c ef252000 00000000 00000000 c0561bc0 00000000 ff00ffff
    3ce0: c05621c0 ef3a5400 ef3f2064 ee573840 00000020 ef3f2064 000055cb ef3f2050
    3d00: c053f0e0 c031cad0 c053e740 00000e60 00000000 00000000 ee573840 ef3a5400
    3d20: ef0a6e00 00000000 ef3f2064 c032507c 00010000 00000020 c0561bc0 c0561bc0
    3d40: ee599850 c032799c 00000000 ee573840 c055a380 ef3a5400 00000000 ef3f2064
    3d60: ef3f2050 c032799c 0101c7c0 2b6755cb c059a280 c030e4d8 000055cb ffffffff
    3d80: ee574fc0 c055a380 ee574000 ee573840 00002b67 ee573840 c03fe9c4 c053fa68
    3da0: c055a380 00001f6f 00000000 ee573840 c053f0e0 c0304fdc ef0a6e01 ef3f2050
    3dc0: ee573858 ef031000 ee573840 c03055d8 c0ba0c40 ef000f40 00100100 c053f0dc
    3de0: c053ffdc c053f0f0 00000008 00000000 ef031000 c02da948 00001140 00000000
    3e00: c0563c78 ef253e5f 00000020 ee573840 00000020 c053f0f0 ef313400 ee573840
    3e20: c053f0e0 00000000 00000000 c05380c0 ef313400 00001000 00000015 c02df280
    3e40: ee574000 ef001e00 00000000 00001080 00000042 005cd980 ef031500 ef031500
    3e60: 00000000 c02df824 ef031500 c053e390 c0541084 f00b1e00 c05925e8 c02df864
    3e80: 00001f5c ef031440 c053e390 c0278524 00000002 00000000 c0b9eb48 c02df280
    3ea0: ee8c7180 00000100 c0542ca8 00000015 00000040 ef031500 ef031500 ef031500
    3ec0: c027803c ef252000 00000040 000000ec c05380c0 c0b9eb40 c0b9eb48 c02df940
    3ee0: ef060780 ffffa4dd c0564a9c c056343c 002e80a8 00000080 ef031500 00000001
    3f00: c053808c ef252000 fffec100 00000003 00000004 002e80a8 0000000c c00258f0
    3f20: 002e80a8 c005e704 00000005 00000100 c05634d0 c0538080 c05333e0 00000000
    3f40: 0000000a c0565580 c05380c0 ffffa4dc c05434f4 00400100 00000004 c0534cd4
    3f60: 00000098 00000000 fffec100 002e80a8 00000004 002e80a8 002a20e0 c0025da8
    3f80: c0534cd4 c000f020 fffec10c c053ea60 ef253fb0 c0008530 0000ffe2 b6ef67f4
    3fa0: 40000010 ffffffff 00000124 c0012f3c 0000ffe2 002e80f0 0000ffe2 00004000
    3fc0: becb6338 becb6334 00000004 00000124 002e80a8 00000004 002e80a8 002a20e0
    3fe0: becb6300 becb62f4 002773bb b6ef67f4 40000010 ffffffff 00000000 00000000
    [] (skb_panic+0x60/0x64) from [] (skb_put+0x4c/0x50)
    [] (skb_put+0x4c/0x50) from [] (tcp_collapse+0x314/0x3ec)
    [] (tcp_collapse+0x314/0x3ec) from []
    (tcp_try_rmem_schedule+0x1b0/0x3c4)
    [] (tcp_try_rmem_schedule+0x1b0/0x3c4) from []
    (tcp_data_queue+0x480/0xe6c)
    [] (tcp_data_queue+0x480/0xe6c) from []
    (tcp_rcv_established+0x180/0x62c)
    [] (tcp_rcv_established+0x180/0x62c) from []
    (tcp_v4_do_rcv+0x13c/0x31c)
    [] (tcp_v4_do_rcv+0x13c/0x31c) from []
    (tcp_v4_rcv+0x718/0x73c)
    [] (tcp_v4_rcv+0x718/0x73c) from []
    (ip_local_deliver+0x98/0x274)
    [] (ip_local_deliver+0x98/0x274) from []
    (ip_rcv+0x420/0x758)
    [] (ip_rcv+0x420/0x758) from []
    (__netif_receive_skb_core+0x44c/0x5bc)
    [] (__netif_receive_skb_core+0x44c/0x5bc) from []
    (netif_receive_skb+0x48/0xb4)
    [] (netif_receive_skb+0x48/0xb4) from []
    (napi_gro_flush+0x70/0x94)
    [] (napi_gro_flush+0x70/0x94) from []
    (napi_complete+0x1c/0x34)
    [] (napi_complete+0x1c/0x34) from []
    (stmmac_poll+0x4e8/0x5c8)
    [] (stmmac_poll+0x4e8/0x5c8) from []
    (net_rx_action+0xc4/0x1e4)
    [] (net_rx_action+0xc4/0x1e4) from []
    (__do_softirq+0x12c/0x2e8)
    [] (__do_softirq+0x12c/0x2e8) from [] (irq_exit+0x78/0xac)
    [] (irq_exit+0x78/0xac) from [] (handle_IRQ+0x44/0x90)
    [] (handle_IRQ+0x44/0x90) from []
    (gic_handle_irq+0x2c/0x5c)
    [] (gic_handle_irq+0x2c/0x5c) from []
    (__irq_usr+0x3c/0x60)

    3) The driver was setting the dma buffer size after allocating dma buffers,
    which caused a system panic when changing the MTU.

    BUG: Bad page state in process ifconfig pfn:2e850
    page:c0b72a00 count:0 mapcount:0 mapping: (null) index:0x0
    page flags: 0x200(arch_1)
    Modules linked in:
    CPU: 0 PID: 566 Comm: ifconfig Not tainted 3.13.0-rc6-01523-gf7111b9 #29
    [] (unwind_backtrace+0x0/0xf8) from []
    (show_stack+0x10/0x14)
    [] (show_stack+0x10/0x14) from [] (dump_stack+0x70/0x88)
    [] (dump_stack+0x70/0x88) from [] (bad_page+0xc8/0x118)
    [] (bad_page+0xc8/0x118) from []
    (get_page_from_freelist+0x744/0x870)
    [] (get_page_from_freelist+0x744/0x870) from []
    (__alloc_pages_nodemask+0x118/0x86c)
    [] (__alloc_pages_nodemask+0x118/0x86c) from []
    (__get_free_pages+0x10/0x54)
    [] (__get_free_pages+0x10/0x54) from []
    (kmalloc_order_trace+0x24/0xa0)
    [] (kmalloc_order_trace+0x24/0xa0) from []
    (__kmalloc_reserve.isra.21+0x24/0x70)
    [] (__kmalloc_reserve.isra.21+0x24/0x70) from []
    (__alloc_skb+0x68/0x13c)
    [] (__alloc_skb+0x68/0x13c) from []
    (__netdev_alloc_skb+0x3c/0xe8)
    [] (__netdev_alloc_skb+0x3c/0xe8) from []
    (stmmac_open+0x63c/0x1024)
    [] (stmmac_open+0x63c/0x1024) from []
    (__dev_open+0xa0/0xfc)
    [] (__dev_open+0xa0/0xfc) from []
    (__dev_change_flags+0x94/0x158)
    [] (__dev_change_flags+0x94/0x158) from []
    (dev_change_flags+0x18/0x48)
    [] (dev_change_flags+0x18/0x48) from []
    (devinet_ioctl+0x638/0x700)
    [] (devinet_ioctl+0x638/0x700) from []
    (sock_ioctl+0x64/0x290)
    [] (sock_ioctl+0x64/0x290) from []
    (do_vfs_ioctl+0x78/0x5b8)
    [] (do_vfs_ioctl+0x78/0x5b8) from [] (SyS_ioctl+0x3c/0x5c)
    [] (SyS_ioctl+0x3c/0x5c) from []

    The fixes have been verified using reproducible, automated testing.

    Signed-off-by: Vince Bridgers
    Signed-off-by: David S. Miller

    Vince Bridgers
     

20 Jan, 2014

2 commits


17 Jan, 2014

1 commit

  • This patch adds support to "max-speed" property which is a standard
    Ethernet device tree property. max-speed specifies maximum speed
    (specified in megabits per second) supported the device.

    Depending on the clocking schemes some of the boards can only support
    few link speeds, so having a way to limit the link speed in the mac
    driver would allow such setups to work reliably.

    Without this patch there is no way to tell the driver to limit the
    link speed.

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

    Srinivas Kandagatla
     

31 Aug, 2013

1 commit


05 Jul, 2013

1 commit

  • This patch adds phy reset callback support for stmmac driver via device
    trees. It adds three new properties to gmac device tree bindings to
    define the reset signal via gpio.

    With this patch users can conveniently pass reset gpio number with pre,
    pulse and post delay in micro secs via DTs.

    active low:
    _________ ____________
    | |
    | |
    |_______________|

    active high:
    ________________
    | |
    | |
    ________| |___________

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: David S. Miller

    Srinivas Kandagatla
     

14 Dec, 2012

1 commit

  • Pull trivial branch from Jiri Kosina:
    "Usual stuff -- comment/printk typo fixes, documentation updates, dead
    code elimination."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
    HOWTO: fix double words typo
    x86 mtrr: fix comment typo in mtrr_bp_init
    propagate name change to comments in kernel source
    doc: Update the name of profiling based on sysfs
    treewide: Fix typos in various drivers
    treewide: Fix typos in various Kconfig
    wireless: mwifiex: Fix typo in wireless/mwifiex driver
    messages: i2o: Fix typo in messages/i2o
    scripts/kernel-doc: check that non-void fcts describe their return value
    Kernel-doc: Convention: Use a "Return" section to describe return values
    radeon: Fix typo and copy/paste error in comments
    doc: Remove unnecessary declarations from Documentation/accounting/getdelays.c
    various: Fix spelling of "asynchronous" in comments.
    Fix misspellings of "whether" in comments.
    eisa: Fix spelling of "asynchronous".
    various: Fix spelling of "registered" in comments.
    doc: fix quite a few typos within Documentation
    target: iscsi: fix comment typos in target/iscsi drivers
    treewide: fix typo of "suport" in various comments and Kconfig
    treewide: fix typo of "suppport" in various comments
    ...

    Linus Torvalds
     

27 Nov, 2012

1 commit

  • GMAC devices newer than databook 3.40 has an embedded timer
    that can be used for mitigating the number of interrupts.
    So this patch adds this optimizations.

    At any rate, the Rx watchdog can be disable (on bugged HW) by
    passing from the platform the riwt_off field.

    In this implementation the rx timer stored in the Reg9 is fixed
    to the max value. This will be tuned by using ethtool.

    V2: added a platform parameter to force to disable the rx-watchdog
    for example on new core where it is bugged.

    V3: do not disable NAPI when Rx watchdog is used.

    V4: a new extra statistic field has been added to show the early
    receive status in the interrupt handler.
    This patch also adds an extra check to avoid to call
    napi_schedule when the DMA_INTR_ENA_RIE bit is disabled in the
    Interrupt Mask register.

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

    Giuseppe CAVALLARO
     

19 Nov, 2012

1 commit


01 Sep, 2012

1 commit

  • This patch removes bus_id from mdio platform data, The reason to remove
    bus_id is, stmmac mdio bus_id is always same as stmmac bus-id, so there
    is no point in passing this in different variable.
    Also stmmac ethernet driver connects to phy with bus_id passed its
    platform data.
    So, having single bus-id is much simpler.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: David S. Miller

    Srinivas Kandagatla
     

15 May, 2012

1 commit

  • In mixed burst (MB) mode, the AHB master always initiates
    the bursts with fixed-size when the DMA requests transfers
    of size less than or equal to 16 beats.
    This patch adds the MB support and the flag that can be
    passed from the platform to select it.
    MB mode can also give some benefits in terms of performances
    on some platforms.

    v2: fixed Coding Style

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

    Giuseppe CAVALLARO
     

20 Apr, 2012

1 commit

  • Freeze and restore can call the custom init/exit functions.
    Also the patch adds a custom data field that can be used
    for storing platform data useful on restore the embedded
    setup (e.g. GPIO, SYSCFG).

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

    Francesco Virlinzi
     

05 Apr, 2012

5 commits

  • The CSR Clock Range has been reworked and new macros has
    been added in the platform header to allow the CSR Clock
    Range selection in the GMII Address Register.
    The previous work didn't add the other fields
    that can be used to achieve MDC clock of frequency
    higher than the IEEE 802.3 specified frequency limit
    of 2.5 MHz and program a clock divider of lower value.
    On such platforms, these are used indeed so this patch
    adds them.

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

    Giuseppe CAVALLARO
     
  • This patch re-works the internal GMAC DMA parameters
    passed from the platform.
    In the past, we only passed the pbl but, with new core,
    other parameters can be passed and are mandatory on some
    platforms.

    New parameters are documented in stmmac.txt because this
    patch has an impact for many platforms.

    Signed-off-by: Shiraz Hashim
    Signed-off-by: Vikas Manocha
    Signed-off-by: Deepak Sikri
    Hacked-by: Giuseppe Cavallaro
    Signed-off-by: David S. Miller

    Deepak SIKRI
     
  • The patch adds the macros to be used for MDC clock selection. The MDC clock
    frequency is based on scaled system clock, and has to be confined to a range
    of 1-2.5 MHz. Based on the input CSR clock, the scaling factor has to be
    selected.
    The platform specific code will provide the default value of this scaling
    factor, based on the input CSR clock.
    There is an option to set MDC clock higher than the IEEE 802.3 specified
    frequency limit of 2.5 MHz. This applies for the interfacing chips that
    support higher MDC clocks. The resultant higher clock of 12.5 MHz requires
    additional Macros to be defined for the clock divider corresponding to the
    to the following selection.
    -----------------------------------------
    Selection MDC Clock
    -----------------------------------------
    1000 clk_csr_i/4
    1001 clk_csr_i/6
    1010 clk_csr_i/8
    1011 clk_csr_i/10
    1100 clk_csr_i/12
    1101 clk_csr_i/14
    1110 clk_csr_i/16
    1111 clk_csr_i/18

    This support has to be added both in the include file, as well as driver. The
    driver need to program the registers based on the interfacing chips. This would
    be more board specific information and needs to be passed through the platform
    code to the driver. This work would be carried out in the future patch set
    release.

    Signed-off-by: Deepak Sikri
    Acked-by: Giuseppe Cavallaro
    Signed-off-by: David S. Miller

    Deepak SIKRI
     
  • This patch explicitly defines the CSUM offload engine type which need
    (not mandatory) to be passed from the platform code.
    STMMAC core supports two check sum offload engine types- Type-1 & Type-2.
    Also, there are STMMAC cores that do not have the check sum offload
    capabilities.

    The behaviour of Type-1 & Type-2 cores related to provision of checksum
    increases the packet length for Type-1 cores by 2, as the checksum is appended
    at the end of data packet and the same is made accountable in the DMA status.
    The STMMAC cores beyond Version-3.5 provide HW interface registers which allows
    the user to read the HW capabilities, while to support the previous cores the
    information related to HW capabilities has to be provided from the platform
    code.

    The Type-1 cores which do not have the HW register interface need this
    information.

    This patch also updates the driver's doc.

    Signed-off-by: Deepak Sikri
    Hacked-by: Giuseppe Cavallaro
    Signed-off-by: David S. Miller

    Deepak SIKRI
     
  • As stmmac mdio bus name prefix is hardcoded in the driver, this allows
    only phys on stmmac mdio buses to connect, however stmmac should allow
    phys on other mdio buses too.

    This patch adds new variable phy_bus_name to plat_stmmacenet_data
    struct to let the BSP decide which phy bus to be used by stmmac driver.
    A typical use-case is to have generic MDIO buses like mdio-gpio on top
    of stmmac.

    Signed-off-by: Srinivas Kandagatla
    Acked-by: Florian Fainelli
    Signed-off-by: Giuseppe Cavallaro
    Signed-off-by: David S. Miller

    Srinivas Kandagatla
     

22 Jul, 2011

1 commit

  • Prior to this change, most PHY configuration parameters were passed
    into the STMMAC device as a separate PHY device. As well as being
    unusual, this made it difficult to make changes to the MAC/PHY
    relationship.

    This patch moves all the PHY parameters into the MAC configuration
    structure, mainly as a separate structure. This allows us to completely
    ignore the MDIO bus attached to a stmmac if desired, and not create
    the PHY bus. It also allows the stmmac driver to use a different PHY
    from the one it is connected to, for example a fixed PHY or bit banging
    PHY.

    Also derive the stmmac/PHY connection type (MII/RMII etc) from the
    mode can be passed into _configure_ethernet.
    STLinux kernel at git://git.stlinux.com/stm/linux-sh4-2.6.32.y.git
    provides several examples how to use this new infrastructure (that
    actually is easier to maintain and clearer).

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

    Giuseppe CAVALLARO
     

19 Jul, 2011

1 commit


04 May, 2011

1 commit

  • stmmac.h uses struct platform_device and doesn't include
    . Whereas drivers/net/stmmac/stmmac.h includes it, but
    doesn't directly use it. And so we get following compilation warning while using
    this file:
    warning: ‘struct platform_device’ declared inside parameter list

    This patch includes in linux/stmmac.h and removes it
    from drivers/net/stmmac/stmmac.h

    Signed-off-by: Viresh Kumar
    Acked-by: Giuseppe Cavallaro
    Signed-off-by: David S. Miller

    Viresh KUMAR
     

31 Mar, 2011

1 commit


25 Nov, 2010

1 commit

  • This patch adds in the plat_stmmacenet_data
    the init and exit callbacks that can be used
    for invoking specific platform functions.
    For example, on ST targets, these call the
    PAD manager functions to set PIO lines and
    syscfg registers.
    The patch removes the stmmac_claim_resource
    only used on STM Kernels as well.

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

    Giuseppe CAVALLARO
     

25 Sep, 2010

1 commit


18 Sep, 2010

2 commits

  • The first version of the driver had hard-coded the logic
    for handling the checksum offloading.
    This was designed according to the chips included in
    the STM platforms where:
    o MAC10/100 supports no COE at all.
    o GMAC fully supports RX/TX COE.

    This is not good for other chip configurations where,
    for example, the mac10/100 supports the tx csum in HW
    or when the GMAC has no IPC.

    Thanks to Johannes Stezenbach; he provided me a first
    draft of this patch that only reviewed the IPC for the
    GMAC devices.

    This patch also helps on SPEAr platforms where the
    MAC10/100 can perform the TX csum in HW.
    Thanks to Deepak SIKRI for his support on this.

    In the end, GMAC devices for STM platforms have
    a bugged Jumbo frame support that needs to have
    the Tx COE disabled for oversized frames (due to
    limited buffer sizes). This information is also
    passed through the driver's platform structure.

    Signed-off-by: Giuseppe Cavallaro
    Signed-off-by: Johannes Stezenbach
    Signed-off-by: Deepak SIKRI
    Signed-off-by: David S. Miller

    Giuseppe CAVALLARO
     
  • This patch adds the CSR Clock range selection.

    Original patch from Johannes Stezenbach fixed the CSR
    in the stmmac_mdio. We agreed to provide this through
    the platform instead of.
    Also thanks to Johannes for having tested it on ARM.

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

    Giuseppe CAVALLARO
     

26 Aug, 2010

1 commit


14 Apr, 2010

1 commit

  • The new enh_desc is used for selecting the enhanced descriptors
    structure. There are several scenarios; some chips (mac10/100
    or gmac) want to use the enhanced descriptors; others want the normal
    ones.
    For example, on ST platforms: MAC10/100 uses the normal desc structure
    and the GMAC uses the enhanced one.
    It can be useful to get this information from the platform.
    This could also be decided at run-time looking at the chip's ID number;
    but it could happen that chips with the same ID want to use different
    descriptor structure.

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

    Giuseppe CAVALLARO
     

08 Jan, 2010

1 commit