Merge branch 'upstream-fixes'

This commit is contained in:
Jeff Garzik 2006-01-18 16:20:16 -05:00
commit b4ea75b649
82 changed files with 1379 additions and 1099 deletions

View File

@ -522,6 +522,7 @@ CONFIG_E100=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
CONFIG_E1000_NAPI=y CONFIG_E1000_NAPI=y
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -493,6 +493,7 @@ CONFIG_NETDEVICES=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
CONFIG_E1000_NAPI=y CONFIG_E1000_NAPI=y
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -415,6 +415,7 @@ CONFIG_NETDEVICES=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
CONFIG_E1000_NAPI=y CONFIG_E1000_NAPI=y
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -496,6 +496,7 @@ CONFIG_NETDEVICES=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
CONFIG_E1000_NAPI=y CONFIG_E1000_NAPI=y
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -496,6 +496,7 @@ CONFIG_NETDEVICES=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
CONFIG_E1000_NAPI=y CONFIG_E1000_NAPI=y
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -644,6 +644,8 @@ CONFIG_8139TOO_PIO=y
# CONFIG_ACENIC is not set # CONFIG_ACENIC is not set
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
# CONFIG_E1000 is not set # CONFIG_E1000 is not set
# CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -557,6 +557,7 @@ CONFIG_E100=m
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -565,6 +565,7 @@ CONFIG_E100=m
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -548,6 +548,7 @@ CONFIG_E100=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -565,6 +565,7 @@ CONFIG_E100=m
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -602,6 +602,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=m CONFIG_E1000=m
CONFIG_E1000_NAPI=y CONFIG_E1000_NAPI=y
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -626,6 +626,7 @@ CONFIG_ACENIC=m
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=m CONFIG_E1000=m
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -533,6 +533,7 @@ CONFIG_MII=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=m CONFIG_E1000=m
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -675,6 +675,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -567,6 +567,7 @@ CONFIG_ACENIC=m
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=m CONFIG_E1000=m
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -454,6 +454,7 @@ CONFIG_AMD8111_ETH=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -724,6 +724,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -671,6 +671,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -499,6 +499,7 @@ CONFIG_NATSEMI=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -488,6 +488,7 @@ CONFIG_E100=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -402,6 +402,7 @@ CONFIG_E100=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -442,6 +442,7 @@ CONFIG_E100=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -295,8 +295,7 @@ static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus)
int ioptex; int ioptex;
int i; int i;
if (busa < iommu->start) BUG_ON(busa < iommu->start);
BUG();
ioptex = (busa - iommu->start) >> PAGE_SHIFT; ioptex = (busa - iommu->start) >> PAGE_SHIFT;
for (i = 0; i < npages; i++) { for (i = 0; i < npages; i++) {
iopte_val(iommu->page_table[ioptex + i]) = 0; iopte_val(iommu->page_table[ioptex + i]) = 0;
@ -340,9 +339,9 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
iopte_t *first; iopte_t *first;
int ioptex; int ioptex;
if ((va & ~PAGE_MASK) != 0) BUG(); BUG_ON((va & ~PAGE_MASK) != 0);
if ((addr & ~PAGE_MASK) != 0) BUG(); BUG_ON((addr & ~PAGE_MASK) != 0);
if ((len & ~PAGE_MASK) != 0) BUG(); BUG_ON((len & ~PAGE_MASK) != 0);
/* page color = physical address */ /* page color = physical address */
ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT, ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT,
@ -405,8 +404,8 @@ static void iommu_unmap_dma_area(unsigned long busa, int len)
unsigned long end; unsigned long end;
int ioptex = (busa - iommu->start) >> PAGE_SHIFT; int ioptex = (busa - iommu->start) >> PAGE_SHIFT;
if ((busa & ~PAGE_MASK) != 0) BUG(); BUG_ON((busa & ~PAGE_MASK) != 0);
if ((len & ~PAGE_MASK) != 0) BUG(); BUG_ON((len & ~PAGE_MASK) != 0);
iopte += ioptex; iopte += ioptex;
end = busa + len; end = busa + len;

View File

@ -529,6 +529,7 @@ CONFIG_NET_PCI=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=m CONFIG_E1000=m
CONFIG_E1000_NAPI=y CONFIG_E1000_NAPI=y
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_MYRI_SBUS is not set # CONFIG_MYRI_SBUS is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set

View File

@ -280,9 +280,9 @@ static struct sparc64_tick_ops stick_operations __read_mostly = {
* Since STICK is constantly updating, we have to access it carefully. * Since STICK is constantly updating, we have to access it carefully.
* *
* The sequence we use to read is: * The sequence we use to read is:
* 1) read low * 1) read high
* 2) read high * 2) read low
* 3) read low again, if it rolled over increment high by 1 * 3) read high again, if it rolled re-read both low and high again.
* *
* Writing STICK safely is also tricky: * Writing STICK safely is also tricky:
* 1) write low to zero * 1) write low to zero
@ -295,18 +295,18 @@ static struct sparc64_tick_ops stick_operations __read_mostly = {
static unsigned long __hbird_read_stick(void) static unsigned long __hbird_read_stick(void)
{ {
unsigned long ret, tmp1, tmp2, tmp3; unsigned long ret, tmp1, tmp2, tmp3;
unsigned long addr = HBIRD_STICK_ADDR; unsigned long addr = HBIRD_STICK_ADDR+8;
__asm__ __volatile__("ldxa [%1] %5, %2\n\t" __asm__ __volatile__("ldxa [%1] %5, %2\n"
"add %1, 0x8, %1\n\t" "1:\n\t"
"ldxa [%1] %5, %3\n\t"
"sub %1, 0x8, %1\n\t" "sub %1, 0x8, %1\n\t"
"ldxa [%1] %5, %3\n\t"
"add %1, 0x8, %1\n\t"
"ldxa [%1] %5, %4\n\t" "ldxa [%1] %5, %4\n\t"
"cmp %4, %2\n\t" "cmp %4, %2\n\t"
"blu,a,pn %%xcc, 1f\n\t" "bne,a,pn %%xcc, 1b\n\t"
" add %3, 1, %3\n" " mov %4, %2\n\t"
"1:\n\t" "sllx %4, 32, %4\n\t"
"sllx %3, 32, %3\n\t"
"or %3, %4, %0\n\t" "or %3, %4, %0\n\t"
: "=&r" (ret), "=&r" (addr), : "=&r" (ret), "=&r" (addr),
"=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3) "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3)

View File

@ -646,6 +646,7 @@ CONFIG_8139TOO=y
# CONFIG_DL2K is not set # CONFIG_DL2K is not set
CONFIG_E1000=y CONFIG_E1000=y
# CONFIG_E1000_NAPI is not set # CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
# CONFIG_NS83820 is not set # CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set # CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set # CONFIG_YELLOWFIN is not set

View File

@ -1914,6 +1914,15 @@ config E1000_NAPI
If in doubt, say N. If in doubt, say N.
config E1000_DISABLE_PACKET_SPLIT
bool "Disable Packet Split for PCI express adapters"
depends on E1000
help
Say Y here if you want to use the legacy receive path for PCI express
hadware.
If in doubt, say N.
source "drivers/net/ixp2000/Kconfig" source "drivers/net/ixp2000/Kconfig"
config MYRI_SBUS config MYRI_SBUS

View File

@ -1925,8 +1925,8 @@ static void cas_tx(struct net_device *dev, struct cas *cp,
u64 compwb = le64_to_cpu(cp->init_block->tx_compwb); u64 compwb = le64_to_cpu(cp->init_block->tx_compwb);
#endif #endif
if (netif_msg_intr(cp)) if (netif_msg_intr(cp))
printk(KERN_DEBUG "%s: tx interrupt, status: 0x%x, %lx\n", printk(KERN_DEBUG "%s: tx interrupt, status: 0x%x, %llx\n",
cp->dev->name, status, compwb); cp->dev->name, status, (unsigned long long)compwb);
/* process all the rings */ /* process all the rings */
for (ring = 0; ring < N_TX_RINGS; ring++) { for (ring = 0; ring < N_TX_RINGS; ring++) {
#ifdef USE_TX_COMPWB #ifdef USE_TX_COMPWB

View File

@ -121,7 +121,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
if(hw->media_type == e1000_media_type_copper) { if (hw->media_type == e1000_media_type_copper) {
ecmd->supported = (SUPPORTED_10baseT_Half | ecmd->supported = (SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Full |
@ -133,7 +133,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ecmd->advertising = ADVERTISED_TP; ecmd->advertising = ADVERTISED_TP;
if(hw->autoneg == 1) { if (hw->autoneg == 1) {
ecmd->advertising |= ADVERTISED_Autoneg; ecmd->advertising |= ADVERTISED_Autoneg;
/* the e1000 autoneg seems to match ethtool nicely */ /* the e1000 autoneg seems to match ethtool nicely */
@ -144,7 +144,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ecmd->port = PORT_TP; ecmd->port = PORT_TP;
ecmd->phy_address = hw->phy_addr; ecmd->phy_address = hw->phy_addr;
if(hw->mac_type == e1000_82543) if (hw->mac_type == e1000_82543)
ecmd->transceiver = XCVR_EXTERNAL; ecmd->transceiver = XCVR_EXTERNAL;
else else
ecmd->transceiver = XCVR_INTERNAL; ecmd->transceiver = XCVR_INTERNAL;
@ -160,13 +160,13 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ecmd->port = PORT_FIBRE; ecmd->port = PORT_FIBRE;
if(hw->mac_type >= e1000_82545) if (hw->mac_type >= e1000_82545)
ecmd->transceiver = XCVR_INTERNAL; ecmd->transceiver = XCVR_INTERNAL;
else else
ecmd->transceiver = XCVR_EXTERNAL; ecmd->transceiver = XCVR_EXTERNAL;
} }
if(netif_carrier_ok(adapter->netdev)) { if (netif_carrier_ok(adapter->netdev)) {
e1000_get_speed_and_duplex(hw, &adapter->link_speed, e1000_get_speed_and_duplex(hw, &adapter->link_speed,
&adapter->link_duplex); &adapter->link_duplex);
@ -175,7 +175,7 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
/* unfortunatly FULL_DUPLEX != DUPLEX_FULL /* unfortunatly FULL_DUPLEX != DUPLEX_FULL
* and HALF_DUPLEX != DUPLEX_HALF */ * and HALF_DUPLEX != DUPLEX_HALF */
if(adapter->link_duplex == FULL_DUPLEX) if (adapter->link_duplex == FULL_DUPLEX)
ecmd->duplex = DUPLEX_FULL; ecmd->duplex = DUPLEX_FULL;
else else
ecmd->duplex = DUPLEX_HALF; ecmd->duplex = DUPLEX_HALF;
@ -205,11 +205,11 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
if (ecmd->autoneg == AUTONEG_ENABLE) { if (ecmd->autoneg == AUTONEG_ENABLE) {
hw->autoneg = 1; hw->autoneg = 1;
if(hw->media_type == e1000_media_type_fiber) if (hw->media_type == e1000_media_type_fiber)
hw->autoneg_advertised = ADVERTISED_1000baseT_Full | hw->autoneg_advertised = ADVERTISED_1000baseT_Full |
ADVERTISED_FIBRE | ADVERTISED_FIBRE |
ADVERTISED_Autoneg; ADVERTISED_Autoneg;
else else
hw->autoneg_advertised = ADVERTISED_10baseT_Half | hw->autoneg_advertised = ADVERTISED_10baseT_Half |
ADVERTISED_10baseT_Full | ADVERTISED_10baseT_Full |
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Half |
@ -219,12 +219,12 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
ADVERTISED_TP; ADVERTISED_TP;
ecmd->advertising = hw->autoneg_advertised; ecmd->advertising = hw->autoneg_advertised;
} else } else
if(e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex))
return -EINVAL; return -EINVAL;
/* reset the link */ /* reset the link */
if(netif_running(adapter->netdev)) { if (netif_running(adapter->netdev)) {
e1000_down(adapter); e1000_down(adapter);
e1000_reset(adapter); e1000_reset(adapter);
e1000_up(adapter); e1000_up(adapter);
@ -241,14 +241,14 @@ e1000_get_pauseparam(struct net_device *netdev,
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
pause->autoneg = pause->autoneg =
(adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
if(hw->fc == e1000_fc_rx_pause) if (hw->fc == e1000_fc_rx_pause)
pause->rx_pause = 1; pause->rx_pause = 1;
else if(hw->fc == e1000_fc_tx_pause) else if (hw->fc == e1000_fc_tx_pause)
pause->tx_pause = 1; pause->tx_pause = 1;
else if(hw->fc == e1000_fc_full) { else if (hw->fc == e1000_fc_full) {
pause->rx_pause = 1; pause->rx_pause = 1;
pause->tx_pause = 1; pause->tx_pause = 1;
} }
@ -260,31 +260,30 @@ e1000_set_pauseparam(struct net_device *netdev,
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
adapter->fc_autoneg = pause->autoneg; adapter->fc_autoneg = pause->autoneg;
if(pause->rx_pause && pause->tx_pause) if (pause->rx_pause && pause->tx_pause)
hw->fc = e1000_fc_full; hw->fc = e1000_fc_full;
else if(pause->rx_pause && !pause->tx_pause) else if (pause->rx_pause && !pause->tx_pause)
hw->fc = e1000_fc_rx_pause; hw->fc = e1000_fc_rx_pause;
else if(!pause->rx_pause && pause->tx_pause) else if (!pause->rx_pause && pause->tx_pause)
hw->fc = e1000_fc_tx_pause; hw->fc = e1000_fc_tx_pause;
else if(!pause->rx_pause && !pause->tx_pause) else if (!pause->rx_pause && !pause->tx_pause)
hw->fc = e1000_fc_none; hw->fc = e1000_fc_none;
hw->original_fc = hw->fc; hw->original_fc = hw->fc;
if(adapter->fc_autoneg == AUTONEG_ENABLE) { if (adapter->fc_autoneg == AUTONEG_ENABLE) {
if(netif_running(adapter->netdev)) { if (netif_running(adapter->netdev)) {
e1000_down(adapter); e1000_down(adapter);
e1000_up(adapter); e1000_up(adapter);
} else } else
e1000_reset(adapter); e1000_reset(adapter);
} } else
else
return ((hw->media_type == e1000_media_type_fiber) ? return ((hw->media_type == e1000_media_type_fiber) ?
e1000_setup_link(hw) : e1000_force_mac_fc(hw)); e1000_setup_link(hw) : e1000_force_mac_fc(hw));
return 0; return 0;
} }
@ -301,14 +300,14 @@ e1000_set_rx_csum(struct net_device *netdev, uint32_t data)
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
adapter->rx_csum = data; adapter->rx_csum = data;
if(netif_running(netdev)) { if (netif_running(netdev)) {
e1000_down(adapter); e1000_down(adapter);
e1000_up(adapter); e1000_up(adapter);
} else } else
e1000_reset(adapter); e1000_reset(adapter);
return 0; return 0;
} }
static uint32_t static uint32_t
e1000_get_tx_csum(struct net_device *netdev) e1000_get_tx_csum(struct net_device *netdev)
{ {
@ -320,7 +319,7 @@ e1000_set_tx_csum(struct net_device *netdev, uint32_t data)
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
if(adapter->hw.mac_type < e1000_82543) { if (adapter->hw.mac_type < e1000_82543) {
if (!data) if (!data)
return -EINVAL; return -EINVAL;
return 0; return 0;
@ -339,8 +338,8 @@ static int
e1000_set_tso(struct net_device *netdev, uint32_t data) e1000_set_tso(struct net_device *netdev, uint32_t data)
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
if((adapter->hw.mac_type < e1000_82544) || if ((adapter->hw.mac_type < e1000_82544) ||
(adapter->hw.mac_type == e1000_82547)) (adapter->hw.mac_type == e1000_82547))
return data ? -EINVAL : 0; return data ? -EINVAL : 0;
if (data) if (data)
@ -348,7 +347,7 @@ e1000_set_tso(struct net_device *netdev, uint32_t data)
else else
netdev->features &= ~NETIF_F_TSO; netdev->features &= ~NETIF_F_TSO;
return 0; return 0;
} }
#endif /* NETIF_F_TSO */ #endif /* NETIF_F_TSO */
static uint32_t static uint32_t
@ -365,7 +364,7 @@ e1000_set_msglevel(struct net_device *netdev, uint32_t data)
adapter->msg_enable = data; adapter->msg_enable = data;
} }
static int static int
e1000_get_regs_len(struct net_device *netdev) e1000_get_regs_len(struct net_device *netdev)
{ {
#define E1000_REGS_LEN 32 #define E1000_REGS_LEN 32
@ -401,7 +400,7 @@ e1000_get_regs(struct net_device *netdev,
regs_buff[11] = E1000_READ_REG(hw, TIDV); regs_buff[11] = E1000_READ_REG(hw, TIDV);
regs_buff[12] = adapter->hw.phy_type; /* PHY type (IGP=1, M88=0) */ regs_buff[12] = adapter->hw.phy_type; /* PHY type (IGP=1, M88=0) */
if(hw->phy_type == e1000_phy_igp) { if (hw->phy_type == e1000_phy_igp) {
e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT,
IGP01E1000_PHY_AGC_A); IGP01E1000_PHY_AGC_A);
e1000_read_phy_reg(hw, IGP01E1000_PHY_AGC_A & e1000_read_phy_reg(hw, IGP01E1000_PHY_AGC_A &
@ -455,7 +454,7 @@ e1000_get_regs(struct net_device *netdev,
e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data);
regs_buff[24] = (uint32_t)phy_data; /* phy local receiver status */ regs_buff[24] = (uint32_t)phy_data; /* phy local receiver status */
regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ regs_buff[25] = regs_buff[24]; /* phy remote receiver status */
if(hw->mac_type >= e1000_82540 && if (hw->mac_type >= e1000_82540 &&
hw->media_type == e1000_media_type_copper) { hw->media_type == e1000_media_type_copper) {
regs_buff[26] = E1000_READ_REG(hw, MANC); regs_buff[26] = E1000_READ_REG(hw, MANC);
} }
@ -479,7 +478,7 @@ e1000_get_eeprom(struct net_device *netdev,
int ret_val = 0; int ret_val = 0;
uint16_t i; uint16_t i;
if(eeprom->len == 0) if (eeprom->len == 0)
return -EINVAL; return -EINVAL;
eeprom->magic = hw->vendor_id | (hw->device_id << 16); eeprom->magic = hw->vendor_id | (hw->device_id << 16);
@ -489,16 +488,16 @@ e1000_get_eeprom(struct net_device *netdev,
eeprom_buff = kmalloc(sizeof(uint16_t) * eeprom_buff = kmalloc(sizeof(uint16_t) *
(last_word - first_word + 1), GFP_KERNEL); (last_word - first_word + 1), GFP_KERNEL);
if(!eeprom_buff) if (!eeprom_buff)
return -ENOMEM; return -ENOMEM;
if(hw->eeprom.type == e1000_eeprom_spi) if (hw->eeprom.type == e1000_eeprom_spi)
ret_val = e1000_read_eeprom(hw, first_word, ret_val = e1000_read_eeprom(hw, first_word,
last_word - first_word + 1, last_word - first_word + 1,
eeprom_buff); eeprom_buff);
else { else {
for (i = 0; i < last_word - first_word + 1; i++) for (i = 0; i < last_word - first_word + 1; i++)
if((ret_val = e1000_read_eeprom(hw, first_word + i, 1, if ((ret_val = e1000_read_eeprom(hw, first_word + i, 1,
&eeprom_buff[i]))) &eeprom_buff[i])))
break; break;
} }
@ -525,10 +524,10 @@ e1000_set_eeprom(struct net_device *netdev,
int max_len, first_word, last_word, ret_val = 0; int max_len, first_word, last_word, ret_val = 0;
uint16_t i; uint16_t i;
if(eeprom->len == 0) if (eeprom->len == 0)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if(eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16)))
return -EFAULT; return -EFAULT;
max_len = hw->eeprom.word_size * 2; max_len = hw->eeprom.word_size * 2;
@ -536,19 +535,19 @@ e1000_set_eeprom(struct net_device *netdev,
first_word = eeprom->offset >> 1; first_word = eeprom->offset >> 1;
last_word = (eeprom->offset + eeprom->len - 1) >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1;
eeprom_buff = kmalloc(max_len, GFP_KERNEL); eeprom_buff = kmalloc(max_len, GFP_KERNEL);
if(!eeprom_buff) if (!eeprom_buff)
return -ENOMEM; return -ENOMEM;
ptr = (void *)eeprom_buff; ptr = (void *)eeprom_buff;
if(eeprom->offset & 1) { if (eeprom->offset & 1) {
/* need read/modify/write of first changed EEPROM word */ /* need read/modify/write of first changed EEPROM word */
/* only the second byte of the word is being modified */ /* only the second byte of the word is being modified */
ret_val = e1000_read_eeprom(hw, first_word, 1, ret_val = e1000_read_eeprom(hw, first_word, 1,
&eeprom_buff[0]); &eeprom_buff[0]);
ptr++; ptr++;
} }
if(((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) { if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) {
/* need read/modify/write of last changed EEPROM word */ /* need read/modify/write of last changed EEPROM word */
/* only the first byte of the word is being modified */ /* only the first byte of the word is being modified */
ret_val = e1000_read_eeprom(hw, last_word, 1, ret_val = e1000_read_eeprom(hw, last_word, 1,
@ -567,9 +566,9 @@ e1000_set_eeprom(struct net_device *netdev,
ret_val = e1000_write_eeprom(hw, first_word, ret_val = e1000_write_eeprom(hw, first_word,
last_word - first_word + 1, eeprom_buff); last_word - first_word + 1, eeprom_buff);
/* Update the checksum over the first part of the EEPROM if needed /* Update the checksum over the first part of the EEPROM if needed
* and flush shadow RAM for 82573 conrollers */ * and flush shadow RAM for 82573 conrollers */
if((ret_val == 0) && ((first_word <= EEPROM_CHECKSUM_REG) || if ((ret_val == 0) && ((first_word <= EEPROM_CHECKSUM_REG) ||
(hw->mac_type == e1000_82573))) (hw->mac_type == e1000_82573)))
e1000_update_eeprom_checksum(hw); e1000_update_eeprom_checksum(hw);
@ -633,7 +632,7 @@ e1000_get_ringparam(struct net_device *netdev,
ring->rx_jumbo_pending = 0; ring->rx_jumbo_pending = 0;
} }
static int static int
e1000_set_ringparam(struct net_device *netdev, e1000_set_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring) struct ethtool_ringparam *ring)
{ {
@ -670,25 +669,25 @@ e1000_set_ringparam(struct net_device *netdev,
txdr = adapter->tx_ring; txdr = adapter->tx_ring;
rxdr = adapter->rx_ring; rxdr = adapter->rx_ring;
if((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
return -EINVAL; return -EINVAL;
rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD);
rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ?
E1000_MAX_RXD : E1000_MAX_82544_RXD)); E1000_MAX_RXD : E1000_MAX_82544_RXD));
E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE); E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE);
txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD); txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD);
txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ? txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ?
E1000_MAX_TXD : E1000_MAX_82544_TXD)); E1000_MAX_TXD : E1000_MAX_82544_TXD));
E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
for (i = 0; i < adapter->num_tx_queues; i++) for (i = 0; i < adapter->num_tx_queues; i++)
txdr[i].count = txdr->count; txdr[i].count = txdr->count;
for (i = 0; i < adapter->num_rx_queues; i++) for (i = 0; i < adapter->num_rx_queues; i++)
rxdr[i].count = rxdr->count; rxdr[i].count = rxdr->count;
if(netif_running(adapter->netdev)) { if (netif_running(adapter->netdev)) {
/* Try to get new resources before deleting old */ /* Try to get new resources before deleting old */
if ((err = e1000_setup_all_rx_resources(adapter))) if ((err = e1000_setup_all_rx_resources(adapter)))
goto err_setup_rx; goto err_setup_rx;
@ -708,7 +707,7 @@ e1000_set_ringparam(struct net_device *netdev,
kfree(rx_old); kfree(rx_old);
adapter->rx_ring = rx_new; adapter->rx_ring = rx_new;
adapter->tx_ring = tx_new; adapter->tx_ring = tx_new;
if((err = e1000_up(adapter))) if ((err = e1000_up(adapter)))
return err; return err;
} }
@ -727,10 +726,10 @@ e1000_set_ringparam(struct net_device *netdev,
uint32_t pat, value; \ uint32_t pat, value; \
uint32_t test[] = \ uint32_t test[] = \
{0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \ {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; \
for(pat = 0; pat < sizeof(test)/sizeof(test[0]); pat++) { \ for (pat = 0; pat < sizeof(test)/sizeof(test[0]); pat++) { \
E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \ E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W)); \
value = E1000_READ_REG(&adapter->hw, R); \ value = E1000_READ_REG(&adapter->hw, R); \
if(value != (test[pat] & W & M)) { \ if (value != (test[pat] & W & M)) { \
DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \ DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \
"0x%08X expected 0x%08X\n", \ "0x%08X expected 0x%08X\n", \
E1000_##R, value, (test[pat] & W & M)); \ E1000_##R, value, (test[pat] & W & M)); \
@ -746,7 +745,7 @@ e1000_set_ringparam(struct net_device *netdev,
uint32_t value; \ uint32_t value; \
E1000_WRITE_REG(&adapter->hw, R, W & M); \ E1000_WRITE_REG(&adapter->hw, R, W & M); \
value = E1000_READ_REG(&adapter->hw, R); \ value = E1000_READ_REG(&adapter->hw, R); \
if((W & M) != (value & M)) { \ if ((W & M) != (value & M)) { \
DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\ DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\
"expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \ "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \
*data = (adapter->hw.mac_type < e1000_82543) ? \ *data = (adapter->hw.mac_type < e1000_82543) ? \
@ -782,7 +781,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle); value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle);
E1000_WRITE_REG(&adapter->hw, STATUS, toggle); E1000_WRITE_REG(&adapter->hw, STATUS, toggle);
after = E1000_READ_REG(&adapter->hw, STATUS) & toggle; after = E1000_READ_REG(&adapter->hw, STATUS) & toggle;
if(value != after) { if (value != after) {
DPRINTK(DRV, ERR, "failed STATUS register test got: " DPRINTK(DRV, ERR, "failed STATUS register test got: "
"0x%08X expected: 0x%08X\n", after, value); "0x%08X expected: 0x%08X\n", after, value);
*data = 1; *data = 1;
@ -810,7 +809,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0x003FFFFB); REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0x003FFFFB);
REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000); REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000);
if(adapter->hw.mac_type >= e1000_82543) { if (adapter->hw.mac_type >= e1000_82543) {
REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0xFFFFFFFF); REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0xFFFFFFFF);
REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF);
@ -818,7 +817,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF);
REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF); REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF);
for(i = 0; i < E1000_RAR_ENTRIES; i++) { for (i = 0; i < E1000_RAR_ENTRIES; i++) {
REG_PATTERN_TEST(RA + ((i << 1) << 2), 0xFFFFFFFF, REG_PATTERN_TEST(RA + ((i << 1) << 2), 0xFFFFFFFF,
0xFFFFFFFF); 0xFFFFFFFF);
REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF, REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF,
@ -834,7 +833,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
} }
for(i = 0; i < E1000_MC_TBL_SIZE; i++) for (i = 0; i < E1000_MC_TBL_SIZE; i++)
REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF); REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF);
*data = 0; *data = 0;
@ -850,8 +849,8 @@ e1000_eeprom_test(struct e1000_adapter *adapter, uint64_t *data)
*data = 0; *data = 0;
/* Read and add up the contents of the EEPROM */ /* Read and add up the contents of the EEPROM */
for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) {
if((e1000_read_eeprom(&adapter->hw, i, 1, &temp)) < 0) { if ((e1000_read_eeprom(&adapter->hw, i, 1, &temp)) < 0) {
*data = 1; *data = 1;
break; break;
} }
@ -859,7 +858,7 @@ e1000_eeprom_test(struct e1000_adapter *adapter, uint64_t *data)
} }
/* If Checksum is not Correct return error else test passed */ /* If Checksum is not Correct return error else test passed */
if((checksum != (uint16_t) EEPROM_SUM) && !(*data)) if ((checksum != (uint16_t) EEPROM_SUM) && !(*data))
*data = 2; *data = 2;
return *data; return *data;
@ -888,9 +887,9 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
*data = 0; *data = 0;
/* Hook up test interrupt handler just for this test */ /* Hook up test interrupt handler just for this test */
if(!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) { if (!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) {
shared_int = FALSE; shared_int = FALSE;
} else if(request_irq(irq, &e1000_test_intr, SA_SHIRQ, } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ,
netdev->name, netdev)){ netdev->name, netdev)){
*data = 1; *data = 1;
return -1; return -1;
@ -901,12 +900,12 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
msec_delay(10); msec_delay(10);
/* Test each interrupt */ /* Test each interrupt */
for(; i < 10; i++) { for (; i < 10; i++) {
/* Interrupt to test */ /* Interrupt to test */
mask = 1 << i; mask = 1 << i;
if(!shared_int) { if (!shared_int) {
/* Disable the interrupt to be reported in /* Disable the interrupt to be reported in
* the cause register and then force the same * the cause register and then force the same
* interrupt and see if one gets posted. If * interrupt and see if one gets posted. If
@ -917,8 +916,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
E1000_WRITE_REG(&adapter->hw, IMC, mask); E1000_WRITE_REG(&adapter->hw, IMC, mask);
E1000_WRITE_REG(&adapter->hw, ICS, mask); E1000_WRITE_REG(&adapter->hw, ICS, mask);
msec_delay(10); msec_delay(10);
if(adapter->test_icr & mask) { if (adapter->test_icr & mask) {
*data = 3; *data = 3;
break; break;
} }
@ -935,12 +934,12 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
E1000_WRITE_REG(&adapter->hw, ICS, mask); E1000_WRITE_REG(&adapter->hw, ICS, mask);
msec_delay(10); msec_delay(10);
if(!(adapter->test_icr & mask)) { if (!(adapter->test_icr & mask)) {
*data = 4; *data = 4;
break; break;
} }
if(!shared_int) { if (!shared_int) {
/* Disable the other interrupts to be reported in /* Disable the other interrupts to be reported in
* the cause register and then force the other * the cause register and then force the other
* interrupts and see if any get posted. If * interrupts and see if any get posted. If
@ -952,7 +951,7 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
E1000_WRITE_REG(&adapter->hw, ICS, ~mask & 0x00007FFF); E1000_WRITE_REG(&adapter->hw, ICS, ~mask & 0x00007FFF);
msec_delay(10); msec_delay(10);
if(adapter->test_icr) { if (adapter->test_icr) {
*data = 5; *data = 5;
break; break;
} }
@ -977,24 +976,24 @@ e1000_free_desc_rings(struct e1000_adapter *adapter)
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
int i; int i;
if(txdr->desc && txdr->buffer_info) { if (txdr->desc && txdr->buffer_info) {
for(i = 0; i < txdr->count; i++) { for (i = 0; i < txdr->count; i++) {
if(txdr->buffer_info[i].dma) if (txdr->buffer_info[i].dma)
pci_unmap_single(pdev, txdr->buffer_info[i].dma, pci_unmap_single(pdev, txdr->buffer_info[i].dma,
txdr->buffer_info[i].length, txdr->buffer_info[i].length,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
if(txdr->buffer_info[i].skb) if (txdr->buffer_info[i].skb)
dev_kfree_skb(txdr->buffer_info[i].skb); dev_kfree_skb(txdr->buffer_info[i].skb);
} }
} }
if(rxdr->desc && rxdr->buffer_info) { if (rxdr->desc && rxdr->buffer_info) {
for(i = 0; i < rxdr->count; i++) { for (i = 0; i < rxdr->count; i++) {
if(rxdr->buffer_info[i].dma) if (rxdr->buffer_info[i].dma)
pci_unmap_single(pdev, rxdr->buffer_info[i].dma, pci_unmap_single(pdev, rxdr->buffer_info[i].dma,
rxdr->buffer_info[i].length, rxdr->buffer_info[i].length,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
if(rxdr->buffer_info[i].skb) if (rxdr->buffer_info[i].skb)
dev_kfree_skb(rxdr->buffer_info[i].skb); dev_kfree_skb(rxdr->buffer_info[i].skb);
} }
} }
@ -1027,11 +1026,11 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
/* Setup Tx descriptor ring and Tx buffers */ /* Setup Tx descriptor ring and Tx buffers */
if(!txdr->count) if (!txdr->count)
txdr->count = E1000_DEFAULT_TXD; txdr->count = E1000_DEFAULT_TXD;
size = txdr->count * sizeof(struct e1000_buffer); size = txdr->count * sizeof(struct e1000_buffer);
if(!(txdr->buffer_info = kmalloc(size, GFP_KERNEL))) { if (!(txdr->buffer_info = kmalloc(size, GFP_KERNEL))) {
ret_val = 1; ret_val = 1;
goto err_nomem; goto err_nomem;
} }
@ -1039,7 +1038,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
txdr->size = txdr->count * sizeof(struct e1000_tx_desc); txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
E1000_ROUNDUP(txdr->size, 4096); E1000_ROUNDUP(txdr->size, 4096);
if(!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma))) { if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma))) {
ret_val = 2; ret_val = 2;
goto err_nomem; goto err_nomem;
} }
@ -1058,12 +1057,12 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT | E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT |
E1000_FDX_COLLISION_DISTANCE << E1000_COLD_SHIFT); E1000_FDX_COLLISION_DISTANCE << E1000_COLD_SHIFT);
for(i = 0; i < txdr->count; i++) { for (i = 0; i < txdr->count; i++) {
struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*txdr, i); struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*txdr, i);
struct sk_buff *skb; struct sk_buff *skb;
unsigned int size = 1024; unsigned int size = 1024;
if(!(skb = alloc_skb(size, GFP_KERNEL))) { if (!(skb = alloc_skb(size, GFP_KERNEL))) {
ret_val = 3; ret_val = 3;
goto err_nomem; goto err_nomem;
} }
@ -1083,18 +1082,18 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
/* Setup Rx descriptor ring and Rx buffers */ /* Setup Rx descriptor ring and Rx buffers */
if(!rxdr->count) if (!rxdr->count)
rxdr->count = E1000_DEFAULT_RXD; rxdr->count = E1000_DEFAULT_RXD;
size = rxdr->count * sizeof(struct e1000_buffer); size = rxdr->count * sizeof(struct e1000_buffer);
if(!(rxdr->buffer_info = kmalloc(size, GFP_KERNEL))) { if (!(rxdr->buffer_info = kmalloc(size, GFP_KERNEL))) {
ret_val = 4; ret_val = 4;
goto err_nomem; goto err_nomem;
} }
memset(rxdr->buffer_info, 0, size); memset(rxdr->buffer_info, 0, size);
rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc);
if(!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) { if (!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) {
ret_val = 5; ret_val = 5;
goto err_nomem; goto err_nomem;
} }
@ -1114,11 +1113,11 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
(adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT);
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
for(i = 0; i < rxdr->count; i++) { for (i = 0; i < rxdr->count; i++) {
struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i);
struct sk_buff *skb; struct sk_buff *skb;
if(!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, if (!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN,
GFP_KERNEL))) { GFP_KERNEL))) {
ret_val = 6; ret_val = 6;
goto err_nomem; goto err_nomem;
@ -1227,15 +1226,15 @@ e1000_nonintegrated_phy_loopback(struct e1000_adapter *adapter)
/* Check Phy Configuration */ /* Check Phy Configuration */
e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg); e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_reg);
if(phy_reg != 0x4100) if (phy_reg != 0x4100)
return 9; return 9;
e1000_read_phy_reg(&adapter->hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg); e1000_read_phy_reg(&adapter->hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_reg);
if(phy_reg != 0x0070) if (phy_reg != 0x0070)
return 10; return 10;
e1000_read_phy_reg(&adapter->hw, 29, &phy_reg); e1000_read_phy_reg(&adapter->hw, 29, &phy_reg);
if(phy_reg != 0x001A) if (phy_reg != 0x001A)
return 11; return 11;
return 0; return 0;
@ -1249,7 +1248,7 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
adapter->hw.autoneg = FALSE; adapter->hw.autoneg = FALSE;
if(adapter->hw.phy_type == e1000_phy_m88) { if (adapter->hw.phy_type == e1000_phy_m88) {
/* Auto-MDI/MDIX Off */ /* Auto-MDI/MDIX Off */
e1000_write_phy_reg(&adapter->hw, e1000_write_phy_reg(&adapter->hw,
M88E1000_PHY_SPEC_CTRL, 0x0808); M88E1000_PHY_SPEC_CTRL, 0x0808);
@ -1269,14 +1268,14 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */
E1000_CTRL_FD); /* Force Duplex to FULL */ E1000_CTRL_FD); /* Force Duplex to FULL */
if(adapter->hw.media_type == e1000_media_type_copper && if (adapter->hw.media_type == e1000_media_type_copper &&
adapter->hw.phy_type == e1000_phy_m88) { adapter->hw.phy_type == e1000_phy_m88) {
ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
} else { } else {
/* Set the ILOS bit on the fiber Nic is half /* Set the ILOS bit on the fiber Nic is half
* duplex link is detected. */ * duplex link is detected. */
stat_reg = E1000_READ_REG(&adapter->hw, STATUS); stat_reg = E1000_READ_REG(&adapter->hw, STATUS);
if((stat_reg & E1000_STATUS_FD) == 0) if ((stat_reg & E1000_STATUS_FD) == 0)
ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU);
} }
@ -1285,7 +1284,7 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
/* Disable the receiver on the PHY so when a cable is plugged in, the /* Disable the receiver on the PHY so when a cable is plugged in, the
* PHY does not begin to autoneg when a cable is reconnected to the NIC. * PHY does not begin to autoneg when a cable is reconnected to the NIC.
*/ */
if(adapter->hw.phy_type == e1000_phy_m88) if (adapter->hw.phy_type == e1000_phy_m88)
e1000_phy_disable_receiver(adapter); e1000_phy_disable_receiver(adapter);
udelay(500); udelay(500);
@ -1301,14 +1300,14 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter)
switch (adapter->hw.mac_type) { switch (adapter->hw.mac_type) {
case e1000_82543: case e1000_82543:
if(adapter->hw.media_type == e1000_media_type_copper) { if (adapter->hw.media_type == e1000_media_type_copper) {
/* Attempt to setup Loopback mode on Non-integrated PHY. /* Attempt to setup Loopback mode on Non-integrated PHY.
* Some PHY registers get corrupted at random, so * Some PHY registers get corrupted at random, so
* attempt this 10 times. * attempt this 10 times.
*/ */
while(e1000_nonintegrated_phy_loopback(adapter) && while (e1000_nonintegrated_phy_loopback(adapter) &&
count++ < 10); count++ < 10);
if(count < 11) if (count < 11)
return 0; return 0;
} }
break; break;
@ -1430,8 +1429,8 @@ static int
e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size)
{ {
frame_size &= ~1; frame_size &= ~1;
if(*(skb->data + 3) == 0xFF) { if (*(skb->data + 3) == 0xFF) {
if((*(skb->data + frame_size / 2 + 10) == 0xBE) && if ((*(skb->data + frame_size / 2 + 10) == 0xBE) &&
(*(skb->data + frame_size / 2 + 12) == 0xAF)) { (*(skb->data + frame_size / 2 + 12) == 0xAF)) {
return 0; return 0;
} }
@ -1450,53 +1449,53 @@ e1000_run_loopback_test(struct e1000_adapter *adapter)
E1000_WRITE_REG(&adapter->hw, RDT, rxdr->count - 1); E1000_WRITE_REG(&adapter->hw, RDT, rxdr->count - 1);
/* Calculate the loop count based on the largest descriptor ring /* Calculate the loop count based on the largest descriptor ring
* The idea is to wrap the largest ring a number of times using 64 * The idea is to wrap the largest ring a number of times using 64
* send/receive pairs during each loop * send/receive pairs during each loop
*/ */
if(rxdr->count <= txdr->count) if (rxdr->count <= txdr->count)
lc = ((txdr->count / 64) * 2) + 1; lc = ((txdr->count / 64) * 2) + 1;
else else
lc = ((rxdr->count / 64) * 2) + 1; lc = ((rxdr->count / 64) * 2) + 1;
k = l = 0; k = l = 0;
for(j = 0; j <= lc; j++) { /* loop count loop */ for (j = 0; j <= lc; j++) { /* loop count loop */
for(i = 0; i < 64; i++) { /* send the packets */ for (i = 0; i < 64; i++) { /* send the packets */
e1000_create_lbtest_frame(txdr->buffer_info[i].skb, e1000_create_lbtest_frame(txdr->buffer_info[i].skb,
1024); 1024);
pci_dma_sync_single_for_device(pdev, pci_dma_sync_single_for_device(pdev,
txdr->buffer_info[k].dma, txdr->buffer_info[k].dma,
txdr->buffer_info[k].length, txdr->buffer_info[k].length,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
if(unlikely(++k == txdr->count)) k = 0; if (unlikely(++k == txdr->count)) k = 0;
} }
E1000_WRITE_REG(&adapter->hw, TDT, k); E1000_WRITE_REG(&adapter->hw, TDT, k);
msec_delay(200); msec_delay(200);
time = jiffies; /* set the start time for the receive */ time = jiffies; /* set the start time for the receive */
good_cnt = 0; good_cnt = 0;
do { /* receive the sent packets */ do { /* receive the sent packets */
pci_dma_sync_single_for_cpu(pdev, pci_dma_sync_single_for_cpu(pdev,
rxdr->buffer_info[l].dma, rxdr->buffer_info[l].dma,
rxdr->buffer_info[l].length, rxdr->buffer_info[l].length,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
ret_val = e1000_check_lbtest_frame( ret_val = e1000_check_lbtest_frame(
rxdr->buffer_info[l].skb, rxdr->buffer_info[l].skb,
1024); 1024);
if(!ret_val) if (!ret_val)
good_cnt++; good_cnt++;
if(unlikely(++l == rxdr->count)) l = 0; if (unlikely(++l == rxdr->count)) l = 0;
/* time + 20 msecs (200 msecs on 2.4) is more than /* time + 20 msecs (200 msecs on 2.4) is more than
* enough time to complete the receives, if it's * enough time to complete the receives, if it's
* exceeded, break and error off * exceeded, break and error off
*/ */
} while (good_cnt < 64 && jiffies < (time + 20)); } while (good_cnt < 64 && jiffies < (time + 20));
if(good_cnt != 64) { if (good_cnt != 64) {
ret_val = 13; /* ret_val is the same as mis-compare */ ret_val = 13; /* ret_val is the same as mis-compare */
break; break;
} }
if(jiffies >= (time + 2)) { if (jiffies >= (time + 2)) {
ret_val = 14; /* error code for time out error */ ret_val = 14; /* error code for time out error */
break; break;
} }
@ -1549,17 +1548,17 @@ e1000_link_test(struct e1000_adapter *adapter, uint64_t *data)
*data = 1; *data = 1;
} else { } else {
e1000_check_for_link(&adapter->hw); e1000_check_for_link(&adapter->hw);
if(adapter->hw.autoneg) /* if auto_neg is set wait for it */ if (adapter->hw.autoneg) /* if auto_neg is set wait for it */
msec_delay(4000); msec_delay(4000);
if(!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) { if (!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) {
*data = 1; *data = 1;
} }
} }
return *data; return *data;
} }
static int static int
e1000_diag_test_count(struct net_device *netdev) e1000_diag_test_count(struct net_device *netdev)
{ {
return E1000_TEST_LEN; return E1000_TEST_LEN;
@ -1572,7 +1571,7 @@ e1000_diag_test(struct net_device *netdev,
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
boolean_t if_running = netif_running(netdev); boolean_t if_running = netif_running(netdev);
if(eth_test->flags == ETH_TEST_FL_OFFLINE) { if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
/* Offline tests */ /* Offline tests */
/* save speed, duplex, autoneg settings */ /* save speed, duplex, autoneg settings */
@ -1582,27 +1581,27 @@ e1000_diag_test(struct net_device *netdev,
/* Link test performed before hardware reset so autoneg doesn't /* Link test performed before hardware reset so autoneg doesn't
* interfere with test result */ * interfere with test result */
if(e1000_link_test(adapter, &data[4])) if (e1000_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
if(if_running) if (if_running)
e1000_down(adapter); e1000_down(adapter);
else else
e1000_reset(adapter); e1000_reset(adapter);
if(e1000_reg_test(adapter, &data[0])) if (e1000_reg_test(adapter, &data[0]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
e1000_reset(adapter); e1000_reset(adapter);
if(e1000_eeprom_test(adapter, &data[1])) if (e1000_eeprom_test(adapter, &data[1]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
e1000_reset(adapter); e1000_reset(adapter);
if(e1000_intr_test(adapter, &data[2])) if (e1000_intr_test(adapter, &data[2]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
e1000_reset(adapter); e1000_reset(adapter);
if(e1000_loopback_test(adapter, &data[3])) if (e1000_loopback_test(adapter, &data[3]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
/* restore speed, duplex, autoneg settings */ /* restore speed, duplex, autoneg settings */
@ -1611,11 +1610,11 @@ e1000_diag_test(struct net_device *netdev,
adapter->hw.autoneg = autoneg; adapter->hw.autoneg = autoneg;
e1000_reset(adapter); e1000_reset(adapter);
if(if_running) if (if_running)
e1000_up(adapter); e1000_up(adapter);
} else { } else {
/* Online tests */ /* Online tests */
if(e1000_link_test(adapter, &data[4])) if (e1000_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
/* Offline tests aren't run; pass by default */ /* Offline tests aren't run; pass by default */
@ -1633,7 +1632,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
switch(adapter->hw.device_id) { switch (adapter->hw.device_id) {
case E1000_DEV_ID_82542: case E1000_DEV_ID_82542:
case E1000_DEV_ID_82543GC_FIBER: case E1000_DEV_ID_82543GC_FIBER:
case E1000_DEV_ID_82543GC_COPPER: case E1000_DEV_ID_82543GC_COPPER:
@ -1649,7 +1648,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
case E1000_DEV_ID_82546GB_FIBER: case E1000_DEV_ID_82546GB_FIBER:
case E1000_DEV_ID_82571EB_FIBER: case E1000_DEV_ID_82571EB_FIBER:
/* Wake events only supported on port A for dual fiber */ /* Wake events only supported on port A for dual fiber */
if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) { if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) {
wol->supported = 0; wol->supported = 0;
wol->wolopts = 0; wol->wolopts = 0;
return; return;
@ -1661,13 +1660,13 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
WAKE_BCAST | WAKE_MAGIC; WAKE_BCAST | WAKE_MAGIC;
wol->wolopts = 0; wol->wolopts = 0;
if(adapter->wol & E1000_WUFC_EX) if (adapter->wol & E1000_WUFC_EX)
wol->wolopts |= WAKE_UCAST; wol->wolopts |= WAKE_UCAST;
if(adapter->wol & E1000_WUFC_MC) if (adapter->wol & E1000_WUFC_MC)
wol->wolopts |= WAKE_MCAST; wol->wolopts |= WAKE_MCAST;
if(adapter->wol & E1000_WUFC_BC) if (adapter->wol & E1000_WUFC_BC)
wol->wolopts |= WAKE_BCAST; wol->wolopts |= WAKE_BCAST;
if(adapter->wol & E1000_WUFC_MAG) if (adapter->wol & E1000_WUFC_MAG)
wol->wolopts |= WAKE_MAGIC; wol->wolopts |= WAKE_MAGIC;
return; return;
} }
@ -1679,7 +1678,7 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
switch(adapter->hw.device_id) { switch (adapter->hw.device_id) {
case E1000_DEV_ID_82542: case E1000_DEV_ID_82542:
case E1000_DEV_ID_82543GC_FIBER: case E1000_DEV_ID_82543GC_FIBER:
case E1000_DEV_ID_82543GC_COPPER: case E1000_DEV_ID_82543GC_COPPER:
@ -1693,23 +1692,23 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
case E1000_DEV_ID_82546GB_FIBER: case E1000_DEV_ID_82546GB_FIBER:
case E1000_DEV_ID_82571EB_FIBER: case E1000_DEV_ID_82571EB_FIBER:
/* Wake events only supported on port A for dual fiber */ /* Wake events only supported on port A for dual fiber */
if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)
return wol->wolopts ? -EOPNOTSUPP : 0; return wol->wolopts ? -EOPNOTSUPP : 0;
/* Fall Through */ /* Fall Through */
default: default:
if(wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
return -EOPNOTSUPP; return -EOPNOTSUPP;
adapter->wol = 0; adapter->wol = 0;
if(wol->wolopts & WAKE_UCAST) if (wol->wolopts & WAKE_UCAST)
adapter->wol |= E1000_WUFC_EX; adapter->wol |= E1000_WUFC_EX;
if(wol->wolopts & WAKE_MCAST) if (wol->wolopts & WAKE_MCAST)
adapter->wol |= E1000_WUFC_MC; adapter->wol |= E1000_WUFC_MC;
if(wol->wolopts & WAKE_BCAST) if (wol->wolopts & WAKE_BCAST)
adapter->wol |= E1000_WUFC_BC; adapter->wol |= E1000_WUFC_BC;
if(wol->wolopts & WAKE_MAGIC) if (wol->wolopts & WAKE_MAGIC)
adapter->wol |= E1000_WUFC_MAG; adapter->wol |= E1000_WUFC_MAG;
} }
@ -1727,7 +1726,7 @@ e1000_led_blink_callback(unsigned long data)
{ {
struct e1000_adapter *adapter = (struct e1000_adapter *) data; struct e1000_adapter *adapter = (struct e1000_adapter *) data;
if(test_and_change_bit(E1000_LED_ON, &adapter->led_status)) if (test_and_change_bit(E1000_LED_ON, &adapter->led_status))
e1000_led_off(&adapter->hw); e1000_led_off(&adapter->hw);
else else
e1000_led_on(&adapter->hw); e1000_led_on(&adapter->hw);
@ -1740,11 +1739,11 @@ e1000_phys_id(struct net_device *netdev, uint32_t data)
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) if (!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ))
data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ);
if(adapter->hw.mac_type < e1000_82571) { if (adapter->hw.mac_type < e1000_82571) {
if(!adapter->blink_timer.function) { if (!adapter->blink_timer.function) {
init_timer(&adapter->blink_timer); init_timer(&adapter->blink_timer);
adapter->blink_timer.function = e1000_led_blink_callback; adapter->blink_timer.function = e1000_led_blink_callback;
adapter->blink_timer.data = (unsigned long) adapter; adapter->blink_timer.data = (unsigned long) adapter;
@ -1782,21 +1781,21 @@ static int
e1000_nway_reset(struct net_device *netdev) e1000_nway_reset(struct net_device *netdev)
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
if(netif_running(netdev)) { if (netif_running(netdev)) {
e1000_down(adapter); e1000_down(adapter);
e1000_up(adapter); e1000_up(adapter);
} }
return 0; return 0;
} }
static int static int
e1000_get_stats_count(struct net_device *netdev) e1000_get_stats_count(struct net_device *netdev)
{ {
return E1000_STATS_LEN; return E1000_STATS_LEN;
} }
static void static void
e1000_get_ethtool_stats(struct net_device *netdev, e1000_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, uint64_t *data) struct ethtool_stats *stats, uint64_t *data)
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
@ -1830,7 +1829,7 @@ e1000_get_ethtool_stats(struct net_device *netdev,
/* BUG_ON(i != E1000_STATS_LEN); */ /* BUG_ON(i != E1000_STATS_LEN); */
} }
static void static void
e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data)
{ {
#ifdef CONFIG_E1000_MQ #ifdef CONFIG_E1000_MQ
@ -1839,9 +1838,9 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data)
uint8_t *p = data; uint8_t *p = data;
int i; int i;
switch(stringset) { switch (stringset) {
case ETH_SS_TEST: case ETH_SS_TEST:
memcpy(data, *e1000_gstrings_test, memcpy(data, *e1000_gstrings_test,
E1000_TEST_LEN*ETH_GSTRING_LEN); E1000_TEST_LEN*ETH_GSTRING_LEN);
break; break;
case ETH_SS_STATS: case ETH_SS_STATS:

View File

@ -1600,10 +1600,10 @@ e1000_phy_setup_autoneg(struct e1000_hw *hw)
if(ret_val) if(ret_val)
return ret_val; return ret_val;
/* Read the MII 1000Base-T Control Register (Address 9). */ /* Read the MII 1000Base-T Control Register (Address 9). */
ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg);
if(ret_val) if(ret_val)
return ret_val; return ret_val;
/* Need to parse both autoneg_advertised and fc and set up /* Need to parse both autoneg_advertised and fc and set up
* the appropriate PHY registers. First we will parse for * the appropriate PHY registers. First we will parse for
@ -3916,7 +3916,7 @@ e1000_read_eeprom(struct e1000_hw *hw,
} }
} }
if(eeprom->use_eerd == TRUE) { if (eeprom->use_eerd == TRUE) {
ret_val = e1000_read_eeprom_eerd(hw, offset, words, data); ret_val = e1000_read_eeprom_eerd(hw, offset, words, data);
if ((e1000_is_onboard_nvm_eeprom(hw) == TRUE) || if ((e1000_is_onboard_nvm_eeprom(hw) == TRUE) ||
(hw->mac_type != e1000_82573)) (hw->mac_type != e1000_82573))
@ -4423,7 +4423,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
return -E1000_ERR_EEPROM; return -E1000_ERR_EEPROM;
} }
/* If STM opcode located in bits 15:8 of flop, reset firmware */ /* If STM opcode located in bits 15:8 of flop, reset firmware */
if ((flop & 0xFF00) == E1000_STM_OPCODE) { if ((flop & 0xFF00) == E1000_STM_OPCODE) {
E1000_WRITE_REG(hw, HICR, E1000_HICR_FW_RESET); E1000_WRITE_REG(hw, HICR, E1000_HICR_FW_RESET);
} }
@ -4431,7 +4431,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
/* Perform the flash update */ /* Perform the flash update */
E1000_WRITE_REG(hw, EECD, eecd | E1000_EECD_FLUPD); E1000_WRITE_REG(hw, EECD, eecd | E1000_EECD_FLUPD);
for (i=0; i < attempts; i++) { for (i=0; i < attempts; i++) {
eecd = E1000_READ_REG(hw, EECD); eecd = E1000_READ_REG(hw, EECD);
if ((eecd & E1000_EECD_FLUPD) == 0) { if ((eecd & E1000_EECD_FLUPD) == 0) {
break; break;
@ -4504,6 +4504,7 @@ e1000_read_mac_addr(struct e1000_hw * hw)
hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF);
hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8);
} }
switch (hw->mac_type) { switch (hw->mac_type) {
default: default:
break; break;
@ -6840,7 +6841,8 @@ int32_t
e1000_check_phy_reset_block(struct e1000_hw *hw) e1000_check_phy_reset_block(struct e1000_hw *hw)
{ {
uint32_t manc = 0; uint32_t manc = 0;
if(hw->mac_type > e1000_82547_rev_2)
if (hw->mac_type > e1000_82547_rev_2)
manc = E1000_READ_REG(hw, MANC); manc = E1000_READ_REG(hw, MANC);
return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ? return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ?
E1000_BLK_PHY_RESET : E1000_SUCCESS; E1000_BLK_PHY_RESET : E1000_SUCCESS;

View File

@ -377,6 +377,7 @@ int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask);
void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask); void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask);
/* Filters (multicast, vlan, receive) */ /* Filters (multicast, vlan, receive) */
void e1000_mc_addr_list_update(struct e1000_hw *hw, uint8_t * mc_addr_list, uint32_t mc_addr_count, uint32_t pad, uint32_t rar_used_count);
uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr); uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr);
void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value); void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value);
void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index); void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index);
@ -401,7 +402,9 @@ void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
/* Port I/O is only supported on 82544 and newer */ /* Port I/O is only supported on 82544 and newer */
uint32_t e1000_io_read(struct e1000_hw *hw, unsigned long port); uint32_t e1000_io_read(struct e1000_hw *hw, unsigned long port);
uint32_t e1000_read_reg_io(struct e1000_hw *hw, uint32_t offset);
void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value); void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value);
void e1000_enable_pciex_master(struct e1000_hw *hw);
int32_t e1000_disable_pciex_master(struct e1000_hw *hw); int32_t e1000_disable_pciex_master(struct e1000_hw *hw);
int32_t e1000_get_software_semaphore(struct e1000_hw *hw); int32_t e1000_get_software_semaphore(struct e1000_hw *hw);
void e1000_release_software_semaphore(struct e1000_hw *hw); void e1000_release_software_semaphore(struct e1000_hw *hw);
@ -899,14 +902,14 @@ struct e1000_ffvt_entry {
#define E1000_TXDCTL 0x03828 /* TX Descriptor Control - RW */ #define E1000_TXDCTL 0x03828 /* TX Descriptor Control - RW */
#define E1000_TADV 0x0382C /* TX Interrupt Absolute Delay Val - RW */ #define E1000_TADV 0x0382C /* TX Interrupt Absolute Delay Val - RW */
#define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */ #define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - RW */
#define E1000_TARC0 0x03840 /* TX Arbitration Count (0) */ #define E1000_TARC0 0x03840 /* TX Arbitration Count (0) */
#define E1000_TDBAL1 0x03900 /* TX Desc Base Address Low (1) - RW */ #define E1000_TDBAL1 0x03900 /* TX Desc Base Address Low (1) - RW */
#define E1000_TDBAH1 0x03904 /* TX Desc Base Address High (1) - RW */ #define E1000_TDBAH1 0x03904 /* TX Desc Base Address High (1) - RW */
#define E1000_TDLEN1 0x03908 /* TX Desc Length (1) - RW */ #define E1000_TDLEN1 0x03908 /* TX Desc Length (1) - RW */
#define E1000_TDH1 0x03910 /* TX Desc Head (1) - RW */ #define E1000_TDH1 0x03910 /* TX Desc Head (1) - RW */
#define E1000_TDT1 0x03918 /* TX Desc Tail (1) - RW */ #define E1000_TDT1 0x03918 /* TX Desc Tail (1) - RW */
#define E1000_TXDCTL1 0x03928 /* TX Descriptor Control (1) - RW */ #define E1000_TXDCTL1 0x03928 /* TX Descriptor Control (1) - RW */
#define E1000_TARC1 0x03940 /* TX Arbitration Count (1) */ #define E1000_TARC1 0x03940 /* TX Arbitration Count (1) */
#define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */ #define E1000_CRCERRS 0x04000 /* CRC Error Count - R/clr */
#define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */ #define E1000_ALGNERRC 0x04004 /* Alignment Error Count - R/clr */
#define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */ #define E1000_SYMERRS 0x04008 /* Symbol Error Count - R/clr */
@ -1761,7 +1764,6 @@ struct e1000_hw {
#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ #define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */
#define E1000_TXDCTL_COUNT_DESC 0x00400000 /* Enable the counting of desc. #define E1000_TXDCTL_COUNT_DESC 0x00400000 /* Enable the counting of desc.
still to be processed. */ still to be processed. */
/* Transmit Configuration Word */ /* Transmit Configuration Word */
#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */ #define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */
#define E1000_TXCW_HD 0x00000040 /* TXCW half duplex */ #define E1000_TXCW_HD 0x00000040 /* TXCW half duplex */

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@
BUG(); \ BUG(); \
} else { \ } else { \
msleep(x); \ msleep(x); \
} } while(0) } } while (0)
/* Some workarounds require millisecond delays and are run during interrupt /* Some workarounds require millisecond delays and are run during interrupt
* context. Most notably, when establishing link, the phy may need tweaking * context. Most notably, when establishing link, the phy may need tweaking

View File

@ -227,7 +227,7 @@ static int __devinit
e1000_validate_option(int *value, struct e1000_option *opt, e1000_validate_option(int *value, struct e1000_option *opt,
struct e1000_adapter *adapter) struct e1000_adapter *adapter)
{ {
if(*value == OPTION_UNSET) { if (*value == OPTION_UNSET) {
*value = opt->def; *value = opt->def;
return 0; return 0;
} }
@ -244,7 +244,7 @@ e1000_validate_option(int *value, struct e1000_option *opt,
} }
break; break;
case range_option: case range_option:
if(*value >= opt->arg.r.min && *value <= opt->arg.r.max) { if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
DPRINTK(PROBE, INFO, DPRINTK(PROBE, INFO,
"%s set to %i\n", opt->name, *value); "%s set to %i\n", opt->name, *value);
return 0; return 0;
@ -254,10 +254,10 @@ e1000_validate_option(int *value, struct e1000_option *opt,
int i; int i;
struct e1000_opt_list *ent; struct e1000_opt_list *ent;
for(i = 0; i < opt->arg.l.nr; i++) { for (i = 0; i < opt->arg.l.nr; i++) {
ent = &opt->arg.l.p[i]; ent = &opt->arg.l.p[i];
if(*value == ent->i) { if (*value == ent->i) {
if(ent->str[0] != '\0') if (ent->str[0] != '\0')
DPRINTK(PROBE, INFO, "%s\n", ent->str); DPRINTK(PROBE, INFO, "%s\n", ent->str);
return 0; return 0;
} }
@ -291,7 +291,7 @@ void __devinit
e1000_check_options(struct e1000_adapter *adapter) e1000_check_options(struct e1000_adapter *adapter)
{ {
int bd = adapter->bd_number; int bd = adapter->bd_number;
if(bd >= E1000_MAX_NIC) { if (bd >= E1000_MAX_NIC) {
DPRINTK(PROBE, NOTICE, DPRINTK(PROBE, NOTICE,
"Warning: no configuration for board #%i\n", bd); "Warning: no configuration for board #%i\n", bd);
DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
@ -315,7 +315,7 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_TxDescriptors > bd) { if (num_TxDescriptors > bd) {
tx_ring->count = TxDescriptors[bd]; tx_ring->count = TxDescriptors[bd];
e1000_validate_option(&tx_ring->count, &opt, adapter); e1000_validate_option(&tx_ring->count, &opt, adapter);
E1000_ROUNDUP(tx_ring->count, E1000_ROUNDUP(tx_ring->count,
REQ_TX_DESCRIPTOR_MULTIPLE); REQ_TX_DESCRIPTOR_MULTIPLE);
} else { } else {
tx_ring->count = opt.def; tx_ring->count = opt.def;
@ -341,7 +341,7 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_RxDescriptors > bd) { if (num_RxDescriptors > bd) {
rx_ring->count = RxDescriptors[bd]; rx_ring->count = RxDescriptors[bd];
e1000_validate_option(&rx_ring->count, &opt, adapter); e1000_validate_option(&rx_ring->count, &opt, adapter);
E1000_ROUNDUP(rx_ring->count, E1000_ROUNDUP(rx_ring->count,
REQ_RX_DESCRIPTOR_MULTIPLE); REQ_RX_DESCRIPTOR_MULTIPLE);
} else { } else {
rx_ring->count = opt.def; rx_ring->count = opt.def;
@ -403,7 +403,7 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_TxIntDelay > bd) { if (num_TxIntDelay > bd) {
adapter->tx_int_delay = TxIntDelay[bd]; adapter->tx_int_delay = TxIntDelay[bd];
e1000_validate_option(&adapter->tx_int_delay, &opt, e1000_validate_option(&adapter->tx_int_delay, &opt,
adapter); adapter);
} else { } else {
adapter->tx_int_delay = opt.def; adapter->tx_int_delay = opt.def;
@ -421,7 +421,7 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_TxAbsIntDelay > bd) { if (num_TxAbsIntDelay > bd) {
adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
e1000_validate_option(&adapter->tx_abs_int_delay, &opt, e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
adapter); adapter);
} else { } else {
adapter->tx_abs_int_delay = opt.def; adapter->tx_abs_int_delay = opt.def;
@ -439,7 +439,7 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_RxIntDelay > bd) { if (num_RxIntDelay > bd) {
adapter->rx_int_delay = RxIntDelay[bd]; adapter->rx_int_delay = RxIntDelay[bd];
e1000_validate_option(&adapter->rx_int_delay, &opt, e1000_validate_option(&adapter->rx_int_delay, &opt,
adapter); adapter);
} else { } else {
adapter->rx_int_delay = opt.def; adapter->rx_int_delay = opt.def;
@ -457,7 +457,7 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_RxAbsIntDelay > bd) { if (num_RxAbsIntDelay > bd) {
adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
e1000_validate_option(&adapter->rx_abs_int_delay, &opt, e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
adapter); adapter);
} else { } else {
adapter->rx_abs_int_delay = opt.def; adapter->rx_abs_int_delay = opt.def;
@ -475,17 +475,17 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_InterruptThrottleRate > bd) { if (num_InterruptThrottleRate > bd) {
adapter->itr = InterruptThrottleRate[bd]; adapter->itr = InterruptThrottleRate[bd];
switch(adapter->itr) { switch (adapter->itr) {
case 0: case 0:
DPRINTK(PROBE, INFO, "%s turned off\n", DPRINTK(PROBE, INFO, "%s turned off\n",
opt.name); opt.name);
break; break;
case 1: case 1:
DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
opt.name); opt.name);
break; break;
default: default:
e1000_validate_option(&adapter->itr, &opt, e1000_validate_option(&adapter->itr, &opt,
adapter); adapter);
break; break;
} }
@ -494,7 +494,7 @@ e1000_check_options(struct e1000_adapter *adapter)
} }
} }
switch(adapter->hw.media_type) { switch (adapter->hw.media_type) {
case e1000_media_type_fiber: case e1000_media_type_fiber:
case e1000_media_type_internal_serdes: case e1000_media_type_internal_serdes:
e1000_check_fiber_options(adapter); e1000_check_fiber_options(adapter);
@ -518,17 +518,17 @@ static void __devinit
e1000_check_fiber_options(struct e1000_adapter *adapter) e1000_check_fiber_options(struct e1000_adapter *adapter)
{ {
int bd = adapter->bd_number; int bd = adapter->bd_number;
if(num_Speed > bd) { if (num_Speed > bd) {
DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
"parameter ignored\n"); "parameter ignored\n");
} }
if(num_Duplex > bd) { if (num_Duplex > bd) {
DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
"parameter ignored\n"); "parameter ignored\n");
} }
if((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) { if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is "
"not valid for fiber adapters, " "not valid for fiber adapters, "
"parameter ignored\n"); "parameter ignored\n");
@ -598,7 +598,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
} }
} }
if((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) { if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
DPRINTK(PROBE, INFO, DPRINTK(PROBE, INFO,
"AutoNeg specified along with Speed or Duplex, " "AutoNeg specified along with Speed or Duplex, "
"parameter ignored\n"); "parameter ignored\n");
@ -659,7 +659,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
switch (speed + dplx) { switch (speed + dplx) {
case 0: case 0:
adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg = adapter->fc_autoneg = 1;
if((num_Speed > bd) && (speed != 0 || dplx != 0)) if ((num_Speed > bd) && (speed != 0 || dplx != 0))
DPRINTK(PROBE, INFO, DPRINTK(PROBE, INFO,
"Speed and duplex autonegotiation enabled\n"); "Speed and duplex autonegotiation enabled\n");
break; break;

View File

@ -69,8 +69,8 @@
#define DRV_MODULE_NAME "tg3" #define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": " #define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "3.47" #define DRV_MODULE_VERSION "3.48"
#define DRV_MODULE_RELDATE "Dec 28, 2005" #define DRV_MODULE_RELDATE "Jan 16, 2006"
#define TG3_DEF_MAC_MODE 0 #define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0 #define TG3_DEF_RX_MODE 0
@ -1325,10 +1325,12 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1); val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1);
tw32(0x7d00, val); tw32(0x7d00, val);
if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
tg3_nvram_lock(tp); int err;
err = tg3_nvram_lock(tp);
tg3_halt_cpu(tp, RX_CPU_BASE); tg3_halt_cpu(tp, RX_CPU_BASE);
tw32_f(NVRAM_SWARB, SWARB_REQ_CLR0); if (!err)
tg3_nvram_unlock(tp); tg3_nvram_unlock(tp);
} }
} }
@ -4193,14 +4195,19 @@ static int tg3_nvram_lock(struct tg3 *tp)
if (tp->tg3_flags & TG3_FLAG_NVRAM) { if (tp->tg3_flags & TG3_FLAG_NVRAM) {
int i; int i;
tw32(NVRAM_SWARB, SWARB_REQ_SET1); if (tp->nvram_lock_cnt == 0) {
for (i = 0; i < 8000; i++) { tw32(NVRAM_SWARB, SWARB_REQ_SET1);
if (tr32(NVRAM_SWARB) & SWARB_GNT1) for (i = 0; i < 8000; i++) {
break; if (tr32(NVRAM_SWARB) & SWARB_GNT1)
udelay(20); break;
udelay(20);
}
if (i == 8000) {
tw32(NVRAM_SWARB, SWARB_REQ_CLR1);
return -ENODEV;
}
} }
if (i == 8000) tp->nvram_lock_cnt++;
return -ENODEV;
} }
return 0; return 0;
} }
@ -4208,8 +4215,12 @@ static int tg3_nvram_lock(struct tg3 *tp)
/* tp->lock is held. */ /* tp->lock is held. */
static void tg3_nvram_unlock(struct tg3 *tp) static void tg3_nvram_unlock(struct tg3 *tp)
{ {
if (tp->tg3_flags & TG3_FLAG_NVRAM) if (tp->tg3_flags & TG3_FLAG_NVRAM) {
tw32_f(NVRAM_SWARB, SWARB_REQ_CLR1); if (tp->nvram_lock_cnt > 0)
tp->nvram_lock_cnt--;
if (tp->nvram_lock_cnt == 0)
tw32_f(NVRAM_SWARB, SWARB_REQ_CLR1);
}
} }
/* tp->lock is held. */ /* tp->lock is held. */
@ -4320,8 +4331,13 @@ static int tg3_chip_reset(struct tg3 *tp)
void (*write_op)(struct tg3 *, u32, u32); void (*write_op)(struct tg3 *, u32, u32);
int i; int i;
if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) {
tg3_nvram_lock(tp); tg3_nvram_lock(tp);
/* No matching tg3_nvram_unlock() after this because
* chip reset below will undo the nvram lock.
*/
tp->nvram_lock_cnt = 0;
}
/* /*
* We must avoid the readl() that normally takes place. * We must avoid the readl() that normally takes place.
@ -4717,6 +4733,10 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset)
(offset == RX_CPU_BASE ? "RX" : "TX")); (offset == RX_CPU_BASE ? "RX" : "TX"));
return -ENODEV; return -ENODEV;
} }
/* Clear firmware's nvram arbitration. */
if (tp->tg3_flags & TG3_FLAG_NVRAM)
tw32(NVRAM_SWARB, SWARB_REQ_CLR0);
return 0; return 0;
} }
@ -4736,7 +4756,7 @@ struct fw_info {
static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_base, static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_base,
int cpu_scratch_size, struct fw_info *info) int cpu_scratch_size, struct fw_info *info)
{ {
int err, i; int err, lock_err, i;
void (*write_op)(struct tg3 *, u32, u32); void (*write_op)(struct tg3 *, u32, u32);
if (cpu_base == TX_CPU_BASE && if (cpu_base == TX_CPU_BASE &&
@ -4755,9 +4775,10 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b
/* It is possible that bootcode is still loading at this point. /* It is possible that bootcode is still loading at this point.
* Get the nvram lock first before halting the cpu. * Get the nvram lock first before halting the cpu.
*/ */
tg3_nvram_lock(tp); lock_err = tg3_nvram_lock(tp);
err = tg3_halt_cpu(tp, cpu_base); err = tg3_halt_cpu(tp, cpu_base);
tg3_nvram_unlock(tp); if (!lock_err)
tg3_nvram_unlock(tp);
if (err) if (err)
goto out; goto out;
@ -8182,7 +8203,7 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
data[1] = 1; data[1] = 1;
} }
if (etest->flags & ETH_TEST_FL_OFFLINE) { if (etest->flags & ETH_TEST_FL_OFFLINE) {
int irq_sync = 0; int err, irq_sync = 0;
if (netif_running(dev)) { if (netif_running(dev)) {
tg3_netif_stop(tp); tg3_netif_stop(tp);
@ -8192,11 +8213,12 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
tg3_full_lock(tp, irq_sync); tg3_full_lock(tp, irq_sync);
tg3_halt(tp, RESET_KIND_SUSPEND, 1); tg3_halt(tp, RESET_KIND_SUSPEND, 1);
tg3_nvram_lock(tp); err = tg3_nvram_lock(tp);
tg3_halt_cpu(tp, RX_CPU_BASE); tg3_halt_cpu(tp, RX_CPU_BASE);
if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
tg3_halt_cpu(tp, TX_CPU_BASE); tg3_halt_cpu(tp, TX_CPU_BASE);
tg3_nvram_unlock(tp); if (!err)
tg3_nvram_unlock(tp);
if (tg3_test_registers(tp) != 0) { if (tg3_test_registers(tp) != 0) {
etest->flags |= ETH_TEST_FL_FAILED; etest->flags |= ETH_TEST_FL_FAILED;
@ -8588,7 +8610,11 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) {
tp->tg3_flags |= TG3_FLAG_NVRAM; tp->tg3_flags |= TG3_FLAG_NVRAM;
tg3_nvram_lock(tp); if (tg3_nvram_lock(tp)) {
printk(KERN_WARNING PFX "%s: Cannot get nvarm lock, "
"tg3_nvram_init failed.\n", tp->dev->name);
return;
}
tg3_enable_nvram_access(tp); tg3_enable_nvram_access(tp);
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
@ -8686,7 +8712,9 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
if (offset > NVRAM_ADDR_MSK) if (offset > NVRAM_ADDR_MSK)
return -EINVAL; return -EINVAL;
tg3_nvram_lock(tp); ret = tg3_nvram_lock(tp);
if (ret)
return ret;
tg3_enable_nvram_access(tp); tg3_enable_nvram_access(tp);
@ -8785,10 +8813,6 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
offset = offset + (pagesize - page_off); offset = offset + (pagesize - page_off);
/* Nvram lock released by tg3_nvram_read() above,
* so need to get it again.
*/
tg3_nvram_lock(tp);
tg3_enable_nvram_access(tp); tg3_enable_nvram_access(tp);
/* /*
@ -8925,7 +8949,9 @@ static int tg3_nvram_write_block(struct tg3 *tp, u32 offset, u32 len, u8 *buf)
else { else {
u32 grc_mode; u32 grc_mode;
tg3_nvram_lock(tp); ret = tg3_nvram_lock(tp);
if (ret)
return ret;
tg3_enable_nvram_access(tp); tg3_enable_nvram_access(tp);
if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) &&

View File

@ -2275,6 +2275,7 @@ struct tg3 {
dma_addr_t stats_mapping; dma_addr_t stats_mapping;
struct work_struct reset_task; struct work_struct reset_task;
int nvram_lock_cnt;
u32 nvram_size; u32 nvram_size;
u32 nvram_pagesize; u32 nvram_pagesize;
u32 nvram_jedecnum; u32 nvram_jedecnum;

View File

@ -1142,6 +1142,9 @@ static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev)
case 0x27c4: case 0x27c4:
ich = 7; ich = 7;
break; break;
case 0x2828: /* ICH8M */
ich = 8;
break;
default: default:
/* we do not handle this PCI device */ /* we do not handle this PCI device */
return; return;
@ -1161,7 +1164,7 @@ static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev)
else else
return; /* not in combined mode */ return; /* not in combined mode */
} else { } else {
WARN_ON((ich != 6) && (ich != 7)); WARN_ON((ich != 6) && (ich != 7) && (ich != 8));
tmp &= 0x3; /* interesting bits 1:0 */ tmp &= 0x3; /* interesting bits 1:0 */
if (tmp & (1 << 0)) if (tmp & (1 << 0))
comb = (1 << 2); /* PATA port 0, SATA port 1 */ comb = (1 << 2); /* PATA port 0, SATA port 1 */

View File

@ -276,6 +276,16 @@ static const struct pci_device_id ahci_pci_tbl[] = {
board_ahci }, /* ESB2 */ board_ahci }, /* ESB2 */
{ PCI_VENDOR_ID_INTEL, 0x27c6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, { PCI_VENDOR_ID_INTEL, 0x27c6, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_ahci }, /* ICH7-M DH */ board_ahci }, /* ICH7-M DH */
{ PCI_VENDOR_ID_INTEL, 0x2821, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_ahci }, /* ICH8 */
{ PCI_VENDOR_ID_INTEL, 0x2822, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_ahci }, /* ICH8 */
{ PCI_VENDOR_ID_INTEL, 0x2824, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_ahci }, /* ICH8 */
{ PCI_VENDOR_ID_INTEL, 0x2829, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_ahci }, /* ICH8M */
{ PCI_VENDOR_ID_INTEL, 0x282a, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_ahci }, /* ICH8M */
{ } /* terminate list */ { } /* terminate list */
}; };

View File

@ -157,6 +157,9 @@ static const struct pci_device_id piix_pci_tbl[] = {
{ 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
{ 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
{ 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
{ 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
{ 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
{ 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
{ } /* terminate list */ { } /* terminate list */
}; };

View File

@ -611,6 +611,10 @@ int ata_rwcmd_protocol(struct ata_queued_cmd *qc)
if (dev->flags & ATA_DFLAG_PIO) { if (dev->flags & ATA_DFLAG_PIO) {
tf->protocol = ATA_PROT_PIO; tf->protocol = ATA_PROT_PIO;
index = dev->multi_count ? 0 : 8; index = dev->multi_count ? 0 : 8;
} else if (lba48 && (qc->ap->flags & ATA_FLAG_PIO_LBA48)) {
/* Unable to use DMA due to host limitation */
tf->protocol = ATA_PROT_PIO;
index = dev->multi_count ? 0 : 4;
} else { } else {
tf->protocol = ATA_PROT_DMA; tf->protocol = ATA_PROT_DMA;
index = 16; index = 16;
@ -1051,18 +1055,22 @@ static unsigned int ata_pio_modes(const struct ata_device *adev)
{ {
u16 modes; u16 modes;
/* Usual case. Word 53 indicates word 88 is valid */ /* Usual case. Word 53 indicates word 64 is valid */
if (adev->id[ATA_ID_FIELD_VALID] & (1 << 2)) { if (adev->id[ATA_ID_FIELD_VALID] & (1 << 1)) {
modes = adev->id[ATA_ID_PIO_MODES] & 0x03; modes = adev->id[ATA_ID_PIO_MODES] & 0x03;
modes <<= 3; modes <<= 3;
modes |= 0x7; modes |= 0x7;
return modes; return modes;
} }
/* If word 88 isn't valid then Word 51 holds the PIO timing number /* If word 64 isn't valid then Word 51 high byte holds the PIO timing
for the maximum. Turn it into a mask and return it */ number for the maximum. Turn it into a mask and return it */
modes = (2 << (adev->id[ATA_ID_OLD_PIO_MODES] & 0xFF)) - 1 ; modes = (2 << ((adev->id[ATA_ID_OLD_PIO_MODES] >> 8) & 0xFF)) - 1 ;
return modes; return modes;
/* But wait.. there's more. Design your standards by committee and
you too can get a free iordy field to process. However its the
speeds not the modes that are supported... Note drivers using the
timing API will get this right anyway */
} }
struct ata_exec_internal_arg { struct ata_exec_internal_arg {
@ -1164,6 +1172,39 @@ ata_exec_internal(struct ata_port *ap, struct ata_device *dev,
return AC_ERR_OTHER; return AC_ERR_OTHER;
} }
/**
* ata_pio_need_iordy - check if iordy needed
* @adev: ATA device
*
* Check if the current speed of the device requires IORDY. Used
* by various controllers for chip configuration.
*/
unsigned int ata_pio_need_iordy(const struct ata_device *adev)
{
int pio;
int speed = adev->pio_mode - XFER_PIO_0;
if (speed < 2)
return 0;
if (speed > 2)
return 1;
/* If we have no drive specific rule, then PIO 2 is non IORDY */
if (adev->id[ATA_ID_FIELD_VALID] & 2) { /* EIDE */
pio = adev->id[ATA_ID_EIDE_PIO];
/* Is the speed faster than the drive allows non IORDY ? */
if (pio) {
/* This is cycle times not frequency - watch the logic! */
if (pio > 240) /* PIO2 is 240nS per cycle */
return 1;
return 0;
}
}
return 0;
}
/** /**
* ata_dev_identify - obtain IDENTIFY x DEVICE page * ata_dev_identify - obtain IDENTIFY x DEVICE page
* @ap: port on which device we wish to probe resides * @ap: port on which device we wish to probe resides
@ -1415,7 +1456,7 @@ void ata_dev_config(struct ata_port *ap, unsigned int i)
ap->udma_mask &= ATA_UDMA5; ap->udma_mask &= ATA_UDMA5;
ap->host->max_sectors = ATA_MAX_SECTORS; ap->host->max_sectors = ATA_MAX_SECTORS;
ap->host->hostt->max_sectors = ATA_MAX_SECTORS; ap->host->hostt->max_sectors = ATA_MAX_SECTORS;
ap->device->flags |= ATA_DFLAG_LOCK_SECTORS; ap->device[i].flags |= ATA_DFLAG_LOCK_SECTORS;
} }
if (ap->ops->dev_config) if (ap->ops->dev_config)
@ -3056,10 +3097,21 @@ static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf,
static void ata_data_xfer(struct ata_port *ap, unsigned char *buf, static void ata_data_xfer(struct ata_port *ap, unsigned char *buf,
unsigned int buflen, int do_write) unsigned int buflen, int do_write)
{ {
if (ap->flags & ATA_FLAG_MMIO) /* Make the crap hardware pay the costs not the good stuff */
ata_mmio_data_xfer(ap, buf, buflen, do_write); if (unlikely(ap->flags & ATA_FLAG_IRQ_MASK)) {
else unsigned long flags;
ata_pio_data_xfer(ap, buf, buflen, do_write); local_irq_save(flags);
if (ap->flags & ATA_FLAG_MMIO)
ata_mmio_data_xfer(ap, buf, buflen, do_write);
else
ata_pio_data_xfer(ap, buf, buflen, do_write);
local_irq_restore(flags);
} else {
if (ap->flags & ATA_FLAG_MMIO)
ata_mmio_data_xfer(ap, buf, buflen, do_write);
else
ata_pio_data_xfer(ap, buf, buflen, do_write);
}
} }
/** /**
@ -5122,6 +5174,7 @@ EXPORT_SYMBOL_GPL(ata_dev_id_string);
EXPORT_SYMBOL_GPL(ata_dev_config); EXPORT_SYMBOL_GPL(ata_dev_config);
EXPORT_SYMBOL_GPL(ata_scsi_simulate); EXPORT_SYMBOL_GPL(ata_scsi_simulate);
EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
EXPORT_SYMBOL_GPL(ata_timing_compute); EXPORT_SYMBOL_GPL(ata_timing_compute);
EXPORT_SYMBOL_GPL(ata_timing_merge); EXPORT_SYMBOL_GPL(ata_timing_merge);

View File

@ -66,6 +66,7 @@ enum {
board_2037x = 0, /* FastTrak S150 TX2plus */ board_2037x = 0, /* FastTrak S150 TX2plus */
board_20319 = 1, /* FastTrak S150 TX4 */ board_20319 = 1, /* FastTrak S150 TX4 */
board_20619 = 2, /* FastTrak TX4000 */ board_20619 = 2, /* FastTrak TX4000 */
board_20771 = 3, /* FastTrak TX2300 */
PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */ PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */
@ -190,6 +191,16 @@ static const struct ata_port_info pdc_port_info[] = {
.udma_mask = 0x7f, /* udma0-6 ; FIXME */ .udma_mask = 0x7f, /* udma0-6 ; FIXME */
.port_ops = &pdc_pata_ops, .port_ops = &pdc_pata_ops,
}, },
/* board_20771 */
{
.sht = &pdc_ata_sht,
.host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
.pio_mask = 0x1f, /* pio0-4 */
.mwdma_mask = 0x07, /* mwdma0-2 */
.udma_mask = 0x7f, /* udma0-6 ; FIXME */
.port_ops = &pdc_sata_ops,
},
}; };
static const struct pci_device_id pdc_ata_pci_tbl[] = { static const struct pci_device_id pdc_ata_pci_tbl[] = {
@ -226,6 +237,8 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
{ PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0, { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_20619 }, board_20619 },
{ PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
board_20771 },
{ } /* terminate list */ { } /* terminate list */
}; };
@ -706,6 +719,9 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
case board_2037x: case board_2037x:
probe_ent->n_ports = 2; probe_ent->n_ports = 2;
break; break;
case board_20771:
probe_ent->n_ports = 2;
break;
case board_20619: case board_20619:
probe_ent->n_ports = 4; probe_ent->n_ports = 4;

View File

@ -470,6 +470,7 @@ static const struct pci_device_id k2_sata_pci_tbl[] = {
{ 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
{ 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 },
{ 0x1166, 0x024a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, { 0x1166, 0x024a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
{ 0x1166, 0x024b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
{ } { }
}; };

View File

@ -199,8 +199,7 @@ struct fbcmap32 {
#define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32) #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32)
#define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32) #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32)
static int fbiogetputcmap(struct file *file, struct fb_info *info, static int fbiogetputcmap(struct fb_info *info, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct fbcmap32 __user *argp = (void __user *)arg; struct fbcmap32 __user *argp = (void __user *)arg;
struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p)); struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p));
@ -236,8 +235,7 @@ struct fbcursor32 {
#define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32) #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32)
#define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32) #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32)
static int fbiogscursor(struct file *file, struct fb_info *info, static int fbiogscursor(struct fb_info *info, unsigned long arg)
unsigned long arg)
{ {
struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p)); struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p));
struct fbcursor32 __user *argp = (void __user *)arg; struct fbcursor32 __user *argp = (void __user *)arg;
@ -263,8 +261,7 @@ static int fbiogscursor(struct file *file, struct fb_info *info,
return info->fbops->fb_ioctl(info, FBIOSCURSOR, (unsigned long)p); return info->fbops->fb_ioctl(info, FBIOSCURSOR, (unsigned long)p);
} }
long sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, int sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
unsigned long arg)
{ {
switch (cmd) { switch (cmd) {
case FBIOGTYPE: case FBIOGTYPE:

View File

@ -20,7 +20,7 @@ extern int sbusfb_mmap_helper(struct sbus_mmap_map *map,
int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
struct fb_info *info, struct fb_info *info,
int type, int fb_depth, unsigned long fb_size); int type, int fb_depth, unsigned long fb_size);
long sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, int sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg); unsigned long arg);
#endif /* _SBUSLIB_H */ #endif /* _SBUSLIB_H */

View File

@ -336,24 +336,47 @@ static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh)
} }
/* /*
* Submit all of the bios for all of the ioends we have saved up, * Submit all of the bios for all of the ioends we have saved up, covering the
* covering the initial writepage page and also any probed pages. * initial writepage page and also any probed pages.
*
* Because we may have multiple ioends spanning a page, we need to start
* writeback on all the buffers before we submit them for I/O. If we mark the
* buffers as we got, then we can end up with a page that only has buffers
* marked async write and I/O complete on can occur before we mark the other
* buffers async write.
*
* The end result of this is that we trip a bug in end_page_writeback() because
* we call it twice for the one page as the code in end_buffer_async_write()
* assumes that all buffers on the page are started at the same time.
*
* The fix is two passes across the ioend list - one to start writeback on the
* bufferheads, and then the second one submit them for I/O.
*/ */
STATIC void STATIC void
xfs_submit_ioend( xfs_submit_ioend(
xfs_ioend_t *ioend) xfs_ioend_t *ioend)
{ {
xfs_ioend_t *head = ioend;
xfs_ioend_t *next; xfs_ioend_t *next;
struct buffer_head *bh; struct buffer_head *bh;
struct bio *bio; struct bio *bio;
sector_t lastblock = 0; sector_t lastblock = 0;
/* Pass 1 - start writeback */
do {
next = ioend->io_list;
for (bh = ioend->io_buffer_head; bh; bh = bh->b_private) {
xfs_start_buffer_writeback(bh);
}
} while ((ioend = next) != NULL);
/* Pass 2 - submit I/O */
ioend = head;
do { do {
next = ioend->io_list; next = ioend->io_list;
bio = NULL; bio = NULL;
for (bh = ioend->io_buffer_head; bh; bh = bh->b_private) { for (bh = ioend->io_buffer_head; bh; bh = bh->b_private) {
xfs_start_buffer_writeback(bh);
if (!bio) { if (!bio) {
retry: retry:

View File

@ -31,7 +31,7 @@
/* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k /* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k
* alignment is sufficient to prevent this */ * alignment is sufficient to prevent this */
struct __attribute__((__aligned__(0x400))) lppaca { struct lppaca {
//============================================================================= //=============================================================================
// CACHE_LINE_1 0x0000 - 0x007F Contains read-only data // CACHE_LINE_1 0x0000 - 0x007F Contains read-only data
// NOTE: The xDynXyz fields are fields that will be dynamically changed by // NOTE: The xDynXyz fields are fields that will be dynamically changed by
@ -129,7 +129,7 @@ struct __attribute__((__aligned__(0x400))) lppaca {
// CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data // CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data
//============================================================================= //=============================================================================
u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF
}; } __attribute__((__aligned__(0x400)));
extern struct lppaca lppaca[]; extern struct lppaca lppaca[];

View File

@ -228,6 +228,7 @@ extern void dump_stack(void);
ntohs((addr).s6_addr16[6]), \ ntohs((addr).s6_addr16[6]), \
ntohs((addr).s6_addr16[7]) ntohs((addr).s6_addr16[7])
#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" #define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
#define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x"
#if defined(__LITTLE_ENDIAN) #if defined(__LITTLE_ENDIAN)
#define HIPQUAD(addr) \ #define HIPQUAD(addr) \

View File

@ -126,16 +126,19 @@ enum {
ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */ ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */
ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */
ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */
ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */
ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
/* various lengths of time */ /* various lengths of time */
ATA_TMOUT_EDD = 5 * HZ, /* hueristic */ ATA_TMOUT_EDD = 5 * HZ, /* heuristic */
ATA_TMOUT_PIO = 30 * HZ, ATA_TMOUT_PIO = 30 * HZ,
ATA_TMOUT_BOOT = 30 * HZ, /* hueristic */ ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */ ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
ATA_TMOUT_CDB = 30 * HZ, ATA_TMOUT_CDB = 30 * HZ,
ATA_TMOUT_CDB_QUICK = 5 * HZ, ATA_TMOUT_CDB_QUICK = 5 * HZ,
ATA_TMOUT_INTERNAL = 30 * HZ, ATA_TMOUT_INTERNAL = 30 * HZ,
@ -499,6 +502,8 @@ extern int ata_scsi_slave_config(struct scsi_device *sdev);
/* /*
* Timing helpers * Timing helpers
*/ */
extern unsigned int ata_pio_need_iordy(const struct ata_device *);
extern int ata_timing_compute(struct ata_device *, unsigned short, extern int ata_timing_compute(struct ata_device *, unsigned short,
struct ata_timing *, int, int); struct ata_timing *, int, int);
extern void ata_timing_merge(const struct ata_timing *, extern void ata_timing_merge(const struct ata_timing *,

View File

@ -18,13 +18,4 @@ struct ip6t_ah
#define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */ #define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */
#define IP6T_AH_INV_MASK 0x03 /* All possible flags. */ #define IP6T_AH_INV_MASK 0x03 /* All possible flags. */
#define MASK_HOPOPTS 128
#define MASK_DSTOPTS 64
#define MASK_ROUTING 32
#define MASK_FRAGMENT 16
#define MASK_AH 8
#define MASK_ESP 4
#define MASK_NONE 2
#define MASK_PROTO 1
#endif /*_IP6T_AH_H*/ #endif /*_IP6T_AH_H*/

View File

@ -7,15 +7,6 @@ struct ip6t_esp
u_int8_t invflags; /* Inverse flags */ u_int8_t invflags; /* Inverse flags */
}; };
#define MASK_HOPOPTS 128
#define MASK_DSTOPTS 64
#define MASK_ROUTING 32
#define MASK_FRAGMENT 16
#define MASK_AH 8
#define MASK_ESP 4
#define MASK_NONE 2
#define MASK_PROTO 1
/* Values for "invflags" field in struct ip6t_esp. */ /* Values for "invflags" field in struct ip6t_esp. */
#define IP6T_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ #define IP6T_ESP_INV_SPI 0x01 /* Invert the sense of spi. */
#define IP6T_ESP_INV_MASK 0x01 /* All possible flags. */ #define IP6T_ESP_INV_MASK 0x01 /* All possible flags. */

View File

@ -21,13 +21,4 @@ struct ip6t_frag
#define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */ #define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */
#define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */ #define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */
#define MASK_HOPOPTS 128
#define MASK_DSTOPTS 64
#define MASK_ROUTING 32
#define MASK_FRAGMENT 16
#define MASK_AH 8
#define MASK_ESP 4
#define MASK_NONE 2
#define MASK_PROTO 1
#endif /*_IP6T_FRAG_H*/ #endif /*_IP6T_FRAG_H*/

View File

@ -20,13 +20,4 @@ struct ip6t_opts
#define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */ #define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */
#define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */ #define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */
#define MASK_HOPOPTS 128
#define MASK_DSTOPTS 64
#define MASK_ROUTING 32
#define MASK_FRAGMENT 16
#define MASK_AH 8
#define MASK_ESP 4
#define MASK_NONE 2
#define MASK_PROTO 1
#endif /*_IP6T_OPTS_H*/ #endif /*_IP6T_OPTS_H*/

View File

@ -30,13 +30,4 @@ struct ip6t_rt
#define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */ #define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */
#define IP6T_RT_INV_MASK 0x07 /* All possible flags. */ #define IP6T_RT_INV_MASK 0x07 /* All possible flags. */
#define MASK_HOPOPTS 128
#define MASK_DSTOPTS 64
#define MASK_ROUTING 32
#define MASK_FRAGMENT 16
#define MASK_AH 8
#define MASK_ESP 4
#define MASK_NONE 2
#define MASK_PROTO 1
#endif /*_IP6T_RT_H*/ #endif /*_IP6T_RT_H*/

View File

@ -926,7 +926,7 @@ static inline int skb_tailroom(const struct sk_buff *skb)
* Increase the headroom of an empty &sk_buff by reducing the tail * Increase the headroom of an empty &sk_buff by reducing the tail
* room. This is only allowed for an empty buffer. * room. This is only allowed for an empty buffer.
*/ */
static inline void skb_reserve(struct sk_buff *skb, unsigned int len) static inline void skb_reserve(struct sk_buff *skb, int len)
{ {
skb->data += len; skb->data += len;
skb->tail += len; skb->tail += len;

View File

@ -92,7 +92,9 @@ static int ebt_ip_check(const char *tablename, unsigned int hookmask,
if (info->invflags & EBT_IP_PROTO) if (info->invflags & EBT_IP_PROTO)
return -EINVAL; return -EINVAL;
if (info->protocol != IPPROTO_TCP && if (info->protocol != IPPROTO_TCP &&
info->protocol != IPPROTO_UDP) info->protocol != IPPROTO_UDP &&
info->protocol != IPPROTO_SCTP &&
info->protocol != IPPROTO_DCCP)
return -EINVAL; return -EINVAL;
} }
if (info->bitmask & EBT_IP_DPORT && info->dport[0] > info->dport[1]) if (info->bitmask & EBT_IP_DPORT && info->dport[0] > info->dport[1])

View File

@ -95,7 +95,9 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum,
"tos=0x%02X, IP proto=%d", NIPQUAD(ih->saddr), "tos=0x%02X, IP proto=%d", NIPQUAD(ih->saddr),
NIPQUAD(ih->daddr), ih->tos, ih->protocol); NIPQUAD(ih->daddr), ih->tos, ih->protocol);
if (ih->protocol == IPPROTO_TCP || if (ih->protocol == IPPROTO_TCP ||
ih->protocol == IPPROTO_UDP) { ih->protocol == IPPROTO_UDP ||
ih->protocol == IPPROTO_SCTP ||
ih->protocol == IPPROTO_DCCP) {
struct tcpudphdr _ports, *pptr; struct tcpudphdr _ports, *pptr;
pptr = skb_header_pointer(skb, ih->ihl*4, pptr = skb_header_pointer(skb, ih->ihl*4,

View File

@ -74,7 +74,6 @@ static inline void *load_pointer(struct sk_buff *skb, int k,
* filtering, filter is the array of filter instructions, and * filtering, filter is the array of filter instructions, and
* len is the number of filter blocks in the array. * len is the number of filter blocks in the array.
*/ */
unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
{ {
struct sock_filter *fentry; /* We walk down these */ struct sock_filter *fentry; /* We walk down these */
@ -175,7 +174,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int
continue; continue;
case BPF_LD|BPF_W|BPF_ABS: case BPF_LD|BPF_W|BPF_ABS:
k = fentry->k; k = fentry->k;
load_w: load_w:
ptr = load_pointer(skb, k, 4, &tmp); ptr = load_pointer(skb, k, 4, &tmp);
if (ptr != NULL) { if (ptr != NULL) {
A = ntohl(*(u32 *)ptr); A = ntohl(*(u32 *)ptr);
@ -184,7 +183,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int
break; break;
case BPF_LD|BPF_H|BPF_ABS: case BPF_LD|BPF_H|BPF_ABS:
k = fentry->k; k = fentry->k;
load_h: load_h:
ptr = load_pointer(skb, k, 2, &tmp); ptr = load_pointer(skb, k, 2, &tmp);
if (ptr != NULL) { if (ptr != NULL) {
A = ntohs(*(u16 *)ptr); A = ntohs(*(u16 *)ptr);
@ -374,7 +373,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
case BPF_JMP|BPF_JSET|BPF_K: case BPF_JMP|BPF_JSET|BPF_K:
case BPF_JMP|BPF_JSET|BPF_X: case BPF_JMP|BPF_JSET|BPF_X:
/* for conditionals both must be safe */ /* for conditionals both must be safe */
if (pc + ftest->jt + 1 >= flen || if (pc + ftest->jt + 1 >= flen ||
pc + ftest->jf + 1 >= flen) pc + ftest->jf + 1 >= flen)
return -EINVAL; return -EINVAL;
break; break;
@ -384,7 +383,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
} }
} }
return (BPF_CLASS(filter[flen - 1].code) == BPF_RET) ? 0 : -EINVAL; return (BPF_CLASS(filter[flen - 1].code) == BPF_RET) ? 0 : -EINVAL;
} }
/** /**
@ -404,8 +403,8 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
int err; int err;
/* Make sure new filter is there and in the right amounts. */ /* Make sure new filter is there and in the right amounts. */
if (fprog->filter == NULL) if (fprog->filter == NULL)
return -EINVAL; return -EINVAL;
fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL); fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL);
if (!fp) if (!fp)

View File

@ -703,7 +703,7 @@ int netpoll_setup(struct netpoll *np)
} }
} }
if (!memcmp(np->local_mac, "\0\0\0\0\0\0", 6) && ndev->dev_addr) if (is_zero_ether_addr(np->local_mac) && ndev->dev_addr)
memcpy(np->local_mac, ndev->dev_addr, 6); memcpy(np->local_mac, ndev->dev_addr, 6);
if (!np->local_ip) { if (!np->local_ip) {

View File

@ -139,6 +139,7 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/etherdevice.h>
#include <net/checksum.h> #include <net/checksum.h>
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/addrconf.h> #include <net/addrconf.h>
@ -281,8 +282,8 @@ struct pktgen_dev {
__u32 src_mac_count; /* How many MACs to iterate through */ __u32 src_mac_count; /* How many MACs to iterate through */
__u32 dst_mac_count; /* How many MACs to iterate through */ __u32 dst_mac_count; /* How many MACs to iterate through */
unsigned char dst_mac[6]; unsigned char dst_mac[ETH_ALEN];
unsigned char src_mac[6]; unsigned char src_mac[ETH_ALEN];
__u32 cur_dst_mac_offset; __u32 cur_dst_mac_offset;
__u32 cur_src_mac_offset; __u32 cur_src_mac_offset;
@ -594,16 +595,9 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
seq_puts(seq, " src_mac: "); seq_puts(seq, " src_mac: ");
if ((pkt_dev->src_mac[0] == 0) && if (is_zero_ether_addr(pkt_dev->src_mac))
(pkt_dev->src_mac[1] == 0) &&
(pkt_dev->src_mac[2] == 0) &&
(pkt_dev->src_mac[3] == 0) &&
(pkt_dev->src_mac[4] == 0) &&
(pkt_dev->src_mac[5] == 0))
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
seq_printf(seq, "%02X%s", pkt_dev->odev->dev_addr[i], i == 5 ? " " : ":"); seq_printf(seq, "%02X%s", pkt_dev->odev->dev_addr[i], i == 5 ? " " : ":");
else else
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
seq_printf(seq, "%02X%s", pkt_dev->src_mac[i], i == 5 ? " " : ":"); seq_printf(seq, "%02X%s", pkt_dev->src_mac[i], i == 5 ? " " : ":");
@ -1189,9 +1183,9 @@ static ssize_t pktgen_if_write(struct file *file, const char __user *user_buffer
} }
if (!strcmp(name, "dst_mac")) { if (!strcmp(name, "dst_mac")) {
char *v = valstr; char *v = valstr;
unsigned char old_dmac[6]; unsigned char old_dmac[ETH_ALEN];
unsigned char *m = pkt_dev->dst_mac; unsigned char *m = pkt_dev->dst_mac;
memcpy(old_dmac, pkt_dev->dst_mac, 6); memcpy(old_dmac, pkt_dev->dst_mac, ETH_ALEN);
len = strn_len(&user_buffer[i], sizeof(valstr) - 1); len = strn_len(&user_buffer[i], sizeof(valstr) - 1);
if (len < 0) { return len; } if (len < 0) { return len; }
@ -1220,8 +1214,8 @@ static ssize_t pktgen_if_write(struct file *file, const char __user *user_buffer
} }
/* Set up Dest MAC */ /* Set up Dest MAC */
if (memcmp(old_dmac, pkt_dev->dst_mac, 6) != 0) if (compare_ether_addr(old_dmac, pkt_dev->dst_mac))
memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, 6); memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN);
sprintf(pg_result, "OK: dstmac"); sprintf(pg_result, "OK: dstmac");
return count; return count;
@ -1560,17 +1554,11 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
/* Default to the interface's mac if not explicitly set. */ /* Default to the interface's mac if not explicitly set. */
if ((pkt_dev->src_mac[0] == 0) && if (is_zero_ether_addr(pkt_dev->src_mac))
(pkt_dev->src_mac[1] == 0) && memcpy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr, ETH_ALEN);
(pkt_dev->src_mac[2] == 0) &&
(pkt_dev->src_mac[3] == 0) &&
(pkt_dev->src_mac[4] == 0) &&
(pkt_dev->src_mac[5] == 0)) {
memcpy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr, 6);
}
/* Set up Dest MAC */ /* Set up Dest MAC */
memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, 6); memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN);
/* Set up pkt size */ /* Set up pkt size */
pkt_dev->cur_pkt_size = pkt_dev->min_pkt_size; pkt_dev->cur_pkt_size = pkt_dev->min_pkt_size;

View File

@ -144,7 +144,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av,
const unsigned char state) const unsigned char state)
{ {
unsigned int gap; unsigned int gap;
signed long new_head; long new_head;
if (av->dccpav_vec_len + packets > av->dccpav_buf_len) if (av->dccpav_vec_len + packets > av->dccpav_buf_len)
return -ENOBUFS; return -ENOBUFS;

View File

@ -46,7 +46,6 @@ obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o
obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o
# matches # matches
obj-$(CONFIG_IP_NF_MATCH_HELPER) += ipt_helper.o
obj-$(CONFIG_IP_NF_MATCH_HASHLIMIT) += ipt_hashlimit.o obj-$(CONFIG_IP_NF_MATCH_HASHLIMIT) += ipt_hashlimit.o
obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o
obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o

View File

@ -32,6 +32,7 @@
#include <linux/in.h> #include <linux/in.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/interrupt.h>
static DEFINE_RWLOCK(ip_ct_gre_lock); static DEFINE_RWLOCK(ip_ct_gre_lock);
#define ASSERT_READ_LOCK(x) #define ASSERT_READ_LOCK(x)

View File

@ -95,7 +95,10 @@ match_policy_out(const struct sk_buff *skb, const struct ipt_policy_info *info)
static int match(const struct sk_buff *skb, static int match(const struct sk_buff *skb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
const void *matchinfo, int offset, int *hotdrop) const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
{ {
const struct ipt_policy_info *info = matchinfo; const struct ipt_policy_info *info = matchinfo;
int ret; int ret;
@ -113,7 +116,7 @@ static int match(const struct sk_buff *skb,
return ret; return ret;
} }
static int checkentry(const char *tablename, const struct ipt_ip *ip, static int checkentry(const char *tablename, const void *ip_void,
void *matchinfo, unsigned int matchsize, void *matchinfo, unsigned int matchsize,
unsigned int hook_mask) unsigned int hook_mask)
{ {

View File

@ -240,9 +240,8 @@ static unsigned rt_hash_mask;
static int rt_hash_log; static int rt_hash_log;
static unsigned int rt_hash_rnd; static unsigned int rt_hash_rnd;
static struct rt_cache_stat *rt_cache_stat; static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
#define RT_CACHE_STAT_INC(field) \ #define RT_CACHE_STAT_INC(field) (__get_cpu_var(rt_cache_stat).field++)
(per_cpu_ptr(rt_cache_stat, raw_smp_processor_id())->field++)
static int rt_intern_hash(unsigned hash, struct rtable *rth, static int rt_intern_hash(unsigned hash, struct rtable *rth,
struct rtable **res); struct rtable **res);
@ -401,7 +400,7 @@ static void *rt_cpu_seq_start(struct seq_file *seq, loff_t *pos)
if (!cpu_possible(cpu)) if (!cpu_possible(cpu))
continue; continue;
*pos = cpu+1; *pos = cpu+1;
return per_cpu_ptr(rt_cache_stat, cpu); return &per_cpu(rt_cache_stat, cpu);
} }
return NULL; return NULL;
} }
@ -414,7 +413,7 @@ static void *rt_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos)
if (!cpu_possible(cpu)) if (!cpu_possible(cpu))
continue; continue;
*pos = cpu+1; *pos = cpu+1;
return per_cpu_ptr(rt_cache_stat, cpu); return &per_cpu(rt_cache_stat, cpu);
} }
return NULL; return NULL;
@ -3160,10 +3159,6 @@ int __init ip_rt_init(void)
ipv4_dst_ops.gc_thresh = (rt_hash_mask + 1); ipv4_dst_ops.gc_thresh = (rt_hash_mask + 1);
ip_rt_max_size = (rt_hash_mask + 1) * 16; ip_rt_max_size = (rt_hash_mask + 1) * 16;
rt_cache_stat = alloc_percpu(struct rt_cache_stat);
if (!rt_cache_stat)
return -ENOMEM;
devinet_init(); devinet_init();
ip_fib_init(); ip_fib_init();
@ -3191,7 +3186,6 @@ int __init ip_rt_init(void)
if (!proc_net_fops_create("rt_cache", S_IRUGO, &rt_cache_seq_fops) || if (!proc_net_fops_create("rt_cache", S_IRUGO, &rt_cache_seq_fops) ||
!(rtstat_pde = create_proc_entry("rt_cache", S_IRUGO, !(rtstat_pde = create_proc_entry("rt_cache", S_IRUGO,
proc_net_stat))) { proc_net_stat))) {
free_percpu(rt_cache_stat);
return -ENOMEM; return -ENOMEM;
} }
rtstat_pde->proc_fops = &rt_cpu_seq_fops; rtstat_pde->proc_fops = &rt_cpu_seq_fops;

View File

@ -2644,7 +2644,7 @@ static int if6_seq_show(struct seq_file *seq, void *v)
{ {
struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
seq_printf(seq, seq_printf(seq,
NIP6_FMT " %02x %02x %02x %02x %8s\n", NIP6_SEQFMT " %02x %02x %02x %02x %8s\n",
NIP6(ifp->addr), NIP6(ifp->addr),
ifp->idev->dev->ifindex, ifp->idev->dev->ifindex,
ifp->prefix_len, ifp->prefix_len,

View File

@ -532,7 +532,7 @@ static int ac6_seq_show(struct seq_file *seq, void *v)
struct ac6_iter_state *state = ac6_seq_private(seq); struct ac6_iter_state *state = ac6_seq_private(seq);
seq_printf(seq, seq_printf(seq,
"%-4d %-15s " NIP6_FMT " %5d\n", "%-4d %-15s " NIP6_SEQFMT " %5d\n",
state->dev->ifindex, state->dev->name, state->dev->ifindex, state->dev->name,
NIP6(im->aca_addr), NIP6(im->aca_addr),
im->aca_users); im->aca_users);

View File

@ -629,7 +629,7 @@ static void ip6fl_fl_seq_show(struct seq_file *seq, struct ip6_flowlabel *fl)
{ {
while(fl) { while(fl) {
seq_printf(seq, seq_printf(seq,
"%05X %-1d %-6d %-6d %-6ld %-8ld " NIP6_FMT " %-4d\n", "%05X %-1d %-6d %-6d %-6ld %-8ld " NIP6_SEQFMT " %-4d\n",
(unsigned)ntohl(fl->label), (unsigned)ntohl(fl->label),
fl->share, fl->share,
(unsigned)fl->owner, (unsigned)fl->owner,
@ -645,7 +645,7 @@ static void ip6fl_fl_seq_show(struct seq_file *seq, struct ip6_flowlabel *fl)
static int ip6fl_seq_show(struct seq_file *seq, void *v) static int ip6fl_seq_show(struct seq_file *seq, void *v)
{ {
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
seq_printf(seq, "%-5s %-1s %-6s %-6s %-6s %-8s %-39s %s\n", seq_printf(seq, "%-5s %-1s %-6s %-6s %-6s %-8s %-32s %s\n",
"Label", "S", "Owner", "Users", "Linger", "Expires", "Dst", "Opt"); "Label", "S", "Owner", "Users", "Linger", "Expires", "Dst", "Opt");
else else
ip6fl_fl_seq_show(seq, v); ip6fl_fl_seq_show(seq, v);

View File

@ -2373,7 +2373,7 @@ static int igmp6_mc_seq_show(struct seq_file *seq, void *v)
struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
seq_printf(seq, seq_printf(seq,
"%-4d %-15s " NIP6_FMT " %5d %08X %ld\n", "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n",
state->dev->ifindex, state->dev->name, state->dev->ifindex, state->dev->name,
NIP6(im->mca_addr), NIP6(im->mca_addr),
im->mca_users, im->mca_flags, im->mca_users, im->mca_flags,
@ -2542,12 +2542,12 @@ static int igmp6_mcf_seq_show(struct seq_file *seq, void *v)
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_printf(seq, seq_printf(seq,
"%3s %6s " "%3s %6s "
"%39s %39s %6s %6s\n", "Idx", "%32s %32s %6s %6s\n", "Idx",
"Device", "Multicast Address", "Device", "Multicast Address",
"Source Address", "INC", "EXC"); "Source Address", "INC", "EXC");
} else { } else {
seq_printf(seq, seq_printf(seq,
"%3d %6.6s " NIP6_FMT " " NIP6_FMT " %6lu %6lu\n", "%3d %6.6s " NIP6_SEQFMT " " NIP6_SEQFMT " %6lu %6lu\n",
state->dev->ifindex, state->dev->name, state->dev->ifindex, state->dev->name,
NIP6(state->im->mca_addr), NIP6(state->im->mca_addr),
NIP6(psf->sf_addr), NIP6(psf->sf_addr),

View File

@ -4,7 +4,6 @@
# Link order matters here. # Link order matters here.
obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o
obj-$(CONFIG_IP6_NF_MATCH_LENGTH) += ip6t_length.o
obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o
obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o ip6t_dst.o obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o ip6t_dst.o
obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o

View File

@ -36,19 +36,19 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
#endif #endif
/* /*
* (Type & 0xC0) >> 6 * (Type & 0xC0) >> 6
* 0 -> ignorable * 0 -> ignorable
* 1 -> must drop the packet * 1 -> must drop the packet
* 2 -> send ICMP PARM PROB regardless and drop packet * 2 -> send ICMP PARM PROB regardless and drop packet
* 3 -> Send ICMP if not a multicast address and drop packet * 3 -> Send ICMP if not a multicast address and drop packet
* (Type & 0x20) >> 5 * (Type & 0x20) >> 5
* 0 -> invariant * 0 -> invariant
* 1 -> can change the routing * 1 -> can change the routing
* (Type & 0x1F) Type * (Type & 0x1F) Type
* 0 -> Pad1 (only 1 byte!) * 0 -> Pad1 (only 1 byte!)
* 1 -> PadN LENGTH info (total length = length + 2) * 1 -> PadN LENGTH info (total length = length + 2)
* C0 | 2 -> JUMBO 4 x x x x ( xxxx > 64k ) * C0 | 2 -> JUMBO 4 x x x x ( xxxx > 64k )
* 5 -> RTALERT 2 x x * 5 -> RTALERT 2 x x
*/ */
static int static int
@ -60,16 +60,16 @@ match(const struct sk_buff *skb,
unsigned int protoff, unsigned int protoff,
int *hotdrop) int *hotdrop)
{ {
struct ipv6_opt_hdr _optsh, *oh; struct ipv6_opt_hdr _optsh, *oh;
const struct ip6t_opts *optinfo = matchinfo; const struct ip6t_opts *optinfo = matchinfo;
unsigned int temp; unsigned int temp;
unsigned int ptr; unsigned int ptr;
unsigned int hdrlen = 0; unsigned int hdrlen = 0;
unsigned int ret = 0; unsigned int ret = 0;
u8 _opttype, *tp = NULL; u8 _opttype, *tp = NULL;
u8 _optlen, *lp = NULL; u8 _optlen, *lp = NULL;
unsigned int optlen; unsigned int optlen;
#if HOPBYHOP #if HOPBYHOP
if (ipv6_find_hdr(skb, &ptr, NEXTHDR_HOP, NULL) < 0) if (ipv6_find_hdr(skb, &ptr, NEXTHDR_HOP, NULL) < 0)
#else #else
@ -77,42 +77,41 @@ match(const struct sk_buff *skb,
#endif #endif
return 0; return 0;
oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh); oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh);
if (oh == NULL){ if (oh == NULL) {
*hotdrop = 1; *hotdrop = 1;
return 0; return 0;
} }
hdrlen = ipv6_optlen(oh); hdrlen = ipv6_optlen(oh);
if (skb->len - ptr < hdrlen){ if (skb->len - ptr < hdrlen) {
/* Packet smaller than it's length field */ /* Packet smaller than it's length field */
return 0; return 0;
} }
DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen);
DEBUGP("len %02X %04X %02X ", DEBUGP("len %02X %04X %02X ",
optinfo->hdrlen, hdrlen, optinfo->hdrlen, hdrlen,
(!(optinfo->flags & IP6T_OPTS_LEN) || (!(optinfo->flags & IP6T_OPTS_LEN) ||
((optinfo->hdrlen == hdrlen) ^ ((optinfo->hdrlen == hdrlen) ^
!!(optinfo->invflags & IP6T_OPTS_INV_LEN)))); !!(optinfo->invflags & IP6T_OPTS_INV_LEN))));
ret = (oh != NULL) ret = (oh != NULL) &&
&& (!(optinfo->flags & IP6T_OPTS_LEN) ||
(!(optinfo->flags & IP6T_OPTS_LEN) || ((optinfo->hdrlen == hdrlen) ^
((optinfo->hdrlen == hdrlen) ^ !!(optinfo->invflags & IP6T_OPTS_INV_LEN)));
!!(optinfo->invflags & IP6T_OPTS_INV_LEN)));
ptr += 2; ptr += 2;
hdrlen -= 2; hdrlen -= 2;
if ( !(optinfo->flags & IP6T_OPTS_OPTS) ){ if (!(optinfo->flags & IP6T_OPTS_OPTS)) {
return ret; return ret;
} else if (optinfo->flags & IP6T_OPTS_NSTRICT) { } else if (optinfo->flags & IP6T_OPTS_NSTRICT) {
DEBUGP("Not strict - not implemented"); DEBUGP("Not strict - not implemented");
} else { } else {
DEBUGP("Strict "); DEBUGP("Strict ");
DEBUGP("#%d ",optinfo->optsnr); DEBUGP("#%d ", optinfo->optsnr);
for(temp=0; temp<optinfo->optsnr; temp++){ for (temp = 0; temp < optinfo->optsnr; temp++) {
/* type field exists ? */ /* type field exists ? */
if (hdrlen < 1) if (hdrlen < 1)
break; break;
@ -122,10 +121,10 @@ match(const struct sk_buff *skb,
break; break;
/* Type check */ /* Type check */
if (*tp != (optinfo->opts[temp] & 0xFF00)>>8){ if (*tp != (optinfo->opts[temp] & 0xFF00) >> 8) {
DEBUGP("Tbad %02X %02X\n", DEBUGP("Tbad %02X %02X\n",
*tp, *tp,
(optinfo->opts[temp] & 0xFF00)>>8); (optinfo->opts[temp] & 0xFF00) >> 8);
return 0; return 0;
} else { } else {
DEBUGP("Tok "); DEBUGP("Tok ");
@ -169,7 +168,8 @@ match(const struct sk_buff *skb,
} }
if (temp == optinfo->optsnr) if (temp == optinfo->optsnr)
return ret; return ret;
else return 0; else
return 0;
} }
return 0; return 0;
@ -178,25 +178,24 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static int static int
checkentry(const char *tablename, checkentry(const char *tablename,
const void *info, const void *info,
void *matchinfo, void *matchinfo,
unsigned int matchinfosize, unsigned int matchinfosize,
unsigned int hook_mask) unsigned int hook_mask)
{ {
const struct ip6t_opts *optsinfo = matchinfo; const struct ip6t_opts *optsinfo = matchinfo;
if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_opts))) { if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_opts))) {
DEBUGP("ip6t_opts: matchsize %u != %u\n", DEBUGP("ip6t_opts: matchsize %u != %u\n",
matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_opts))); matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_opts)));
return 0; return 0;
} }
if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) { if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) {
DEBUGP("ip6t_opts: unknown flags %X\n", DEBUGP("ip6t_opts: unknown flags %X\n", optsinfo->invflags);
optsinfo->invflags); return 0;
return 0; }
}
return 1; return 1;
} }
static struct ip6t_match opts_match = { static struct ip6t_match opts_match = {
@ -212,12 +211,12 @@ static struct ip6t_match opts_match = {
static int __init init(void) static int __init init(void)
{ {
return ip6t_register_match(&opts_match); return ip6t_register_match(&opts_match);
} }
static void __exit cleanup(void) static void __exit cleanup(void)
{ {
ip6t_unregister_match(&opts_match); ip6t_unregister_match(&opts_match);
} }
module_init(init); module_init(init);

View File

@ -27,45 +27,45 @@ match(const struct sk_buff *skb,
unsigned int protoff, unsigned int protoff,
int *hotdrop) int *hotdrop)
{ {
unsigned char eui64[8];
int i = 0;
unsigned char eui64[8]; if (!(skb->mac.raw >= skb->head &&
int i=0; (skb->mac.raw + ETH_HLEN) <= skb->data) &&
offset != 0) {
*hotdrop = 1;
return 0;
}
if ( !(skb->mac.raw >= skb->head memset(eui64, 0, sizeof(eui64));
&& (skb->mac.raw + ETH_HLEN) <= skb->data)
&& offset != 0) {
*hotdrop = 1;
return 0;
}
memset(eui64, 0, sizeof(eui64));
if (eth_hdr(skb)->h_proto == ntohs(ETH_P_IPV6)) { if (eth_hdr(skb)->h_proto == ntohs(ETH_P_IPV6)) {
if (skb->nh.ipv6h->version == 0x6) { if (skb->nh.ipv6h->version == 0x6) {
memcpy(eui64, eth_hdr(skb)->h_source, 3); memcpy(eui64, eth_hdr(skb)->h_source, 3);
memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3); memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
eui64[3]=0xff; eui64[3] = 0xff;
eui64[4]=0xfe; eui64[4] = 0xfe;
eui64[0] |= 0x02; eui64[0] |= 0x02;
i=0; i = 0;
while ((skb->nh.ipv6h->saddr.s6_addr[8+i] == while ((skb->nh.ipv6h->saddr.s6_addr[8+i] == eui64[i])
eui64[i]) && (i<8)) i++; && (i < 8))
i++;
if ( i == 8 ) if (i == 8)
return 1; return 1;
} }
} }
return 0; return 0;
} }
static int static int
ip6t_eui64_checkentry(const char *tablename, ip6t_eui64_checkentry(const char *tablename,
const void *ip, const void *ip,
void *matchinfo, void *matchinfo,
unsigned int matchsize, unsigned int matchsize,
unsigned int hook_mask) unsigned int hook_mask)
{ {
if (hook_mask if (hook_mask
& ~((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_IN) | & ~((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_IN) |

View File

@ -31,12 +31,12 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
static inline int static inline int
id_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) id_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert)
{ {
int r=0; int r = 0;
DEBUGP("frag id_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', DEBUGP("frag id_match:%c 0x%x <= 0x%x <= 0x%x", invert ? '!' : ' ',
min,id,max); min, id, max);
r=(id >= min && id <= max) ^ invert; r = (id >= min && id <= max) ^ invert;
DEBUGP(" result %s\n",r? "PASS" : "FAILED"); DEBUGP(" result %s\n", r ? "PASS" : "FAILED");
return r; return r;
} }
static int static int
@ -48,92 +48,91 @@ match(const struct sk_buff *skb,
unsigned int protoff, unsigned int protoff,
int *hotdrop) int *hotdrop)
{ {
struct frag_hdr _frag, *fh; struct frag_hdr _frag, *fh;
const struct ip6t_frag *fraginfo = matchinfo; const struct ip6t_frag *fraginfo = matchinfo;
unsigned int ptr; unsigned int ptr;
if (ipv6_find_hdr(skb, &ptr, NEXTHDR_FRAGMENT, NULL) < 0) if (ipv6_find_hdr(skb, &ptr, NEXTHDR_FRAGMENT, NULL) < 0)
return 0; return 0;
fh = skb_header_pointer(skb, ptr, sizeof(_frag), &_frag); fh = skb_header_pointer(skb, ptr, sizeof(_frag), &_frag);
if (fh == NULL){ if (fh == NULL) {
*hotdrop = 1; *hotdrop = 1;
return 0; return 0;
} }
DEBUGP("INFO %04X ", fh->frag_off); DEBUGP("INFO %04X ", fh->frag_off);
DEBUGP("OFFSET %04X ", ntohs(fh->frag_off) & ~0x7); DEBUGP("OFFSET %04X ", ntohs(fh->frag_off) & ~0x7);
DEBUGP("RES %02X %04X", fh->reserved, ntohs(fh->frag_off) & 0x6); DEBUGP("RES %02X %04X", fh->reserved, ntohs(fh->frag_off) & 0x6);
DEBUGP("MF %04X ", fh->frag_off & htons(IP6_MF)); DEBUGP("MF %04X ", fh->frag_off & htons(IP6_MF));
DEBUGP("ID %u %08X\n", ntohl(fh->identification), DEBUGP("ID %u %08X\n", ntohl(fh->identification),
ntohl(fh->identification)); ntohl(fh->identification));
DEBUGP("IPv6 FRAG id %02X ", DEBUGP("IPv6 FRAG id %02X ",
(id_match(fraginfo->ids[0], fraginfo->ids[1], (id_match(fraginfo->ids[0], fraginfo->ids[1],
ntohl(fh->identification), ntohl(fh->identification),
!!(fraginfo->invflags & IP6T_FRAG_INV_IDS)))); !!(fraginfo->invflags & IP6T_FRAG_INV_IDS))));
DEBUGP("res %02X %02X%04X %02X ", DEBUGP("res %02X %02X%04X %02X ",
(fraginfo->flags & IP6T_FRAG_RES), fh->reserved, (fraginfo->flags & IP6T_FRAG_RES), fh->reserved,
ntohs(fh->frag_off) & 0x6, ntohs(fh->frag_off) & 0x6,
!((fraginfo->flags & IP6T_FRAG_RES) !((fraginfo->flags & IP6T_FRAG_RES)
&& (fh->reserved || (ntohs(fh->frag_off) & 0x06)))); && (fh->reserved || (ntohs(fh->frag_off) & 0x06))));
DEBUGP("first %02X %02X %02X ", DEBUGP("first %02X %02X %02X ",
(fraginfo->flags & IP6T_FRAG_FST), (fraginfo->flags & IP6T_FRAG_FST),
ntohs(fh->frag_off) & ~0x7, ntohs(fh->frag_off) & ~0x7,
!((fraginfo->flags & IP6T_FRAG_FST) !((fraginfo->flags & IP6T_FRAG_FST)
&& (ntohs(fh->frag_off) & ~0x7))); && (ntohs(fh->frag_off) & ~0x7)));
DEBUGP("mf %02X %02X %02X ", DEBUGP("mf %02X %02X %02X ",
(fraginfo->flags & IP6T_FRAG_MF), (fraginfo->flags & IP6T_FRAG_MF),
ntohs(fh->frag_off) & IP6_MF, ntohs(fh->frag_off) & IP6_MF,
!((fraginfo->flags & IP6T_FRAG_MF) !((fraginfo->flags & IP6T_FRAG_MF)
&& !((ntohs(fh->frag_off) & IP6_MF)))); && !((ntohs(fh->frag_off) & IP6_MF))));
DEBUGP("last %02X %02X %02X\n", DEBUGP("last %02X %02X %02X\n",
(fraginfo->flags & IP6T_FRAG_NMF), (fraginfo->flags & IP6T_FRAG_NMF),
ntohs(fh->frag_off) & IP6_MF, ntohs(fh->frag_off) & IP6_MF,
!((fraginfo->flags & IP6T_FRAG_NMF) !((fraginfo->flags & IP6T_FRAG_NMF)
&& (ntohs(fh->frag_off) & IP6_MF))); && (ntohs(fh->frag_off) & IP6_MF)));
return (fh != NULL) return (fh != NULL)
&& &&
(id_match(fraginfo->ids[0], fraginfo->ids[1], (id_match(fraginfo->ids[0], fraginfo->ids[1],
ntohl(fh->identification), ntohl(fh->identification),
!!(fraginfo->invflags & IP6T_FRAG_INV_IDS))) !!(fraginfo->invflags & IP6T_FRAG_INV_IDS)))
&& &&
!((fraginfo->flags & IP6T_FRAG_RES) !((fraginfo->flags & IP6T_FRAG_RES)
&& (fh->reserved || (ntohs(fh->frag_off) & 0x6))) && (fh->reserved || (ntohs(fh->frag_off) & 0x6)))
&& &&
!((fraginfo->flags & IP6T_FRAG_FST) !((fraginfo->flags & IP6T_FRAG_FST)
&& (ntohs(fh->frag_off) & ~0x7)) && (ntohs(fh->frag_off) & ~0x7))
&& &&
!((fraginfo->flags & IP6T_FRAG_MF) !((fraginfo->flags & IP6T_FRAG_MF)
&& !(ntohs(fh->frag_off) & IP6_MF)) && !(ntohs(fh->frag_off) & IP6_MF))
&& &&
!((fraginfo->flags & IP6T_FRAG_NMF) !((fraginfo->flags & IP6T_FRAG_NMF)
&& (ntohs(fh->frag_off) & IP6_MF)); && (ntohs(fh->frag_off) & IP6_MF));
} }
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static int static int
checkentry(const char *tablename, checkentry(const char *tablename,
const void *ip, const void *ip,
void *matchinfo, void *matchinfo,
unsigned int matchinfosize, unsigned int matchinfosize,
unsigned int hook_mask) unsigned int hook_mask)
{ {
const struct ip6t_frag *fraginfo = matchinfo; const struct ip6t_frag *fraginfo = matchinfo;
if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_frag))) { if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_frag))) {
DEBUGP("ip6t_frag: matchsize %u != %u\n", DEBUGP("ip6t_frag: matchsize %u != %u\n",
matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_frag))); matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_frag)));
return 0; return 0;
} }
if (fraginfo->invflags & ~IP6T_FRAG_INV_MASK) { if (fraginfo->invflags & ~IP6T_FRAG_INV_MASK) {
DEBUGP("ip6t_frag: unknown flags %X\n", DEBUGP("ip6t_frag: unknown flags %X\n", fraginfo->invflags);
fraginfo->invflags); return 0;
return 0; }
}
return 1; return 1;
} }
static struct ip6t_match frag_match = { static struct ip6t_match frag_match = {
@ -145,12 +144,12 @@ static struct ip6t_match frag_match = {
static int __init init(void) static int __init init(void)
{ {
return ip6t_register_match(&frag_match); return ip6t_register_match(&frag_match);
} }
static void __exit cleanup(void) static void __exit cleanup(void)
{ {
ip6t_unregister_match(&frag_match); ip6t_unregister_match(&frag_match);
} }
module_init(init); module_init(init);

View File

@ -36,19 +36,19 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
#endif #endif
/* /*
* (Type & 0xC0) >> 6 * (Type & 0xC0) >> 6
* 0 -> ignorable * 0 -> ignorable
* 1 -> must drop the packet * 1 -> must drop the packet
* 2 -> send ICMP PARM PROB regardless and drop packet * 2 -> send ICMP PARM PROB regardless and drop packet
* 3 -> Send ICMP if not a multicast address and drop packet * 3 -> Send ICMP if not a multicast address and drop packet
* (Type & 0x20) >> 5 * (Type & 0x20) >> 5
* 0 -> invariant * 0 -> invariant
* 1 -> can change the routing * 1 -> can change the routing
* (Type & 0x1F) Type * (Type & 0x1F) Type
* 0 -> Pad1 (only 1 byte!) * 0 -> Pad1 (only 1 byte!)
* 1 -> PadN LENGTH info (total length = length + 2) * 1 -> PadN LENGTH info (total length = length + 2)
* C0 | 2 -> JUMBO 4 x x x x ( xxxx > 64k ) * C0 | 2 -> JUMBO 4 x x x x ( xxxx > 64k )
* 5 -> RTALERT 2 x x * 5 -> RTALERT 2 x x
*/ */
static int static int
@ -60,16 +60,16 @@ match(const struct sk_buff *skb,
unsigned int protoff, unsigned int protoff,
int *hotdrop) int *hotdrop)
{ {
struct ipv6_opt_hdr _optsh, *oh; struct ipv6_opt_hdr _optsh, *oh;
const struct ip6t_opts *optinfo = matchinfo; const struct ip6t_opts *optinfo = matchinfo;
unsigned int temp; unsigned int temp;
unsigned int ptr; unsigned int ptr;
unsigned int hdrlen = 0; unsigned int hdrlen = 0;
unsigned int ret = 0; unsigned int ret = 0;
u8 _opttype, *tp = NULL; u8 _opttype, *tp = NULL;
u8 _optlen, *lp = NULL; u8 _optlen, *lp = NULL;
unsigned int optlen; unsigned int optlen;
#if HOPBYHOP #if HOPBYHOP
if (ipv6_find_hdr(skb, &ptr, NEXTHDR_HOP, NULL) < 0) if (ipv6_find_hdr(skb, &ptr, NEXTHDR_HOP, NULL) < 0)
#else #else
@ -77,42 +77,41 @@ match(const struct sk_buff *skb,
#endif #endif
return 0; return 0;
oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh); oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh);
if (oh == NULL){ if (oh == NULL) {
*hotdrop = 1; *hotdrop = 1;
return 0; return 0;
} }
hdrlen = ipv6_optlen(oh); hdrlen = ipv6_optlen(oh);
if (skb->len - ptr < hdrlen){ if (skb->len - ptr < hdrlen) {
/* Packet smaller than it's length field */ /* Packet smaller than it's length field */
return 0; return 0;
} }
DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen);
DEBUGP("len %02X %04X %02X ", DEBUGP("len %02X %04X %02X ",
optinfo->hdrlen, hdrlen, optinfo->hdrlen, hdrlen,
(!(optinfo->flags & IP6T_OPTS_LEN) || (!(optinfo->flags & IP6T_OPTS_LEN) ||
((optinfo->hdrlen == hdrlen) ^ ((optinfo->hdrlen == hdrlen) ^
!!(optinfo->invflags & IP6T_OPTS_INV_LEN)))); !!(optinfo->invflags & IP6T_OPTS_INV_LEN))));
ret = (oh != NULL) ret = (oh != NULL) &&
&& (!(optinfo->flags & IP6T_OPTS_LEN) ||
(!(optinfo->flags & IP6T_OPTS_LEN) || ((optinfo->hdrlen == hdrlen) ^
((optinfo->hdrlen == hdrlen) ^ !!(optinfo->invflags & IP6T_OPTS_INV_LEN)));
!!(optinfo->invflags & IP6T_OPTS_INV_LEN)));
ptr += 2; ptr += 2;
hdrlen -= 2; hdrlen -= 2;
if ( !(optinfo->flags & IP6T_OPTS_OPTS) ){ if (!(optinfo->flags & IP6T_OPTS_OPTS)) {
return ret; return ret;
} else if (optinfo->flags & IP6T_OPTS_NSTRICT) { } else if (optinfo->flags & IP6T_OPTS_NSTRICT) {
DEBUGP("Not strict - not implemented"); DEBUGP("Not strict - not implemented");
} else { } else {
DEBUGP("Strict "); DEBUGP("Strict ");
DEBUGP("#%d ",optinfo->optsnr); DEBUGP("#%d ", optinfo->optsnr);
for(temp=0; temp<optinfo->optsnr; temp++){ for (temp = 0; temp < optinfo->optsnr; temp++) {
/* type field exists ? */ /* type field exists ? */
if (hdrlen < 1) if (hdrlen < 1)
break; break;
@ -122,10 +121,10 @@ match(const struct sk_buff *skb,
break; break;
/* Type check */ /* Type check */
if (*tp != (optinfo->opts[temp] & 0xFF00)>>8){ if (*tp != (optinfo->opts[temp] & 0xFF00) >> 8) {
DEBUGP("Tbad %02X %02X\n", DEBUGP("Tbad %02X %02X\n",
*tp, *tp,
(optinfo->opts[temp] & 0xFF00)>>8); (optinfo->opts[temp] & 0xFF00) >> 8);
return 0; return 0;
} else { } else {
DEBUGP("Tok "); DEBUGP("Tok ");
@ -169,7 +168,8 @@ match(const struct sk_buff *skb,
} }
if (temp == optinfo->optsnr) if (temp == optinfo->optsnr)
return ret; return ret;
else return 0; else
return 0;
} }
return 0; return 0;
@ -178,25 +178,24 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static int static int
checkentry(const char *tablename, checkentry(const char *tablename,
const void *entry, const void *entry,
void *matchinfo, void *matchinfo,
unsigned int matchinfosize, unsigned int matchinfosize,
unsigned int hook_mask) unsigned int hook_mask)
{ {
const struct ip6t_opts *optsinfo = matchinfo; const struct ip6t_opts *optsinfo = matchinfo;
if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_opts))) { if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_opts))) {
DEBUGP("ip6t_opts: matchsize %u != %u\n", DEBUGP("ip6t_opts: matchsize %u != %u\n",
matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_opts))); matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_opts)));
return 0; return 0;
} }
if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) { if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) {
DEBUGP("ip6t_opts: unknown flags %X\n", DEBUGP("ip6t_opts: unknown flags %X\n", optsinfo->invflags);
optsinfo->invflags); return 0;
return 0; }
}
return 1; return 1;
} }
static struct ip6t_match opts_match = { static struct ip6t_match opts_match = {
@ -212,12 +211,12 @@ static struct ip6t_match opts_match = {
static int __init init(void) static int __init init(void)
{ {
return ip6t_register_match(&opts_match); return ip6t_register_match(&opts_match);
} }
static void __exit cleanup(void) static void __exit cleanup(void)
{ {
ip6t_unregister_match(&opts_match); ip6t_unregister_match(&opts_match);
} }
module_init(init); module_init(init);

View File

@ -50,20 +50,20 @@ ipv6header_match(const struct sk_buff *skb,
len = skb->len - ptr; len = skb->len - ptr;
temp = 0; temp = 0;
while (ip6t_ext_hdr(nexthdr)) { while (ip6t_ext_hdr(nexthdr)) {
struct ipv6_opt_hdr _hdr, *hp; struct ipv6_opt_hdr _hdr, *hp;
int hdrlen; int hdrlen;
/* Is there enough space for the next ext header? */ /* Is there enough space for the next ext header? */
if (len < (int)sizeof(struct ipv6_opt_hdr)) if (len < (int)sizeof(struct ipv6_opt_hdr))
return 0; return 0;
/* No more exthdr -> evaluate */ /* No more exthdr -> evaluate */
if (nexthdr == NEXTHDR_NONE) { if (nexthdr == NEXTHDR_NONE) {
temp |= MASK_NONE; temp |= MASK_NONE;
break; break;
} }
/* ESP -> evaluate */ /* ESP -> evaluate */
if (nexthdr == NEXTHDR_ESP) { if (nexthdr == NEXTHDR_ESP) {
temp |= MASK_ESP; temp |= MASK_ESP;
break; break;
} }
@ -72,43 +72,43 @@ ipv6header_match(const struct sk_buff *skb,
BUG_ON(hp == NULL); BUG_ON(hp == NULL);
/* Calculate the header length */ /* Calculate the header length */
if (nexthdr == NEXTHDR_FRAGMENT) { if (nexthdr == NEXTHDR_FRAGMENT) {
hdrlen = 8; hdrlen = 8;
} else if (nexthdr == NEXTHDR_AUTH) } else if (nexthdr == NEXTHDR_AUTH)
hdrlen = (hp->hdrlen+2)<<2; hdrlen = (hp->hdrlen + 2) << 2;
else else
hdrlen = ipv6_optlen(hp); hdrlen = ipv6_optlen(hp);
/* set the flag */ /* set the flag */
switch (nexthdr){ switch (nexthdr) {
case NEXTHDR_HOP: case NEXTHDR_HOP:
temp |= MASK_HOPOPTS; temp |= MASK_HOPOPTS;
break; break;
case NEXTHDR_ROUTING: case NEXTHDR_ROUTING:
temp |= MASK_ROUTING; temp |= MASK_ROUTING;
break; break;
case NEXTHDR_FRAGMENT: case NEXTHDR_FRAGMENT:
temp |= MASK_FRAGMENT; temp |= MASK_FRAGMENT;
break; break;
case NEXTHDR_AUTH: case NEXTHDR_AUTH:
temp |= MASK_AH; temp |= MASK_AH;
break; break;
case NEXTHDR_DEST: case NEXTHDR_DEST:
temp |= MASK_DSTOPTS; temp |= MASK_DSTOPTS;
break; break;
default: default:
return 0; return 0;
break; break;
} }
nexthdr = hp->nexthdr; nexthdr = hp->nexthdr;
len -= hdrlen; len -= hdrlen;
ptr += hdrlen; ptr += hdrlen;
if (ptr > skb->len) if (ptr > skb->len)
break; break;
} }
if ( (nexthdr != NEXTHDR_NONE ) && (nexthdr != NEXTHDR_ESP) ) if ((nexthdr != NEXTHDR_NONE) && (nexthdr != NEXTHDR_ESP))
temp |= MASK_PROTO; temp |= MASK_PROTO;
if (info->modeflag) if (info->modeflag)
@ -137,8 +137,8 @@ ipv6header_checkentry(const char *tablename,
return 0; return 0;
/* invflags is 0 or 0xff in hard mode */ /* invflags is 0 or 0xff in hard mode */
if ((!info->modeflag) && info->invflags != 0x00 if ((!info->modeflag) && info->invflags != 0x00 &&
&& info->invflags != 0xFF) info->invflags != 0xFF)
return 0; return 0;
return 1; return 1;
@ -152,7 +152,7 @@ static struct ip6t_match ip6t_ipv6header_match = {
.me = THIS_MODULE, .me = THIS_MODULE,
}; };
static int __init ipv6header_init(void) static int __init ipv6header_init(void)
{ {
return ip6t_register_match(&ip6t_ipv6header_match); return ip6t_register_match(&ip6t_ipv6header_match);
} }
@ -164,4 +164,3 @@ static void __exit ipv6header_exit(void)
module_init(ipv6header_init); module_init(ipv6header_init);
module_exit(ipv6header_exit); module_exit(ipv6header_exit);

View File

@ -36,14 +36,14 @@ match(const struct sk_buff *skb,
if (!skb->sk || !skb->sk->sk_socket || !skb->sk->sk_socket->file) if (!skb->sk || !skb->sk->sk_socket || !skb->sk->sk_socket->file)
return 0; return 0;
if(info->match & IP6T_OWNER_UID) { if (info->match & IP6T_OWNER_UID) {
if((skb->sk->sk_socket->file->f_uid != info->uid) ^ if ((skb->sk->sk_socket->file->f_uid != info->uid) ^
!!(info->invert & IP6T_OWNER_UID)) !!(info->invert & IP6T_OWNER_UID))
return 0; return 0;
} }
if(info->match & IP6T_OWNER_GID) { if (info->match & IP6T_OWNER_GID) {
if((skb->sk->sk_socket->file->f_gid != info->gid) ^ if ((skb->sk->sk_socket->file->f_gid != info->gid) ^
!!(info->invert & IP6T_OWNER_GID)) !!(info->invert & IP6T_OWNER_GID))
return 0; return 0;
} }
@ -53,23 +53,23 @@ match(const struct sk_buff *skb,
static int static int
checkentry(const char *tablename, checkentry(const char *tablename,
const void *ip, const void *ip,
void *matchinfo, void *matchinfo,
unsigned int matchsize, unsigned int matchsize,
unsigned int hook_mask) unsigned int hook_mask)
{ {
const struct ip6t_owner_info *info = matchinfo; const struct ip6t_owner_info *info = matchinfo;
if (hook_mask if (hook_mask
& ~((1 << NF_IP6_LOCAL_OUT) | (1 << NF_IP6_POST_ROUTING))) { & ~((1 << NF_IP6_LOCAL_OUT) | (1 << NF_IP6_POST_ROUTING))) {
printk("ip6t_owner: only valid for LOCAL_OUT or POST_ROUTING.\n"); printk("ip6t_owner: only valid for LOCAL_OUT or POST_ROUTING.\n");
return 0; return 0;
} }
if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_owner_info))) if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_owner_info)))
return 0; return 0;
if (info->match & (IP6T_OWNER_PID|IP6T_OWNER_SID)) { if (info->match & (IP6T_OWNER_PID | IP6T_OWNER_SID)) {
printk("ipt_owner: pid and sid matching " printk("ipt_owner: pid and sid matching "
"not supported anymore\n"); "not supported anymore\n");
return 0; return 0;

View File

@ -118,7 +118,7 @@ static int match(const struct sk_buff *skb,
return ret; return ret;
} }
static int checkentry(const char *tablename, const struct ip6t_ip6 *ip, static int checkentry(const char *tablename, const void *ip_void,
void *matchinfo, unsigned int matchsize, void *matchinfo, unsigned int matchsize,
unsigned int hook_mask) unsigned int hook_mask)
{ {

View File

@ -33,12 +33,12 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>");
static inline int static inline int
segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert)
{ {
int r=0; int r = 0;
DEBUGP("rt segsleft_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', DEBUGP("rt segsleft_match:%c 0x%x <= 0x%x <= 0x%x",
min,id,max); invert ? '!' : ' ', min, id, max);
r=(id >= min && id <= max) ^ invert; r = (id >= min && id <= max) ^ invert;
DEBUGP(" result %s\n",r? "PASS" : "FAILED"); DEBUGP(" result %s\n", r ? "PASS" : "FAILED");
return r; return r;
} }
static int static int
@ -50,87 +50,93 @@ match(const struct sk_buff *skb,
unsigned int protoff, unsigned int protoff,
int *hotdrop) int *hotdrop)
{ {
struct ipv6_rt_hdr _route, *rh; struct ipv6_rt_hdr _route, *rh;
const struct ip6t_rt *rtinfo = matchinfo; const struct ip6t_rt *rtinfo = matchinfo;
unsigned int temp; unsigned int temp;
unsigned int ptr; unsigned int ptr;
unsigned int hdrlen = 0; unsigned int hdrlen = 0;
unsigned int ret = 0; unsigned int ret = 0;
struct in6_addr *ap, _addr; struct in6_addr *ap, _addr;
if (ipv6_find_hdr(skb, &ptr, NEXTHDR_ROUTING, NULL) < 0) if (ipv6_find_hdr(skb, &ptr, NEXTHDR_ROUTING, NULL) < 0)
return 0; return 0;
rh = skb_header_pointer(skb, ptr, sizeof(_route), &_route); rh = skb_header_pointer(skb, ptr, sizeof(_route), &_route);
if (rh == NULL){ if (rh == NULL) {
*hotdrop = 1; *hotdrop = 1;
return 0; return 0;
} }
hdrlen = ipv6_optlen(rh); hdrlen = ipv6_optlen(rh);
if (skb->len - ptr < hdrlen){ if (skb->len - ptr < hdrlen) {
/* Pcket smaller than its length field */ /* Pcket smaller than its length field */
return 0; return 0;
} }
DEBUGP("IPv6 RT LEN %u %u ", hdrlen, rh->hdrlen); DEBUGP("IPv6 RT LEN %u %u ", hdrlen, rh->hdrlen);
DEBUGP("TYPE %04X ", rh->type); DEBUGP("TYPE %04X ", rh->type);
DEBUGP("SGS_LEFT %u %02X\n", rh->segments_left, rh->segments_left); DEBUGP("SGS_LEFT %u %02X\n", rh->segments_left, rh->segments_left);
DEBUGP("IPv6 RT segsleft %02X ", DEBUGP("IPv6 RT segsleft %02X ",
(segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], (segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1],
rh->segments_left, rh->segments_left,
!!(rtinfo->invflags & IP6T_RT_INV_SGS)))); !!(rtinfo->invflags & IP6T_RT_INV_SGS))));
DEBUGP("type %02X %02X %02X ", DEBUGP("type %02X %02X %02X ",
rtinfo->rt_type, rh->type, rtinfo->rt_type, rh->type,
(!(rtinfo->flags & IP6T_RT_TYP) || (!(rtinfo->flags & IP6T_RT_TYP) ||
((rtinfo->rt_type == rh->type) ^ ((rtinfo->rt_type == rh->type) ^
!!(rtinfo->invflags & IP6T_RT_INV_TYP)))); !!(rtinfo->invflags & IP6T_RT_INV_TYP))));
DEBUGP("len %02X %04X %02X ", DEBUGP("len %02X %04X %02X ",
rtinfo->hdrlen, hdrlen, rtinfo->hdrlen, hdrlen,
(!(rtinfo->flags & IP6T_RT_LEN) || (!(rtinfo->flags & IP6T_RT_LEN) ||
((rtinfo->hdrlen == hdrlen) ^ ((rtinfo->hdrlen == hdrlen) ^
!!(rtinfo->invflags & IP6T_RT_INV_LEN)))); !!(rtinfo->invflags & IP6T_RT_INV_LEN))));
DEBUGP("res %02X %02X %02X ", DEBUGP("res %02X %02X %02X ",
(rtinfo->flags & IP6T_RT_RES), ((struct rt0_hdr *)rh)->reserved, (rtinfo->flags & IP6T_RT_RES),
!((rtinfo->flags & IP6T_RT_RES) && (((struct rt0_hdr *)rh)->reserved))); ((struct rt0_hdr *)rh)->reserved,
!((rtinfo->flags & IP6T_RT_RES) &&
(((struct rt0_hdr *)rh)->reserved)));
ret = (rh != NULL) ret = (rh != NULL)
&& &&
(segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], (segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1],
rh->segments_left, rh->segments_left,
!!(rtinfo->invflags & IP6T_RT_INV_SGS))) !!(rtinfo->invflags & IP6T_RT_INV_SGS)))
&& &&
(!(rtinfo->flags & IP6T_RT_LEN) || (!(rtinfo->flags & IP6T_RT_LEN) ||
((rtinfo->hdrlen == hdrlen) ^ ((rtinfo->hdrlen == hdrlen) ^
!!(rtinfo->invflags & IP6T_RT_INV_LEN))) !!(rtinfo->invflags & IP6T_RT_INV_LEN)))
&& &&
(!(rtinfo->flags & IP6T_RT_TYP) || (!(rtinfo->flags & IP6T_RT_TYP) ||
((rtinfo->rt_type == rh->type) ^ ((rtinfo->rt_type == rh->type) ^
!!(rtinfo->invflags & IP6T_RT_INV_TYP))); !!(rtinfo->invflags & IP6T_RT_INV_TYP)));
if (ret && (rtinfo->flags & IP6T_RT_RES)) { if (ret && (rtinfo->flags & IP6T_RT_RES)) {
u_int32_t *rp, _reserved; u_int32_t *rp, _reserved;
rp = skb_header_pointer(skb, rp = skb_header_pointer(skb,
ptr + offsetof(struct rt0_hdr, reserved), ptr + offsetof(struct rt0_hdr,
sizeof(_reserved), &_reserved); reserved),
sizeof(_reserved),
&_reserved);
ret = (*rp == 0); ret = (*rp == 0);
} }
DEBUGP("#%d ",rtinfo->addrnr); DEBUGP("#%d ", rtinfo->addrnr);
if ( !(rtinfo->flags & IP6T_RT_FST) ){ if (!(rtinfo->flags & IP6T_RT_FST)) {
return ret; return ret;
} else if (rtinfo->flags & IP6T_RT_FST_NSTRICT) { } else if (rtinfo->flags & IP6T_RT_FST_NSTRICT) {
DEBUGP("Not strict "); DEBUGP("Not strict ");
if ( rtinfo->addrnr > (unsigned int)((hdrlen-8)/16) ){ if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) {
DEBUGP("There isn't enough space\n"); DEBUGP("There isn't enough space\n");
return 0; return 0;
} else { } else {
unsigned int i = 0; unsigned int i = 0;
DEBUGP("#%d ",rtinfo->addrnr); DEBUGP("#%d ", rtinfo->addrnr);
for(temp=0; temp<(unsigned int)((hdrlen-8)/16); temp++){ for (temp = 0;
temp < (unsigned int)((hdrlen - 8) / 16);
temp++) {
ap = skb_header_pointer(skb, ap = skb_header_pointer(skb,
ptr ptr
+ sizeof(struct rt0_hdr) + sizeof(struct rt0_hdr)
@ -141,24 +147,26 @@ match(const struct sk_buff *skb,
BUG_ON(ap == NULL); BUG_ON(ap == NULL);
if (ipv6_addr_equal(ap, &rtinfo->addrs[i])) { if (ipv6_addr_equal(ap, &rtinfo->addrs[i])) {
DEBUGP("i=%d temp=%d;\n",i,temp); DEBUGP("i=%d temp=%d;\n", i, temp);
i++; i++;
} }
if (i==rtinfo->addrnr) break; if (i == rtinfo->addrnr)
break;
} }
DEBUGP("i=%d #%d\n", i, rtinfo->addrnr); DEBUGP("i=%d #%d\n", i, rtinfo->addrnr);
if (i == rtinfo->addrnr) if (i == rtinfo->addrnr)
return ret; return ret;
else return 0; else
return 0;
} }
} else { } else {
DEBUGP("Strict "); DEBUGP("Strict ");
if ( rtinfo->addrnr > (unsigned int)((hdrlen-8)/16) ){ if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) {
DEBUGP("There isn't enough space\n"); DEBUGP("There isn't enough space\n");
return 0; return 0;
} else { } else {
DEBUGP("#%d ",rtinfo->addrnr); DEBUGP("#%d ", rtinfo->addrnr);
for(temp=0; temp<rtinfo->addrnr; temp++){ for (temp = 0; temp < rtinfo->addrnr; temp++) {
ap = skb_header_pointer(skb, ap = skb_header_pointer(skb,
ptr ptr
+ sizeof(struct rt0_hdr) + sizeof(struct rt0_hdr)
@ -171,9 +179,11 @@ match(const struct sk_buff *skb,
break; break;
} }
DEBUGP("temp=%d #%d\n", temp, rtinfo->addrnr); DEBUGP("temp=%d #%d\n", temp, rtinfo->addrnr);
if ((temp == rtinfo->addrnr) && (temp == (unsigned int)((hdrlen-8)/16))) if ((temp == rtinfo->addrnr) &&
(temp == (unsigned int)((hdrlen - 8) / 16)))
return ret; return ret;
else return 0; else
return 0;
} }
} }
@ -183,32 +193,31 @@ match(const struct sk_buff *skb,
/* Called when user tries to insert an entry of this type. */ /* Called when user tries to insert an entry of this type. */
static int static int
checkentry(const char *tablename, checkentry(const char *tablename,
const void *entry, const void *entry,
void *matchinfo, void *matchinfo,
unsigned int matchinfosize, unsigned int matchinfosize,
unsigned int hook_mask) unsigned int hook_mask)
{ {
const struct ip6t_rt *rtinfo = matchinfo; const struct ip6t_rt *rtinfo = matchinfo;
if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_rt))) { if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_rt))) {
DEBUGP("ip6t_rt: matchsize %u != %u\n", DEBUGP("ip6t_rt: matchsize %u != %u\n",
matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_rt))); matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_rt)));
return 0; return 0;
} }
if (rtinfo->invflags & ~IP6T_RT_INV_MASK) { if (rtinfo->invflags & ~IP6T_RT_INV_MASK) {
DEBUGP("ip6t_rt: unknown flags %X\n", DEBUGP("ip6t_rt: unknown flags %X\n", rtinfo->invflags);
rtinfo->invflags); return 0;
return 0; }
} if ((rtinfo->flags & (IP6T_RT_RES | IP6T_RT_FST_MASK)) &&
if ( (rtinfo->flags & (IP6T_RT_RES|IP6T_RT_FST_MASK)) && (!(rtinfo->flags & IP6T_RT_TYP) ||
(!(rtinfo->flags & IP6T_RT_TYP) || (rtinfo->rt_type != 0) ||
(rtinfo->rt_type != 0) || (rtinfo->invflags & IP6T_RT_INV_TYP))) {
(rtinfo->invflags & IP6T_RT_INV_TYP)) ) { DEBUGP("`--rt-type 0' required before `--rt-0-*'");
DEBUGP("`--rt-type 0' required before `--rt-0-*'"); return 0;
return 0; }
}
return 1; return 1;
} }
static struct ip6t_match rt_match = { static struct ip6t_match rt_match = {
@ -220,12 +229,12 @@ static struct ip6t_match rt_match = {
static int __init init(void) static int __init init(void)
{ {
return ip6t_register_match(&rt_match); return ip6t_register_match(&rt_match);
} }
static void __exit cleanup(void) static void __exit cleanup(void)
{ {
ip6t_unregister_match(&rt_match); ip6t_unregister_match(&rt_match);
} }
module_init(init); module_init(init);

View File

@ -81,7 +81,7 @@ static int krxtimod(void *arg)
for (;;) { for (;;) {
unsigned long jif; unsigned long jif;
signed long timeout; long timeout;
/* deal with the server being asked to die */ /* deal with the server being asked to die */
if (krxtimod_die) { if (krxtimod_die) {

View File

@ -361,7 +361,7 @@ static void rxrpc_proc_peers_stop(struct seq_file *p, void *v)
static int rxrpc_proc_peers_show(struct seq_file *m, void *v) static int rxrpc_proc_peers_show(struct seq_file *m, void *v)
{ {
struct rxrpc_peer *peer = list_entry(v, struct rxrpc_peer, proc_link); struct rxrpc_peer *peer = list_entry(v, struct rxrpc_peer, proc_link);
signed long timeout; long timeout;
/* display header on line 1 */ /* display header on line 1 */
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
@ -373,8 +373,8 @@ static int rxrpc_proc_peers_show(struct seq_file *m, void *v)
/* display one peer per line on subsequent lines */ /* display one peer per line on subsequent lines */
timeout = 0; timeout = 0;
if (!list_empty(&peer->timeout.link)) if (!list_empty(&peer->timeout.link))
timeout = (signed long) peer->timeout.timo_jif - timeout = (long) peer->timeout.timo_jif -
(signed long) jiffies; (long) jiffies;
seq_printf(m, "%5hu %08x %5d %5d %8ld %5Zu %7lu\n", seq_printf(m, "%5hu %08x %5d %5d %8ld %5Zu %7lu\n",
peer->trans->port, peer->trans->port,
@ -468,7 +468,7 @@ static void rxrpc_proc_conns_stop(struct seq_file *p, void *v)
static int rxrpc_proc_conns_show(struct seq_file *m, void *v) static int rxrpc_proc_conns_show(struct seq_file *m, void *v)
{ {
struct rxrpc_connection *conn; struct rxrpc_connection *conn;
signed long timeout; long timeout;
conn = list_entry(v, struct rxrpc_connection, proc_link); conn = list_entry(v, struct rxrpc_connection, proc_link);
@ -484,8 +484,8 @@ static int rxrpc_proc_conns_show(struct seq_file *m, void *v)
/* display one conn per line on subsequent lines */ /* display one conn per line on subsequent lines */
timeout = 0; timeout = 0;
if (!list_empty(&conn->timeout.link)) if (!list_empty(&conn->timeout.link))
timeout = (signed long) conn->timeout.timo_jif - timeout = (long) conn->timeout.timo_jif -
(signed long) jiffies; (long) jiffies;
seq_printf(m, seq_printf(m,
"%5hu %08x %5hu %04hx %08x %-3.3s %08x %08x %5Zu %8ld\n", "%5hu %08x %5hu %04hx %08x %-3.3s %08x %08x %5Zu %8ld\n",

View File

@ -228,14 +228,13 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
} }
sch_tree_unlock(sch); sch_tree_unlock(sch);
for (i=0; i<=TC_PRIO_MAX; i++) { for (i=0; i<q->bands; i++) {
int band = q->prio2band[i]; if (q->queues[i] == &noop_qdisc) {
if (q->queues[band] == &noop_qdisc) {
struct Qdisc *child; struct Qdisc *child;
child = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); child = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops);
if (child) { if (child) {
sch_tree_lock(sch); sch_tree_lock(sch);
child = xchg(&q->queues[band], child); child = xchg(&q->queues[i], child);
if (child != &noop_qdisc) if (child != &noop_qdisc)
qdisc_destroy(child); qdisc_destroy(child);

View File

@ -144,6 +144,8 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
(iph->protocol == IPPROTO_TCP || (iph->protocol == IPPROTO_TCP ||
iph->protocol == IPPROTO_UDP || iph->protocol == IPPROTO_UDP ||
iph->protocol == IPPROTO_SCTP ||
iph->protocol == IPPROTO_DCCP ||
iph->protocol == IPPROTO_ESP)) iph->protocol == IPPROTO_ESP))
h2 ^= *(((u32*)iph) + iph->ihl); h2 ^= *(((u32*)iph) + iph->ihl);
break; break;
@ -155,6 +157,8 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
h2 = iph->saddr.s6_addr32[3]^iph->nexthdr; h2 = iph->saddr.s6_addr32[3]^iph->nexthdr;
if (iph->nexthdr == IPPROTO_TCP || if (iph->nexthdr == IPPROTO_TCP ||
iph->nexthdr == IPPROTO_UDP || iph->nexthdr == IPPROTO_UDP ||
iph->nexthdr == IPPROTO_SCTP ||
iph->nexthdr == IPPROTO_DCCP ||
iph->nexthdr == IPPROTO_ESP) iph->nexthdr == IPPROTO_ESP)
h2 ^= *(u32*)&iph[1]; h2 ^= *(u32*)&iph[1];
break; break;

View File

@ -69,13 +69,14 @@ struct sbus_dma_info {
}; };
#endif #endif
struct snd_cs4231;
struct cs4231_dma_control { struct cs4231_dma_control {
void (*prepare)(struct cs4231_dma_control *dma_cont, int dir); void (*prepare)(struct cs4231_dma_control *dma_cont, int dir);
void (*enable)(struct cs4231_dma_control *dma_cont, int on); void (*enable)(struct cs4231_dma_control *dma_cont, int on);
int (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len); int (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len);
unsigned int (*address)(struct cs4231_dma_control *dma_cont); unsigned int (*address)(struct cs4231_dma_control *dma_cont);
void (*reset)(struct snd_cs4231 *chip); void (*reset)(struct snd_cs4231 *chip);
void (*preallocate)(struct snd_cs4231 *chip, struct snd_snd_pcm *pcm); void (*preallocate)(struct snd_cs4231 *chip, struct snd_pcm *pcm);
#ifdef EBUS_SUPPORT #ifdef EBUS_SUPPORT
struct ebus_dma_info ebus_info; struct ebus_dma_info ebus_info;
#endif #endif