1. 25 2月, 2014 1 次提交
    • C
      gianfar: Implement MAC reset and reconfig procedure · a328ac92
      Claudiu Manoil 提交于
      The main MAC config registers like: RCTRL/TCTRL, MRBLR,
      MAXFRM, RXIC/TXIC, most fields of MACCFG1/2, should not
      be changed on-the-fly, but at least after stopping the
      DMA and disabling the Rx/Tx blocks and, for increased
      reliability, after a MAC soft reset.
      
      Impelement a complete MAC soft reset and reconfig procedure
      following the latest HW advisories - gfar_mac_reset() - to
      replace gfar_mac_init() and (the confusing) init_registers()
      functions.
      
      Factor out separate config functions for RCTRL and TCTRL,
      insure programming order of the relevant config regs after
      MAC soft reset.
      
      Split gfar_hw_init() into gfar_mac_reset() and the remaining
      global regs that don't need to be reconfigured after MAC soft
      reset (FIFOCFG, ATTRELI, HW counters a.s.o).
      
      As gfar_hw_init() now makes all the register writes @probe()
      time, based on all the device flags and config options, it
      must be moved further down, just before register_netdev(),
      as the last config step when the config values are comitted
      to HW.  Also, move netif_carrier_off() after register_netdev(),
      because it has no effect if called before.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a328ac92
  2. 19 2月, 2014 5 次提交
    • C
      gianfar: Add missing graceful reset steps and fixes · c10650b6
      Claudiu Manoil 提交于
      gfar_halt() and gfar_start() are responsible for stopping
      and starting the DMA and the Rx/Tx hw rings. They implement
      the support for the "graceful Rx/Tx stop/start" hw procedure,
      and also disable/enable eTSEC's hw interrupts in the process.
      
      The GRS/GTS procedure requires however to have the RQUEUE/TQUEUE
      registers cleared first and to wait for a period of time for the
      current frame to pass through the interface (around ~10ms for a
      jumbo frame). Only then may the GTS and GRS bits from DMACTRL be
      set to shut down the DMA, and finally the Tx_EN and Rx_EN bits in
      MACCFG1 may be cleared to disable the Tx/Rx blocks.
      
      The same register programming order applies to start the Rx/Tx:
      enabling the RQUEUE/TQUEUE *before* clearing the GRS/GTS bits.
      
      This is a HW recommendation in order to avoid a possible
      controller "lock up" during graceful reset.
      
      Cleanup the gfar_halt()/start() prototypes, to take priv instead
      of ndev as their purpose is to operate on HW. Enabling the
      RQUEUE/TQUEUE in the hw_init() is not needed anymore since
      that's the job of gfar_start().
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c10650b6
    • C
      gianfar: Factor out enabling/disabling of hw interrupts · efeddce7
      Claudiu Manoil 提交于
      Throughout the code there are places where the controller's
      hw interrupt sources need to get disabled/enabled (masked/
      un-masked) all at once.  The recommendation for disabling
      the interrupts is to clear the ievent first then the imask
      register (not the other way around).
      Use the gfar_ints_enable/disable() helpers to make these
      operations consistent.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      efeddce7
    • C
      gianfar: Remove useless HAS_PADDING device flag · 532c37bc
      Claudiu Manoil 提交于
      The RCTRL updates of the FSL_GIANFAR_DEV_HAS_PADDING device
      flag get overriden by the FSL_GIANFAR_DEV_HAS_TIMER flag
      settings, which impose a Rx padding alignment of 8 bytes.
      As all the eTSEC devices that set HAS_PADDING also set the
      HAS_TIMER flag, the HAS_PADDING flag is now obsolete.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      532c37bc
    • C
      gianfar: Remove sysfs stubs for FIFOCFG and stashing · 34018fd4
      Claudiu Manoil 提交于
      Removing the sysfs stubs for the Tx FIFOCFG and ATTRELI
      (stashing) config registers, as these registers may only
      be configured after a MAC reset, with the controller stopped
      (i.e. during hw init, at probe() time).  The current sysfs
      stubs allow on-the-fly updates of these registers (the locking
      measures are useless and only add unecessary code).
      
      Changing these registers is discouraged. Only the default values
      will be used instead.
      
      Moreover, the stashing (ATTRELI) configuration options were
      effectively disabled (didn't get to the hw anyway if changed)
      because the stashing device_flags (HAS_BD_STASHING|HAS_BUF_STASHING)
      were "accidentally" cleared during probe().
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      34018fd4
    • C
      gianfar: Cleanup/Fix gfar_probe and the hw init code · 20862788
      Claudiu Manoil 提交于
      Factor out gfar_hw_init() to contain all the controller hw
      initialization steps for a better control of register writes,
      and to significantly simplify the tangled code from gfar_probe().
      This results in code size and stack usage reduction (besides
      code readability).
      
      Fix memory leak on device removal, by freeing the rx_/tx_queue
      structures.
      
      Replace custom bit swapping function with a library one (bitrev8).
      
      Move allocation of rx_/tx_queue struct arrays before the group
      structure init, because in order to assign Rx/Tx queues
      to groups we need to have the queues first.  This also allows
      earlier bail out of gfar_probe(), in case the memory allocation
      fails.
      
      The flow control checks for maccfg1 were removed from gfar_probe(),
      since flow control is disabled at probe time (priv->rx_/tx_pause_en
      are 0). Redundant initializations (by 0) also removed.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      20862788
  3. 17 1月, 2014 1 次提交
  4. 22 11月, 2013 1 次提交
  5. 19 10月, 2013 1 次提交
    • C
      gianfar: Simplify MQ polling to avoid soft lockup · 3ba405db
      Claudiu Manoil 提交于
      Under certain low traffic conditions, the single core
      devices with multiple Rx/Tx queues (MQ mode) may reach
      soft lockup due to gfar_poll not returning in proper time.
      The following exception was obtained using iperf on a 100Mbit
      half-duplex link, for a p1010 single core device:
      
      BUG: soft lockup - CPU#0 stuck for 23s! [iperf:2847]
      Modules linked in:
      CPU: 0 PID: 2847 Comm: iperf Not tainted 3.12.0-rc3 #16
      task: e8bf8000 ti: eeb16000 task.ti: ee646000
      NIP: c0255b6c LR: c0367ae8 CTR: c0461c18
      REGS: eeb17e70 TRAP: 0901   Not tainted  (3.12.0-rc3)
      MSR: 00029000 <CE,EE,ME>  CR: 44228428  XER: 20000000
      
      GPR00: c0367ad4 eeb17f20 e8bf8000 ee01f4b4 00000008 ffffffff ffffffff
      00000000
      GPR08: 000000c0 00000008 000000ff ffffffc0 000193fe
      NIP [c0255b6c] find_next_bit+0xb8/0xc4
      LR [c0367ae8] gfar_poll+0xc8/0x1d8
      Call Trace:
      [eeb17f20] [c0367ad4] gfar_poll+0xb4/0x1d8 (unreliable)
      [eeb17f70] [c0422100] net_rx_action+0xa4/0x158
      [eeb17fa0] [c003ec6c] __do_softirq+0xcc/0x17c
      [eeb17ff0] [c000c28c] call_do_softirq+0x24/0x3c
      [ee647cc0] [c0004660] do_softirq+0x6c/0x94
      [ee647ce0] [c003eb9c] local_bh_enable+0x9c/0xa0
      [ee647cf0] [c0454fe8] tcp_prequeue_process+0xa4/0xdc
      [ee647d10] [c0457e44] tcp_recvmsg+0x498/0x96c
      [ee647d80] [c047b630] inet_recvmsg+0x40/0x64
      [ee647da0] [c040ca8c] sock_recvmsg+0x90/0xc0
      [ee647e30] [c040edb8] SyS_recvfrom+0x98/0xfc
      
      To prevent this, the outer while() loop has been removed
      allowing gfar_poll() to return faster even if there's
      still budget left.  Also, there's no need to recompute
      the budget per Rx queue anymore.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3ba405db
  6. 10 10月, 2013 4 次提交
  7. 04 9月, 2013 1 次提交
    • C
      gianfar: Fix reported number of sent bytes to BQL · 50ad076b
      Claudiu Manoil 提交于
      Fix the amount of sent bytes reported to BQL by reporting the
      number of bytes on wire in the xmit routine, and recording that
      value for each skb in order to be correctly confirmed on Tx
      confirmation cleanup.
      
      Reporting skb->len to BQL just before exiting xmit is not correct
      due to possible insertions of TOE block and alignment bytes in the
      skb->data, which are being stripped off by the controller before
      transmission on wire.  This led to mismatch of (incorrectly)
      reported bytes to BQL b/w xmit and Tx confirmation, resulting in
      Tx timeout firing, for the h/w tx timestamping acceleration case.
      
      There's no easy way to obtain the number of bytes on wire in the Tx
      confirmation routine, so skb->cb is used to convey that information
      from xmit to Tx confirmation, for now (as proposed by Eric). Revived
      the currently unused GFAR_CB() construct for that purpose.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      50ad076b
  8. 14 8月, 2013 1 次提交
    • C
      gianfar: Add flow control support · 23402bdd
      Claudiu Manoil 提交于
      eTSEC has Rx and Tx flow control capabilities that may be enabled
      through MACCFG1[Rx_Flow, Tx_Flow] bits.  These bits must not be set
      however when eTSEC is operated in Half-Duplex mode.  Unfortunately,
      the driver currently sets these bits unconditionally.
      This patch adds the proper handling of the PAUSE frame capability
      register bits by implementing the ethtool -A interface.  When pause
      autoneg is enabled, the controller uses the phy's capability to
      negotiate PAUSE frame settings with the link partner and reconfigures
      its Rx_Flow and Tx_Flow settings to match the capabilities of the
      link partner.  If pause autoneg is off, the PAUSE frame generation
      may be forced manually (ethtool -A).  Flow control is disabled by
      default now.
      This implementation is inspired by the tg3 driver.
      Signed-off-by: NLutz Jaenicke <ljaenicke@innominate.com>
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      23402bdd
  9. 06 8月, 2013 2 次提交
    • C
      gianfar: Cleanup TxFCB insertion on xmit · 0d0cffdc
      Claudiu Manoil 提交于
      Cleanup gfar_start_xmit()'s fast path by factoring out "redundant"
      FCB insertion code (repeated gfar_add_fcb() calls and related)
      and by reducing the number of if() clauses (i.e. if(fcb) checks).
      Improve maintainability (e.g. there's less code and easier to read)
      also by introducing do_csum and do_vlan to mark the other 2 Tx TOE
      functionalities, following the same model as do_tstamp.
      fcb_len may also be 0 now, to mark that Tx FCB insertion conditions
      (do_csum, do_vlan, do_tstamp) have not been met.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0d0cffdc
    • C
      gianfar: Fix Tx csum generation errata handling · 02d88fb4
      Claudiu Manoil 提交于
      Both [eTSEC76] and [eTSEC12] errata relate to Tx checksum generation
      (for some MPC83xx and MCP8548 older revisions). They require the same
      workaround: manual checksum computation and insertion, and disabling
      the H/W Tx csum acceleration feature (per frame) through Tx FCB
      (Frame Control Block) csum offload settings.
      
      The workaround for [eTSEC76] needs to be fixed because it currently
      fails to disable H/W Tx csum insertion via FCB. This patch fixes it
      and provides a common workaround implementation for both Tx csum errata.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      02d88fb4
  10. 02 8月, 2013 1 次提交
  11. 12 6月, 2013 1 次提交
  12. 26 5月, 2013 1 次提交
  13. 23 4月, 2013 1 次提交
  14. 20 4月, 2013 1 次提交
  15. 22 3月, 2013 3 次提交
  16. 21 3月, 2013 4 次提交
    • C
      gianfar: Refactor config coalescing calls for all queues · 800c644b
      Claudiu Manoil 提交于
      The only place where gfar_configure_coalescing is called
      with an actual bitmask (other than 0xff) is in gfar_poll
      (on the hot path). So make gfar_configure_coalescing()
      static for the buffer processing path, and export
      gfar_configure_coalescing_all() for the remaining cases
      that require to set coalescing for all the queues at once
      (on the slow path).
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      800c644b
    • C
      gianfar: Remove redundant programming of [rt]xic registers · 5d9657d8
      Claudiu Manoil 提交于
      For Multi Q Multi Group (MQ_MG_MODE) mode, the Rx/Tx colescing registers [rt]xic
      are aliased with the [rt]xic0 registers (coalescing setting regs for Q0). This
      avoids programming twice in a row the coalescing registers for the Rx/Tx hw Q0.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5d9657d8
    • C
      gianfar: Poll only active Rx queues · 6be5ed3f
      Claudiu Manoil 提交于
      Split the napi budget fairly among the active queues only, instead
      of dividing it by the total number of Rx queues assigned to the
      given interrupt group.
      Use the h/w indication field RXFi in rstat (receive status register)
      to identify the active rx queues from the current interrupt group
      (i.e. receive event occured on ring i, if ring i is part of the current
      interrupt group). This indication field in rstat, RXFi i=0..7,
      allows us to find out on which queues of the same interrupt group
      do we have incomming traffic once we entered the polling routine for
      the given interrupt group. After servicing the ring i, the corresponding
      bit RXFi will be written with 1 to clear the active queue indication for
      that ring.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6be5ed3f
    • C
      gianfar: Fix tx napi polling · c233cf40
      Claudiu Manoil 提交于
      There are 2 issues with the current napi poll routine, with regards
      to tx ring cleanup:
      1) for multi-queue devices (MQ_MG_MODE), should tx_bit_map != rx_bit_map,
      which is possible (and supported in h/w) if the DT property "fsl,tx-bit-map"
      holds a different value than rx_bit_map, the current polling routine will
      service the wrong Tx queues in this case (i.e. the interrupt group will
      receive interrupts from tx queues that it will not service)
      2) Tx cleanup completion consumes napi budget, whereas the napi budget
      should be reserved for Rx work only.
      
      The patch fixes these issues and provides a clean napi polling routine.
      Napi poll completion is reached when all the Rx queues have been
      serviced and there is no Tx work to do.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c233cf40
  17. 15 3月, 2013 1 次提交
  18. 25 2月, 2013 1 次提交
  19. 15 2月, 2013 6 次提交
    • C
      gianfar: Fix and cleanup Rx FCB indication · ba779711
      Claudiu Manoil 提交于
      This fixes a less obvious error on one hand, and prevents futher
      similar errors by disambiguating and optimizing RxFCB indication,
      on the other hand.
      
      The error consists in NETIF_F_HW_VLAN_TX flag being used as an
      indication of Rx FCB insertion. This happened as soon gfar_uses_fcb(),
      which despite its name indicates Rx FCB insertion, started
      incorporating is_vlan_on().
      is_vlan_on(), on the other hand, is also a misleading construct because
      we need to differentiate b/w hw VLAN extraction/VLEX (marked by VLAN_RX
      flag) and hw VLAN insertion/VLINS (VLAN_TX flag), which are different
      mechanisms using different types of FCBs.
      
      The hw spec for the RxFCB feature is as follows:
      In the case of RxBD rings, FCBs (Frame Control Block) are inserted by
      the eTSEC whenever RCTRL[PRSDEP] is set to a non-zero value. Only one
      FCB is inserted per frame (in the buffer pointed to by the RxBD with
      bit F set). TOE acceleration for receive is enabled for all rx frames
      in this case.
      
      This patch introduces priv->uses_rxfcb field to quickly signal RxFCB
      insertion in accordance with the specification above.
      
      The dependency on FSL_GIANFAR_DEV_HAS_TIMER was also eliminated as
      another source of confusion. The actual dependency is to priv->hwts_rx_en.
      Upon changing priv->hwts_rx_en via IOCTL, the gfar device is being
      restarted and on init_mac() the priv->hwts_rx_en flag determines RxFCB
      insertion, and rctrl is programmed accordingly. The patch takes care
      of this case too.
      
      Though maybe not as self documenting as the inlining version uses_fcb(),
      priv->uses_rxfcb has the main purpose to quickly signal, on the hot path,
      that the incoming frame has a *Rx* FCB block inserted which needs to be
      pulled out before passing the skb to the stack. This is a performance
      critical operation, it needs to happen fast, that's why uses_rxfcb is
      placed in the first cacheline of gfar_private.
      This is also why a cached rctrl cannot be used instead: 1) because
      we don't have 32 bits available in the first cacheline of gfar_priv
      (but only 16); 2) bit operations are expensive on the hot path.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ba779711
    • C
      gianfar: Remove wrong buffer size conditioning to VLAN h/w offload · 13f228da
      Claudiu Manoil 提交于
      The controller's ref manual states clearly that when the hw Rx vlan
      offload feature is enabled, meaning that the VLEX bit from RCTRL is
      correctly enabled, then the hw performs automatic VLAN tag extraction
      and deletion from the ethernet frames. So there's no point in trying to
      increase the rx buff size when rxvlan is on, as the frame is actually
      smaller.
      And the Tx vlan hw accel feature (VLINS) has nothing to do with rx buff
      size computation.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      13f228da
    • C
      gianfar: gfar_process_frame returns void · 61db26c6
      Claudiu Manoil 提交于
      No return code is expected from gfar_process_frame(), hence
      change it to return void.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      61db26c6
    • C
      gianfar: GRO_DROP is unlikely · bd9e89f2
      Claudiu Manoil 提交于
      The change is significant since it affects the rx hot path.
      Paul observed and documented the effects at asm level, see
      below:
      
      "It turns out that it does make a difference, since gfar_process_frame
      gets inlined, and so the increment code gets moved out of line (I have
      marked the if statment with * and the increment code within "-----"):
      
        ------------------------- as is currently ------------------
           4d14:       80 61 00 18     lwz     r3,24(r1)
           4d18:       7f c4 f3 78     mr      r4,r30
           4d1c:       48 00 00 01     bl      4d1c <gfar_clean_rx_ring+0x10c>
        *  4d20:       2f 83 00 04     cmpwi   cr7,r3,4
           4d24:       40 9e 00 1c     bne-    cr7,4d40
      <gfar_clean_rx_ring+0x130>
              ----------------------------
           4d28:       81 3c 01 f8     lwz     r9,504(r28)
           4d2c:       81 5c 01 fc     lwz     r10,508(r28)
           4d30:       31 4a 00 01     addic   r10,r10,1
           4d34:       7d 29 01 94     addze   r9,r9
           4d38:       91 3c 01 f8     stw     r9,504(r28)
           4d3c:       91 5c 01 fc     stw     r10,508(r28)
              ----------------------------
           4d40:       a0 1f 00 24     lhz     r0,36(r31)
           4d44:       81 3f 00 00     lwz     r9,0(r31)
           4d48:       7f a4 eb 78     mr      r4,r29
           4d4c:       7f e3 fb 78     mr      r3,r31
      
        -------------------------- unlikely ------------------------
           4d14:       80 61 00 18     lwz     r3,24(r1)
           4d18:       7f c4 f3 78     mr      r4,r30
           4d1c:       48 00 00 01     bl      4d1c <gfar_clean_rx_ring+0x10c>
        *  4d20:       2f 83 00 04     cmpwi   cr7,r3,4
           4d24:       41 9e 03 94     beq-    cr7,50b8
      <gfar_clean_rx_ring+0x4a8>
           4d28:       a0 1f 00 24     lhz     r0,36(r31)
           4d2c:       81 3f 00 00     lwz     r9,0(r31)
           4d30:       7f a4 eb 78     mr      r4,r29
           4d34:       7f e3 fb 78     mr      r3,r31
      [...]
           50b8:       81 3c 01 f8     lwz     r9,504(r28)
           50bc:       81 5c 01 fc     lwz     r10,508(r28)
           50c0:       31 4a 00 01     addic   r10,r10,1
           50c4:       7d 29 01 94     addze   r9,r9
           50c8:       91 3c 01 f8     stw     r9,504(r28)
           50cc:       91 5c 01 fc     stw     r10,508(r28)
           50d0:       4b ff fc 58     b       4d28 <gfar_clean_rx_ring+0x118>
      
      So, the increment does actually get moved ~1k away."
      
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bd9e89f2
    • C
      gianfar: Add device ref (dev) in gfar_private · 369ec162
      Claudiu Manoil 提交于
      Use device pointer (dev) to simplify the code and to
      avoid double indirections, especially on the hot path.
      
      Basically, instead of accessing priv to get the ofdev
      reference and then accessing the ofdev structure to
      dereference the needed dev pointer, we will get the
      dev pointer directly from priv.
      
      The dev pointer is required on the hot path, see gfar_new_rxbdp
      or gfar_clean_rx_ring (or xmit), and this patch makes
      it available directly from priv's 1st cacheline.
      
      This change is reflected at asm level too, taking (the hot)
      gfar_new_rxbdp():
      initial version -
          18c0:	7c 7e 1b 78 	mr      r30,r3
      
          18d0:	81 69 04 3c 	lwz     r11,1084(r9)
      
          18d8:	34 6b 00 10 	addic.  r3,r11,16
          18dc:	41 82 00 08 	beq-    18e4
      
      patched version -
          18d0:	80 69 04 38 	lwz     r3,1080(r9)
      
          18d8:	2f 83 00 00 	cmpwi   cr7,r3,0
          18dc:	41 9e 00 08 	beq-    cr7,18e4
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      369ec162
    • C
      gianfar: Remove unused device_node ref in gfar_private · 41a20609
      Claudiu Manoil 提交于
      Remove unused device node pointer.
      Remove duplicated SET_NETDEV_DEV().
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      41a20609
  20. 13 2月, 2013 1 次提交
    • P
      gianfar: convert u64 status counters to atomic64_t · 212079df
      Paul Gortmaker 提交于
      While looking at some asm dump for an unrelated change, Eric
      noticed in the following stats count increment code:
      
          50b8:       81 3c 01 f8     lwz     r9,504(r28)
          50bc:       81 5c 01 fc     lwz     r10,508(r28)
          50c0:       31 4a 00 01     addic   r10,r10,1
          50c4:       7d 29 01 94     addze   r9,r9
          50c8:       91 3c 01 f8     stw     r9,504(r28)
          50cc:       91 5c 01 fc     stw     r10,508(r28)
      
      that a 64 bit counter was used on ppc-32 without sync
      and hence the "ethtool -S" output was racy.
      
      Here we convert all the values to use atomic64_t so that
      the output will always be consistent.
      Reported-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      212079df
  21. 09 2月, 2013 1 次提交
  22. 05 2月, 2013 1 次提交
    • P
      gianfar: dont conditionally alloc Rx/Err irq structs · 7c1e7e99
      Paul Gortmaker 提交于
      Commit ee873fda
      
          "gianfar: Pack struct gfar_priv_grp into three cachelines"
      
      causes the following null dereference at driver init on sbc8548:
      
         libphy: Freescale PowerQUICC MII Bus: probed
         Unable to handle kernel paging request for data at address 0x00000000
         Faulting instruction address: 0xc01d6a38
         Oops: Kernel access of bad area, sig: 11 [#1]
         [...]
         NIP [c01d6a38] gfar_parse_group+0x228/0x280
         LR [c01d6a34] gfar_parse_group+0x224/0x280
         Call Trace:
         [ef82dd60] [c01d6a34] gfar_parse_group+0x224/0x280 (unreliable)
         [ef82dd90] [c01d73a4] gfar_probe+0x284/0xfe0
      
      The reason is that the commit also changed the allocation of the
      Rx and error handling irq structs to be skipped for !MQ_MG_MODE.
      In the !MQ_MG_MODE case, only the Tx irq struct is allocated.
      
      Digging further, we see that MQ_MG_MODE is set only if we find
      the OF compatible string "fsl,etsec2".
      
      A quick grep in the dts directory shows lots of boards that support
      Rx/Tx/Err, but without this specific compat string.  And hence they
      go after the unallocated Rx/Error structs and cause the above oops.
      
      Hence such a change can not be deployed until all the dts files
      are updated and sufficiently deployed.  Further, the optimization
      is of limited value, since the kmalloc'd struct in question has only
      a single unsigned int, and an (IFNAMSIZ + 6) sized string.
      
      Note that no changes to the freeing code are needed here, as it
      already did an unconditional free of Rx/Tx/Error gfar_irqinfo.
      
      Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7c1e7e99