1. 27 Feb, 2014 1 commit
  2. 26 Feb, 2014 31 commits
  3. 25 Feb, 2014 8 commits
    • Joe Perches's avatar
      bnx2x: Remove hidden flow control goto from BNX2X_ALLOC macros · cd2b0389
      Joe Perches authored
      BNX2X_ALLOC macros use "goto alloc_mem_err"
      so these labels appear unused in some functions.
      
      Expand these macros in-place via coccinelle and
      some typing.
      
      Update the macros to use statement expressions
      and remove the BNX2X_ALLOC macro.
      
      This adds some > 80 char lines.
      
      $ cat bnx2x_pci_alloc.cocci
      @@
      expression e1;
      expression e2;
      expression e3;
      @@
      -	BNX2X_PCI_ALLOC(e1, e2, e3);
      +	e1 = BNX2X_PCI_ALLOC(e2, e3); if (!e1) goto alloc_mem_err;
      
      @@
      expression e1;
      expression e2;
      expression e3;
      @@
      -	BNX2X_PCI_FALLOC(e1, e2, e3);
      +	e1 = BNX2X_PCI_FALLOC(e2, e3); if (!e1) goto alloc_mem_err;
      
      @@
      expression e1;
      expression e2;
      @@
      -	BNX2X_ALLOC(e1, e2);
      +	e1 = kzalloc(e2, GFP_KERNEL); if (!e1) goto alloc_mem_err;
      
      @@
      expression e1;
      expression e2;
      expression e3;
      @@
      -	kzalloc(sizeof(e1) * e2, e3)
      +	kcalloc(e2, sizeof(e1), e3)
      
      @@
      expression e1;
      expression e2;
      expression e3;
      @@
      -	kzalloc(e1 * sizeof(e2), e3)
      +	kcalloc(e1, sizeof(e2), e3)
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd2b0389
    • Florian Fainelli's avatar
      net: bcmgenet: remove unused bh_lock member · 51adfcc3
      Florian Fainelli authored
      bh_lock spinlock is unused, remove it from the private driver structure.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      51adfcc3
    • Florian Fainelli's avatar
      net: bcmgenet: remove commented code in bcmgenet_xmit() · da56bbf7
      Florian Fainelli authored
      This code is commented since it is unused, left-over from the very first
      time this driver was merged.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      da56bbf7
    • Florian Fainelli's avatar
      net: bcmgenet: drop checks on priv->phydev · 80d8e96d
      Florian Fainelli authored
      Drop all the checks on priv->phydev since we will refuse probing the
      driver if we cannot attach to a PHY device. Drop all checks on
      priv->phydev. This also fixes some smatch issues reported by Dan
      Carpenter.
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      80d8e96d
    • David S. Miller's avatar
      Merge branch 'gianfar' · 432c5b3a
      David S. Miller authored
      Claudiu Manoil says:
      
      ====================
      gianfar: Device reset and reconfig fixes
      
      These patches end up fixing some notable device reset & reconfig
      related problems.  One issue is on-the-fly (Rx/Tx on) programming
      of interrupt coalescing (IC) registers on the processing path,
      against HW recommendation.  This is an old issue that became visible
      after BQL introduction, as under certain conditions (low traffic)
      one TX interrupt gets lost and BQL fires Tx timeout as a result.
      Another notable issue is a race on the Tx path (xmit, clean_tx)
      during device reset (i.e. during Tx timeout watchdog firing)
      that leads to NULL access.
      Fixing the problematic on-thy-fly register writes (i.e. the IC regs)
      required the implementation of a MAC soft reset procedure.
      The race leading to NULL access was addressed by fixing the
      stop_gfar()/startup_gfar() pair (disable/enable napi a.s.o.)
      and adding the device state DOWN to sync with the TX path.
      
      v2: Refactored if() clauses from gfar_set_features(), PATCH 2.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      432c5b3a
    • Claudiu Manoil's avatar
      gianfar: Fix Tx int miss, dont write IC on-the-fly · f19015ba
      Claudiu Manoil authored
      Programming the interrupt coalescing (IC) registers while
      the controller/DMA is on may incur the loss of one Tx
      confirmation interrupt, under certain conditions.  This is
      a subtle hw race because it does not occur during a burst
      of Tx packets.  It has been observed on p2020 devices that,
      if just one packet is being xmit'ed, the Tx confirmation
      doesn't trigger and BQL evetually blocks the Tx queues,
      followed by Tx timeout and an un-responsive device.
      This issue was not apparent prior to introducing BQL
      support, as a late Tx confirmation was not an issue back then
      and the next burst of Tx frames would have triggered the
      Tx confirmation/ Tx ring cleanup anyway.
      
      Bottom line, the hw specifications state that the IC registers
      should not be programmed while the Rx/Tx blocks (the DMA) are
      enabled. Further more, these registers are currently re-written
      with the same values on the processing path, over and over again.
      To fix this, rewriting the IC registers has been removed from
      the processing path (napi poll).  A complete MAC reset procedure
      has been implemented for the ethtool -c option instead, to
      reliably update these registers while the controller is stopped.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f19015ba
    • Claudiu Manoil's avatar
      gianfar: Fix device reset races (oops) for Tx · 0851133b
      Claudiu Manoil authored
      The device reset procedure, stop_gfar()/startup_gfar(), has
      concurrency issues.
      "Kernel access of bad area" oopses show up during Tx timeout
      device reset or other reset cases (like changing MTU) that
      happen while the interface still has traffic. The oopses
      happen in start_xmit and clean_tx_ring when accessing tx_queue->
      tx_skbuff which is NULL. The race comes from de-allocating the
      tx_skbuff while transmission and napi processing are still
      active. Though the Tx queues get temoprarily stopped when Tx
      timeout occurs, they get re-enabled as a result of Tx congestion
      handling inside the napi context (see clean_tx_ring()). Not
      disabling the napi during reset is also a bug, because
      clean_tx_ring() will try to access tx_skbuff while it is being
      de-alloc'ed and re-alloc'ed.
      
      To fix this, stop_gfar() needs to disable napi processing
      after stopping the Tx queues. However, in order to prevent
      clean_tx_ring() to re-enable the Tx queue before the napi
      gets disabled, the device state DOWN has been introduced.
      It prevents the Tx congestion management from re-enabling the
      de-congested Tx queue while the device is brought down.
      An additional locking state, RESETTING, has been introduced
      to prevent simultaneous resets or to prevent configuring the
      device while it is resetting.
      The bogus 'rxlock's (for each Rx queue) have been removed since
      their purpose is not justified, as they don't prevent nor are
      suited to prevent device reset/reconfig races (such as this one).
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0851133b
    • Claudiu Manoil's avatar
      gianfar: Don't free/request irqs on device reset · 80ec396c
      Claudiu Manoil authored
      Resetting the device (stop_gfar()/startup_gfar()) should
      be fast and to the point, in order to timely recover
      from an error condition (like Tx timeout) or during
      device reconfig.  The irq free/ request routines are just
      redundant here, and they should be part of the device
      close/ open routines instead.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      80ec396c