Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (43 commits)
  net: Fix 'Re: PACKET_TX_RING: packet size is too long'
  netdev: usb: dm9601.c can drive a device not supported yet, add support for it
  qlge: Fix firmware mailbox command timeout.
  qlge: Fix EEH handling.
  AF_RAW: Augment raw_send_hdrinc to expand skb to fit iphdr->ihl (v2)
  bonding: fix a race condition in calls to slave MII ioctls
  virtio-net: fix data corruption with OOM
  sfc: Set ip_summed correctly for page buffers passed to GRO
  cnic: Fix L2CTX_STATUSB_NUM offset in context memory.
  MAINTAINERS: rt2x00 list is moderated
  airo: Reorder tests, check bounds before element
  mac80211: fix for incorrect sequence number on hostapd injected frames
  libertas spi: fix sparse errors
  mac80211: trivial: fix spelling in mesh_hwmp
  cfg80211: sme: deauthenticate on assoc failure
  mac80211: keep auth state when assoc fails
  mac80211: fix ibss joining
  b43: add 'struct b43_wl' missing declaration
  b43: Fix Bugzilla #14181 and the bug from the previous 'fix'
  rt2x00: Fix crypto in TX frame for rt2800usb
  ...
This commit is contained in:
Linus Torvalds 2009-10-29 09:22:08 -07:00
commit 49b2de8e6f
45 changed files with 807 additions and 403 deletions

View File

@ -83,19 +83,19 @@ static __inline__ isdn_net_local * isdn_net_get_locked_lp(isdn_net_dev *nd)
spin_lock_irqsave(&nd->queue_lock, flags); spin_lock_irqsave(&nd->queue_lock, flags);
lp = nd->queue; /* get lp on top of queue */ lp = nd->queue; /* get lp on top of queue */
spin_lock(&nd->queue->xmit_lock);
while (isdn_net_lp_busy(nd->queue)) { while (isdn_net_lp_busy(nd->queue)) {
spin_unlock(&nd->queue->xmit_lock);
nd->queue = nd->queue->next; nd->queue = nd->queue->next;
if (nd->queue == lp) { /* not found -- should never happen */ if (nd->queue == lp) { /* not found -- should never happen */
lp = NULL; lp = NULL;
goto errout; goto errout;
} }
spin_lock(&nd->queue->xmit_lock);
} }
lp = nd->queue; lp = nd->queue;
nd->queue = nd->queue->next; nd->queue = nd->queue->next;
spin_unlock_irqrestore(&nd->queue_lock, flags);
spin_lock(&lp->xmit_lock);
local_bh_disable(); local_bh_disable();
return lp;
errout: errout:
spin_unlock_irqrestore(&nd->queue_lock, flags); spin_unlock_irqrestore(&nd->queue_lock, flags);
return lp; return lp;

View File

@ -34,6 +34,7 @@
* *
* *
*/ */
#include <linux/capability.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>

View File

@ -361,9 +361,12 @@ struct l2_fhdr {
#define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE (1<<28) #define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE (1<<28)
#define BNX2_L2CTX_HOST_BDIDX 0x00000004 #define BNX2_L2CTX_HOST_BDIDX 0x00000004
#define BNX2_L2CTX_STATUSB_NUM_SHIFT 16 #define BNX2_L2CTX_L5_STATUSB_NUM_SHIFT 16
#define BNX2_L2CTX_STATUSB_NUM(sb_id) \ #define BNX2_L2CTX_L2_STATUSB_NUM_SHIFT 24
(((sb_id) > 0) ? (((sb_id) + 7) << BNX2_L2CTX_STATUSB_NUM_SHIFT) : 0) #define BNX2_L2CTX_L5_STATUSB_NUM(sb_id) \
(((sb_id) > 0) ? (((sb_id) + 7) << BNX2_L2CTX_L5_STATUSB_NUM_SHIFT) : 0)
#define BNX2_L2CTX_L2_STATUSB_NUM(sb_id) \
(((sb_id) > 0) ? (((sb_id) + 7) << BNX2_L2CTX_L2_STATUSB_NUM_SHIFT) : 0)
#define BNX2_L2CTX_HOST_BSEQ 0x00000008 #define BNX2_L2CTX_HOST_BSEQ 0x00000008
#define BNX2_L2CTX_NX_BSEQ 0x0000000c #define BNX2_L2CTX_NX_BSEQ 0x0000000c
#define BNX2_L2CTX_NX_BDHADDR_HI 0x00000010 #define BNX2_L2CTX_NX_BDHADDR_HI 0x00000010

View File

@ -691,7 +691,7 @@ static int bond_check_dev_link(struct bonding *bond,
struct net_device *slave_dev, int reporting) struct net_device *slave_dev, int reporting)
{ {
const struct net_device_ops *slave_ops = slave_dev->netdev_ops; const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
static int (*ioctl)(struct net_device *, struct ifreq *, int); int (*ioctl)(struct net_device *, struct ifreq *, int);
struct ifreq ifr; struct ifreq ifr;
struct mii_ioctl_data *mii; struct mii_ioctl_data *mii;
@ -3665,10 +3665,10 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb,
if (skb->protocol == htons(ETH_P_IP)) { if (skb->protocol == htons(ETH_P_IP)) {
return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
(data->h_dest[5] ^ bond_dev->dev_addr[5])) % count; (data->h_dest[5] ^ data->h_source[5])) % count;
} }
return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; return (data->h_dest[5] ^ data->h_source[5]) % count;
} }
/* /*
@ -3695,7 +3695,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb,
} }
return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; return (data->h_dest[5] ^ data->h_source[5]) % count;
} }
/* /*
@ -3706,7 +3706,7 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb,
{ {
struct ethhdr *data = (struct ethhdr *)skb->data; struct ethhdr *data = (struct ethhdr *)skb->data;
return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count; return (data->h_dest[5] ^ data->h_source[5]) % count;
} }
/*-------------------------- Device entry points ----------------------------*/ /*-------------------------- Device entry points ----------------------------*/

View File

@ -2264,9 +2264,9 @@ static void cnic_init_bnx2_rx_ring(struct cnic_dev *dev)
cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_CTX_TYPE, val); cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_CTX_TYPE, val);
if (sb_id == 0) if (sb_id == 0)
val = 2 << BNX2_L2CTX_STATUSB_NUM_SHIFT; val = 2 << BNX2_L2CTX_L2_STATUSB_NUM_SHIFT;
else else
val = BNX2_L2CTX_STATUSB_NUM(sb_id); val = BNX2_L2CTX_L2_STATUSB_NUM(sb_id);
cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val); cnic_ctx_wr(dev, cid_addr, BNX2_L2CTX_HOST_BDIDX, val);
rxbd = (struct rx_bd *) (cp->l2_ring + BCM_PAGE_SIZE); rxbd = (struct rx_bd *) (cp->l2_ring + BCM_PAGE_SIZE);
@ -2423,7 +2423,7 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
cp->int_num = 0; cp->int_num = 0;
if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) {
u32 sb_id = cp->status_blk_num; u32 sb_id = cp->status_blk_num;
u32 sb = BNX2_L2CTX_STATUSB_NUM(sb_id); u32 sb = BNX2_L2CTX_L5_STATUSB_NUM(sb_id);
cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT; cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT;
cnic_ctx_wr(dev, cp->kwq_cid_addr, L5_KRNLQ_HOST_QIDX, sb); cnic_ctx_wr(dev, cp->kwq_cid_addr, L5_KRNLQ_HOST_QIDX, sb);

View File

@ -50,7 +50,7 @@
#define DM9000_RCSR 0x32 #define DM9000_RCSR 0x32
#define CHIPR_DM9000A 0x19 #define CHIPR_DM9000A 0x19
#define CHIPR_DM9000B 0x1B #define CHIPR_DM9000B 0x1A
#define DM9000_MRCMDX 0xF0 #define DM9000_MRCMDX 0xF0
#define DM9000_MRCMD 0xF2 #define DM9000_MRCMD 0xF2

View File

@ -519,9 +519,13 @@ extern s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw);
extern s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw); extern s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw);
extern s32 e1000e_get_phy_info_igp(struct e1000_hw *hw); extern s32 e1000e_get_phy_info_igp(struct e1000_hw *hw);
extern s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data); extern s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
extern s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset,
u16 *data);
extern s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw); extern s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw);
extern s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active); extern s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active);
extern s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data); extern s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data);
extern s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset,
u16 data);
extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw); extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw);
extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw); extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw);
extern s32 e1000e_get_cfg_done(struct e1000_hw *hw); extern s32 e1000e_get_cfg_done(struct e1000_hw *hw);
@ -538,7 +542,11 @@ extern s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data);
extern s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data); extern s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data);
extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl); extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
extern s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset,
u16 data);
extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
extern s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset,
u16 *data);
extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
u32 usec_interval, bool *success); u32 usec_interval, bool *success);
extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw); extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw);
@ -546,7 +554,11 @@ extern s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data);
extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data);
extern s32 e1000e_check_downshift(struct e1000_hw *hw); extern s32 e1000e_check_downshift(struct e1000_hw *hw);
extern s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data); extern s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data);
extern s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset,
u16 *data);
extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data); extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data);
extern s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset,
u16 data);
extern s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow); extern s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow);
extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw);
extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw);

View File

@ -764,11 +764,13 @@ struct e1000_phy_operations {
s32 (*get_cable_length)(struct e1000_hw *); s32 (*get_cable_length)(struct e1000_hw *);
s32 (*get_phy_info)(struct e1000_hw *); s32 (*get_phy_info)(struct e1000_hw *);
s32 (*read_phy_reg)(struct e1000_hw *, u32, u16 *); s32 (*read_phy_reg)(struct e1000_hw *, u32, u16 *);
s32 (*read_phy_reg_locked)(struct e1000_hw *, u32, u16 *);
void (*release_phy)(struct e1000_hw *); void (*release_phy)(struct e1000_hw *);
s32 (*reset_phy)(struct e1000_hw *); s32 (*reset_phy)(struct e1000_hw *);
s32 (*set_d0_lplu_state)(struct e1000_hw *, bool); s32 (*set_d0_lplu_state)(struct e1000_hw *, bool);
s32 (*set_d3_lplu_state)(struct e1000_hw *, bool); s32 (*set_d3_lplu_state)(struct e1000_hw *, bool);
s32 (*write_phy_reg)(struct e1000_hw *, u32, u16); s32 (*write_phy_reg)(struct e1000_hw *, u32, u16);
s32 (*write_phy_reg_locked)(struct e1000_hw *, u32, u16);
s32 (*cfg_on_link_up)(struct e1000_hw *); s32 (*cfg_on_link_up)(struct e1000_hw *);
}; };

View File

@ -122,6 +122,13 @@
#define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */ #define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */
#define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */
/* OEM Bits Phy Register */
#define HV_OEM_BITS PHY_REG(768, 25)
#define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */
#define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */
/* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
/* Offset 04h HSFSTS */ /* Offset 04h HSFSTS */
union ich8_hws_flash_status { union ich8_hws_flash_status {
@ -200,6 +207,7 @@ static s32 e1000_setup_led_pchlan(struct e1000_hw *hw);
static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw); static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw);
static s32 e1000_led_on_pchlan(struct e1000_hw *hw); static s32 e1000_led_on_pchlan(struct e1000_hw *hw);
static s32 e1000_led_off_pchlan(struct e1000_hw *hw); static s32 e1000_led_off_pchlan(struct e1000_hw *hw);
static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active);
static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
{ {
@ -242,7 +250,11 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan;
phy->ops.read_phy_reg = e1000_read_phy_reg_hv; phy->ops.read_phy_reg = e1000_read_phy_reg_hv;
phy->ops.read_phy_reg_locked = e1000_read_phy_reg_hv_locked;
phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan;
phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan;
phy->ops.write_phy_reg = e1000_write_phy_reg_hv; phy->ops.write_phy_reg = e1000_write_phy_reg_hv;
phy->ops.write_phy_reg_locked = e1000_write_phy_reg_hv_locked;
phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
phy->id = e1000_phy_unknown; phy->id = e1000_phy_unknown;
@ -303,6 +315,8 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
case IGP03E1000_E_PHY_ID: case IGP03E1000_E_PHY_ID:
phy->type = e1000_phy_igp_3; phy->type = e1000_phy_igp_3;
phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
phy->ops.read_phy_reg_locked = e1000e_read_phy_reg_igp_locked;
phy->ops.write_phy_reg_locked = e1000e_write_phy_reg_igp_locked;
break; break;
case IFE_E_PHY_ID: case IFE_E_PHY_ID:
case IFE_PLUS_E_PHY_ID: case IFE_PLUS_E_PHY_ID:
@ -567,13 +581,40 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
static DEFINE_MUTEX(nvm_mutex); static DEFINE_MUTEX(nvm_mutex);
/**
* e1000_acquire_nvm_ich8lan - Acquire NVM mutex
* @hw: pointer to the HW structure
*
* Acquires the mutex for performing NVM operations.
**/
static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw)
{
mutex_lock(&nvm_mutex);
return 0;
}
/**
* e1000_release_nvm_ich8lan - Release NVM mutex
* @hw: pointer to the HW structure
*
* Releases the mutex used while performing NVM operations.
**/
static void e1000_release_nvm_ich8lan(struct e1000_hw *hw)
{
mutex_unlock(&nvm_mutex);
return;
}
static DEFINE_MUTEX(swflag_mutex);
/** /**
* e1000_acquire_swflag_ich8lan - Acquire software control flag * e1000_acquire_swflag_ich8lan - Acquire software control flag
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* *
* Acquires the software control flag for performing NVM and PHY * Acquires the software control flag for performing PHY and select
* operations. This is a function pointer entry point only called by * MAC CSR accesses.
* read/write routines for the PHY and NVM parts.
**/ **/
static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
{ {
@ -582,7 +623,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
might_sleep(); might_sleep();
mutex_lock(&nvm_mutex); mutex_lock(&swflag_mutex);
while (timeout) { while (timeout) {
extcnf_ctrl = er32(EXTCNF_CTRL); extcnf_ctrl = er32(EXTCNF_CTRL);
@ -599,7 +640,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
goto out; goto out;
} }
timeout = PHY_CFG_TIMEOUT * 2; timeout = SW_FLAG_TIMEOUT;
extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl); ew32(EXTCNF_CTRL, extcnf_ctrl);
@ -623,7 +664,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
out: out:
if (ret_val) if (ret_val)
mutex_unlock(&nvm_mutex); mutex_unlock(&swflag_mutex);
return ret_val; return ret_val;
} }
@ -632,9 +673,8 @@ out:
* e1000_release_swflag_ich8lan - Release software control flag * e1000_release_swflag_ich8lan - Release software control flag
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* *
* Releases the software control flag for performing NVM and PHY operations. * Releases the software control flag for performing PHY and select
* This is a function pointer entry point only called by read/write * MAC CSR accesses.
* routines for the PHY and NVM parts.
**/ **/
static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
{ {
@ -644,7 +684,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl); ew32(EXTCNF_CTRL, extcnf_ctrl);
mutex_unlock(&nvm_mutex); mutex_unlock(&swflag_mutex);
return;
} }
/** /**
@ -844,7 +886,7 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
u32 i; u32 i;
u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; u32 data, cnf_size, cnf_base_addr, sw_cfg_mask;
s32 ret_val; s32 ret_val;
u16 word_addr, reg_data, reg_addr, phy_page = 0; u16 reg, word_addr, reg_data, reg_addr, phy_page = 0;
ret_val = e1000e_phy_hw_reset_generic(hw); ret_val = e1000e_phy_hw_reset_generic(hw);
if (ret_val) if (ret_val)
@ -859,6 +901,10 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
return ret_val; return ret_val;
} }
/* Dummy read to clear the phy wakeup bit after lcd reset */
if (hw->mac.type == e1000_pchlan)
e1e_rphy(hw, BM_WUC, &reg);
/* /*
* Initialize the PHY from the NVM on ICH platforms. This * Initialize the PHY from the NVM on ICH platforms. This
* is needed due to an issue where the NVM configuration is * is needed due to an issue where the NVM configuration is
@ -1053,6 +1099,38 @@ static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw)
return ret_val; return ret_val;
} }
/**
* e1000_set_lplu_state_pchlan - Set Low Power Link Up state
* @hw: pointer to the HW structure
* @active: true to enable LPLU, false to disable
*
* Sets the LPLU state according to the active flag. For PCH, if OEM write
* bit are disabled in the NVM, writing the LPLU bits in the MAC will not set
* the phy speed. This function will manually set the LPLU bit and restart
* auto-neg as hw would do. D3 and D0 LPLU will call the same function
* since it configures the same bit.
**/
static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active)
{
s32 ret_val = 0;
u16 oem_reg;
ret_val = e1e_rphy(hw, HV_OEM_BITS, &oem_reg);
if (ret_val)
goto out;
if (active)
oem_reg |= HV_OEM_BITS_LPLU;
else
oem_reg &= ~HV_OEM_BITS_LPLU;
oem_reg |= HV_OEM_BITS_RESTART_AN;
ret_val = e1e_wphy(hw, HV_OEM_BITS, oem_reg);
out:
return ret_val;
}
/** /**
* e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
@ -1314,12 +1392,11 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
(words == 0)) { (words == 0)) {
hw_dbg(hw, "nvm parameter(s) out of bounds\n"); hw_dbg(hw, "nvm parameter(s) out of bounds\n");
return -E1000_ERR_NVM; ret_val = -E1000_ERR_NVM;
goto out;
} }
ret_val = e1000_acquire_swflag_ich8lan(hw); nvm->ops.acquire_nvm(hw);
if (ret_val)
goto out;
ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
if (ret_val) { if (ret_val) {
@ -1345,7 +1422,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
} }
} }
e1000_release_swflag_ich8lan(hw); nvm->ops.release_nvm(hw);
out: out:
if (ret_val) if (ret_val)
@ -1603,11 +1680,15 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
return -E1000_ERR_NVM; return -E1000_ERR_NVM;
} }
nvm->ops.acquire_nvm(hw);
for (i = 0; i < words; i++) { for (i = 0; i < words; i++) {
dev_spec->shadow_ram[offset+i].modified = 1; dev_spec->shadow_ram[offset+i].modified = 1;
dev_spec->shadow_ram[offset+i].value = data[i]; dev_spec->shadow_ram[offset+i].value = data[i];
} }
nvm->ops.release_nvm(hw);
return 0; return 0;
} }
@ -1637,9 +1718,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
if (nvm->type != e1000_nvm_flash_sw) if (nvm->type != e1000_nvm_flash_sw)
goto out; goto out;
ret_val = e1000_acquire_swflag_ich8lan(hw); nvm->ops.acquire_nvm(hw);
if (ret_val)
goto out;
/* /*
* We're writing to the opposite bank so if we're on bank 1, * We're writing to the opposite bank so if we're on bank 1,
@ -1657,7 +1736,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
old_bank_offset = 0; old_bank_offset = 0;
ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
if (ret_val) { if (ret_val) {
e1000_release_swflag_ich8lan(hw); nvm->ops.release_nvm(hw);
goto out; goto out;
} }
} else { } else {
@ -1665,7 +1744,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
new_bank_offset = 0; new_bank_offset = 0;
ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
if (ret_val) { if (ret_val) {
e1000_release_swflag_ich8lan(hw); nvm->ops.release_nvm(hw);
goto out; goto out;
} }
} }
@ -1723,7 +1802,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
if (ret_val) { if (ret_val) {
/* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
hw_dbg(hw, "Flash commit failed.\n"); hw_dbg(hw, "Flash commit failed.\n");
e1000_release_swflag_ich8lan(hw); nvm->ops.release_nvm(hw);
goto out; goto out;
} }
@ -1736,7 +1815,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD;
ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
if (ret_val) { if (ret_val) {
e1000_release_swflag_ich8lan(hw); nvm->ops.release_nvm(hw);
goto out; goto out;
} }
data &= 0xBFFF; data &= 0xBFFF;
@ -1744,7 +1823,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
act_offset * 2 + 1, act_offset * 2 + 1,
(u8)(data >> 8)); (u8)(data >> 8));
if (ret_val) { if (ret_val) {
e1000_release_swflag_ich8lan(hw); nvm->ops.release_nvm(hw);
goto out; goto out;
} }
@ -1757,7 +1836,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1;
ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
if (ret_val) { if (ret_val) {
e1000_release_swflag_ich8lan(hw); nvm->ops.release_nvm(hw);
goto out; goto out;
} }
@ -1767,7 +1846,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
dev_spec->shadow_ram[i].value = 0xFFFF; dev_spec->shadow_ram[i].value = 0xFFFF;
} }
e1000_release_swflag_ich8lan(hw); nvm->ops.release_nvm(hw);
/* /*
* Reload the EEPROM, or else modifications will not appear * Reload the EEPROM, or else modifications will not appear
@ -1831,14 +1910,12 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
**/ **/
void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
{ {
struct e1000_nvm_info *nvm = &hw->nvm;
union ich8_flash_protected_range pr0; union ich8_flash_protected_range pr0;
union ich8_hws_flash_status hsfsts; union ich8_hws_flash_status hsfsts;
u32 gfpreg; u32 gfpreg;
s32 ret_val;
ret_val = e1000_acquire_swflag_ich8lan(hw); nvm->ops.acquire_nvm(hw);
if (ret_val)
return;
gfpreg = er32flash(ICH_FLASH_GFPREG); gfpreg = er32flash(ICH_FLASH_GFPREG);
@ -1859,7 +1936,7 @@ void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
hsfsts.hsf_status.flockdn = true; hsfsts.hsf_status.flockdn = true;
ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval); ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval);
e1000_release_swflag_ich8lan(hw); nvm->ops.release_nvm(hw);
} }
/** /**
@ -2229,6 +2306,7 @@ static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw)
**/ **/
static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
{ {
u16 reg;
u32 ctrl, icr, kab; u32 ctrl, icr, kab;
s32 ret_val; s32 ret_val;
@ -2304,6 +2382,9 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
hw_dbg(hw, "Auto Read Done did not complete\n"); hw_dbg(hw, "Auto Read Done did not complete\n");
} }
} }
/* Dummy read to clear the phy wakeup bit after lcd reset */
if (hw->mac.type == e1000_pchlan)
e1e_rphy(hw, BM_WUC, &reg);
/* /*
* For PCH, this write will make sure that any noise * For PCH, this write will make sure that any noise
@ -2843,9 +2924,8 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
E1000_PHY_CTRL_GBE_DISABLE; E1000_PHY_CTRL_GBE_DISABLE;
ew32(PHY_CTRL, phy_ctrl); ew32(PHY_CTRL, phy_ctrl);
/* Workaround SWFLAG unexpectedly set during S0->Sx */
if (hw->mac.type == e1000_pchlan) if (hw->mac.type == e1000_pchlan)
udelay(500); e1000_phy_hw_reset_ich8lan(hw);
default: default:
break; break;
} }
@ -3113,9 +3193,9 @@ static struct e1000_phy_operations ich8_phy_ops = {
}; };
static struct e1000_nvm_operations ich8_nvm_ops = { static struct e1000_nvm_operations ich8_nvm_ops = {
.acquire_nvm = e1000_acquire_swflag_ich8lan, .acquire_nvm = e1000_acquire_nvm_ich8lan,
.read_nvm = e1000_read_nvm_ich8lan, .read_nvm = e1000_read_nvm_ich8lan,
.release_nvm = e1000_release_swflag_ich8lan, .release_nvm = e1000_release_nvm_ich8lan,
.update_nvm = e1000_update_nvm_checksum_ich8lan, .update_nvm = e1000_update_nvm_checksum_ich8lan,
.valid_led_default = e1000_valid_led_default_ich8lan, .valid_led_default = e1000_valid_led_default_ich8lan,
.validate_nvm = e1000_validate_nvm_checksum_ich8lan, .validate_nvm = e1000_validate_nvm_checksum_ich8lan,

View File

@ -164,16 +164,25 @@ s32 e1000e_get_phy_id(struct e1000_hw *hw)
* MDIC mode. No harm in trying again in this case since * MDIC mode. No harm in trying again in this case since
* the PHY ID is unknown at this point anyway * the PHY ID is unknown at this point anyway
*/ */
ret_val = phy->ops.acquire_phy(hw);
if (ret_val)
goto out;
ret_val = e1000_set_mdio_slow_mode_hv(hw, true); ret_val = e1000_set_mdio_slow_mode_hv(hw, true);
if (ret_val) if (ret_val)
goto out; goto out;
phy->ops.release_phy(hw);
retry_count++; retry_count++;
} }
out: out:
/* Revert to MDIO fast mode, if applicable */ /* Revert to MDIO fast mode, if applicable */
if (retry_count) if (retry_count) {
ret_val = phy->ops.acquire_phy(hw);
if (ret_val)
return ret_val;
ret_val = e1000_set_mdio_slow_mode_hv(hw, false); ret_val = e1000_set_mdio_slow_mode_hv(hw, false);
phy->ops.release_phy(hw);
}
return ret_val; return ret_val;
} }
@ -354,38 +363,117 @@ s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data)
} }
/** /**
* e1000e_read_phy_reg_igp - Read igp PHY register * __e1000e_read_phy_reg_igp - Read igp PHY register
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* @offset: register offset to be read * @offset: register offset to be read
* @data: pointer to the read data * @data: pointer to the read data
* @locked: semaphore has already been acquired or not
* *
* Acquires semaphore, if necessary, then reads the PHY register at offset * Acquires semaphore, if necessary, then reads the PHY register at offset
* and storing the retrieved information in data. Release any acquired * and stores the retrieved information in data. Release any acquired
* semaphores before exiting. * semaphores before exiting.
**/ **/
s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data,
bool locked)
{ {
s32 ret_val; s32 ret_val = 0;
ret_val = hw->phy.ops.acquire_phy(hw); if (!locked) {
if (ret_val) if (!(hw->phy.ops.acquire_phy))
return ret_val; goto out;
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
goto out;
}
if (offset > MAX_PHY_MULTI_PAGE_REG) { if (offset > MAX_PHY_MULTI_PAGE_REG) {
ret_val = e1000e_write_phy_reg_mdic(hw, ret_val = e1000e_write_phy_reg_mdic(hw,
IGP01E1000_PHY_PAGE_SELECT, IGP01E1000_PHY_PAGE_SELECT,
(u16)offset); (u16)offset);
if (ret_val) { if (ret_val)
hw->phy.ops.release_phy(hw); goto release;
return ret_val;
}
} }
ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data); data);
hw->phy.ops.release_phy(hw); release:
if (!locked)
hw->phy.ops.release_phy(hw);
out:
return ret_val;
}
/**
* e1000e_read_phy_reg_igp - Read igp PHY register
* @hw: pointer to the HW structure
* @offset: register offset to be read
* @data: pointer to the read data
*
* Acquires semaphore then reads the PHY register at offset and stores the
* retrieved information in data.
* Release the acquired semaphore before exiting.
**/
s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
{
return __e1000e_read_phy_reg_igp(hw, offset, data, false);
}
/**
* e1000e_read_phy_reg_igp_locked - Read igp PHY register
* @hw: pointer to the HW structure
* @offset: register offset to be read
* @data: pointer to the read data
*
* Reads the PHY register at offset and stores the retrieved information
* in data. Assumes semaphore already acquired.
**/
s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data)
{
return __e1000e_read_phy_reg_igp(hw, offset, data, true);
}
/**
* e1000e_write_phy_reg_igp - Write igp PHY register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
* @locked: semaphore has already been acquired or not
*
* Acquires semaphore, if necessary, then writes the data to PHY register
* at the offset. Release any acquired semaphores before exiting.
**/
static s32 __e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data,
bool locked)
{
s32 ret_val = 0;
if (!locked) {
if (!(hw->phy.ops.acquire_phy))
goto out;
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
goto out;
}
if (offset > MAX_PHY_MULTI_PAGE_REG) {
ret_val = e1000e_write_phy_reg_mdic(hw,
IGP01E1000_PHY_PAGE_SELECT,
(u16)offset);
if (ret_val)
goto release;
}
ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data);
release:
if (!locked)
hw->phy.ops.release_phy(hw);
out:
return ret_val; return ret_val;
} }
@ -395,53 +483,53 @@ s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
* @offset: register offset to write to * @offset: register offset to write to
* @data: data to write at register offset * @data: data to write at register offset
* *
* Acquires semaphore, if necessary, then writes the data to PHY register * Acquires semaphore then writes the data to PHY register
* at the offset. Release any acquired semaphores before exiting. * at the offset. Release any acquired semaphores before exiting.
**/ **/
s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
{ {
s32 ret_val; return __e1000e_write_phy_reg_igp(hw, offset, data, false);
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
if (offset > MAX_PHY_MULTI_PAGE_REG) {
ret_val = e1000e_write_phy_reg_mdic(hw,
IGP01E1000_PHY_PAGE_SELECT,
(u16)offset);
if (ret_val) {
hw->phy.ops.release_phy(hw);
return ret_val;
}
}
ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data);
hw->phy.ops.release_phy(hw);
return ret_val;
} }
/** /**
* e1000e_read_kmrn_reg - Read kumeran register * e1000e_write_phy_reg_igp_locked - Write igp PHY register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
*
* Writes the data to PHY register at the offset.
* Assumes semaphore already acquired.
**/
s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data)
{
return __e1000e_write_phy_reg_igp(hw, offset, data, true);
}
/**
* __e1000_read_kmrn_reg - Read kumeran register
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* @offset: register offset to be read * @offset: register offset to be read
* @data: pointer to the read data * @data: pointer to the read data
* @locked: semaphore has already been acquired or not
* *
* Acquires semaphore, if necessary. Then reads the PHY register at offset * Acquires semaphore, if necessary. Then reads the PHY register at offset
* using the kumeran interface. The information retrieved is stored in data. * using the kumeran interface. The information retrieved is stored in data.
* Release any acquired semaphores before exiting. * Release any acquired semaphores before exiting.
**/ **/
s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data,
bool locked)
{ {
u32 kmrnctrlsta; u32 kmrnctrlsta;
s32 ret_val; s32 ret_val = 0;
ret_val = hw->phy.ops.acquire_phy(hw); if (!locked) {
if (ret_val) if (!(hw->phy.ops.acquire_phy))
return ret_val; goto out;
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
goto out;
}
kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
@ -452,40 +540,110 @@ s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
kmrnctrlsta = er32(KMRNCTRLSTA); kmrnctrlsta = er32(KMRNCTRLSTA);
*data = (u16)kmrnctrlsta; *data = (u16)kmrnctrlsta;
hw->phy.ops.release_phy(hw); if (!locked)
hw->phy.ops.release_phy(hw);
out:
return ret_val; return ret_val;
} }
/** /**
* e1000e_write_kmrn_reg - Write kumeran register * e1000e_read_kmrn_reg - Read kumeran register
* @hw: pointer to the HW structure
* @offset: register offset to be read
* @data: pointer to the read data
*
* Acquires semaphore then reads the PHY register at offset using the
* kumeran interface. The information retrieved is stored in data.
* Release the acquired semaphore before exiting.
**/
s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
{
return __e1000_read_kmrn_reg(hw, offset, data, false);
}
/**
* e1000_read_kmrn_reg_locked - Read kumeran register
* @hw: pointer to the HW structure
* @offset: register offset to be read
* @data: pointer to the read data
*
* Reads the PHY register at offset using the kumeran interface. The
* information retrieved is stored in data.
* Assumes semaphore already acquired.
**/
s32 e1000_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data)
{
return __e1000_read_kmrn_reg(hw, offset, data, true);
}
/**
* __e1000_write_kmrn_reg - Write kumeran register
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* @offset: register offset to write to * @offset: register offset to write to
* @data: data to write at register offset * @data: data to write at register offset
* @locked: semaphore has already been acquired or not
* *
* Acquires semaphore, if necessary. Then write the data to PHY register * Acquires semaphore, if necessary. Then write the data to PHY register
* at the offset using the kumeran interface. Release any acquired semaphores * at the offset using the kumeran interface. Release any acquired semaphores
* before exiting. * before exiting.
**/ **/
s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data,
bool locked)
{ {
u32 kmrnctrlsta; u32 kmrnctrlsta;
s32 ret_val; s32 ret_val = 0;
ret_val = hw->phy.ops.acquire_phy(hw); if (!locked) {
if (ret_val) if (!(hw->phy.ops.acquire_phy))
return ret_val; goto out;
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
goto out;
}
kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
E1000_KMRNCTRLSTA_OFFSET) | data; E1000_KMRNCTRLSTA_OFFSET) | data;
ew32(KMRNCTRLSTA, kmrnctrlsta); ew32(KMRNCTRLSTA, kmrnctrlsta);
udelay(2); udelay(2);
hw->phy.ops.release_phy(hw);
if (!locked)
hw->phy.ops.release_phy(hw);
out:
return ret_val; return ret_val;
} }
/**
* e1000e_write_kmrn_reg - Write kumeran register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
*
* Acquires semaphore then writes the data to the PHY register at the offset
* using the kumeran interface. Release the acquired semaphore before exiting.
**/
s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
{
return __e1000_write_kmrn_reg(hw, offset, data, false);
}
/**
* e1000_write_kmrn_reg_locked - Write kumeran register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
*
* Write the data to PHY register at the offset using the kumeran interface.
* Assumes semaphore already acquired.
**/
s32 e1000_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data)
{
return __e1000_write_kmrn_reg(hw, offset, data, true);
}
/** /**
* e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link * e1000_copper_link_setup_82577 - Setup 82577 PHY for copper link
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
@ -2105,6 +2263,10 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
u32 page = offset >> IGP_PAGE_SHIFT; u32 page = offset >> IGP_PAGE_SHIFT;
u32 page_shift = 0; u32 page_shift = 0;
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
/* Page 800 works differently than the rest so it has its own func */ /* Page 800 works differently than the rest so it has its own func */
if (page == BM_WUC_PAGE) { if (page == BM_WUC_PAGE) {
ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data,
@ -2112,10 +2274,6 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
goto out; goto out;
} }
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
goto out;
hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
if (offset > MAX_PHY_MULTI_PAGE_REG) { if (offset > MAX_PHY_MULTI_PAGE_REG) {
@ -2135,18 +2293,15 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
/* Page is shifted left, PHY expects (page x 32) */ /* Page is shifted left, PHY expects (page x 32) */
ret_val = e1000e_write_phy_reg_mdic(hw, page_select, ret_val = e1000e_write_phy_reg_mdic(hw, page_select,
(page << page_shift)); (page << page_shift));
if (ret_val) { if (ret_val)
hw->phy.ops.release_phy(hw);
goto out; goto out;
}
} }
ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data); data);
hw->phy.ops.release_phy(hw);
out: out:
hw->phy.ops.release_phy(hw);
return ret_val; return ret_val;
} }
@ -2167,6 +2322,10 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
u32 page = offset >> IGP_PAGE_SHIFT; u32 page = offset >> IGP_PAGE_SHIFT;
u32 page_shift = 0; u32 page_shift = 0;
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
/* Page 800 works differently than the rest so it has its own func */ /* Page 800 works differently than the rest so it has its own func */
if (page == BM_WUC_PAGE) { if (page == BM_WUC_PAGE) {
ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data,
@ -2174,10 +2333,6 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
goto out; goto out;
} }
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
goto out;
hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
if (offset > MAX_PHY_MULTI_PAGE_REG) { if (offset > MAX_PHY_MULTI_PAGE_REG) {
@ -2197,17 +2352,14 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
/* Page is shifted left, PHY expects (page x 32) */ /* Page is shifted left, PHY expects (page x 32) */
ret_val = e1000e_write_phy_reg_mdic(hw, page_select, ret_val = e1000e_write_phy_reg_mdic(hw, page_select,
(page << page_shift)); (page << page_shift));
if (ret_val) { if (ret_val)
hw->phy.ops.release_phy(hw);
goto out; goto out;
}
} }
ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data); data);
hw->phy.ops.release_phy(hw);
out: out:
hw->phy.ops.release_phy(hw);
return ret_val; return ret_val;
} }
@ -2226,17 +2378,17 @@ s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data)
s32 ret_val; s32 ret_val;
u16 page = (u16)(offset >> IGP_PAGE_SHIFT); u16 page = (u16)(offset >> IGP_PAGE_SHIFT);
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
/* Page 800 works differently than the rest so it has its own func */ /* Page 800 works differently than the rest so it has its own func */
if (page == BM_WUC_PAGE) { if (page == BM_WUC_PAGE) {
ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data,
true); true);
return ret_val; goto out;
} }
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
hw->phy.addr = 1; hw->phy.addr = 1;
if (offset > MAX_PHY_MULTI_PAGE_REG) { if (offset > MAX_PHY_MULTI_PAGE_REG) {
@ -2245,16 +2397,14 @@ s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data)
ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT,
page); page);
if (ret_val) { if (ret_val)
hw->phy.ops.release_phy(hw); goto out;
return ret_val;
}
} }
ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data); data);
out:
hw->phy.ops.release_phy(hw); hw->phy.ops.release_phy(hw);
return ret_val; return ret_val;
} }
@ -2272,17 +2422,17 @@ s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data)
s32 ret_val; s32 ret_val;
u16 page = (u16)(offset >> IGP_PAGE_SHIFT); u16 page = (u16)(offset >> IGP_PAGE_SHIFT);
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
/* Page 800 works differently than the rest so it has its own func */ /* Page 800 works differently than the rest so it has its own func */
if (page == BM_WUC_PAGE) { if (page == BM_WUC_PAGE) {
ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data,
false); false);
return ret_val; goto out;
} }
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
hw->phy.addr = 1; hw->phy.addr = 1;
if (offset > MAX_PHY_MULTI_PAGE_REG) { if (offset > MAX_PHY_MULTI_PAGE_REG) {
@ -2290,17 +2440,15 @@ s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data)
ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT, ret_val = e1000e_write_phy_reg_mdic(hw, BM_PHY_PAGE_SELECT,
page); page);
if (ret_val) { if (ret_val)
hw->phy.ops.release_phy(hw); goto out;
return ret_val;
}
} }
ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data); data);
out:
hw->phy.ops.release_phy(hw); hw->phy.ops.release_phy(hw);
return ret_val; return ret_val;
} }
@ -2320,6 +2468,8 @@ s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data)
* 3) Write the address using the address opcode (0x11) * 3) Write the address using the address opcode (0x11)
* 4) Read or write the data using the data opcode (0x12) * 4) Read or write the data using the data opcode (0x12)
* 5) Restore 769_17.2 to its original value * 5) Restore 769_17.2 to its original value
*
* Assumes semaphore already acquired.
**/ **/
static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
u16 *data, bool read) u16 *data, bool read)
@ -2327,20 +2477,12 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
s32 ret_val; s32 ret_val;
u16 reg = BM_PHY_REG_NUM(offset); u16 reg = BM_PHY_REG_NUM(offset);
u16 phy_reg = 0; u16 phy_reg = 0;
u8 phy_acquired = 1;
/* Gig must be disabled for MDIO accesses to page 800 */ /* Gig must be disabled for MDIO accesses to page 800 */
if ((hw->mac.type == e1000_pchlan) && if ((hw->mac.type == e1000_pchlan) &&
(!(er32(PHY_CTRL) & E1000_PHY_CTRL_GBE_DISABLE))) (!(er32(PHY_CTRL) & E1000_PHY_CTRL_GBE_DISABLE)))
hw_dbg(hw, "Attempting to access page 800 while gig enabled\n"); hw_dbg(hw, "Attempting to access page 800 while gig enabled\n");
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val) {
phy_acquired = 0;
goto out;
}
/* All operations in this function are phy address 1 */ /* All operations in this function are phy address 1 */
hw->phy.addr = 1; hw->phy.addr = 1;
@ -2397,8 +2539,6 @@ static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg);
out: out:
if (phy_acquired == 1)
hw->phy.ops.release_phy(hw);
return ret_val; return ret_val;
} }
@ -2439,52 +2579,63 @@ static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
return 0; return 0;
} }
/**
* e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode
* @hw: pointer to the HW structure
* @slow: true for slow mode, false for normal mode
*
* Assumes semaphore already acquired.
**/
s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow) s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow)
{ {
s32 ret_val = 0; s32 ret_val = 0;
u16 data = 0; u16 data = 0;
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
/* Set MDIO mode - page 769, register 16: 0x2580==slow, 0x2180==fast */ /* Set MDIO mode - page 769, register 16: 0x2580==slow, 0x2180==fast */
hw->phy.addr = 1; hw->phy.addr = 1;
ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT,
(BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT));
if (ret_val) { if (ret_val)
hw->phy.ops.release_phy(hw); goto out;
return ret_val;
}
ret_val = e1000e_write_phy_reg_mdic(hw, BM_CS_CTRL1, ret_val = e1000e_write_phy_reg_mdic(hw, BM_CS_CTRL1,
(0x2180 | (slow << 10))); (0x2180 | (slow << 10)));
if (ret_val)
goto out;
/* dummy read when reverting to fast mode - throw away result */ /* dummy read when reverting to fast mode - throw away result */
if (!slow) if (!slow)
e1000e_read_phy_reg_mdic(hw, BM_CS_CTRL1, &data); ret_val = e1000e_read_phy_reg_mdic(hw, BM_CS_CTRL1, &data);
hw->phy.ops.release_phy(hw);
out:
return ret_val; return ret_val;
} }
/** /**
* e1000_read_phy_reg_hv - Read HV PHY register * __e1000_read_phy_reg_hv - Read HV PHY register
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* @offset: register offset to be read * @offset: register offset to be read
* @data: pointer to the read data * @data: pointer to the read data
* @locked: semaphore has already been acquired or not
* *
* Acquires semaphore, if necessary, then reads the PHY register at offset * Acquires semaphore, if necessary, then reads the PHY register at offset
* and storing the retrieved information in data. Release any acquired * and stores the retrieved information in data. Release any acquired
* semaphore before exiting. * semaphore before exiting.
**/ **/
s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data) static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data,
bool locked)
{ {
s32 ret_val; s32 ret_val;
u16 page = BM_PHY_REG_PAGE(offset); u16 page = BM_PHY_REG_PAGE(offset);
u16 reg = BM_PHY_REG_NUM(offset); u16 reg = BM_PHY_REG_NUM(offset);
bool in_slow_mode = false; bool in_slow_mode = false;
if (!locked) {
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
}
/* Workaround failure in MDIO access while cable is disconnected */ /* Workaround failure in MDIO access while cable is disconnected */
if ((hw->phy.type == e1000_phy_82577) && if ((hw->phy.type == e1000_phy_82577) &&
!(er32(STATUS) & E1000_STATUS_LU)) { !(er32(STATUS) & E1000_STATUS_LU)) {
@ -2508,10 +2659,6 @@ s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data)
goto out; goto out;
} }
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
goto out;
hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); hw->phy.addr = e1000_get_phy_addr_for_hv_page(page);
if (page == HV_INTC_FC_PAGE_START) if (page == HV_INTC_FC_PAGE_START)
@ -2529,42 +2676,76 @@ s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data)
ret_val = e1000e_write_phy_reg_mdic(hw, ret_val = e1000e_write_phy_reg_mdic(hw,
IGP01E1000_PHY_PAGE_SELECT, IGP01E1000_PHY_PAGE_SELECT,
(page << IGP_PAGE_SHIFT)); (page << IGP_PAGE_SHIFT));
if (ret_val) {
hw->phy.ops.release_phy(hw);
goto out;
}
hw->phy.addr = phy_addr; hw->phy.addr = phy_addr;
} }
} }
ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
data); data);
hw->phy.ops.release_phy(hw);
out: out:
/* Revert to MDIO fast mode, if applicable */ /* Revert to MDIO fast mode, if applicable */
if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) if ((hw->phy.type == e1000_phy_82577) && in_slow_mode)
ret_val = e1000_set_mdio_slow_mode_hv(hw, false); ret_val = e1000_set_mdio_slow_mode_hv(hw, false);
if (!locked)
hw->phy.ops.release_phy(hw);
return ret_val; return ret_val;
} }
/** /**
* e1000_write_phy_reg_hv - Write HV PHY register * e1000_read_phy_reg_hv - Read HV PHY register
* @hw: pointer to the HW structure
* @offset: register offset to be read
* @data: pointer to the read data
*
* Acquires semaphore then reads the PHY register at offset and stores
* the retrieved information in data. Release the acquired semaphore
* before exiting.
**/
s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data)
{
return __e1000_read_phy_reg_hv(hw, offset, data, false);
}
/**
* e1000_read_phy_reg_hv_locked - Read HV PHY register
* @hw: pointer to the HW structure
* @offset: register offset to be read
* @data: pointer to the read data
*
* Reads the PHY register at offset and stores the retrieved information
* in data. Assumes semaphore already acquired.
**/
s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data)
{
return __e1000_read_phy_reg_hv(hw, offset, data, true);
}
/**
* __e1000_write_phy_reg_hv - Write HV PHY register
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
* @offset: register offset to write to * @offset: register offset to write to
* @data: data to write at register offset * @data: data to write at register offset
* @locked: semaphore has already been acquired or not
* *
* Acquires semaphore, if necessary, then writes the data to PHY register * Acquires semaphore, if necessary, then writes the data to PHY register
* at the offset. Release any acquired semaphores before exiting. * at the offset. Release any acquired semaphores before exiting.
**/ **/
s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data) static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
bool locked)
{ {
s32 ret_val; s32 ret_val;
u16 page = BM_PHY_REG_PAGE(offset); u16 page = BM_PHY_REG_PAGE(offset);
u16 reg = BM_PHY_REG_NUM(offset); u16 reg = BM_PHY_REG_NUM(offset);
bool in_slow_mode = false; bool in_slow_mode = false;
if (!locked) {
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
return ret_val;
}
/* Workaround failure in MDIO access while cable is disconnected */ /* Workaround failure in MDIO access while cable is disconnected */
if ((hw->phy.type == e1000_phy_82577) && if ((hw->phy.type == e1000_phy_82577) &&
!(er32(STATUS) & E1000_STATUS_LU)) { !(er32(STATUS) & E1000_STATUS_LU)) {
@ -2588,10 +2769,6 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data)
goto out; goto out;
} }
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
goto out;
hw->phy.addr = e1000_get_phy_addr_for_hv_page(page); hw->phy.addr = e1000_get_phy_addr_for_hv_page(page);
if (page == HV_INTC_FC_PAGE_START) if (page == HV_INTC_FC_PAGE_START)
@ -2607,15 +2784,10 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data)
((MAX_PHY_REG_ADDRESS & reg) == 0) && ((MAX_PHY_REG_ADDRESS & reg) == 0) &&
(data & (1 << 11))) { (data & (1 << 11))) {
u16 data2 = 0x7EFF; u16 data2 = 0x7EFF;
hw->phy.ops.release_phy(hw);
ret_val = e1000_access_phy_debug_regs_hv(hw, (1 << 6) | 0x3, ret_val = e1000_access_phy_debug_regs_hv(hw, (1 << 6) | 0x3,
&data2, false); &data2, false);
if (ret_val) if (ret_val)
goto out; goto out;
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val)
goto out;
} }
if (reg > MAX_PHY_MULTI_PAGE_REG) { if (reg > MAX_PHY_MULTI_PAGE_REG) {
@ -2630,26 +2802,52 @@ s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data)
ret_val = e1000e_write_phy_reg_mdic(hw, ret_val = e1000e_write_phy_reg_mdic(hw,
IGP01E1000_PHY_PAGE_SELECT, IGP01E1000_PHY_PAGE_SELECT,
(page << IGP_PAGE_SHIFT)); (page << IGP_PAGE_SHIFT));
if (ret_val) {
hw->phy.ops.release_phy(hw);
goto out;
}
hw->phy.addr = phy_addr; hw->phy.addr = phy_addr;
} }
} }
ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg,
data); data);
hw->phy.ops.release_phy(hw);
out: out:
/* Revert to MDIO fast mode, if applicable */ /* Revert to MDIO fast mode, if applicable */
if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) if ((hw->phy.type == e1000_phy_82577) && in_slow_mode)
ret_val = e1000_set_mdio_slow_mode_hv(hw, false); ret_val = e1000_set_mdio_slow_mode_hv(hw, false);
if (!locked)
hw->phy.ops.release_phy(hw);
return ret_val; return ret_val;
} }
/**
* e1000_write_phy_reg_hv - Write HV PHY register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
*
* Acquires semaphore then writes the data to PHY register at the offset.
* Release the acquired semaphores before exiting.
**/
s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data)
{
return __e1000_write_phy_reg_hv(hw, offset, data, false);
}
/**
* e1000_write_phy_reg_hv_locked - Write HV PHY register
* @hw: pointer to the HW structure
* @offset: register offset to write to
* @data: data to write at register offset
*
* Writes the data to PHY register at the offset. Assumes semaphore
* already acquired.
**/
s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data)
{
return __e1000_write_phy_reg_hv(hw, offset, data, true);
}
/** /**
* e1000_get_phy_addr_for_hv_page - Get PHY adrress based on page * e1000_get_phy_addr_for_hv_page - Get PHY adrress based on page
* @page: page to be accessed * @page: page to be accessed
@ -2671,10 +2869,9 @@ static u32 e1000_get_phy_addr_for_hv_page(u32 page)
* @data: pointer to the data to be read or written * @data: pointer to the data to be read or written
* @read: determines if operation is read or written * @read: determines if operation is read or written
* *
* Acquires semaphore, if necessary, then reads the PHY register at offset * Reads the PHY register at offset and stores the retreived information
* and storing the retreived information in data. Release any acquired * in data. Assumes semaphore already acquired. Note that the procedure
* semaphores before exiting. Note that the procedure to read these regs * to read these regs uses the address port and data port to read/write.
* uses the address port and data port to read/write.
**/ **/
static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset, static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
u16 *data, bool read) u16 *data, bool read)
@ -2682,20 +2879,12 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
s32 ret_val; s32 ret_val;
u32 addr_reg = 0; u32 addr_reg = 0;
u32 data_reg = 0; u32 data_reg = 0;
u8 phy_acquired = 1;
/* This takes care of the difference with desktop vs mobile phy */ /* This takes care of the difference with desktop vs mobile phy */
addr_reg = (hw->phy.type == e1000_phy_82578) ? addr_reg = (hw->phy.type == e1000_phy_82578) ?
I82578_ADDR_REG : I82577_ADDR_REG; I82578_ADDR_REG : I82577_ADDR_REG;
data_reg = addr_reg + 1; data_reg = addr_reg + 1;
ret_val = hw->phy.ops.acquire_phy(hw);
if (ret_val) {
hw_dbg(hw, "Could not acquire PHY\n");
phy_acquired = 0;
goto out;
}
/* All operations in this function are phy address 2 */ /* All operations in this function are phy address 2 */
hw->phy.addr = 2; hw->phy.addr = 2;
@ -2718,8 +2907,6 @@ static s32 e1000_access_phy_debug_regs_hv(struct e1000_hw *hw, u32 offset,
} }
out: out:
if (phy_acquired == 1)
hw->phy.ops.release_phy(hw);
return ret_val; return ret_val;
} }

View File

@ -98,12 +98,13 @@ static void ri_tasklet(unsigned long dev)
stats->tx_packets++; stats->tx_packets++;
stats->tx_bytes +=skb->len; stats->tx_bytes +=skb->len;
skb->dev = __dev_get_by_index(&init_net, skb->iif); skb->dev = dev_get_by_index(&init_net, skb->iif);
if (!skb->dev) { if (!skb->dev) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
stats->tx_dropped++; stats->tx_dropped++;
break; break;
} }
dev_put(skb->dev);
skb->iif = _dev->ifindex; skb->iif = _dev->ifindex;
if (from & AT_EGRESS) { if (from & AT_EGRESS) {

View File

@ -732,7 +732,7 @@ static int igb_set_ringparam(struct net_device *netdev,
{ {
struct igb_adapter *adapter = netdev_priv(netdev); struct igb_adapter *adapter = netdev_priv(netdev);
struct igb_ring *temp_ring; struct igb_ring *temp_ring;
int i, err; int i, err = 0;
u32 new_rx_count, new_tx_count; u32 new_rx_count, new_tx_count;
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
@ -752,18 +752,30 @@ static int igb_set_ringparam(struct net_device *netdev,
return 0; return 0;
} }
while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
msleep(1);
if (!netif_running(adapter->netdev)) {
for (i = 0; i < adapter->num_tx_queues; i++)
adapter->tx_ring[i].count = new_tx_count;
for (i = 0; i < adapter->num_rx_queues; i++)
adapter->rx_ring[i].count = new_rx_count;
adapter->tx_ring_count = new_tx_count;
adapter->rx_ring_count = new_rx_count;
goto clear_reset;
}
if (adapter->num_tx_queues > adapter->num_rx_queues) if (adapter->num_tx_queues > adapter->num_rx_queues)
temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring)); temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring));
else else
temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring)); temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring));
if (!temp_ring)
return -ENOMEM;
while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) if (!temp_ring) {
msleep(1); err = -ENOMEM;
goto clear_reset;
}
if (netif_running(adapter->netdev)) igb_down(adapter);
igb_down(adapter);
/* /*
* We can't just free everything and then setup again, * We can't just free everything and then setup again,
@ -820,14 +832,11 @@ static int igb_set_ringparam(struct net_device *netdev,
adapter->rx_ring_count = new_rx_count; adapter->rx_ring_count = new_rx_count;
} }
err = 0;
err_setup: err_setup:
if (netif_running(adapter->netdev)) igb_up(adapter);
igb_up(adapter);
clear_bit(__IGB_RESETTING, &adapter->state);
vfree(temp_ring); vfree(temp_ring);
clear_reset:
clear_bit(__IGB_RESETTING, &adapter->state);
return err; return err;
} }

View File

@ -279,7 +279,7 @@ static int igbvf_set_ringparam(struct net_device *netdev,
{ {
struct igbvf_adapter *adapter = netdev_priv(netdev); struct igbvf_adapter *adapter = netdev_priv(netdev);
struct igbvf_ring *temp_ring; struct igbvf_ring *temp_ring;
int err; int err = 0;
u32 new_rx_count, new_tx_count; u32 new_rx_count, new_tx_count;
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
@ -299,15 +299,22 @@ static int igbvf_set_ringparam(struct net_device *netdev,
return 0; return 0;
} }
temp_ring = vmalloc(sizeof(struct igbvf_ring));
if (!temp_ring)
return -ENOMEM;
while (test_and_set_bit(__IGBVF_RESETTING, &adapter->state)) while (test_and_set_bit(__IGBVF_RESETTING, &adapter->state))
msleep(1); msleep(1);
if (netif_running(adapter->netdev)) if (!netif_running(adapter->netdev)) {
igbvf_down(adapter); adapter->tx_ring->count = new_tx_count;
adapter->rx_ring->count = new_rx_count;
goto clear_reset;
}
temp_ring = vmalloc(sizeof(struct igbvf_ring));
if (!temp_ring) {
err = -ENOMEM;
goto clear_reset;
}
igbvf_down(adapter);
/* /*
* We can't just free everything and then setup again, * We can't just free everything and then setup again,
@ -339,14 +346,11 @@ static int igbvf_set_ringparam(struct net_device *netdev,
memcpy(adapter->rx_ring, temp_ring,sizeof(struct igbvf_ring)); memcpy(adapter->rx_ring, temp_ring,sizeof(struct igbvf_ring));
} }
err = 0;
err_setup: err_setup:
if (netif_running(adapter->netdev)) igbvf_up(adapter);
igbvf_up(adapter);
clear_bit(__IGBVF_RESETTING, &adapter->state);
vfree(temp_ring); vfree(temp_ring);
clear_reset:
clear_bit(__IGBVF_RESETTING, &adapter->state);
return err; return err;
} }

View File

@ -798,7 +798,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
{ {
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct ixgbe_ring *temp_tx_ring, *temp_rx_ring; struct ixgbe_ring *temp_tx_ring, *temp_rx_ring;
int i, err; int i, err = 0;
u32 new_rx_count, new_tx_count; u32 new_rx_count, new_tx_count;
bool need_update = false; bool need_update = false;
@ -822,6 +822,16 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
msleep(1); msleep(1);
if (!netif_running(adapter->netdev)) {
for (i = 0; i < adapter->num_tx_queues; i++)
adapter->tx_ring[i].count = new_tx_count;
for (i = 0; i < adapter->num_rx_queues; i++)
adapter->rx_ring[i].count = new_rx_count;
adapter->tx_ring_count = new_tx_count;
adapter->rx_ring_count = new_rx_count;
goto err_setup;
}
temp_tx_ring = kcalloc(adapter->num_tx_queues, temp_tx_ring = kcalloc(adapter->num_tx_queues,
sizeof(struct ixgbe_ring), GFP_KERNEL); sizeof(struct ixgbe_ring), GFP_KERNEL);
if (!temp_tx_ring) { if (!temp_tx_ring) {
@ -879,8 +889,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
/* if rings need to be updated, here's the place to do it in one shot */ /* if rings need to be updated, here's the place to do it in one shot */
if (need_update) { if (need_update) {
if (netif_running(netdev)) ixgbe_down(adapter);
ixgbe_down(adapter);
/* tx */ /* tx */
if (new_tx_count != adapter->tx_ring_count) { if (new_tx_count != adapter->tx_ring_count) {
@ -897,13 +906,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev,
temp_rx_ring = NULL; temp_rx_ring = NULL;
adapter->rx_ring_count = new_rx_count; adapter->rx_ring_count = new_rx_count;
} }
}
/* success! */
err = 0;
if (netif_running(netdev))
ixgbe_up(adapter); ixgbe_up(adapter);
}
err_setup: err_setup:
clear_bit(__IXGBE_RESETTING, &adapter->state); clear_bit(__IXGBE_RESETTING, &adapter->state);
return err; return err;

View File

@ -75,7 +75,7 @@
#include "myri10ge_mcp.h" #include "myri10ge_mcp.h"
#include "myri10ge_mcp_gen_header.h" #include "myri10ge_mcp_gen_header.h"
#define MYRI10GE_VERSION_STR "1.5.0-1.432" #define MYRI10GE_VERSION_STR "1.5.1-1.451"
MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
MODULE_AUTHOR("Maintainer: help@myri.com"); MODULE_AUTHOR("Maintainer: help@myri.com");
@ -1624,10 +1624,21 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
return 0; return 0;
} }
} }
if (*ptr == 'R' || *ptr == 'Q') { if (*ptr == '2')
/* We've found either an XFP or quad ribbon fiber */ ptr++;
if (*ptr == 'R' || *ptr == 'Q' || *ptr == 'S') {
/* We've found either an XFP, quad ribbon fiber, or SFP+ */
cmd->port = PORT_FIBRE; cmd->port = PORT_FIBRE;
cmd->supported |= SUPPORTED_FIBRE;
cmd->advertising |= ADVERTISED_FIBRE;
} else {
cmd->port = PORT_OTHER;
} }
if (*ptr == 'R' || *ptr == 'S')
cmd->transceiver = XCVR_EXTERNAL;
else
cmd->transceiver = XCVR_INTERNAL;
return 0; return 0;
} }

View File

@ -419,6 +419,7 @@ enum {
#define NETXEN_CRB_ROMUSB \ #define NETXEN_CRB_ROMUSB \
NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_ROMUSB) NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_ROMUSB)
#define NETXEN_CRB_I2Q NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_I2Q) #define NETXEN_CRB_I2Q NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_I2Q)
#define NETXEN_CRB_I2C0 NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_I2C0)
#define NETXEN_CRB_SMB NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_SMB) #define NETXEN_CRB_SMB NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_SMB)
#define NETXEN_CRB_MAX NETXEN_PCI_CRB_WINDOW(64) #define NETXEN_CRB_MAX NETXEN_PCI_CRB_WINDOW(64)

View File

@ -1901,22 +1901,16 @@ netxen_setup_hwops(struct netxen_adapter *adapter)
int netxen_nic_get_board_info(struct netxen_adapter *adapter) int netxen_nic_get_board_info(struct netxen_adapter *adapter)
{ {
int offset, board_type, magic, header_version; int offset, board_type, magic;
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
offset = NX_FW_MAGIC_OFFSET; offset = NX_FW_MAGIC_OFFSET;
if (netxen_rom_fast_read(adapter, offset, &magic)) if (netxen_rom_fast_read(adapter, offset, &magic))
return -EIO; return -EIO;
offset = NX_HDR_VERSION_OFFSET; if (magic != NETXEN_BDINFO_MAGIC) {
if (netxen_rom_fast_read(adapter, offset, &header_version)) dev_err(&pdev->dev, "invalid board config, magic=%08x\n",
return -EIO; magic);
if (magic != NETXEN_BDINFO_MAGIC ||
header_version != NETXEN_BDINFO_VERSION) {
dev_err(&pdev->dev,
"invalid board config, magic=%08x, version=%08x\n",
magic, header_version);
return -EIO; return -EIO;
} }

View File

@ -531,6 +531,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
continue; continue;
if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
if (off == (NETXEN_CRB_I2C0 + 0x1c))
continue;
/* do not reset PCI */ /* do not reset PCI */
if (off == (ROMUSB_GLB + 0xbc)) if (off == (ROMUSB_GLB + 0xbc))
continue; continue;
@ -553,12 +555,6 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
continue; continue;
} }
if (off == NETXEN_ADDR_ERROR) {
printk(KERN_ERR "%s: Err: Unknown addr: 0x%08x\n",
netxen_nic_driver_name, buf[i].addr);
continue;
}
init_delay = 1; init_delay = 1;
/* After writing this register, HW needs time for CRB */ /* After writing this register, HW needs time for CRB */
/* to quiet down (else crb_window returns 0xffffffff) */ /* to quiet down (else crb_window returns 0xffffffff) */

View File

@ -1919,6 +1919,7 @@ static void netxen_tx_timeout_task(struct work_struct *work)
request_reset: request_reset:
adapter->need_fw_reset = 1; adapter->need_fw_reset = 1;
clear_bit(__NX_RESETTING, &adapter->state);
} }
struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)

View File

@ -111,9 +111,6 @@ struct pppoe_net {
rwlock_t hash_lock; rwlock_t hash_lock;
}; };
/* to eliminate a race btw pppoe_flush_dev and pppoe_release */
static DEFINE_SPINLOCK(flush_lock);
/* /*
* PPPoE could be in the following stages: * PPPoE could be in the following stages:
* 1) Discovery stage (to obtain remote MAC and Session ID) * 1) Discovery stage (to obtain remote MAC and Session ID)
@ -303,45 +300,48 @@ static void pppoe_flush_dev(struct net_device *dev)
write_lock_bh(&pn->hash_lock); write_lock_bh(&pn->hash_lock);
for (i = 0; i < PPPOE_HASH_SIZE; i++) { for (i = 0; i < PPPOE_HASH_SIZE; i++) {
struct pppox_sock *po = pn->hash_table[i]; struct pppox_sock *po = pn->hash_table[i];
struct sock *sk;
while (po != NULL) { while (po) {
struct sock *sk; while (po && po->pppoe_dev != dev) {
if (po->pppoe_dev != dev) {
po = po->next; po = po->next;
continue;
} }
if (!po)
break;
sk = sk_pppox(po); sk = sk_pppox(po);
spin_lock(&flush_lock);
po->pppoe_dev = NULL;
spin_unlock(&flush_lock);
dev_put(dev);
/* We always grab the socket lock, followed by the /* We always grab the socket lock, followed by the
* hash_lock, in that order. Since we should * hash_lock, in that order. Since we should hold the
* hold the sock lock while doing any unbinding, * sock lock while doing any unbinding, we need to
* we need to release the lock we're holding. * release the lock we're holding. Hold a reference to
* Hold a reference to the sock so it doesn't disappear * the sock so it doesn't disappear as we're jumping
* as we're jumping between locks. * between locks.
*/ */
sock_hold(sk); sock_hold(sk);
write_unlock_bh(&pn->hash_lock); write_unlock_bh(&pn->hash_lock);
lock_sock(sk); lock_sock(sk);
if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { if (po->pppoe_dev == dev
&& sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) {
pppox_unbind_sock(sk); pppox_unbind_sock(sk);
sk->sk_state = PPPOX_ZOMBIE; sk->sk_state = PPPOX_ZOMBIE;
sk->sk_state_change(sk); sk->sk_state_change(sk);
po->pppoe_dev = NULL;
dev_put(dev);
} }
release_sock(sk); release_sock(sk);
sock_put(sk); sock_put(sk);
/* Restart scan at the beginning of this hash chain. /* Restart the process from the start of the current
* While the lock was dropped the chain contents may * hash chain. We dropped locks so the world may have
* have changed. * change from underneath us.
*/ */
BUG_ON(pppoe_pernet(dev_net(dev)) == NULL);
write_lock_bh(&pn->hash_lock); write_lock_bh(&pn->hash_lock);
po = pn->hash_table[i]; po = pn->hash_table[i];
} }
@ -388,11 +388,16 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
struct pppox_sock *po = pppox_sk(sk); struct pppox_sock *po = pppox_sk(sk);
struct pppox_sock *relay_po; struct pppox_sock *relay_po;
/* Backlog receive. Semantics of backlog rcv preclude any code from
* executing in lock_sock()/release_sock() bounds; meaning sk->sk_state
* can't change.
*/
if (sk->sk_state & PPPOX_BOUND) { if (sk->sk_state & PPPOX_BOUND) {
ppp_input(&po->chan, skb); ppp_input(&po->chan, skb);
} else if (sk->sk_state & PPPOX_RELAY) { } else if (sk->sk_state & PPPOX_RELAY) {
relay_po = get_item_by_addr(dev_net(po->pppoe_dev), relay_po = get_item_by_addr(sock_net(sk),
&po->pppoe_relay); &po->pppoe_relay);
if (relay_po == NULL) if (relay_po == NULL)
goto abort_kfree; goto abort_kfree;
@ -447,6 +452,10 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
goto drop; goto drop;
pn = pppoe_pernet(dev_net(dev)); pn = pppoe_pernet(dev_net(dev));
/* Note that get_item does a sock_hold(), so sk_pppox(po)
* is known to be safe.
*/
po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex); po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
if (!po) if (!po)
goto drop; goto drop;
@ -561,6 +570,7 @@ static int pppoe_release(struct socket *sock)
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct pppox_sock *po; struct pppox_sock *po;
struct pppoe_net *pn; struct pppoe_net *pn;
struct net *net = NULL;
if (!sk) if (!sk)
return 0; return 0;
@ -571,44 +581,28 @@ static int pppoe_release(struct socket *sock)
return -EBADF; return -EBADF;
} }
po = pppox_sk(sk);
if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) {
dev_put(po->pppoe_dev);
po->pppoe_dev = NULL;
}
pppox_unbind_sock(sk); pppox_unbind_sock(sk);
/* Signal the death of the socket. */ /* Signal the death of the socket. */
sk->sk_state = PPPOX_DEAD; sk->sk_state = PPPOX_DEAD;
/* net = sock_net(sk);
* pppoe_flush_dev could lead to a race with pn = pppoe_pernet(net);
* this routine so we use flush_lock to eliminate
* such a case (we only need per-net specific data)
*/
spin_lock(&flush_lock);
po = pppox_sk(sk);
if (!po->pppoe_dev) {
spin_unlock(&flush_lock);
goto out;
}
pn = pppoe_pernet(dev_net(po->pppoe_dev));
spin_unlock(&flush_lock);
/* /*
* protect "po" from concurrent updates * protect "po" from concurrent updates
* on pppoe_flush_dev * on pppoe_flush_dev
*/ */
write_lock_bh(&pn->hash_lock); delete_item(pn, po->pppoe_pa.sid, po->pppoe_pa.remote,
po->pppoe_ifindex);
po = pppox_sk(sk);
if (stage_session(po->pppoe_pa.sid))
__delete_item(pn, po->pppoe_pa.sid, po->pppoe_pa.remote,
po->pppoe_ifindex);
if (po->pppoe_dev) {
dev_put(po->pppoe_dev);
po->pppoe_dev = NULL;
}
write_unlock_bh(&pn->hash_lock);
out:
sock_orphan(sk); sock_orphan(sk);
sock->sk = NULL; sock->sk = NULL;
@ -625,8 +619,9 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct sockaddr_pppox *sp = (struct sockaddr_pppox *)uservaddr; struct sockaddr_pppox *sp = (struct sockaddr_pppox *)uservaddr;
struct pppox_sock *po = pppox_sk(sk); struct pppox_sock *po = pppox_sk(sk);
struct net_device *dev; struct net_device *dev = NULL;
struct pppoe_net *pn; struct pppoe_net *pn;
struct net *net = NULL;
int error; int error;
lock_sock(sk); lock_sock(sk);
@ -652,12 +647,14 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
/* Delete the old binding */ /* Delete the old binding */
if (stage_session(po->pppoe_pa.sid)) { if (stage_session(po->pppoe_pa.sid)) {
pppox_unbind_sock(sk); pppox_unbind_sock(sk);
pn = pppoe_pernet(sock_net(sk));
delete_item(pn, po->pppoe_pa.sid,
po->pppoe_pa.remote, po->pppoe_ifindex);
if (po->pppoe_dev) { if (po->pppoe_dev) {
pn = pppoe_pernet(dev_net(po->pppoe_dev));
delete_item(pn, po->pppoe_pa.sid,
po->pppoe_pa.remote, po->pppoe_ifindex);
dev_put(po->pppoe_dev); dev_put(po->pppoe_dev);
po->pppoe_dev = NULL;
} }
memset(sk_pppox(po) + 1, 0, memset(sk_pppox(po) + 1, 0,
sizeof(struct pppox_sock) - sizeof(struct sock)); sizeof(struct pppox_sock) - sizeof(struct sock));
sk->sk_state = PPPOX_NONE; sk->sk_state = PPPOX_NONE;
@ -666,16 +663,15 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
/* Re-bind in session stage only */ /* Re-bind in session stage only */
if (stage_session(sp->sa_addr.pppoe.sid)) { if (stage_session(sp->sa_addr.pppoe.sid)) {
error = -ENODEV; error = -ENODEV;
dev = dev_get_by_name(sock_net(sk), sp->sa_addr.pppoe.dev); net = sock_net(sk);
dev = dev_get_by_name(net, sp->sa_addr.pppoe.dev);
if (!dev) if (!dev)
goto end; goto err_put;
po->pppoe_dev = dev; po->pppoe_dev = dev;
po->pppoe_ifindex = dev->ifindex; po->pppoe_ifindex = dev->ifindex;
pn = pppoe_pernet(dev_net(dev)); pn = pppoe_pernet(net);
write_lock_bh(&pn->hash_lock);
if (!(dev->flags & IFF_UP)) { if (!(dev->flags & IFF_UP)) {
write_unlock_bh(&pn->hash_lock);
goto err_put; goto err_put;
} }
@ -683,6 +679,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
&sp->sa_addr.pppoe, &sp->sa_addr.pppoe,
sizeof(struct pppoe_addr)); sizeof(struct pppoe_addr));
write_lock_bh(&pn->hash_lock);
error = __set_item(pn, po); error = __set_item(pn, po);
write_unlock_bh(&pn->hash_lock); write_unlock_bh(&pn->hash_lock);
if (error < 0) if (error < 0)
@ -696,8 +693,11 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
po->chan.ops = &pppoe_chan_ops; po->chan.ops = &pppoe_chan_ops;
error = ppp_register_net_channel(dev_net(dev), &po->chan); error = ppp_register_net_channel(dev_net(dev), &po->chan);
if (error) if (error) {
delete_item(pn, po->pppoe_pa.sid,
po->pppoe_pa.remote, po->pppoe_ifindex);
goto err_put; goto err_put;
}
sk->sk_state = PPPOX_CONNECTED; sk->sk_state = PPPOX_CONNECTED;
} }
@ -915,6 +915,14 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
struct pppoe_hdr *ph; struct pppoe_hdr *ph;
int data_len = skb->len; int data_len = skb->len;
/* The higher-level PPP code (ppp_unregister_channel()) ensures the PPP
* xmit operations conclude prior to an unregistration call. Thus
* sk->sk_state cannot change, so we don't need to do lock_sock().
* But, we also can't do a lock_sock since that introduces a potential
* deadlock as we'd reverse the lock ordering used when calling
* ppp_unregister_channel().
*/
if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
goto abort; goto abort;
@ -944,7 +952,6 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
po->pppoe_pa.remote, NULL, data_len); po->pppoe_pa.remote, NULL, data_len);
dev_queue_xmit(skb); dev_queue_xmit(skb);
return 1; return 1;
abort: abort:

View File

@ -95,6 +95,7 @@ enum {
/* Misc. stuff */ /* Misc. stuff */
MAILBOX_COUNT = 16, MAILBOX_COUNT = 16,
MAILBOX_TIMEOUT = 5,
PROC_ADDR_RDY = (1 << 31), PROC_ADDR_RDY = (1 << 31),
PROC_ADDR_R = (1 << 30), PROC_ADDR_R = (1 << 30),

View File

@ -3916,6 +3916,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
goto err_out; goto err_out;
} }
pci_save_state(pdev);
qdev->reg_base = qdev->reg_base =
ioremap_nocache(pci_resource_start(pdev, 1), ioremap_nocache(pci_resource_start(pdev, 1),
pci_resource_len(pdev, 1)); pci_resource_len(pdev, 1));
@ -4070,6 +4071,33 @@ static void __devexit qlge_remove(struct pci_dev *pdev)
free_netdev(ndev); free_netdev(ndev);
} }
/* Clean up resources without touching hardware. */
static void ql_eeh_close(struct net_device *ndev)
{
int i;
struct ql_adapter *qdev = netdev_priv(ndev);
if (netif_carrier_ok(ndev)) {
netif_carrier_off(ndev);
netif_stop_queue(ndev);
}
if (test_bit(QL_ADAPTER_UP, &qdev->flags))
cancel_delayed_work_sync(&qdev->asic_reset_work);
cancel_delayed_work_sync(&qdev->mpi_reset_work);
cancel_delayed_work_sync(&qdev->mpi_work);
cancel_delayed_work_sync(&qdev->mpi_idc_work);
cancel_delayed_work_sync(&qdev->mpi_port_cfg_work);
for (i = 0; i < qdev->rss_ring_count; i++)
netif_napi_del(&qdev->rx_ring[i].napi);
clear_bit(QL_ADAPTER_UP, &qdev->flags);
ql_tx_ring_clean(qdev);
ql_free_rx_buffers(qdev);
ql_release_adapter_resources(qdev);
}
/* /*
* This callback is called by the PCI subsystem whenever * This callback is called by the PCI subsystem whenever
* a PCI bus error is detected. * a PCI bus error is detected.
@ -4078,17 +4106,21 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev,
enum pci_channel_state state) enum pci_channel_state state)
{ {
struct net_device *ndev = pci_get_drvdata(pdev); struct net_device *ndev = pci_get_drvdata(pdev);
struct ql_adapter *qdev = netdev_priv(ndev);
netif_device_detach(ndev); switch (state) {
case pci_channel_io_normal:
if (state == pci_channel_io_perm_failure) return PCI_ERS_RESULT_CAN_RECOVER;
case pci_channel_io_frozen:
netif_device_detach(ndev);
if (netif_running(ndev))
ql_eeh_close(ndev);
pci_disable_device(pdev);
return PCI_ERS_RESULT_NEED_RESET;
case pci_channel_io_perm_failure:
dev_err(&pdev->dev,
"%s: pci_channel_io_perm_failure.\n", __func__);
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
}
if (netif_running(ndev))
ql_adapter_down(qdev);
pci_disable_device(pdev);
/* Request a slot reset. */ /* Request a slot reset. */
return PCI_ERS_RESULT_NEED_RESET; return PCI_ERS_RESULT_NEED_RESET;
@ -4105,25 +4137,15 @@ static pci_ers_result_t qlge_io_slot_reset(struct pci_dev *pdev)
struct net_device *ndev = pci_get_drvdata(pdev); struct net_device *ndev = pci_get_drvdata(pdev);
struct ql_adapter *qdev = netdev_priv(ndev); struct ql_adapter *qdev = netdev_priv(ndev);
pdev->error_state = pci_channel_io_normal;
pci_restore_state(pdev);
if (pci_enable_device(pdev)) { if (pci_enable_device(pdev)) {
QPRINTK(qdev, IFUP, ERR, QPRINTK(qdev, IFUP, ERR,
"Cannot re-enable PCI device after reset.\n"); "Cannot re-enable PCI device after reset.\n");
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
} }
pci_set_master(pdev); pci_set_master(pdev);
netif_carrier_off(ndev);
ql_adapter_reset(qdev);
/* Make sure the EEPROM is good */
memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
if (!is_valid_ether_addr(ndev->perm_addr)) {
QPRINTK(qdev, IFUP, ERR, "After reset, invalid MAC address.\n");
return PCI_ERS_RESULT_DISCONNECT;
}
return PCI_ERS_RESULT_RECOVERED; return PCI_ERS_RESULT_RECOVERED;
} }
@ -4131,17 +4153,21 @@ static void qlge_io_resume(struct pci_dev *pdev)
{ {
struct net_device *ndev = pci_get_drvdata(pdev); struct net_device *ndev = pci_get_drvdata(pdev);
struct ql_adapter *qdev = netdev_priv(ndev); struct ql_adapter *qdev = netdev_priv(ndev);
int err = 0;
pci_set_master(pdev); if (ql_adapter_reset(qdev))
QPRINTK(qdev, DRV, ERR, "reset FAILED!\n");
if (netif_running(ndev)) { if (netif_running(ndev)) {
if (ql_adapter_up(qdev)) { err = qlge_open(ndev);
if (err) {
QPRINTK(qdev, IFUP, ERR, QPRINTK(qdev, IFUP, ERR,
"Device initialization failed after reset.\n"); "Device initialization failed after reset.\n");
return; return;
} }
} else {
QPRINTK(qdev, IFUP, ERR,
"Device was not running prior to EEH.\n");
} }
netif_device_attach(ndev); netif_device_attach(ndev);
} }

View File

@ -470,7 +470,8 @@ end:
*/ */
static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
{ {
int status, count; int status;
unsigned long count;
/* Begin polled mode for MPI */ /* Begin polled mode for MPI */
@ -491,9 +492,9 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
/* Wait for the command to complete. We loop /* Wait for the command to complete. We loop
* here because some AEN might arrive while * here because some AEN might arrive while
* we're waiting for the mailbox command to * we're waiting for the mailbox command to
* complete. If more than 5 arrive then we can * complete. If more than 5 seconds expire we can
* assume something is wrong. */ * assume something is wrong. */
count = 5; count = jiffies + HZ * MAILBOX_TIMEOUT;
do { do {
/* Wait for the interrupt to come in. */ /* Wait for the interrupt to come in. */
status = ql_wait_mbx_cmd_cmplt(qdev); status = ql_wait_mbx_cmd_cmplt(qdev);
@ -517,15 +518,15 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
MB_CMD_STS_GOOD) || MB_CMD_STS_GOOD) ||
((mbcp->mbox_out[0] & 0x0000f000) == ((mbcp->mbox_out[0] & 0x0000f000) ==
MB_CMD_STS_INTRMDT)) MB_CMD_STS_INTRMDT))
break; goto done;
} while (--count); } while (time_before(jiffies, count));
if (!count) { QPRINTK(qdev, DRV, ERR,
QPRINTK(qdev, DRV, ERR, "Timed out waiting for mailbox complete.\n");
"Timed out waiting for mailbox complete.\n"); status = -ETIMEDOUT;
status = -ETIMEDOUT; goto end;
goto end;
} done:
/* Now we can clear the interrupt condition /* Now we can clear the interrupt condition
* and look at our status. * and look at our status.

View File

@ -1029,7 +1029,10 @@ static void rtl8169_vlan_rx_register(struct net_device *dev,
spin_lock_irqsave(&tp->lock, flags); spin_lock_irqsave(&tp->lock, flags);
tp->vlgrp = grp; tp->vlgrp = grp;
if (tp->vlgrp) /*
* Do not disable RxVlan on 8110SCd.
*/
if (tp->vlgrp || (tp->mac_version == RTL_GIGA_MAC_VER_05))
tp->cp_cmd |= RxVlan; tp->cp_cmd |= RxVlan;
else else
tp->cp_cmd &= ~RxVlan; tp->cp_cmd &= ~RxVlan;
@ -3197,6 +3200,14 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
rtl8169_init_phy(dev, tp); rtl8169_init_phy(dev, tp);
/*
* Pretend we are using VLANs; This bypasses a nasty bug where
* Interrupts stop flowing on high load on 8110SCd controllers.
*/
if (tp->mac_version == RTL_GIGA_MAC_VER_05)
RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) | RxVlan);
device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL); device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL);
out: out:

View File

@ -444,7 +444,8 @@ static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue,
* the appropriate LRO method * the appropriate LRO method
*/ */
static void efx_rx_packet_lro(struct efx_channel *channel, static void efx_rx_packet_lro(struct efx_channel *channel,
struct efx_rx_buffer *rx_buf) struct efx_rx_buffer *rx_buf,
bool checksummed)
{ {
struct napi_struct *napi = &channel->napi_str; struct napi_struct *napi = &channel->napi_str;
@ -466,7 +467,8 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
skb->len = rx_buf->len; skb->len = rx_buf->len;
skb->data_len = rx_buf->len; skb->data_len = rx_buf->len;
skb->truesize += rx_buf->len; skb->truesize += rx_buf->len;
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed =
checksummed ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE;
napi_gro_frags(napi); napi_gro_frags(napi);
@ -475,6 +477,7 @@ out:
rx_buf->page = NULL; rx_buf->page = NULL;
} else { } else {
EFX_BUG_ON_PARANOID(!rx_buf->skb); EFX_BUG_ON_PARANOID(!rx_buf->skb);
EFX_BUG_ON_PARANOID(!checksummed);
napi_gro_receive(napi, rx_buf->skb); napi_gro_receive(napi, rx_buf->skb);
rx_buf->skb = NULL; rx_buf->skb = NULL;
@ -570,7 +573,7 @@ void __efx_rx_packet(struct efx_channel *channel,
} }
if (likely(checksummed || rx_buf->page)) { if (likely(checksummed || rx_buf->page)) {
efx_rx_packet_lro(channel, rx_buf); efx_rx_packet_lro(channel, rx_buf, checksummed);
goto done; goto done;
} }

View File

@ -30,6 +30,7 @@
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/cacheflush.h>
#include "sh_eth.h" #include "sh_eth.h"

View File

@ -649,6 +649,10 @@ static const struct usb_device_id products[] = {
USB_DEVICE(0x0fe6, 0x8101), /* DM9601 USB to Fast Ethernet Adapter */ USB_DEVICE(0x0fe6, 0x8101), /* DM9601 USB to Fast Ethernet Adapter */
.driver_info = (unsigned long)&dm9601_info, .driver_info = (unsigned long)&dm9601_info,
}, },
{
USB_DEVICE(0x0a46, 0x9000), /* DM9000E */
.driver_info = (unsigned long)&dm9601_info,
},
{}, // END {}, // END
}; };

View File

@ -516,8 +516,7 @@ again:
/* Free up any pending old buffers before queueing new ones. */ /* Free up any pending old buffers before queueing new ones. */
free_old_xmit_skbs(vi); free_old_xmit_skbs(vi);
/* Put new one in send queue and do transmit */ /* Try to transmit */
__skb_queue_head(&vi->send, skb);
capacity = xmit_skb(vi, skb); capacity = xmit_skb(vi, skb);
/* This can happen with OOM and indirect buffers. */ /* This can happen with OOM and indirect buffers. */
@ -531,8 +530,17 @@ again:
} }
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
vi->svq->vq_ops->kick(vi->svq); vi->svq->vq_ops->kick(vi->svq);
/*
* Put new one in send queue. You'd expect we'd need this before
* xmit_skb calls add_buf(), since the callback can be triggered
* immediately after that. But since the callback just triggers
* another call back here, normal network xmit locking prevents the
* race.
*/
__skb_queue_head(&vi->send, skb);
/* Don't wait up for transmitted skbs to be freed. */ /* Don't wait up for transmitted skbs to be freed. */
skb_orphan(skb); skb_orphan(skb);
nf_reset(skb); nf_reset(skb);

View File

@ -4790,9 +4790,8 @@ static int proc_stats_rid_open( struct inode *inode,
static int get_dec_u16( char *buffer, int *start, int limit ) { static int get_dec_u16( char *buffer, int *start, int limit ) {
u16 value; u16 value;
int valid = 0; int valid = 0;
for( value = 0; buffer[*start] >= '0' && for (value = 0; *start < limit && buffer[*start] >= '0' &&
buffer[*start] <= '9' && buffer[*start] <= '9'; (*start)++) {
*start < limit; (*start)++ ) {
valid = 1; valid = 1;
value *= 10; value *= 10;
value += buffer[*start] - '0'; value += buffer[*start] - '0';

View File

@ -1,6 +1,7 @@
#ifndef B43_LEDS_H_ #ifndef B43_LEDS_H_
#define B43_LEDS_H_ #define B43_LEDS_H_
struct b43_wl;
struct b43_wldev; struct b43_wldev;
#ifdef CONFIG_B43_LEDS #ifdef CONFIG_B43_LEDS

View File

@ -4501,7 +4501,6 @@ static void b43_op_stop(struct ieee80211_hw *hw)
cancel_work_sync(&(wl->beacon_update_trigger)); cancel_work_sync(&(wl->beacon_update_trigger));
wiphy_rfkill_stop_polling(hw->wiphy);
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
if (b43_status(dev) >= B43_STAT_STARTED) { if (b43_status(dev) >= B43_STAT_STARTED) {
dev = b43_wireless_core_stop(dev); dev = b43_wireless_core_stop(dev);

View File

@ -33,7 +33,8 @@ bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
& B43_MMIO_RADIO_HWENABLED_HI_MASK)) & B43_MMIO_RADIO_HWENABLED_HI_MASK))
return 1; return 1;
} else { } else {
if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO) if (b43_status(dev) >= B43_STAT_STARTED &&
b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
& B43_MMIO_RADIO_HWENABLED_LO_MASK) & B43_MMIO_RADIO_HWENABLED_LO_MASK)
return 1; return 1;
} }

View File

@ -134,7 +134,7 @@ static void spu_transaction_finish(struct if_spi_card *card)
static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len) static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len)
{ {
int err = 0; int err = 0;
u16 reg_out = cpu_to_le16(reg | IF_SPI_WRITE_OPERATION_MASK); __le16 reg_out = cpu_to_le16(reg | IF_SPI_WRITE_OPERATION_MASK);
struct spi_message m; struct spi_message m;
struct spi_transfer reg_trans; struct spi_transfer reg_trans;
struct spi_transfer data_trans; struct spi_transfer data_trans;
@ -166,7 +166,7 @@ static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len)
static inline int spu_write_u16(struct if_spi_card *card, u16 reg, u16 val) static inline int spu_write_u16(struct if_spi_card *card, u16 reg, u16 val)
{ {
u16 buff; __le16 buff;
buff = cpu_to_le16(val); buff = cpu_to_le16(val);
return spu_write(card, reg, (u8 *)&buff, sizeof(u16)); return spu_write(card, reg, (u8 *)&buff, sizeof(u16));
@ -188,7 +188,7 @@ static int spu_read(struct if_spi_card *card, u16 reg, u8 *buf, int len)
{ {
unsigned int delay; unsigned int delay;
int err = 0; int err = 0;
u16 reg_out = cpu_to_le16(reg | IF_SPI_READ_OPERATION_MASK); __le16 reg_out = cpu_to_le16(reg | IF_SPI_READ_OPERATION_MASK);
struct spi_message m; struct spi_message m;
struct spi_transfer reg_trans; struct spi_transfer reg_trans;
struct spi_transfer dummy_trans; struct spi_transfer dummy_trans;
@ -235,7 +235,7 @@ static int spu_read(struct if_spi_card *card, u16 reg, u8 *buf, int len)
/* Read 16 bits from an SPI register */ /* Read 16 bits from an SPI register */
static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val) static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val)
{ {
u16 buf; __le16 buf;
int ret; int ret;
ret = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); ret = spu_read(card, reg, (u8 *)&buf, sizeof(buf));
@ -248,7 +248,7 @@ static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val)
* The low 16 bits are read first. */ * The low 16 bits are read first. */
static int spu_read_u32(struct if_spi_card *card, u16 reg, u32 *val) static int spu_read_u32(struct if_spi_card *card, u16 reg, u32 *val)
{ {
u32 buf; __le32 buf;
int err; int err;
err = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); err = spu_read(card, reg, (u8 *)&buf, sizeof(buf));

View File

@ -1994,7 +1994,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
(skbdesc->entry->entry_idx + 1) : 0xff); txdesc->key_idx : 0xff);
rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT,
skb->len - txdesc->l2pad); skb->len - txdesc->l2pad);
rt2x00_set_field32(&word, TXWI_W1_PACKETID, rt2x00_set_field32(&word, TXWI_W1_PACKETID,

View File

@ -335,6 +335,7 @@ struct pktgen_dev {
__u32 cur_src_mac_offset; __u32 cur_src_mac_offset;
__be32 cur_saddr; __be32 cur_saddr;
__be32 cur_daddr; __be32 cur_daddr;
__u16 ip_id;
__u16 cur_udp_dst; __u16 cur_udp_dst;
__u16 cur_udp_src; __u16 cur_udp_src;
__u16 cur_queue_map; __u16 cur_queue_map;
@ -2630,6 +2631,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
iph->protocol = IPPROTO_UDP; /* UDP */ iph->protocol = IPPROTO_UDP; /* UDP */
iph->saddr = pkt_dev->cur_saddr; iph->saddr = pkt_dev->cur_saddr;
iph->daddr = pkt_dev->cur_daddr; iph->daddr = pkt_dev->cur_daddr;
iph->id = htons(pkt_dev->ip_id);
pkt_dev->ip_id++;
iph->frag_off = 0; iph->frag_off = 0;
iplen = 20 + 8 + datalen; iplen = 20 + 8 + datalen;
iph->tot_len = htons(iplen); iph->tot_len = htons(iplen);
@ -2641,24 +2644,26 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
skb->dev = odev; skb->dev = odev;
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
if (pkt_dev->nfrags <= 0) if (pkt_dev->nfrags <= 0) {
pgh = (struct pktgen_hdr *)skb_put(skb, datalen); pgh = (struct pktgen_hdr *)skb_put(skb, datalen);
else { memset(pgh + 1, 0, datalen - sizeof(struct pktgen_hdr));
} else {
int frags = pkt_dev->nfrags; int frags = pkt_dev->nfrags;
int i; int i, len;
pgh = (struct pktgen_hdr *)(((char *)(udph)) + 8); pgh = (struct pktgen_hdr *)(((char *)(udph)) + 8);
if (frags > MAX_SKB_FRAGS) if (frags > MAX_SKB_FRAGS)
frags = MAX_SKB_FRAGS; frags = MAX_SKB_FRAGS;
if (datalen > frags * PAGE_SIZE) { if (datalen > frags * PAGE_SIZE) {
skb_put(skb, datalen - frags * PAGE_SIZE); len = datalen - frags * PAGE_SIZE;
memset(skb_put(skb, len), 0, len);
datalen = frags * PAGE_SIZE; datalen = frags * PAGE_SIZE;
} }
i = 0; i = 0;
while (datalen > 0) { while (datalen > 0) {
struct page *page = alloc_pages(GFP_KERNEL, 0); struct page *page = alloc_pages(GFP_KERNEL | __GFP_ZERO, 0);
skb_shinfo(skb)->frags[i].page = page; skb_shinfo(skb)->frags[i].page = page;
skb_shinfo(skb)->frags[i].page_offset = 0; skb_shinfo(skb)->frags[i].page_offset = 0;
skb_shinfo(skb)->frags[i].size = skb_shinfo(skb)->frags[i].size =

View File

@ -352,13 +352,24 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
skb->transport_header = skb->network_header; skb->transport_header = skb->network_header;
err = memcpy_fromiovecend((void *)iph, from, 0, length); err = -EFAULT;
if (err) if (memcpy_fromiovecend((void *)iph, from, 0, length))
goto error_fault; goto error_free;
/* We don't modify invalid header */
iphlen = iph->ihl * 4; iphlen = iph->ihl * 4;
if (iphlen >= sizeof(*iph) && iphlen <= length) {
/*
* We don't want to modify the ip header, but we do need to
* be sure that it won't cause problems later along the network
* stack. Specifically we want to make sure that iph->ihl is a
* sane value. If ihl points beyond the length of the buffer passed
* in, reject the frame as invalid
*/
err = -EINVAL;
if (iphlen > length)
goto error_free;
if (iphlen >= sizeof(*iph)) {
if (!iph->saddr) if (!iph->saddr)
iph->saddr = rt->rt_src; iph->saddr = rt->rt_src;
iph->check = 0; iph->check = 0;
@ -381,8 +392,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
out: out:
return 0; return 0;
error_fault: error_free:
err = -EFAULT;
kfree_skb(skb); kfree_skb(skb);
error: error:
IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS); IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS);

View File

@ -1442,9 +1442,9 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
goto found_ok_skb; goto found_ok_skb;
if (tcp_hdr(skb)->fin) if (tcp_hdr(skb)->fin)
goto found_fin_ok; goto found_fin_ok;
if (WARN_ON(!(flags & MSG_PEEK))) WARN(!(flags & MSG_PEEK), KERN_INFO "recvmsg bug 2: "
printk(KERN_INFO "recvmsg bug 2: copied %X " "copied %X seq %X\n", *seq,
"seq %X\n", *seq, TCP_SKB_CB(skb)->seq); TCP_SKB_CB(skb)->seq);
} }
/* Well, if we have backlog, try to process it now yet. */ /* Well, if we have backlog, try to process it now yet. */

View File

@ -538,13 +538,12 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
WLAN_CAPABILITY_PRIVACY, WLAN_CAPABILITY_PRIVACY,
capability); capability);
if (bss) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG #ifdef CONFIG_MAC80211_IBSS_DEBUG
if (bss)
printk(KERN_DEBUG " sta_find_ibss: selected %pM current " printk(KERN_DEBUG " sta_find_ibss: selected %pM current "
"%pM\n", bss->cbss.bssid, ifibss->bssid); "%pM\n", bss->cbss.bssid, ifibss->bssid);
#endif /* CONFIG_MAC80211_IBSS_DEBUG */ #endif /* CONFIG_MAC80211_IBSS_DEBUG */
if (bss && !memcmp(ifibss->bssid, bss->cbss.bssid, ETH_ALEN)) {
printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM"
" based on configured SSID\n", " based on configured SSID\n",
sdata->dev->name, bss->cbss.bssid); sdata->dev->name, bss->cbss.bssid);
@ -552,8 +551,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
ieee80211_sta_join_ibss(sdata, bss); ieee80211_sta_join_ibss(sdata, bss);
ieee80211_rx_bss_put(local, bss); ieee80211_rx_bss_put(local, bss);
return; return;
} else if (bss) }
ieee80211_rx_bss_put(local, bss);
#ifdef CONFIG_MAC80211_IBSS_DEBUG #ifdef CONFIG_MAC80211_IBSS_DEBUG
printk(KERN_DEBUG " did not try to join ibss\n"); printk(KERN_DEBUG " did not try to join ibss\n");

View File

@ -259,7 +259,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,
* @hwmp_ie: hwmp information element (PREP or PREQ) * @hwmp_ie: hwmp information element (PREP or PREQ)
* *
* This function updates the path routing information to the originator and the * This function updates the path routing information to the originator and the
* transmitter of a HWMP PREQ or PREP fram. * transmitter of a HWMP PREQ or PREP frame.
* *
* Returns: metric to frame originator or 0 if the frame should not be further * Returns: metric to frame originator or 0 if the frame should not be further
* processed * processed

View File

@ -1457,8 +1457,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
if (status_code != WLAN_STATUS_SUCCESS) { if (status_code != WLAN_STATUS_SUCCESS) {
printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
sdata->dev->name, status_code); sdata->dev->name, status_code);
list_del(&wk->list); wk->state = IEEE80211_MGD_STATE_IDLE;
kfree(wk);
return RX_MGMT_CFG80211_ASSOC; return RX_MGMT_CFG80211_ASSOC;
} }

View File

@ -1445,7 +1445,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) if (tmp_sdata->vif.type != NL80211_IFTYPE_AP)
continue; continue;
if (compare_ether_addr(tmp_sdata->dev->dev_addr, if (compare_ether_addr(tmp_sdata->dev->dev_addr,
hdr->addr2)) { hdr->addr2) == 0) {
dev_hold(tmp_sdata->dev); dev_hold(tmp_sdata->dev);
dev_put(sdata->dev); dev_put(sdata->dev);
sdata = tmp_sdata; sdata = tmp_sdata;

View File

@ -982,10 +982,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
goto out_put; goto out_put;
size_max = po->tx_ring.frame_size size_max = po->tx_ring.frame_size
- sizeof(struct skb_shared_info) - (po->tp_hdrlen - sizeof(struct sockaddr_ll));
- po->tp_hdrlen
- LL_ALLOCATED_SPACE(dev)
- sizeof(struct sockaddr_ll);
if (size_max > dev->mtu + reserve) if (size_max > dev->mtu + reserve)
size_max = dev->mtu + reserve; size_max = dev->mtu + reserve;

View File

@ -358,6 +358,7 @@ int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev); struct wireless_dev *wdev);
void cfg80211_conn_work(struct work_struct *work); void cfg80211_conn_work(struct work_struct *work);
void cfg80211_sme_failed_assoc(struct wireless_dev *wdev);
bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev); bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev);
/* internal helpers */ /* internal helpers */

View File

@ -62,6 +62,7 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
u8 *ie = mgmt->u.assoc_resp.variable; u8 *ie = mgmt->u.assoc_resp.variable;
int i, ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); int i, ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
struct cfg80211_internal_bss *bss = NULL; struct cfg80211_internal_bss *bss = NULL;
bool need_connect_result = true;
wdev_lock(wdev); wdev_lock(wdev);
@ -94,6 +95,14 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
} }
WARN_ON(!bss); WARN_ON(!bss);
} else if (wdev->conn) {
cfg80211_sme_failed_assoc(wdev);
need_connect_result = false;
/*
* do not call connect_result() now because the
* sme will schedule work that does it later.
*/
goto out;
} }
if (!wdev->conn && wdev->sme_state == CFG80211_SME_IDLE) { if (!wdev->conn && wdev->sme_state == CFG80211_SME_IDLE) {

View File

@ -26,6 +26,7 @@ struct cfg80211_conn {
CFG80211_CONN_AUTHENTICATING, CFG80211_CONN_AUTHENTICATING,
CFG80211_CONN_ASSOCIATE_NEXT, CFG80211_CONN_ASSOCIATE_NEXT,
CFG80211_CONN_ASSOCIATING, CFG80211_CONN_ASSOCIATING,
CFG80211_CONN_DEAUTH_ASSOC_FAIL,
} state; } state;
u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
u8 *ie; u8 *ie;
@ -148,6 +149,12 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
NULL, 0, NULL, 0,
WLAN_REASON_DEAUTH_LEAVING); WLAN_REASON_DEAUTH_LEAVING);
return err; return err;
case CFG80211_CONN_DEAUTH_ASSOC_FAIL:
__cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
NULL, 0,
WLAN_REASON_DEAUTH_LEAVING);
/* return an error so that we call __cfg80211_connect_result() */
return -EINVAL;
default: default:
return 0; return 0;
} }
@ -158,6 +165,7 @@ void cfg80211_conn_work(struct work_struct *work)
struct cfg80211_registered_device *rdev = struct cfg80211_registered_device *rdev =
container_of(work, struct cfg80211_registered_device, conn_work); container_of(work, struct cfg80211_registered_device, conn_work);
struct wireless_dev *wdev; struct wireless_dev *wdev;
u8 bssid[ETH_ALEN];
rtnl_lock(); rtnl_lock();
cfg80211_lock_rdev(rdev); cfg80211_lock_rdev(rdev);
@ -173,10 +181,10 @@ void cfg80211_conn_work(struct work_struct *work)
wdev_unlock(wdev); wdev_unlock(wdev);
continue; continue;
} }
memcpy(bssid, wdev->conn->params.bssid, ETH_ALEN);
if (cfg80211_conn_do_work(wdev)) if (cfg80211_conn_do_work(wdev))
__cfg80211_connect_result( __cfg80211_connect_result(
wdev->netdev, wdev->netdev, bssid,
wdev->conn->params.bssid,
NULL, 0, NULL, 0, NULL, 0, NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE, WLAN_STATUS_UNSPECIFIED_FAILURE,
false, NULL); false, NULL);
@ -337,6 +345,15 @@ bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev)
return true; return true;
} }
void cfg80211_sme_failed_assoc(struct wireless_dev *wdev)
{
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
wdev->conn->state = CFG80211_CONN_DEAUTH_ASSOC_FAIL;
schedule_work(&rdev->conn_work);
}
void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
const u8 *req_ie, size_t req_ie_len, const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len, const u8 *resp_ie, size_t resp_ie_len,