Commit 00ab2f3d authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6

parents 4cf808eb f5e2a7b2
...@@ -2020,8 +2020,8 @@ config SIS190 ...@@ -2020,8 +2020,8 @@ config SIS190
will be called sis190. This is recommended. will be called sis190. This is recommended.
config SKGE config SKGE
tristate "New SysKonnect GigaEthernet support (EXPERIMENTAL)" tristate "New SysKonnect GigaEthernet support"
depends on PCI && EXPERIMENTAL depends on PCI
select CRC32 select CRC32
---help--- ---help---
This driver support the Marvell Yukon or SysKonnect SK-98xx/SK-95xx This driver support the Marvell Yukon or SysKonnect SK-98xx/SK-95xx
...@@ -2082,7 +2082,6 @@ config SK98LIN ...@@ -2082,7 +2082,6 @@ config SK98LIN
- Allied Telesyn AT-2971SX Gigabit Ethernet Adapter - Allied Telesyn AT-2971SX Gigabit Ethernet Adapter
- Allied Telesyn AT-2971T Gigabit Ethernet Adapter - Allied Telesyn AT-2971T Gigabit Ethernet Adapter
- Belkin Gigabit Desktop Card 10/100/1000Base-T Adapter, Copper RJ-45 - Belkin Gigabit Desktop Card 10/100/1000Base-T Adapter, Copper RJ-45
- DGE-530T Gigabit Ethernet Adapter
- EG1032 v2 Instant Gigabit Network Adapter - EG1032 v2 Instant Gigabit Network Adapter
- EG1064 v2 Instant Gigabit Network Adapter - EG1064 v2 Instant Gigabit Network Adapter
- Marvell 88E8001 Gigabit LOM Ethernet Adapter (Abit) - Marvell 88E8001 Gigabit LOM Ethernet Adapter (Abit)
......
...@@ -1581,6 +1581,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1581,6 +1581,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
printk(KERN_INFO DRV_NAME printk(KERN_INFO DRV_NAME
": %s: %s not enslaved\n", ": %s: %s not enslaved\n",
bond_dev->name, slave_dev->name); bond_dev->name, slave_dev->name);
write_unlock_bh(&bond->lock);
return -EINVAL; return -EINVAL;
} }
......
...@@ -1791,6 +1791,8 @@ static int __devinit sis190_init_one(struct pci_dev *pdev, ...@@ -1791,6 +1791,8 @@ static int __devinit sis190_init_one(struct pci_dev *pdev,
goto out; goto out;
} }
pci_set_drvdata(pdev, dev);
tp = netdev_priv(dev); tp = netdev_priv(dev);
ioaddr = tp->mmio_addr; ioaddr = tp->mmio_addr;
...@@ -1827,8 +1829,6 @@ static int __devinit sis190_init_one(struct pci_dev *pdev, ...@@ -1827,8 +1829,6 @@ static int __devinit sis190_init_one(struct pci_dev *pdev,
if (rc < 0) if (rc < 0)
goto err_remove_mii; goto err_remove_mii;
pci_set_drvdata(pdev, dev);
net_probe(tp, KERN_INFO "%s: %s at %p (IRQ: %d), " net_probe(tp, KERN_INFO "%s: %s at %p (IRQ: %d), "
"%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
pci_name(pdev), sis_chip_info[ent->driver_data].name, pci_name(pdev), sis_chip_info[ent->driver_data].name,
......
...@@ -1697,6 +1697,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port) ...@@ -1697,6 +1697,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_SET); skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_SET);
skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_CLR); skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_CLR);
skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR); skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON | GMC_RST_CLR);
if (skge->autoneg == AUTONEG_DISABLE) { if (skge->autoneg == AUTONEG_DISABLE) {
reg = GM_GPCR_AU_ALL_DIS; reg = GM_GPCR_AU_ALL_DIS;
gma_write16(hw, port, GM_GP_CTRL, gma_write16(hw, port, GM_GP_CTRL,
...@@ -1704,16 +1705,23 @@ static void yukon_mac_init(struct skge_hw *hw, int port) ...@@ -1704,16 +1705,23 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
switch (skge->speed) { switch (skge->speed) {
case SPEED_1000: case SPEED_1000:
reg &= ~GM_GPCR_SPEED_100;
reg |= GM_GPCR_SPEED_1000; reg |= GM_GPCR_SPEED_1000;
/* fallthru */ break;
case SPEED_100: case SPEED_100:
reg &= ~GM_GPCR_SPEED_1000;
reg |= GM_GPCR_SPEED_100; reg |= GM_GPCR_SPEED_100;
break;
case SPEED_10:
reg &= ~(GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100);
break;
} }
if (skge->duplex == DUPLEX_FULL) if (skge->duplex == DUPLEX_FULL)
reg |= GM_GPCR_DUP_FULL; reg |= GM_GPCR_DUP_FULL;
} else } else
reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL; reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL;
switch (skge->flow_control) { switch (skge->flow_control) {
case FLOW_MODE_NONE: case FLOW_MODE_NONE:
skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
......
...@@ -520,10 +520,16 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) ...@@ -520,10 +520,16 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
switch (sky2->speed) { switch (sky2->speed) {
case SPEED_1000: case SPEED_1000:
reg &= ~GM_GPCR_SPEED_100;
reg |= GM_GPCR_SPEED_1000; reg |= GM_GPCR_SPEED_1000;
/* fallthru */ break;
case SPEED_100: case SPEED_100:
reg &= ~GM_GPCR_SPEED_1000;
reg |= GM_GPCR_SPEED_100; reg |= GM_GPCR_SPEED_100;
break;
case SPEED_10:
reg &= ~(GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100);
break;
} }
if (sky2->duplex == DUPLEX_FULL) if (sky2->duplex == DUPLEX_FULL)
...@@ -1446,6 +1452,29 @@ static void sky2_link_up(struct sky2_port *sky2) ...@@ -1446,6 +1452,29 @@ static void sky2_link_up(struct sky2_port *sky2)
sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), GMAC_DEF_MSK); sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), GMAC_DEF_MSK);
reg = gma_read16(hw, port, GM_GP_CTRL); reg = gma_read16(hw, port, GM_GP_CTRL);
if (sky2->autoneg == AUTONEG_DISABLE) {
reg |= GM_GPCR_AU_ALL_DIS;
/* Is write/read necessary? Copied from sky2_mac_init */
gma_write16(hw, port, GM_GP_CTRL, reg);
gma_read16(hw, port, GM_GP_CTRL);
switch (sky2->speed) {
case SPEED_1000:
reg &= ~GM_GPCR_SPEED_100;
reg |= GM_GPCR_SPEED_1000;
break;
case SPEED_100:
reg &= ~GM_GPCR_SPEED_1000;
reg |= GM_GPCR_SPEED_100;
break;
case SPEED_10:
reg &= ~(GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100);
break;
}
} else
reg &= ~GM_GPCR_AU_ALL_DIS;
if (sky2->duplex == DUPLEX_FULL || sky2->autoneg == AUTONEG_ENABLE) if (sky2->duplex == DUPLEX_FULL || sky2->autoneg == AUTONEG_ENABLE)
reg |= GM_GPCR_DUP_FULL; reg |= GM_GPCR_DUP_FULL;
......
...@@ -1042,7 +1042,7 @@ typedef struct net_local { ...@@ -1042,7 +1042,7 @@ typedef struct net_local {
__u16 functional_address[2]; __u16 functional_address[2];
__u16 bitwise_group_address[2]; __u16 bitwise_group_address[2];
__u8 *ptr_ucode; const __u8 *ptr_ucode;
__u8 cleanup; __u8 cleanup;
......
...@@ -1872,7 +1872,7 @@ static int atmel_set_encodeext(struct net_device *dev, ...@@ -1872,7 +1872,7 @@ static int atmel_set_encodeext(struct net_device *dev,
struct atmel_private *priv = netdev_priv(dev); struct atmel_private *priv = netdev_priv(dev);
struct iw_point *encoding = &wrqu->encoding; struct iw_point *encoding = &wrqu->encoding;
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
int idx, key_len; int idx, key_len, alg = ext->alg, set_key = 1;
/* Determine and validate the key index */ /* Determine and validate the key index */
idx = encoding->flags & IW_ENCODE_INDEX; idx = encoding->flags & IW_ENCODE_INDEX;
...@@ -1883,39 +1883,42 @@ static int atmel_set_encodeext(struct net_device *dev, ...@@ -1883,39 +1883,42 @@ static int atmel_set_encodeext(struct net_device *dev,
} else } else
idx = priv->default_key; idx = priv->default_key;
if ((encoding->flags & IW_ENCODE_DISABLED) || if (encoding->flags & IW_ENCODE_DISABLED)
ext->alg == IW_ENCODE_ALG_NONE) { alg = IW_ENCODE_ALG_NONE;
priv->wep_is_on = 0;
priv->encryption_level = 0;
priv->pairwise_cipher_suite = CIPHER_SUITE_NONE;
}
if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
priv->default_key = idx; priv->default_key = idx;
set_key = ext->key_len > 0 ? 1 : 0;
}
/* Set the requested key */ if (set_key) {
switch (ext->alg) { /* Set the requested key first */
case IW_ENCODE_ALG_NONE: switch (alg) {
break; case IW_ENCODE_ALG_NONE:
case IW_ENCODE_ALG_WEP: priv->wep_is_on = 0;
if (ext->key_len > 5) { priv->encryption_level = 0;
priv->wep_key_len[idx] = 13; priv->pairwise_cipher_suite = CIPHER_SUITE_NONE;
priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; break;
priv->encryption_level = 2; case IW_ENCODE_ALG_WEP:
} else if (ext->key_len > 0) { if (ext->key_len > 5) {
priv->wep_key_len[idx] = 5; priv->wep_key_len[idx] = 13;
priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128;
priv->encryption_level = 1; priv->encryption_level = 2;
} else { } else if (ext->key_len > 0) {
priv->wep_key_len[idx] = 5;
priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64;
priv->encryption_level = 1;
} else {
return -EINVAL;
}
priv->wep_is_on = 1;
memset(priv->wep_keys[idx], 0, 13);
key_len = min ((int)ext->key_len, priv->wep_key_len[idx]);
memcpy(priv->wep_keys[idx], ext->key, key_len);
break;
default:
return -EINVAL; return -EINVAL;
} }
priv->wep_is_on = 1;
memset(priv->wep_keys[idx], 0, 13);
key_len = min ((int)ext->key_len, priv->wep_key_len[idx]);
memcpy(priv->wep_keys[idx], ext->key, key_len);
break;
default:
return -EINVAL;
} }
return -EINPROGRESS; return -EINPROGRESS;
...@@ -3061,17 +3064,26 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) ...@@ -3061,17 +3064,26 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
} }
if (status == C80211_MGMT_SC_Success && priv->wep_is_on) { if (status == C80211_MGMT_SC_Success && priv->wep_is_on) {
int should_associate = 0;
/* WEP */ /* WEP */
if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum)
return; return;
if (trans_seq_no == 0x0002 && if (system == C80211_MGMT_AAN_OPENSYSTEM) {
auth->el_id == C80211_MGMT_ElementID_ChallengeText) { if (trans_seq_no == 0x0002) {
send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); should_associate = 1;
return; }
} else if (system == C80211_MGMT_AAN_SHAREDKEY) {
if (trans_seq_no == 0x0002 &&
auth->el_id == C80211_MGMT_ElementID_ChallengeText) {
send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len);
return;
} else if (trans_seq_no == 0x0004) {
should_associate = 1;
}
} }
if (trans_seq_no == 0x0004) { if (should_associate) {
if(priv->station_was_associated) { if(priv->station_was_associated) {
atmel_enter_state(priv, STATION_STATE_REASSOCIATING); atmel_enter_state(priv, STATION_STATE_REASSOCIATING);
send_association_request(priv, 1); send_association_request(priv, 1);
...@@ -3084,11 +3096,13 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) ...@@ -3084,11 +3096,13 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
} }
} }
if (status == C80211_MGMT_SC_AuthAlgNotSupported) { if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {
/* Do opensystem first, then try sharedkey */ /* Do opensystem first, then try sharedkey */
if (system == C80211_MGMT_AAN_OPENSYSTEM) { if (system == WLAN_AUTH_OPEN) {
priv->CurrentAuthentTransactionSeqNum = 0x001; priv->CurrentAuthentTransactionSeqNum = 0x001;
send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); priv->exclude_unencrypted = 1;
send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0);
return;
} else if (priv->connect_to_any_BSS) { } else if (priv->connect_to_any_BSS) {
int bss_index; int bss_index;
...@@ -3439,10 +3453,13 @@ static void atmel_management_timer(u_long a) ...@@ -3439,10 +3453,13 @@ static void atmel_management_timer(u_long a)
priv->AuthenticationRequestRetryCnt = 0; priv->AuthenticationRequestRetryCnt = 0;
restart_search(priv); restart_search(priv);
} else { } else {
int auth = C80211_MGMT_AAN_OPENSYSTEM;
priv->AuthenticationRequestRetryCnt++; priv->AuthenticationRequestRetryCnt++;
priv->CurrentAuthentTransactionSeqNum = 0x0001; priv->CurrentAuthentTransactionSeqNum = 0x0001;
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0); if (priv->wep_is_on && priv->exclude_unencrypted)
auth = C80211_MGMT_AAN_SHAREDKEY;
send_authentication_request(priv, auth, NULL, 0);
} }
break; break;
...@@ -3541,12 +3558,15 @@ static void atmel_command_irq(struct atmel_private *priv) ...@@ -3541,12 +3558,15 @@ static void atmel_command_irq(struct atmel_private *priv)
priv->station_was_associated = priv->station_is_associated; priv->station_was_associated = priv->station_is_associated;
atmel_enter_state(priv, STATION_STATE_READY); atmel_enter_state(priv, STATION_STATE_READY);
} else { } else {
int auth = C80211_MGMT_AAN_OPENSYSTEM;
priv->AuthenticationRequestRetryCnt = 0; priv->AuthenticationRequestRetryCnt = 0;
atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); atmel_enter_state(priv, STATION_STATE_AUTHENTICATING);
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
priv->CurrentAuthentTransactionSeqNum = 0x0001; priv->CurrentAuthentTransactionSeqNum = 0x0001;
send_authentication_request(priv, C80211_MGMT_AAN_SHAREDKEY, NULL, 0); if (priv->wep_is_on && priv->exclude_unencrypted)
auth = C80211_MGMT_AAN_SHAREDKEY;
send_authentication_request(priv, auth, NULL, 0);
} }
return; return;
} }
......
...@@ -950,16 +950,8 @@ wv_82593_cmd(struct net_device * dev, ...@@ -950,16 +950,8 @@ wv_82593_cmd(struct net_device * dev,
static inline int static inline int
wv_diag(struct net_device * dev) wv_diag(struct net_device * dev)
{ {
int ret = FALSE; return(wv_82593_cmd(dev, "wv_diag(): diagnose",
OP0_DIAGNOSE, SR0_DIAGNOSE_PASSED));
if(wv_82593_cmd(dev, "wv_diag(): diagnose",
OP0_DIAGNOSE, SR0_DIAGNOSE_PASSED))
ret = TRUE;
#ifdef DEBUG_CONFIG_ERRORS
printk(KERN_INFO "wavelan_cs: i82593 Self Test failed!\n");
#endif
return(ret);
} /* wv_diag */ } /* wv_diag */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
...@@ -3604,8 +3596,8 @@ wv_82593_config(struct net_device * dev) ...@@ -3604,8 +3596,8 @@ wv_82593_config(struct net_device * dev)
cfblk.lin_prio = 0; /* conform to 802.3 backoff algoritm */ cfblk.lin_prio = 0; /* conform to 802.3 backoff algoritm */
cfblk.exp_prio = 5; /* conform to 802.3 backoff algoritm */ cfblk.exp_prio = 5; /* conform to 802.3 backoff algoritm */
cfblk.bof_met = 1; /* conform to 802.3 backoff algoritm */ cfblk.bof_met = 1; /* conform to 802.3 backoff algoritm */
cfblk.ifrm_spc = 0x20; /* 32 bit times interframe spacing */ cfblk.ifrm_spc = 0x20 >> 4; /* 32 bit times interframe spacing */
cfblk.slottim_low = 0x20; /* 32 bit times slot time */ cfblk.slottim_low = 0x20 >> 5; /* 32 bit times slot time */
cfblk.slottim_hi = 0x0; cfblk.slottim_hi = 0x0;
cfblk.max_retr = 15; cfblk.max_retr = 15;
cfblk.prmisc = ((lp->promiscuous) ? TRUE: FALSE); /* Promiscuous mode */ cfblk.prmisc = ((lp->promiscuous) ? TRUE: FALSE); /* Promiscuous mode */
......
...@@ -98,9 +98,9 @@ lcs_register_debug_facility(void) ...@@ -98,9 +98,9 @@ lcs_register_debug_facility(void)
return -ENOMEM; return -ENOMEM;
} }
debug_register_view(lcs_dbf_setup, &debug_hex_ascii_view); debug_register_view(lcs_dbf_setup, &debug_hex_ascii_view);
debug_set_level(lcs_dbf_setup, 4); debug_set_level(lcs_dbf_setup, 2);
debug_register_view(lcs_dbf_trace, &debug_hex_ascii_view); debug_register_view(lcs_dbf_trace, &debug_hex_ascii_view);
debug_set_level(lcs_dbf_trace, 4); debug_set_level(lcs_dbf_trace, 2);
return 0; return 0;
} }
...@@ -1292,9 +1292,8 @@ lcs_set_multicast_list(struct net_device *dev) ...@@ -1292,9 +1292,8 @@ lcs_set_multicast_list(struct net_device *dev)
LCS_DBF_TEXT(4, trace, "setmulti"); LCS_DBF_TEXT(4, trace, "setmulti");
card = (struct lcs_card *) dev->priv; card = (struct lcs_card *) dev->priv;
if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD)) { if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD))
schedule_work(&card->kernel_thread_starter); schedule_work(&card->kernel_thread_starter);
}
} }
#endif /* CONFIG_IP_MULTICAST */ #endif /* CONFIG_IP_MULTICAST */
...@@ -1459,6 +1458,8 @@ lcs_txbuffer_cb(struct lcs_channel *channel, struct lcs_buffer *buffer) ...@@ -1459,6 +1458,8 @@ lcs_txbuffer_cb(struct lcs_channel *channel, struct lcs_buffer *buffer)
lcs_release_buffer(channel, buffer); lcs_release_buffer(channel, buffer);
card = (struct lcs_card *) card = (struct lcs_card *)
((char *) channel - offsetof(struct lcs_card, write)); ((char *) channel - offsetof(struct lcs_card, write));
if (netif_queue_stopped(card->dev))
netif_wake_queue(card->dev);
spin_lock(&card->lock); spin_lock(&card->lock);
card->tx_emitted--; card->tx_emitted--;
if (card->tx_emitted <= 0 && card->tx_buffer != NULL) if (card->tx_emitted <= 0 && card->tx_buffer != NULL)
...@@ -1478,6 +1479,7 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb, ...@@ -1478,6 +1479,7 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,
struct net_device *dev) struct net_device *dev)
{ {
struct lcs_header *header; struct lcs_header *header;
int rc = 0;
LCS_DBF_TEXT(5, trace, "hardxmit"); LCS_DBF_TEXT(5, trace, "hardxmit");
if (skb == NULL) { if (skb == NULL) {
...@@ -1492,10 +1494,8 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb, ...@@ -1492,10 +1494,8 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,
card->stats.tx_carrier_errors++; card->stats.tx_carrier_errors++;
return 0; return 0;
} }
if (netif_queue_stopped(dev) ) { netif_stop_queue(card->dev);
card->stats.tx_dropped++; spin_lock(&card->lock);
return -EBUSY;
}
if (card->tx_buffer != NULL && if (card->tx_buffer != NULL &&
card->tx_buffer->count + sizeof(struct lcs_header) + card->tx_buffer->count + sizeof(struct lcs_header) +
skb->len + sizeof(u16) > LCS_IOBUFFERSIZE) skb->len + sizeof(u16) > LCS_IOBUFFERSIZE)
...@@ -1506,7 +1506,8 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb, ...@@ -1506,7 +1506,8 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,
card->tx_buffer = lcs_get_buffer(&card->write); card->tx_buffer = lcs_get_buffer(&card->write);
if (card->tx_buffer == NULL) { if (card->tx_buffer == NULL) {
card->stats.tx_dropped++; card->stats.tx_dropped++;
return -EBUSY; rc = -EBUSY;
goto out;
} }
card->tx_buffer->callback = lcs_txbuffer_cb; card->tx_buffer->callback = lcs_txbuffer_cb;
card->tx_buffer->count = 0; card->tx_buffer->count = 0;
...@@ -1518,13 +1519,18 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb, ...@@ -1518,13 +1519,18 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,
header->type = card->lan_type; header->type = card->lan_type;
header->slot = card->portno; header->slot = card->portno;
memcpy(header + 1, skb->data, skb->len); memcpy(header + 1, skb->data, skb->len);
spin_unlock(&card->lock);
card->stats.tx_bytes += skb->len; card->stats.tx_bytes += skb->len;
card->stats.tx_packets++; card->stats.tx_packets++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
if (card->tx_emitted <= 0) netif_wake_queue(card->dev);
spin_lock(&card->lock);
if (card->tx_emitted <= 0 && card->tx_buffer != NULL)
/* If this is the first tx buffer emit it immediately. */ /* If this is the first tx buffer emit it immediately. */
__lcs_emit_txbuffer(card); __lcs_emit_txbuffer(card);
return 0; out:
spin_unlock(&card->lock);
return rc;
} }
static int static int
...@@ -1535,9 +1541,7 @@ lcs_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1535,9 +1541,7 @@ lcs_start_xmit(struct sk_buff *skb, struct net_device *dev)
LCS_DBF_TEXT(5, trace, "pktxmit"); LCS_DBF_TEXT(5, trace, "pktxmit");
card = (struct lcs_card *) dev->priv; card = (struct lcs_card *) dev->priv;
spin_lock(&card->lock);
rc = __lcs_start_xmit(card, skb, dev); rc = __lcs_start_xmit(card, skb, dev);
spin_unlock(&card->lock);
return rc; return rc;
} }
...@@ -2319,7 +2323,6 @@ __init lcs_init_module(void) ...@@ -2319,7 +2323,6 @@ __init lcs_init_module(void)
PRINT_ERR("Initialization failed\n"); PRINT_ERR("Initialization failed\n");
return rc; return rc;
} }
return 0; return 0;
} }
......
...@@ -95,7 +95,7 @@ do { \ ...@@ -95,7 +95,7 @@ do { \
*/ */
#define LCS_ILLEGAL_OFFSET 0xffff #define LCS_ILLEGAL_OFFSET 0xffff
#define LCS_IOBUFFERSIZE 0x5000 #define LCS_IOBUFFERSIZE 0x5000
#define LCS_NUM_BUFFS 8 /* needs to be power of 2 */ #define LCS_NUM_BUFFS 32 /* needs to be power of 2 */
#define LCS_MAC_LENGTH 6 #define LCS_MAC_LENGTH 6
#define LCS_INVALID_PORT_NO -1 #define LCS_INVALID_PORT_NO -1
#define LCS_LANCMD_TIMEOUT_DEFAULT 5 #define LCS_LANCMD_TIMEOUT_DEFAULT 5
......
...@@ -1075,16 +1075,6 @@ qeth_get_qdio_q_format(struct qeth_card *card) ...@@ -1075,16 +1075,6 @@ qeth_get_qdio_q_format(struct qeth_card *card)
} }
} }
static inline int
qeth_isdigit(char * buf)
{
while (*buf) {
if (!isdigit(*buf++))
return 0;
}
return 1;
}
static inline int static inline int
qeth_isxdigit(char * buf) qeth_isxdigit(char * buf)
{ {
...@@ -1104,33 +1094,17 @@ qeth_ipaddr4_to_string(const __u8 *addr, char *buf) ...@@ -1104,33 +1094,17 @@ qeth_ipaddr4_to_string(const __u8 *addr, char *buf)
static inline int static inline int
qeth_string_to_ipaddr4(const char *buf, __u8 *addr) qeth_string_to_ipaddr4(const char *buf, __u8 *addr)
{ {
const char *start, *end; int count = 0, rc = 0;
char abuf[4]; int in[4];
char *tmp;
int len; rc = sscanf(buf, "%d.%d.%d.%d%n",
int i; &in[0], &in[1], &in[2], &in[3], &count);
if (rc != 4 || count)
start = buf; return -EINVAL;
for (i = 0; i < 4; i++) { for (count = 0; count < 4; count++) {
if (i == 3) { if (in[count] > 255)
end = strchr(start,0xa);
if (end)
len = end - start;
else
len = strlen(start);
}
else {
end = strchr(start, '.');
len = end - start;
}
if ((len <= 0) || (len > 3))
return -EINVAL;
memset(abuf, 0, 4);
strncpy(abuf, start, len);
if (!qeth_isdigit(abuf))
return -EINVAL; return -EINVAL;
addr[i] = simple_strtoul(abuf, &tmp, 10); addr[count] = in[count];
start = end + 1;
} }
return 0; return 0;
} }
...@@ -1149,36 +1123,44 @@ qeth_ipaddr6_to_string(const __u8 *addr, char *buf) ...@@ -1149,36 +1123,44 @@ qeth_ipaddr6_to_string(const __u8 *addr, char *buf)
static inline int static inline int
qeth_string_to_ipaddr6(const char *buf, __u8 *addr) qeth_string_to_ipaddr6(const char *buf, __u8 *addr)
{ {
const char *start, *end; char *end, *start;
u16 *tmp_addr; __u16 *in;
char abuf[5]; char num[5];
char *tmp; int num2, cnt, out, found, save_cnt;
int len; unsigned short in_tmp[8] = {0, };
int i;
cnt = out = found = save_cnt = num2 = 0;
tmp_addr = (u16 *)addr; end = start = (char *) buf;
start = buf; in = (__u16 *) addr;
for (i = 0; i < 8; i++) { memset(in, 0, 16);
if (i == 7) { while (end) {
end = strchr(start,0xa); end = strchr(end,':');
if (end) if (end == NULL) {
len = end - start; end = (char *)buf + (strlen(buf));
else out = 1;
len = strlen(start); }
} if ((end - start)) {
else { memset(num, 0, 5);
end = strchr(start, ':'); memcpy(num, start, end - start);
len = end - start; if (!qeth_isxdigit(num))
return -EINVAL;
sscanf(start, "%x", &num2);
if (found)
in_tmp[save_cnt++] = num2;
else
in[cnt++] = num2;
if (out)
break;
} else {
if (found)
return -EINVAL;
found = 1;
} }
if ((len <= 0) || (len > 4)) start = ++end;
return -EINVAL; }
memset(abuf, 0, 5); cnt = 7;
strncpy(abuf, start, len); while (save_cnt)
if (!qeth_isxdigit(abuf)) in[cnt--] = in_tmp[--save_cnt];
return -EINVAL;
tmp_addr[i] = simple_strtoul(abuf, &tmp, 16);
start = end + 1;
}
return 0; return 0;
} }
......
...@@ -59,8 +59,7 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx) ...@@ -59,8 +59,7 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx)
for (i = 0; i < ctx->num_pages; ++i) for (i = 0; i < ctx->num_pages; ++i)
free_page((unsigned long)ctx->pages[i]); free_page((unsigned long)ctx->pages[i]);
kfree(ctx->pages); kfree(ctx->pages);
if (ctx->elements != NULL) kfree(ctx->elements);
kfree(ctx->elements);
kfree(ctx); kfree(ctx);
} }
...@@ -413,6 +412,13 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, ...@@ -413,6 +412,13 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
QETH_DBF_TEXT(trace, 5, "eddpftcp"); QETH_DBF_TEXT(trace, 5, "eddpftcp");
eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl; eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl;
if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2) {
eddp->skb_offset += sizeof(struct ethhdr);
#ifdef CONFIG_QETH_VLAN
if (eddp->mac.h_proto == __constant_htons(ETH_P_8021Q))
eddp->skb_offset += VLAN_HLEN;
#endif /* CONFIG_QETH_VLAN */
}
tcph = eddp->skb->h.th; tcph = eddp->skb->h.th;
while (eddp->skb_offset < eddp->skb->len) { while (eddp->skb_offset < eddp->skb->len) {
data_len = min((int)skb_shinfo(eddp->skb)->tso_size, data_len = min((int)skb_shinfo(eddp->skb)->tso_size,
...@@ -483,6 +489,7 @@ qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, ...@@ -483,6 +489,7 @@ qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
return -ENOMEM; return -ENOMEM;
} }
if (qhdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) { if (qhdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) {
skb->mac.raw = (skb->data) + sizeof(struct qeth_hdr);
memcpy(&eddp->mac, eth_hdr(skb), ETH_HLEN); memcpy(&eddp->mac, eth_hdr(skb), ETH_HLEN);
#ifdef CONFIG_QETH_VLAN #ifdef CONFIG_QETH_VLAN
if (eddp->mac.h_proto == __constant_htons(ETH_P_8021Q)) { if (eddp->mac.h_proto == __constant_htons(ETH_P_8021Q)) {
......
...@@ -516,7 +516,8 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode) ...@@ -516,7 +516,8 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode)
QETH_DBF_TEXT(setup, 3, "setoffl"); QETH_DBF_TEXT(setup, 3, "setoffl");
QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); QETH_DBF_HEX(setup, 3, &card, sizeof(void *));
netif_carrier_off(card->dev); if (card->dev && netif_carrier_ok(card->dev))
netif_carrier_off(card->dev);
recover_flag = card->state; recover_flag = card->state;
if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){ if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){
PRINT_WARN("Stopping card %s interrupted by user!\n", PRINT_WARN("Stopping card %s interrupted by user!\n",
...@@ -1679,6 +1680,7 @@ qeth_cmd_timeout(unsigned long data) ...@@ -1679,6 +1680,7 @@ qeth_cmd_timeout(unsigned long data)
spin_unlock_irqrestore(&reply->card->lock, flags); spin_unlock_irqrestore(&reply->card->lock, flags);
} }
static struct qeth_ipa_cmd * static struct qeth_ipa_cmd *
qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob)
{ {
...@@ -1699,7 +1701,8 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) ...@@ -1699,7 +1701,8 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob)
QETH_CARD_IFNAME(card), QETH_CARD_IFNAME(card),
card->info.chpid); card->info.chpid);
card->lan_online = 0; card->lan_online = 0;
netif_carrier_off(card->dev); if (card->dev && netif_carrier_ok(card->dev))
netif_carrier_off(card->dev);
return NULL; return NULL;
case IPA_CMD_STARTLAN: case IPA_CMD_STARTLAN:
PRINT_INFO("Link reestablished on %s " PRINT_INFO("Link reestablished on %s "
...@@ -5562,7 +5565,7 @@ qeth_set_multicast_list(struct net_device *dev) ...@@ -5562,7 +5565,7 @@ qeth_set_multicast_list(struct net_device *dev)
if (card->info.type == QETH_CARD_TYPE_OSN) if (card->info.type == QETH_CARD_TYPE_OSN)
return ; return ;
QETH_DBF_TEXT(trace,3,"setmulti"); QETH_DBF_TEXT(trace, 3, "setmulti");
qeth_delete_mc_addresses(card); qeth_delete_mc_addresses(card);
if (card->options.layer2) { if (card->options.layer2) {
qeth_layer2_add_multicast(card); qeth_layer2_add_multicast(card);
...@@ -5579,7 +5582,6 @@ qeth_set_multicast_list(struct net_device *dev) ...@@ -5579,7 +5582,6 @@ qeth_set_multicast_list(struct net_device *dev)
return; return;
if (qeth_set_thread_start_bit(card, QETH_SET_PROMISC_MODE_THREAD)==0) if (qeth_set_thread_start_bit(card, QETH_SET_PROMISC_MODE_THREAD)==0)
schedule_work(&card->kernel_thread_starter); schedule_work(&card->kernel_thread_starter);
} }
static int static int
...@@ -7452,6 +7454,7 @@ qeth_softsetup_card(struct qeth_card *card) ...@@ -7452,6 +7454,7 @@ qeth_softsetup_card(struct qeth_card *card)
card->lan_online = 1; card->lan_online = 1;
if (card->info.type==QETH_CARD_TYPE_OSN) if (card->info.type==QETH_CARD_TYPE_OSN)
goto out; goto out;
qeth_set_large_send(card, card->options.large_send);
if (card->options.layer2) { if (card->options.layer2) {
card->dev->features |= card->dev->features |=
NETIF_F_HW_VLAN_FILTER | NETIF_F_HW_VLAN_FILTER |
...@@ -7468,12 +7471,6 @@ qeth_softsetup_card(struct qeth_card *card) ...@@ -7468,12 +7471,6 @@ qeth_softsetup_card(struct qeth_card *card)
#endif #endif
goto out; goto out;
} }
if ((card->options.large_send == QETH_LARGE_SEND_EDDP) ||
(card->options.large_send == QETH_LARGE_SEND_TSO))
card->dev->features |= NETIF_F_TSO | NETIF_F_SG;
else
card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG);
if ((rc = qeth_setadapter_parms(card))) if ((rc = qeth_setadapter_parms(card)))
QETH_DBF_TEXT_(setup, 2, "2err%d", rc); QETH_DBF_TEXT_(setup, 2, "2err%d", rc);
if ((rc = qeth_start_ipassists(card))) if ((rc = qeth_start_ipassists(card)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment