forked from Minki/linux
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (43 commits) netlink: genl: fix circular locking Revert "mac80211: Use skb_header_cloned() on TX path." af_unix: fix 'poll for write'/ connected DGRAM sockets tun: Proper handling of IPv6 header in tun driver when TUN_NO_PI is set atl1: relax eeprom mac address error check net/enc28j60: low power mode net/enc28j60: section fix sky2: 88E8040T pci device id netxen: download firmware in pci probe netxen: cleanup debug messages netxen: remove global physical_port array netxen: fix portnum for hp mezz cards ibm_newemac: select CRC32 in Kconfig xfrm: fix fragmentation for ipv4 xfrm tunnel netfilter: nf_conntrack_h323: fix module unload crash netfilter: nf_conntrack_h323: fix memory leak in module initialization error path netfilter: nf_nat: fix RCU races atm: [he] send idle cells instead of unassigned when in SDH mode atm: [he] limit queries to the device's register space atm: [br2864] fix routed vcmux support ...
This commit is contained in:
commit
d83b14c0db
@ -1542,7 +1542,8 @@ he_start(struct atm_dev *dev)
|
||||
/* initialize framer */
|
||||
|
||||
#ifdef CONFIG_ATM_HE_USE_SUNI
|
||||
suni_init(he_dev->atm_dev);
|
||||
if (he_isMM(he_dev))
|
||||
suni_init(he_dev->atm_dev);
|
||||
if (he_dev->atm_dev->phy && he_dev->atm_dev->phy->start)
|
||||
he_dev->atm_dev->phy->start(he_dev->atm_dev);
|
||||
#endif /* CONFIG_ATM_HE_USE_SUNI */
|
||||
@ -1554,6 +1555,7 @@ he_start(struct atm_dev *dev)
|
||||
val = he_phy_get(he_dev->atm_dev, SUNI_TPOP_APM);
|
||||
val = (val & ~SUNI_TPOP_APM_S) | (SUNI_TPOP_S_SDH << SUNI_TPOP_APM_S_SHIFT);
|
||||
he_phy_put(he_dev->atm_dev, val, SUNI_TPOP_APM);
|
||||
he_phy_put(he_dev->atm_dev, SUNI_TACP_IUCHP_CLP, SUNI_TACP_IUCHP);
|
||||
}
|
||||
|
||||
/* 5.1.12 enable transmit and receive */
|
||||
@ -2848,6 +2850,11 @@ he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void __user *arg)
|
||||
spin_lock_irqsave(&he_dev->global_lock, flags);
|
||||
switch (reg.type) {
|
||||
case HE_REGTYPE_PCI:
|
||||
if (reg.addr < 0 || reg.addr >= HE_REGMAP_SIZE) {
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
reg.val = he_readl(he_dev, reg.addr);
|
||||
break;
|
||||
case HE_REGTYPE_RCM:
|
||||
|
@ -267,13 +267,7 @@ struct he_dev {
|
||||
|
||||
char prod_id[30];
|
||||
char mac_addr[6];
|
||||
int media; /*
|
||||
* 0x26 = HE155 MM
|
||||
* 0x27 = HE622 MM
|
||||
* 0x46 = HE155 SM
|
||||
* 0x47 = HE622 SM
|
||||
*/
|
||||
|
||||
int media;
|
||||
|
||||
unsigned int vcibits, vpibits;
|
||||
unsigned int cells_per_row;
|
||||
@ -392,6 +386,7 @@ struct he_vcc
|
||||
#define HE_DEV(dev) ((struct he_dev *) (dev)->dev_data)
|
||||
|
||||
#define he_is622(dev) ((dev)->media & 0x1)
|
||||
#define he_isMM(dev) ((dev)->media & 0x20)
|
||||
|
||||
#define HE_REGMAP_SIZE 0x100000
|
||||
|
||||
@ -876,8 +871,8 @@ struct he_vcc
|
||||
#define M_SN 0x3a /* integer */
|
||||
#define MEDIA 0x3e /* integer */
|
||||
#define HE155MM 0x26
|
||||
#define HE155SM 0x27
|
||||
#define HE622MM 0x46
|
||||
#define HE622MM 0x27
|
||||
#define HE155SM 0x46
|
||||
#define HE622SM 0x47
|
||||
#define MAC_ADDR 0x42 /* char[] */
|
||||
|
||||
|
@ -2562,17 +2562,11 @@ static int __devinit ia_start(struct atm_dev *dev)
|
||||
error = suni_init(dev);
|
||||
if (error)
|
||||
goto err_free_rx;
|
||||
/*
|
||||
* Enable interrupt on loss of signal
|
||||
* SUNI_RSOP_CIE - 0x10
|
||||
* SUNI_RSOP_CIE_LOSE - 0x04
|
||||
*/
|
||||
ia_phy_put(dev, ia_phy_get(dev, 0x10) | 0x04, 0x10);
|
||||
#ifndef MODULE
|
||||
error = dev->phy->start(dev);
|
||||
if (error)
|
||||
goto err_free_rx;
|
||||
#endif
|
||||
if (dev->phy->start) {
|
||||
error = dev->phy->start(dev);
|
||||
if (error)
|
||||
goto err_free_rx;
|
||||
}
|
||||
/* Get iadev->carrier_detect status */
|
||||
IaFrontEndIntr(iadev);
|
||||
}
|
||||
@ -3198,6 +3192,8 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
|
||||
IF_INIT(printk("dev_id = 0x%x iadev->LineRate = %d \n", (u32)dev,
|
||||
iadev->LineRate);)
|
||||
|
||||
pci_set_drvdata(pdev, dev);
|
||||
|
||||
ia_dev[iadev_count] = iadev;
|
||||
_ia_dev[iadev_count] = dev;
|
||||
iadev_count++;
|
||||
@ -3219,8 +3215,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
|
||||
iadev->next_board = ia_boards;
|
||||
ia_boards = dev;
|
||||
|
||||
pci_set_drvdata(pdev, dev);
|
||||
|
||||
return 0;
|
||||
|
||||
err_out_deregister_dev:
|
||||
@ -3238,9 +3232,14 @@ static void __devexit ia_remove_one(struct pci_dev *pdev)
|
||||
struct atm_dev *dev = pci_get_drvdata(pdev);
|
||||
IADEV *iadev = INPH_IA_DEV(dev);
|
||||
|
||||
ia_phy_put(dev, ia_phy_get(dev,0x10) & ~(0x4), 0x10);
|
||||
/* Disable phy interrupts */
|
||||
ia_phy_put(dev, ia_phy_get(dev, SUNI_RSOP_CIE) & ~(SUNI_RSOP_CIE_LOSE),
|
||||
SUNI_RSOP_CIE);
|
||||
udelay(1);
|
||||
|
||||
if (dev->phy && dev->phy->stop)
|
||||
dev->phy->stop(dev);
|
||||
|
||||
/* De-register device */
|
||||
free_irq(iadev->irq, dev);
|
||||
iadev_count--;
|
||||
|
@ -471,7 +471,6 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
|
||||
memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* see if SPI FLAGS exist ? */
|
||||
|
@ -400,26 +400,31 @@ enc28j60_packet_write(struct enc28j60_net *priv, int len, const u8 *data)
|
||||
mutex_unlock(&priv->lock);
|
||||
}
|
||||
|
||||
static unsigned long msec20_to_jiffies;
|
||||
|
||||
static int poll_ready(struct enc28j60_net *priv, u8 reg, u8 mask, u8 val)
|
||||
{
|
||||
unsigned long timeout = jiffies + msec20_to_jiffies;
|
||||
|
||||
/* 20 msec timeout read */
|
||||
while ((nolock_regb_read(priv, reg) & mask) != val) {
|
||||
if (time_after(jiffies, timeout)) {
|
||||
if (netif_msg_drv(priv))
|
||||
dev_dbg(&priv->spi->dev,
|
||||
"reg %02x ready timeout!\n", reg);
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
cpu_relax();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait until the PHY operation is complete.
|
||||
*/
|
||||
static int wait_phy_ready(struct enc28j60_net *priv)
|
||||
{
|
||||
unsigned long timeout = jiffies + 20 * HZ / 1000;
|
||||
int ret = 1;
|
||||
|
||||
/* 20 msec timeout read */
|
||||
while (nolock_regb_read(priv, MISTAT) & MISTAT_BUSY) {
|
||||
if (time_after(jiffies, timeout)) {
|
||||
if (netif_msg_drv(priv))
|
||||
printk(KERN_DEBUG DRV_NAME
|
||||
": PHY ready timeout!\n");
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
cpu_relax();
|
||||
}
|
||||
return ret;
|
||||
return poll_ready(priv, MISTAT, MISTAT_BUSY, 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -594,6 +599,32 @@ static void nolock_txfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
|
||||
nolock_regw_write(priv, ETXNDL, end);
|
||||
}
|
||||
|
||||
/*
|
||||
* Low power mode shrinks power consumption about 100x, so we'd like
|
||||
* the chip to be in that mode whenever it's inactive. (However, we
|
||||
* can't stay in lowpower mode during suspend with WOL active.)
|
||||
*/
|
||||
static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
|
||||
{
|
||||
if (netif_msg_drv(priv))
|
||||
dev_dbg(&priv->spi->dev, "%s power...\n",
|
||||
is_low ? "low" : "high");
|
||||
|
||||
mutex_lock(&priv->lock);
|
||||
if (is_low) {
|
||||
nolock_reg_bfclr(priv, ECON1, ECON1_RXEN);
|
||||
poll_ready(priv, ESTAT, ESTAT_RXBUSY, 0);
|
||||
poll_ready(priv, ECON1, ECON1_TXRTS, 0);
|
||||
/* ECON2_VRPS was set during initialization */
|
||||
nolock_reg_bfset(priv, ECON2, ECON2_PWRSV);
|
||||
} else {
|
||||
nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV);
|
||||
poll_ready(priv, ESTAT, ESTAT_CLKRDY, ESTAT_CLKRDY);
|
||||
/* caller sets ECON1_RXEN */
|
||||
}
|
||||
mutex_unlock(&priv->lock);
|
||||
}
|
||||
|
||||
static int enc28j60_hw_init(struct enc28j60_net *priv)
|
||||
{
|
||||
u8 reg;
|
||||
@ -612,8 +643,8 @@ static int enc28j60_hw_init(struct enc28j60_net *priv)
|
||||
priv->tx_retry_count = 0;
|
||||
priv->max_pk_counter = 0;
|
||||
priv->rxfilter = RXFILTER_NORMAL;
|
||||
/* enable address auto increment */
|
||||
nolock_regb_write(priv, ECON2, ECON2_AUTOINC);
|
||||
/* enable address auto increment and voltage regulator powersave */
|
||||
nolock_regb_write(priv, ECON2, ECON2_AUTOINC | ECON2_VRPS);
|
||||
|
||||
nolock_rxfifo_init(priv, RXSTART_INIT, RXEND_INIT);
|
||||
nolock_txfifo_init(priv, TXSTART_INIT, TXEND_INIT);
|
||||
@ -690,7 +721,7 @@ static int enc28j60_hw_init(struct enc28j60_net *priv)
|
||||
|
||||
static void enc28j60_hw_enable(struct enc28j60_net *priv)
|
||||
{
|
||||
/* enable interrutps */
|
||||
/* enable interrupts */
|
||||
if (netif_msg_hw(priv))
|
||||
printk(KERN_DEBUG DRV_NAME ": %s() enabling interrupts.\n",
|
||||
__FUNCTION__);
|
||||
@ -726,15 +757,12 @@ enc28j60_setlink(struct net_device *ndev, u8 autoneg, u16 speed, u8 duplex)
|
||||
int ret = 0;
|
||||
|
||||
if (!priv->hw_enable) {
|
||||
if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) {
|
||||
/* link is in low power mode now; duplex setting
|
||||
* will take effect on next enc28j60_hw_init().
|
||||
*/
|
||||
if (autoneg == AUTONEG_DISABLE && speed == SPEED_10)
|
||||
priv->full_duplex = (duplex == DUPLEX_FULL);
|
||||
if (!enc28j60_hw_init(priv)) {
|
||||
if (netif_msg_drv(priv))
|
||||
dev_err(&ndev->dev,
|
||||
"hw_reset() failed\n");
|
||||
ret = -EINVAL;
|
||||
}
|
||||
} else {
|
||||
else {
|
||||
if (netif_msg_link(priv))
|
||||
dev_warn(&ndev->dev,
|
||||
"unsupported link setting\n");
|
||||
@ -1307,7 +1335,8 @@ static int enc28j60_net_open(struct net_device *dev)
|
||||
}
|
||||
return -EADDRNOTAVAIL;
|
||||
}
|
||||
/* Reset the hardware here */
|
||||
/* Reset the hardware here (and take it out of low power mode) */
|
||||
enc28j60_lowpower(priv, false);
|
||||
enc28j60_hw_disable(priv);
|
||||
if (!enc28j60_hw_init(priv)) {
|
||||
if (netif_msg_ifup(priv))
|
||||
@ -1337,6 +1366,7 @@ static int enc28j60_net_close(struct net_device *dev)
|
||||
printk(KERN_DEBUG DRV_NAME ": %s() enter\n", __FUNCTION__);
|
||||
|
||||
enc28j60_hw_disable(priv);
|
||||
enc28j60_lowpower(priv, true);
|
||||
netif_stop_queue(dev);
|
||||
|
||||
return 0;
|
||||
@ -1537,6 +1567,8 @@ static int __devinit enc28j60_probe(struct spi_device *spi)
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops);
|
||||
|
||||
enc28j60_lowpower(priv, true);
|
||||
|
||||
ret = register_netdev(dev);
|
||||
if (ret) {
|
||||
if (netif_msg_probe(priv))
|
||||
@ -1556,7 +1588,7 @@ error_alloc:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int enc28j60_remove(struct spi_device *spi)
|
||||
static int __devexit enc28j60_remove(struct spi_device *spi)
|
||||
{
|
||||
struct enc28j60_net *priv = dev_get_drvdata(&spi->dev);
|
||||
|
||||
@ -1573,15 +1605,16 @@ static int enc28j60_remove(struct spi_device *spi)
|
||||
static struct spi_driver enc28j60_driver = {
|
||||
.driver = {
|
||||
.name = DRV_NAME,
|
||||
.bus = &spi_bus_type,
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
},
|
||||
.probe = enc28j60_probe,
|
||||
.remove = __devexit_p(enc28j60_remove),
|
||||
};
|
||||
|
||||
static int __init enc28j60_init(void)
|
||||
{
|
||||
msec20_to_jiffies = msecs_to_jiffies(20);
|
||||
|
||||
return spi_register_driver(&enc28j60_driver);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
config IBM_NEW_EMAC
|
||||
tristate "IBM EMAC Ethernet support"
|
||||
depends on PPC_DCR && PPC_MERGE
|
||||
select CRC32
|
||||
help
|
||||
This driver supports the IBM EMAC family of Ethernet controllers
|
||||
typically found on 4xx embedded PowerPC chips, but also on the
|
||||
|
@ -776,7 +776,6 @@ struct netxen_hardware_context {
|
||||
|
||||
u8 revision_id;
|
||||
u16 board_type;
|
||||
u16 max_ports;
|
||||
struct netxen_board_info boardcfg;
|
||||
u32 xg_linkup;
|
||||
u32 qg_linksup;
|
||||
@ -863,6 +862,7 @@ struct netxen_adapter {
|
||||
unsigned char mac_addr[ETH_ALEN];
|
||||
int mtu;
|
||||
int portnum;
|
||||
u8 physical_port;
|
||||
|
||||
struct work_struct watchdog_task;
|
||||
struct timer_list watchdog_timer;
|
||||
@ -1034,7 +1034,6 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr);
|
||||
|
||||
/* Functions from netxen_nic_isr.c */
|
||||
void netxen_initialize_adapter_sw(struct netxen_adapter *adapter);
|
||||
void netxen_initialize_adapter_hw(struct netxen_adapter *adapter);
|
||||
void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr,
|
||||
struct pci_dev **used_dev);
|
||||
void netxen_initialize_adapter_ops(struct netxen_adapter *adapter);
|
||||
@ -1077,20 +1076,6 @@ static const struct netxen_brdinfo netxen_boards[] = {
|
||||
|
||||
#define NUM_SUPPORTED_BOARDS ARRAY_SIZE(netxen_boards)
|
||||
|
||||
static inline void get_brd_port_by_type(u32 type, int *ports)
|
||||
{
|
||||
int i, found = 0;
|
||||
for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) {
|
||||
if (netxen_boards[i].brdtype == type) {
|
||||
*ports = netxen_boards[i].ports;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
*ports = 0;
|
||||
}
|
||||
|
||||
static inline void get_brd_name_by_type(u32 type, char *name)
|
||||
{
|
||||
int i, found = 0;
|
||||
@ -1169,5 +1154,4 @@ extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,
|
||||
|
||||
extern struct ethtool_ops netxen_nic_ethtool_ops;
|
||||
|
||||
extern int physical_port[]; /* physical port # from virtual port.*/
|
||||
#endif /* __NETXEN_NIC_H_ */
|
||||
|
@ -369,7 +369,7 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
|
||||
for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
|
||||
/* GB: port specific registers */
|
||||
if (mode == 0 && i >= 19)
|
||||
window = physical_port[adapter->portnum] *
|
||||
window = adapter->physical_port *
|
||||
NETXEN_NIC_PORT_WINDOW;
|
||||
|
||||
NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
|
||||
@ -527,7 +527,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
|
||||
{
|
||||
struct netxen_adapter *adapter = netdev_priv(dev);
|
||||
__u32 val;
|
||||
int port = physical_port[adapter->portnum];
|
||||
int port = adapter->physical_port;
|
||||
|
||||
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
|
||||
if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
|
||||
@ -573,7 +573,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
|
||||
{
|
||||
struct netxen_adapter *adapter = netdev_priv(dev);
|
||||
__u32 val;
|
||||
int port = physical_port[adapter->portnum];
|
||||
int port = adapter->physical_port;
|
||||
/* read mode */
|
||||
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
|
||||
if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
|
||||
|
@ -396,11 +396,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
|
||||
}
|
||||
adapter->intr_scheme = readl(
|
||||
NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW));
|
||||
printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netxen_nic_driver_name,
|
||||
adapter->intr_scheme);
|
||||
adapter->msi_mode = readl(
|
||||
NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_FW));
|
||||
DPRINTK(INFO, "Receive Peg ready too. starting stuff\n");
|
||||
|
||||
addr = netxen_alloc(adapter->ahw.pdev,
|
||||
sizeof(struct netxen_ring_ctx) +
|
||||
@ -408,8 +405,6 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
|
||||
(dma_addr_t *) & adapter->ctx_desc_phys_addr,
|
||||
&adapter->ctx_desc_pdev);
|
||||
|
||||
printk(KERN_INFO "ctx_desc_phys_addr: 0x%llx\n",
|
||||
(unsigned long long) adapter->ctx_desc_phys_addr);
|
||||
if (addr == NULL) {
|
||||
DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
|
||||
err = -ENOMEM;
|
||||
@ -429,8 +424,6 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
|
||||
adapter->max_tx_desc_count,
|
||||
(dma_addr_t *) & hw->cmd_desc_phys_addr,
|
||||
&adapter->ahw.cmd_desc_pdev);
|
||||
printk(KERN_INFO "cmd_desc_phys_addr: 0x%llx\n",
|
||||
(unsigned long long) hw->cmd_desc_phys_addr);
|
||||
|
||||
if (addr == NULL) {
|
||||
DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
|
||||
@ -1032,15 +1025,15 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
|
||||
int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu)
|
||||
{
|
||||
netxen_nic_write_w0(adapter,
|
||||
NETXEN_NIU_GB_MAX_FRAME_SIZE(
|
||||
physical_port[adapter->portnum]), new_mtu);
|
||||
NETXEN_NIU_GB_MAX_FRAME_SIZE(adapter->physical_port),
|
||||
new_mtu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu)
|
||||
{
|
||||
new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE;
|
||||
if (physical_port[adapter->portnum] == 0)
|
||||
if (adapter->physical_port == 0)
|
||||
netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE,
|
||||
new_mtu);
|
||||
else
|
||||
@ -1051,7 +1044,7 @@ int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu)
|
||||
|
||||
void netxen_nic_init_niu_gb(struct netxen_adapter *adapter)
|
||||
{
|
||||
netxen_niu_gbe_init_port(adapter, physical_port[adapter->portnum]);
|
||||
netxen_niu_gbe_init_port(adapter, adapter->physical_port);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1127,7 +1120,6 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
|
||||
|
||||
void netxen_nic_flash_print(struct netxen_adapter *adapter)
|
||||
{
|
||||
int valid = 1;
|
||||
u32 fw_major = 0;
|
||||
u32 fw_minor = 0;
|
||||
u32 fw_build = 0;
|
||||
@ -1137,70 +1129,62 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter)
|
||||
__le32 *ptr32;
|
||||
|
||||
struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
|
||||
if (board_info->magic != NETXEN_BDINFO_MAGIC) {
|
||||
printk
|
||||
("NetXen Unknown board config, Read 0x%x expected as 0x%x\n",
|
||||
board_info->magic, NETXEN_BDINFO_MAGIC);
|
||||
valid = 0;
|
||||
}
|
||||
if (board_info->header_version != NETXEN_BDINFO_VERSION) {
|
||||
printk("NetXen Unknown board config version."
|
||||
" Read %x, expected %x\n",
|
||||
board_info->header_version, NETXEN_BDINFO_VERSION);
|
||||
valid = 0;
|
||||
}
|
||||
if (valid) {
|
||||
ptr32 = (u32 *)&serial_num;
|
||||
addr = NETXEN_USER_START +
|
||||
offsetof(struct netxen_new_user_info, serial_num);
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) {
|
||||
printk("%s: ERROR reading %s board userarea.\n",
|
||||
netxen_nic_driver_name,
|
||||
netxen_nic_driver_name);
|
||||
return;
|
||||
}
|
||||
ptr32++;
|
||||
addr += sizeof(u32);
|
||||
}
|
||||
|
||||
adapter->driver_mismatch = 0;
|
||||
|
||||
ptr32 = (u32 *)&serial_num;
|
||||
addr = NETXEN_USER_START +
|
||||
offsetof(struct netxen_new_user_info, serial_num);
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) {
|
||||
printk("%s: ERROR reading %s board userarea.\n",
|
||||
netxen_nic_driver_name,
|
||||
netxen_nic_driver_name);
|
||||
adapter->driver_mismatch = 1;
|
||||
return;
|
||||
}
|
||||
ptr32++;
|
||||
addr += sizeof(u32);
|
||||
}
|
||||
|
||||
fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_FW_VERSION_MAJOR));
|
||||
fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_FW_VERSION_MINOR));
|
||||
fw_build =
|
||||
readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB));
|
||||
|
||||
if (adapter->portnum == 0) {
|
||||
get_brd_name_by_type(board_info->board_type, brd_name);
|
||||
|
||||
printk("NetXen %s Board S/N %s Chip id 0x%x\n",
|
||||
brd_name, serial_num, board_info->chip_id);
|
||||
|
||||
printk("NetXen %s Board #%d, Chip id 0x%x\n",
|
||||
board_info->board_type == 0x0b ? "XGB" : "GBE",
|
||||
board_info->board_num, board_info->chip_id);
|
||||
fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_FW_VERSION_MAJOR));
|
||||
fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_FW_VERSION_MINOR));
|
||||
fw_build =
|
||||
readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB));
|
||||
|
||||
printk("NetXen Firmware version %d.%d.%d\n", fw_major, fw_minor,
|
||||
fw_build);
|
||||
brd_name, serial_num, board_info->chip_id);
|
||||
printk("NetXen Firmware version %d.%d.%d\n", fw_major,
|
||||
fw_minor, fw_build);
|
||||
}
|
||||
|
||||
if (fw_major != _NETXEN_NIC_LINUX_MAJOR) {
|
||||
printk(KERN_ERR "The mismatch in driver version and firmware "
|
||||
"version major number\n"
|
||||
"Driver version major number = %d \t"
|
||||
"Firmware version major number = %d \n",
|
||||
_NETXEN_NIC_LINUX_MAJOR, fw_major);
|
||||
adapter->driver_mismatch = 1;
|
||||
}
|
||||
if (fw_minor != _NETXEN_NIC_LINUX_MINOR &&
|
||||
fw_minor != (_NETXEN_NIC_LINUX_MINOR + 1)) {
|
||||
printk(KERN_ERR "The mismatch in driver version and firmware "
|
||||
"version minor number\n"
|
||||
"Driver version minor number = %d \t"
|
||||
"Firmware version minor number = %d \n",
|
||||
_NETXEN_NIC_LINUX_MINOR, fw_minor);
|
||||
adapter->driver_mismatch = 1;
|
||||
}
|
||||
if (adapter->driver_mismatch)
|
||||
printk(KERN_INFO "Use the driver with version no %d.%d.xxx\n",
|
||||
fw_major, fw_minor);
|
||||
if (adapter->driver_mismatch) {
|
||||
printk(KERN_ERR "%s: driver and firmware version mismatch\n",
|
||||
adapter->netdev->name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (adapter->ahw.board_type) {
|
||||
case NETXEN_NIC_GBE:
|
||||
dev_info(&adapter->pdev->dev, "%s: GbE port initialized\n",
|
||||
adapter->netdev->name);
|
||||
break;
|
||||
case NETXEN_NIC_XGBE:
|
||||
dev_info(&adapter->pdev->dev, "%s: XGbE port initialized\n",
|
||||
adapter->netdev->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,21 +203,6 @@ void netxen_initialize_adapter_sw(struct netxen_adapter *adapter)
|
||||
}
|
||||
}
|
||||
|
||||
void netxen_initialize_adapter_hw(struct netxen_adapter *adapter)
|
||||
{
|
||||
int ports = 0;
|
||||
struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
|
||||
|
||||
if (netxen_nic_get_board_info(adapter) != 0)
|
||||
printk("%s: Error getting board config info.\n",
|
||||
netxen_nic_driver_name);
|
||||
get_brd_port_by_type(board_info->board_type, &ports);
|
||||
if (ports == 0)
|
||||
printk(KERN_ERR "%s: Unknown board type\n",
|
||||
netxen_nic_driver_name);
|
||||
adapter->ahw.max_ports = ports;
|
||||
}
|
||||
|
||||
void netxen_initialize_adapter_ops(struct netxen_adapter *adapter)
|
||||
{
|
||||
switch (adapter->ahw.board_type) {
|
||||
@ -765,18 +750,13 @@ int netxen_flash_unlock(struct netxen_adapter *adapter)
|
||||
|
||||
int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
|
||||
{
|
||||
int addr, val, status;
|
||||
int addr, val;
|
||||
int n, i;
|
||||
int init_delay = 0;
|
||||
struct crb_addr_pair *buf;
|
||||
u32 off;
|
||||
|
||||
/* resetall */
|
||||
status = netxen_nic_get_board_info(adapter);
|
||||
if (status)
|
||||
printk("%s: netxen_pinit_from_rom: Error getting board info\n",
|
||||
netxen_nic_driver_name);
|
||||
|
||||
netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET,
|
||||
NETXEN_ROMBUS_RESET);
|
||||
|
||||
@ -860,10 +840,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
|
||||
netxen_nic_pci_change_crbwindow(adapter, 1);
|
||||
}
|
||||
if (init_delay == 1) {
|
||||
msleep(2000);
|
||||
msleep(1000);
|
||||
init_delay = 0;
|
||||
}
|
||||
msleep(20);
|
||||
msleep(1);
|
||||
}
|
||||
kfree(buf);
|
||||
|
||||
@ -938,12 +918,28 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
|
||||
|
||||
void netxen_free_adapter_offload(struct netxen_adapter *adapter)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (adapter->dummy_dma.addr) {
|
||||
pci_free_consistent(adapter->ahw.pdev,
|
||||
i = 100;
|
||||
do {
|
||||
if (dma_watchdog_shutdown_request(adapter) == 1)
|
||||
break;
|
||||
msleep(50);
|
||||
if (dma_watchdog_shutdown_poll_result(adapter) == 1)
|
||||
break;
|
||||
} while (--i);
|
||||
|
||||
if (i) {
|
||||
pci_free_consistent(adapter->ahw.pdev,
|
||||
NETXEN_HOST_DUMMY_DMA_SIZE,
|
||||
adapter->dummy_dma.addr,
|
||||
adapter->dummy_dma.phys_addr);
|
||||
adapter->dummy_dma.addr = NULL;
|
||||
adapter->dummy_dma.addr = NULL;
|
||||
} else {
|
||||
printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
|
||||
adapter->netdev->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ static void netxen_nic_isr_other(struct netxen_adapter *adapter)
|
||||
|
||||
/* verify the offset */
|
||||
val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
|
||||
val = val >> physical_port[adapter->portnum];
|
||||
val = val >> adapter->physical_port;
|
||||
if (val == adapter->ahw.qg_linksup)
|
||||
return;
|
||||
|
||||
@ -199,7 +199,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
|
||||
|
||||
/* WINDOW = 1 */
|
||||
val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
|
||||
val >>= (physical_port[adapter->portnum] * 8);
|
||||
val >>= (adapter->physical_port * 8);
|
||||
val &= 0xff;
|
||||
|
||||
if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) {
|
||||
|
@ -70,17 +70,15 @@ static void netxen_nic_poll_controller(struct net_device *netdev);
|
||||
static irqreturn_t netxen_intr(int irq, void *data);
|
||||
static irqreturn_t netxen_msi_intr(int irq, void *data);
|
||||
|
||||
int physical_port[] = {0, 1, 2, 3};
|
||||
|
||||
/* PCI Device ID Table */
|
||||
static struct pci_device_id netxen_pci_tbl[] __devinitdata = {
|
||||
{PCI_DEVICE(0x4040, 0x0001)},
|
||||
{PCI_DEVICE(0x4040, 0x0002)},
|
||||
{PCI_DEVICE(0x4040, 0x0003)},
|
||||
{PCI_DEVICE(0x4040, 0x0004)},
|
||||
{PCI_DEVICE(0x4040, 0x0005)},
|
||||
{PCI_DEVICE(0x4040, 0x0024)},
|
||||
{PCI_DEVICE(0x4040, 0x0025)},
|
||||
{PCI_DEVICE(0x4040, 0x0001), PCI_DEVICE_CLASS(0x020000, ~0)},
|
||||
{PCI_DEVICE(0x4040, 0x0002), PCI_DEVICE_CLASS(0x020000, ~0)},
|
||||
{PCI_DEVICE(0x4040, 0x0003), PCI_DEVICE_CLASS(0x020000, ~0)},
|
||||
{PCI_DEVICE(0x4040, 0x0004), PCI_DEVICE_CLASS(0x020000, ~0)},
|
||||
{PCI_DEVICE(0x4040, 0x0005), PCI_DEVICE_CLASS(0x020000, ~0)},
|
||||
{PCI_DEVICE(0x4040, 0x0024), PCI_DEVICE_CLASS(0x020000, ~0)},
|
||||
{PCI_DEVICE(0x4040, 0x0025), PCI_DEVICE_CLASS(0x020000, ~0)},
|
||||
{0,}
|
||||
};
|
||||
|
||||
@ -288,10 +286,11 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
int pci_func_id = PCI_FUNC(pdev->devfn);
|
||||
DECLARE_MAC_BUF(mac);
|
||||
|
||||
printk(KERN_INFO "%s \n", netxen_nic_driver_string);
|
||||
if (pci_func_id == 0)
|
||||
printk(KERN_INFO "%s \n", netxen_nic_driver_string);
|
||||
|
||||
if (pdev->class != 0x020000) {
|
||||
printk(KERN_ERR"NetXen function %d, class %x will not "
|
||||
printk(KERN_DEBUG "NetXen function %d, class %x will not "
|
||||
"be enabled.\n",pci_func_id, pdev->class);
|
||||
return -ENODEV;
|
||||
}
|
||||
@ -450,8 +449,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
*/
|
||||
adapter->curr_window = 255;
|
||||
|
||||
/* initialize the adapter */
|
||||
netxen_initialize_adapter_hw(adapter);
|
||||
if (netxen_nic_get_board_info(adapter) != 0) {
|
||||
printk("%s: Error getting board config info.\n",
|
||||
netxen_nic_driver_name);
|
||||
err = -EIO;
|
||||
goto err_out_iounmap;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adapter in our case is quad port so initialize it before
|
||||
@ -530,17 +533,15 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
netxen_initialize_adapter_sw(adapter); /* initialize the buffers in adapter */
|
||||
|
||||
/* Mezz cards have PCI function 0,2,3 enabled */
|
||||
if ((adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ)
|
||||
&& (pci_func_id >= 2))
|
||||
switch (adapter->ahw.boardcfg.board_type) {
|
||||
case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ:
|
||||
case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ:
|
||||
if (pci_func_id >= 2)
|
||||
adapter->portnum = pci_func_id - 2;
|
||||
|
||||
#ifdef CONFIG_IA64
|
||||
if(adapter->portnum == 0) {
|
||||
netxen_pinit_from_rom(adapter, 0);
|
||||
udelay(500);
|
||||
netxen_load_firmware(adapter);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
init_timer(&adapter->watchdog_timer);
|
||||
adapter->ahw.xg_linkup = 0;
|
||||
@ -613,11 +614,18 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
err = -ENODEV;
|
||||
goto err_out_free_dev;
|
||||
}
|
||||
} else {
|
||||
writel(0, NETXEN_CRB_NORMALIZE(adapter,
|
||||
CRB_CMDPEG_STATE));
|
||||
netxen_pinit_from_rom(adapter, 0);
|
||||
msleep(1);
|
||||
netxen_load_firmware(adapter);
|
||||
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
|
||||
}
|
||||
|
||||
/* clear the register for future unloads/loads */
|
||||
writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
|
||||
printk(KERN_INFO "State: 0x%0x\n",
|
||||
dev_info(&pdev->dev, "cmdpeg state: 0x%0x\n",
|
||||
readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
|
||||
|
||||
/*
|
||||
@ -639,9 +647,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
/*
|
||||
* See if the firmware gave us a virtual-physical port mapping.
|
||||
*/
|
||||
adapter->physical_port = adapter->portnum;
|
||||
i = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_V2P(adapter->portnum)));
|
||||
if (i != 0x55555555)
|
||||
physical_port[adapter->portnum] = i;
|
||||
adapter->physical_port = i;
|
||||
|
||||
netif_carrier_off(netdev);
|
||||
netif_stop_queue(netdev);
|
||||
@ -654,22 +663,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
goto err_out_free_dev;
|
||||
}
|
||||
|
||||
netxen_nic_flash_print(adapter);
|
||||
pci_set_drvdata(pdev, adapter);
|
||||
|
||||
switch (adapter->ahw.board_type) {
|
||||
case NETXEN_NIC_GBE:
|
||||
printk(KERN_INFO "%s: QUAD GbE board initialized\n",
|
||||
netxen_nic_driver_name);
|
||||
break;
|
||||
|
||||
case NETXEN_NIC_XGBE:
|
||||
printk(KERN_INFO "%s: XGbE board initialized\n",
|
||||
netxen_nic_driver_name);
|
||||
break;
|
||||
}
|
||||
|
||||
adapter->driver_mismatch = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
err_out_free_dev:
|
||||
@ -760,55 +756,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
|
||||
|
||||
vfree(adapter->cmd_buf_arr);
|
||||
|
||||
if (adapter->portnum == 0) {
|
||||
if (init_firmware_done) {
|
||||
i = 100;
|
||||
do {
|
||||
if (dma_watchdog_shutdown_request(adapter) == 1)
|
||||
break;
|
||||
msleep(100);
|
||||
if (dma_watchdog_shutdown_poll_result(adapter) == 1)
|
||||
break;
|
||||
} while (--i);
|
||||
|
||||
if (i == 0)
|
||||
printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
|
||||
netdev->name);
|
||||
|
||||
/* clear the register for future unloads/loads */
|
||||
writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
|
||||
printk(KERN_INFO "State: 0x%0x\n",
|
||||
readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
|
||||
|
||||
/* leave the hw in the same state as reboot */
|
||||
writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
|
||||
netxen_pinit_from_rom(adapter, 0);
|
||||
msleep(1);
|
||||
netxen_load_firmware(adapter);
|
||||
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
|
||||
}
|
||||
|
||||
/* clear the register for future unloads/loads */
|
||||
writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
|
||||
printk(KERN_INFO "State: 0x%0x\n",
|
||||
readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
|
||||
|
||||
i = 100;
|
||||
do {
|
||||
if (dma_watchdog_shutdown_request(adapter) == 1)
|
||||
break;
|
||||
msleep(100);
|
||||
if (dma_watchdog_shutdown_poll_result(adapter) == 1)
|
||||
break;
|
||||
} while (--i);
|
||||
|
||||
if (i) {
|
||||
netxen_free_adapter_offload(adapter);
|
||||
} else {
|
||||
printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
|
||||
netdev->name);
|
||||
}
|
||||
}
|
||||
if (adapter->portnum == 0)
|
||||
netxen_free_adapter_offload(adapter);
|
||||
|
||||
if (adapter->irq)
|
||||
free_irq(adapter->irq, adapter);
|
||||
@ -840,13 +789,15 @@ static int netxen_nic_open(struct net_device *netdev)
|
||||
irq_handler_t handler;
|
||||
unsigned long flags = IRQF_SAMPLE_RANDOM;
|
||||
|
||||
if (adapter->driver_mismatch)
|
||||
return -EIO;
|
||||
|
||||
if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) {
|
||||
err = netxen_init_firmware(adapter);
|
||||
if (err != 0) {
|
||||
printk(KERN_ERR "Failed to init firmware\n");
|
||||
return -EIO;
|
||||
}
|
||||
netxen_nic_flash_print(adapter);
|
||||
|
||||
/* setup all the resources for the Phantom... */
|
||||
/* this include the descriptors for rcv, tx, and status */
|
||||
@ -895,14 +846,12 @@ static int netxen_nic_open(struct net_device *netdev)
|
||||
if (adapter->set_mtu)
|
||||
adapter->set_mtu(adapter, netdev->mtu);
|
||||
|
||||
if (!adapter->driver_mismatch)
|
||||
mod_timer(&adapter->watchdog_timer, jiffies);
|
||||
mod_timer(&adapter->watchdog_timer, jiffies);
|
||||
|
||||
napi_enable(&adapter->napi);
|
||||
netxen_nic_enable_int(adapter);
|
||||
|
||||
if (!adapter->driver_mismatch)
|
||||
netif_start_queue(netdev);
|
||||
netif_start_queue(netdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
|
||||
long timeout = 0;
|
||||
long result = 0;
|
||||
long restore = 0;
|
||||
long phy = physical_port[adapter->portnum];
|
||||
long phy = adapter->physical_port;
|
||||
__u32 address;
|
||||
__u32 command;
|
||||
__u32 status;
|
||||
@ -190,7 +190,7 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg,
|
||||
long timeout = 0;
|
||||
long result = 0;
|
||||
long restore = 0;
|
||||
long phy = physical_port[adapter->portnum];
|
||||
long phy = adapter->physical_port;
|
||||
__u32 address;
|
||||
__u32 command;
|
||||
__u32 status;
|
||||
@ -456,7 +456,7 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
|
||||
|
||||
int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
|
||||
{
|
||||
u32 portnum = physical_port[adapter->portnum];
|
||||
u32 portnum = adapter->physical_port;
|
||||
|
||||
netxen_crb_writelit_adapter(adapter,
|
||||
NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447);
|
||||
@ -573,7 +573,7 @@ static int netxen_niu_macaddr_get(struct netxen_adapter *adapter,
|
||||
{
|
||||
u32 stationhigh;
|
||||
u32 stationlow;
|
||||
int phy = physical_port[adapter->portnum];
|
||||
int phy = adapter->physical_port;
|
||||
u8 val[8];
|
||||
|
||||
if (addr == NULL)
|
||||
@ -604,7 +604,7 @@ int netxen_niu_macaddr_set(struct netxen_adapter *adapter,
|
||||
{
|
||||
u8 temp[4];
|
||||
u32 val;
|
||||
int phy = physical_port[adapter->portnum];
|
||||
int phy = adapter->physical_port;
|
||||
unsigned char mac_addr[6];
|
||||
int i;
|
||||
DECLARE_MAC_BUF(mac);
|
||||
@ -724,7 +724,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
|
||||
int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter)
|
||||
{
|
||||
__u32 mac_cfg0;
|
||||
u32 port = physical_port[adapter->portnum];
|
||||
u32 port = adapter->physical_port;
|
||||
|
||||
if (port > NETXEN_NIU_MAX_GBE_PORTS)
|
||||
return -EINVAL;
|
||||
@ -740,7 +740,7 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter)
|
||||
int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
|
||||
{
|
||||
__u32 mac_cfg;
|
||||
u32 port = physical_port[adapter->portnum];
|
||||
u32 port = adapter->physical_port;
|
||||
|
||||
if (port > NETXEN_NIU_MAX_XG_PORTS)
|
||||
return -EINVAL;
|
||||
@ -757,7 +757,7 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
|
||||
netxen_niu_prom_mode_t mode)
|
||||
{
|
||||
__u32 reg;
|
||||
u32 port = physical_port[adapter->portnum];
|
||||
u32 port = adapter->physical_port;
|
||||
|
||||
if (port > NETXEN_NIU_MAX_GBE_PORTS)
|
||||
return -EINVAL;
|
||||
@ -814,7 +814,7 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
|
||||
int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
|
||||
netxen_ethernet_macaddr_t addr)
|
||||
{
|
||||
int phy = physical_port[adapter->portnum];
|
||||
int phy = adapter->physical_port;
|
||||
u8 temp[4];
|
||||
u32 val;
|
||||
|
||||
@ -867,7 +867,7 @@ int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
|
||||
int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter,
|
||||
netxen_ethernet_macaddr_t * addr)
|
||||
{
|
||||
int phy = physical_port[adapter->portnum];
|
||||
int phy = adapter->physical_port;
|
||||
u32 stationhigh;
|
||||
u32 stationlow;
|
||||
u8 val[8];
|
||||
@ -896,7 +896,7 @@ int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
|
||||
netxen_niu_prom_mode_t mode)
|
||||
{
|
||||
__u32 reg;
|
||||
u32 port = physical_port[adapter->portnum];
|
||||
u32 port = adapter->physical_port;
|
||||
|
||||
if (port > NETXEN_NIU_MAX_XG_PORTS)
|
||||
return -EINVAL;
|
||||
|
@ -118,6 +118,7 @@ static const struct pci_device_id sky2_id_table[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4355) }, /* 88E8040T */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4357) }, /* 88E8042 */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */
|
||||
|
@ -313,6 +313,21 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
|
||||
|
||||
switch (tun->flags & TUN_TYPE_MASK) {
|
||||
case TUN_TUN_DEV:
|
||||
if (tun->flags & TUN_NO_PI) {
|
||||
switch (skb->data[0] & 0xf0) {
|
||||
case 0x40:
|
||||
pi.proto = htons(ETH_P_IP);
|
||||
break;
|
||||
case 0x60:
|
||||
pi.proto = htons(ETH_P_IPV6);
|
||||
break;
|
||||
default:
|
||||
tun->dev->stats.rx_dropped++;
|
||||
kfree_skb(skb);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
skb_reset_mac_header(skb);
|
||||
skb->protocol = pi.proto;
|
||||
skb->dev = tun->dev;
|
||||
|
@ -630,7 +630,6 @@ struct b43_pio {
|
||||
|
||||
/* Context information for a noise calculation (Link Quality). */
|
||||
struct b43_noise_calculation {
|
||||
u8 channel_at_start;
|
||||
bool calculation_running;
|
||||
u8 nr_samples;
|
||||
s8 samples[8][4];
|
||||
|
@ -795,66 +795,23 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
|
||||
{
|
||||
struct b43_dmaring *ring;
|
||||
int err;
|
||||
int nr_slots;
|
||||
dma_addr_t dma_test;
|
||||
|
||||
ring = kzalloc(sizeof(*ring), GFP_KERNEL);
|
||||
if (!ring)
|
||||
goto out;
|
||||
ring->type = type;
|
||||
|
||||
nr_slots = B43_RXRING_SLOTS;
|
||||
ring->nr_slots = B43_RXRING_SLOTS;
|
||||
if (for_tx)
|
||||
nr_slots = B43_TXRING_SLOTS;
|
||||
ring->nr_slots = B43_TXRING_SLOTS;
|
||||
|
||||
ring->meta = kcalloc(nr_slots, sizeof(struct b43_dmadesc_meta),
|
||||
ring->meta = kcalloc(ring->nr_slots, sizeof(struct b43_dmadesc_meta),
|
||||
GFP_KERNEL);
|
||||
if (!ring->meta)
|
||||
goto err_kfree_ring;
|
||||
if (for_tx) {
|
||||
ring->txhdr_cache = kcalloc(nr_slots,
|
||||
b43_txhdr_size(dev),
|
||||
GFP_KERNEL);
|
||||
if (!ring->txhdr_cache)
|
||||
goto err_kfree_meta;
|
||||
|
||||
/* test for ability to dma to txhdr_cache */
|
||||
dma_test = dma_map_single(dev->dev->dma_dev,
|
||||
ring->txhdr_cache,
|
||||
b43_txhdr_size(dev),
|
||||
DMA_TO_DEVICE);
|
||||
|
||||
if (b43_dma_mapping_error(ring, dma_test,
|
||||
b43_txhdr_size(dev), 1)) {
|
||||
/* ugh realloc */
|
||||
kfree(ring->txhdr_cache);
|
||||
ring->txhdr_cache = kcalloc(nr_slots,
|
||||
b43_txhdr_size(dev),
|
||||
GFP_KERNEL | GFP_DMA);
|
||||
if (!ring->txhdr_cache)
|
||||
goto err_kfree_meta;
|
||||
|
||||
dma_test = dma_map_single(dev->dev->dma_dev,
|
||||
ring->txhdr_cache,
|
||||
b43_txhdr_size(dev),
|
||||
DMA_TO_DEVICE);
|
||||
|
||||
if (b43_dma_mapping_error(ring, dma_test,
|
||||
b43_txhdr_size(dev), 1)) {
|
||||
|
||||
b43err(dev->wl,
|
||||
"TXHDR DMA allocation failed\n");
|
||||
goto err_kfree_txhdr_cache;
|
||||
}
|
||||
}
|
||||
|
||||
dma_unmap_single(dev->dev->dma_dev,
|
||||
dma_test, b43_txhdr_size(dev),
|
||||
DMA_TO_DEVICE);
|
||||
}
|
||||
|
||||
ring->type = type;
|
||||
ring->dev = dev;
|
||||
ring->nr_slots = nr_slots;
|
||||
ring->mmio_base = b43_dmacontroller_base(type, controller_index);
|
||||
ring->index = controller_index;
|
||||
if (type == B43_DMA_64BIT)
|
||||
@ -879,6 +836,48 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
|
||||
ring->last_injected_overflow = jiffies;
|
||||
#endif
|
||||
|
||||
if (for_tx) {
|
||||
ring->txhdr_cache = kcalloc(ring->nr_slots,
|
||||
b43_txhdr_size(dev),
|
||||
GFP_KERNEL);
|
||||
if (!ring->txhdr_cache)
|
||||
goto err_kfree_meta;
|
||||
|
||||
/* test for ability to dma to txhdr_cache */
|
||||
dma_test = dma_map_single(dev->dev->dma_dev,
|
||||
ring->txhdr_cache,
|
||||
b43_txhdr_size(dev),
|
||||
DMA_TO_DEVICE);
|
||||
|
||||
if (b43_dma_mapping_error(ring, dma_test,
|
||||
b43_txhdr_size(dev), 1)) {
|
||||
/* ugh realloc */
|
||||
kfree(ring->txhdr_cache);
|
||||
ring->txhdr_cache = kcalloc(ring->nr_slots,
|
||||
b43_txhdr_size(dev),
|
||||
GFP_KERNEL | GFP_DMA);
|
||||
if (!ring->txhdr_cache)
|
||||
goto err_kfree_meta;
|
||||
|
||||
dma_test = dma_map_single(dev->dev->dma_dev,
|
||||
ring->txhdr_cache,
|
||||
b43_txhdr_size(dev),
|
||||
DMA_TO_DEVICE);
|
||||
|
||||
if (b43_dma_mapping_error(ring, dma_test,
|
||||
b43_txhdr_size(dev), 1)) {
|
||||
|
||||
b43err(dev->wl,
|
||||
"TXHDR DMA allocation failed\n");
|
||||
goto err_kfree_txhdr_cache;
|
||||
}
|
||||
}
|
||||
|
||||
dma_unmap_single(dev->dev->dma_dev,
|
||||
dma_test, b43_txhdr_size(dev),
|
||||
DMA_TO_DEVICE);
|
||||
}
|
||||
|
||||
err = alloc_ringmemory(ring);
|
||||
if (err)
|
||||
goto err_kfree_txhdr_cache;
|
||||
|
@ -1145,7 +1145,6 @@ static void b43_generate_noise_sample(struct b43_wldev *dev)
|
||||
b43_jssi_write(dev, 0x7F7F7F7F);
|
||||
b43_write32(dev, B43_MMIO_MACCMD,
|
||||
b43_read32(dev, B43_MMIO_MACCMD) | B43_MACCMD_BGNOISE);
|
||||
B43_WARN_ON(dev->noisecalc.channel_at_start != dev->phy.channel);
|
||||
}
|
||||
|
||||
static void b43_calculate_link_quality(struct b43_wldev *dev)
|
||||
@ -1154,7 +1153,6 @@ static void b43_calculate_link_quality(struct b43_wldev *dev)
|
||||
|
||||
if (dev->noisecalc.calculation_running)
|
||||
return;
|
||||
dev->noisecalc.channel_at_start = dev->phy.channel;
|
||||
dev->noisecalc.calculation_running = 1;
|
||||
dev->noisecalc.nr_samples = 0;
|
||||
|
||||
@ -1171,9 +1169,16 @@ static void handle_irq_noise(struct b43_wldev *dev)
|
||||
|
||||
/* Bottom half of Link Quality calculation. */
|
||||
|
||||
/* Possible race condition: It might be possible that the user
|
||||
* changed to a different channel in the meantime since we
|
||||
* started the calculation. We ignore that fact, since it's
|
||||
* not really that much of a problem. The background noise is
|
||||
* an estimation only anyway. Slightly wrong results will get damped
|
||||
* by the averaging of the 8 sample rounds. Additionally the
|
||||
* value is shortlived. So it will be replaced by the next noise
|
||||
* calculation round soon. */
|
||||
|
||||
B43_WARN_ON(!dev->noisecalc.calculation_running);
|
||||
if (dev->noisecalc.channel_at_start != phy->channel)
|
||||
goto drop_calculation;
|
||||
*((__le32 *)noise) = cpu_to_le32(b43_jssi_read(dev));
|
||||
if (noise[0] == 0x7F || noise[1] == 0x7F ||
|
||||
noise[2] == 0x7F || noise[3] == 0x7F)
|
||||
@ -1214,11 +1219,10 @@ static void handle_irq_noise(struct b43_wldev *dev)
|
||||
average -= 48;
|
||||
|
||||
dev->stats.link_noise = average;
|
||||
drop_calculation:
|
||||
dev->noisecalc.calculation_running = 0;
|
||||
return;
|
||||
}
|
||||
generate_new:
|
||||
generate_new:
|
||||
b43_generate_noise_sample(dev);
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,13 @@ config RT2X00_LIB_FIRMWARE
|
||||
config RT2X00_LIB_RFKILL
|
||||
boolean
|
||||
depends on RT2X00_LIB
|
||||
depends on INPUT
|
||||
select RFKILL
|
||||
select INPUT_POLLDEV
|
||||
|
||||
config RT2X00_LIB_LEDS
|
||||
boolean
|
||||
depends on RT2X00_LIB
|
||||
depends on RT2X00_LIB && NEW_LEDS
|
||||
|
||||
config RT2400PCI
|
||||
tristate "Ralink rt2400 pci/pcmcia support"
|
||||
@ -51,7 +52,7 @@ config RT2400PCI
|
||||
|
||||
config RT2400PCI_RFKILL
|
||||
bool "RT2400 rfkill support"
|
||||
depends on RT2400PCI
|
||||
depends on RT2400PCI && INPUT
|
||||
select RT2X00_LIB_RFKILL
|
||||
---help---
|
||||
This adds support for integrated rt2400 devices that feature a
|
||||
@ -60,7 +61,7 @@ config RT2400PCI_RFKILL
|
||||
|
||||
config RT2400PCI_LEDS
|
||||
bool "RT2400 leds support"
|
||||
depends on RT2400PCI
|
||||
depends on RT2400PCI && NEW_LEDS
|
||||
select LEDS_CLASS
|
||||
select RT2X00_LIB_LEDS
|
||||
---help---
|
||||
@ -78,7 +79,7 @@ config RT2500PCI
|
||||
|
||||
config RT2500PCI_RFKILL
|
||||
bool "RT2500 rfkill support"
|
||||
depends on RT2500PCI
|
||||
depends on RT2500PCI && INPUT
|
||||
select RT2X00_LIB_RFKILL
|
||||
---help---
|
||||
This adds support for integrated rt2500 devices that feature a
|
||||
@ -87,7 +88,7 @@ config RT2500PCI_RFKILL
|
||||
|
||||
config RT2500PCI_LEDS
|
||||
bool "RT2500 leds support"
|
||||
depends on RT2500PCI
|
||||
depends on RT2500PCI && NEW_LEDS
|
||||
select LEDS_CLASS
|
||||
select RT2X00_LIB_LEDS
|
||||
---help---
|
||||
@ -107,7 +108,7 @@ config RT61PCI
|
||||
|
||||
config RT61PCI_RFKILL
|
||||
bool "RT61 rfkill support"
|
||||
depends on RT61PCI
|
||||
depends on RT61PCI && INPUT
|
||||
select RT2X00_LIB_RFKILL
|
||||
---help---
|
||||
This adds support for integrated rt61 devices that feature a
|
||||
@ -116,7 +117,7 @@ config RT61PCI_RFKILL
|
||||
|
||||
config RT61PCI_LEDS
|
||||
bool "RT61 leds support"
|
||||
depends on RT61PCI
|
||||
depends on RT61PCI && NEW_LEDS
|
||||
select LEDS_CLASS
|
||||
select RT2X00_LIB_LEDS
|
||||
---help---
|
||||
@ -133,7 +134,7 @@ config RT2500USB
|
||||
|
||||
config RT2500USB_LEDS
|
||||
bool "RT2500 leds support"
|
||||
depends on RT2500USB
|
||||
depends on RT2500USB && NEW_LEDS
|
||||
select LEDS_CLASS
|
||||
select RT2X00_LIB_LEDS
|
||||
---help---
|
||||
@ -152,7 +153,7 @@ config RT73USB
|
||||
|
||||
config RT73USB_LEDS
|
||||
bool "RT73 leds support"
|
||||
depends on RT73USB
|
||||
depends on RT73USB && NEW_LEDS
|
||||
select LEDS_CLASS
|
||||
select RT2X00_LIB_LEDS
|
||||
---help---
|
||||
|
@ -412,8 +412,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
|
||||
if (pci_set_mwi(pci_dev))
|
||||
ERROR_PROBE("MWI not available.\n");
|
||||
|
||||
if (pci_set_dma_mask(pci_dev, DMA_64BIT_MASK) &&
|
||||
pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) {
|
||||
if (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) {
|
||||
ERROR_PROBE("PCI DMA not supported.\n");
|
||||
retval = -EIO;
|
||||
goto exit_disable_device;
|
||||
|
@ -362,6 +362,12 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Kill guardian urb (if required by driver).
|
||||
*/
|
||||
if (!test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))
|
||||
return;
|
||||
|
||||
for (i = 0; i < rt2x00dev->bcn->limit; i++) {
|
||||
priv_bcn = rt2x00dev->bcn->entries[i].priv_data;
|
||||
usb_kill_urb(priv_bcn->urb);
|
||||
|
@ -2131,6 +2131,7 @@ static struct usb_device_id rt73usb_device_table[] = {
|
||||
/* D-Link */
|
||||
{ USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) },
|
||||
{ USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) },
|
||||
{ USB_DEVICE(0x07d1, 0x3c06), USB_DEVICE_DATA(&rt73usb_ops) },
|
||||
{ USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) },
|
||||
/* Gemtek */
|
||||
{ USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) },
|
||||
|
@ -1168,15 +1168,21 @@ EXPORT_SYMBOL(ssb_dma_translation);
|
||||
int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask)
|
||||
{
|
||||
struct device *dma_dev = ssb_dev->dma_dev;
|
||||
int err = 0;
|
||||
|
||||
#ifdef CONFIG_SSB_PCIHOST
|
||||
if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI)
|
||||
return dma_set_mask(dma_dev, mask);
|
||||
if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI) {
|
||||
err = pci_set_dma_mask(ssb_dev->bus->host_pci, mask);
|
||||
if (err)
|
||||
return err;
|
||||
err = pci_set_consistent_dma_mask(ssb_dev->bus->host_pci, mask);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
dma_dev->coherent_dma_mask = mask;
|
||||
dma_dev->dma_mask = &dma_dev->coherent_dma_mask;
|
||||
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(ssb_dma_set_mask);
|
||||
|
||||
|
@ -41,7 +41,7 @@ struct ip_tunnel_prl {
|
||||
__u16 __reserved;
|
||||
__u32 datalen;
|
||||
__u32 __reserved2;
|
||||
void __user *data;
|
||||
/* data follows */
|
||||
};
|
||||
|
||||
/* PRL flags */
|
||||
|
@ -15,6 +15,7 @@ enum nf_ct_ext_id
|
||||
|
||||
/* Extensions: optional stuff which isn't permanently in struct. */
|
||||
struct nf_ct_ext {
|
||||
struct rcu_head rcu;
|
||||
u8 offset[NF_CT_EXT_NUM];
|
||||
u8 len;
|
||||
char data[0];
|
||||
|
@ -188,10 +188,13 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
skb_push(skb, 2);
|
||||
if (brdev->payload == p_bridged)
|
||||
} else { /* e_vc */
|
||||
if (brdev->payload == p_bridged) {
|
||||
skb_push(skb, 2);
|
||||
memset(skb->data, 0, 2);
|
||||
} else { /* p_routed */
|
||||
skb_pull(skb, ETH_HLEN);
|
||||
}
|
||||
}
|
||||
skb_debug(skb);
|
||||
|
||||
@ -377,11 +380,8 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
|
||||
(skb->data + 6, ethertype_ipv4,
|
||||
sizeof(ethertype_ipv4)) == 0)
|
||||
skb->protocol = __constant_htons(ETH_P_IP);
|
||||
else {
|
||||
brdev->stats.rx_errors++;
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
else
|
||||
goto error;
|
||||
skb_pull(skb, sizeof(llc_oui_ipv4));
|
||||
skb_reset_network_header(skb);
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
@ -394,44 +394,56 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
|
||||
(memcmp(skb->data, llc_oui_pid_pad, 7) == 0)) {
|
||||
skb_pull(skb, sizeof(llc_oui_pid_pad));
|
||||
skb->protocol = eth_type_trans(skb, net_dev);
|
||||
} else {
|
||||
brdev->stats.rx_errors++;
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
goto error;
|
||||
|
||||
} else {
|
||||
/* first 2 chars should be 0 */
|
||||
if (*((u16 *) (skb->data)) != 0) {
|
||||
brdev->stats.rx_errors++;
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
} else { /* e_vc */
|
||||
if (brdev->payload == p_routed) {
|
||||
struct iphdr *iph;
|
||||
|
||||
skb_reset_network_header(skb);
|
||||
iph = ip_hdr(skb);
|
||||
if (iph->version == 4)
|
||||
skb->protocol = __constant_htons(ETH_P_IP);
|
||||
else if (iph->version == 6)
|
||||
skb->protocol = __constant_htons(ETH_P_IPV6);
|
||||
else
|
||||
goto error;
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
} else { /* p_bridged */
|
||||
/* first 2 chars should be 0 */
|
||||
if (*((u16 *) (skb->data)) != 0)
|
||||
goto error;
|
||||
skb_pull(skb, BR2684_PAD_LEN);
|
||||
skb->protocol = eth_type_trans(skb, net_dev);
|
||||
}
|
||||
skb_pull(skb, BR2684_PAD_LEN + ETH_HLEN); /* pad, dstmac, srcmac, ethtype */
|
||||
skb->protocol = eth_type_trans(skb, net_dev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ATM_BR2684_IPFILTER
|
||||
if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) {
|
||||
brdev->stats.rx_dropped++;
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb)))
|
||||
goto dropped;
|
||||
#endif /* CONFIG_ATM_BR2684_IPFILTER */
|
||||
skb->dev = net_dev;
|
||||
ATM_SKB(skb)->vcc = atmvcc; /* needed ? */
|
||||
pr_debug("received packet's protocol: %x\n", ntohs(skb->protocol));
|
||||
skb_debug(skb);
|
||||
if (unlikely(!(net_dev->flags & IFF_UP))) {
|
||||
/* sigh, interface is down */
|
||||
brdev->stats.rx_dropped++;
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
/* sigh, interface is down? */
|
||||
if (unlikely(!(net_dev->flags & IFF_UP)))
|
||||
goto dropped;
|
||||
brdev->stats.rx_packets++;
|
||||
brdev->stats.rx_bytes += skb->len;
|
||||
memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
|
||||
netif_rx(skb);
|
||||
return;
|
||||
|
||||
dropped:
|
||||
brdev->stats.rx_dropped++;
|
||||
goto free_skb;
|
||||
error:
|
||||
brdev->stats.rx_errors++;
|
||||
free_skb:
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -518,9 +530,9 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
|
||||
struct sk_buff *next = skb->next;
|
||||
|
||||
skb->next = skb->prev = NULL;
|
||||
br2684_push(atmvcc, skb);
|
||||
BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
|
||||
BRPRIV(skb->dev)->stats.rx_packets--;
|
||||
br2684_push(atmvcc, skb);
|
||||
|
||||
skb = next;
|
||||
}
|
||||
|
@ -119,6 +119,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/if_vlan.h>
|
||||
|
||||
#include "net-sysfs.h"
|
||||
|
||||
@ -1362,6 +1363,29 @@ void netif_device_attach(struct net_device *dev)
|
||||
}
|
||||
EXPORT_SYMBOL(netif_device_attach);
|
||||
|
||||
static bool can_checksum_protocol(unsigned long features, __be16 protocol)
|
||||
{
|
||||
return ((features & NETIF_F_GEN_CSUM) ||
|
||||
((features & NETIF_F_IP_CSUM) &&
|
||||
protocol == htons(ETH_P_IP)) ||
|
||||
((features & NETIF_F_IPV6_CSUM) &&
|
||||
protocol == htons(ETH_P_IPV6)));
|
||||
}
|
||||
|
||||
static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb)
|
||||
{
|
||||
if (can_checksum_protocol(dev->features, skb->protocol))
|
||||
return true;
|
||||
|
||||
if (skb->protocol == htons(ETH_P_8021Q)) {
|
||||
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
|
||||
if (can_checksum_protocol(dev->features & dev->vlan_features,
|
||||
veh->h_vlan_encapsulated_proto))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Invalidate hardware checksum when packet is to be mangled, and
|
||||
@ -1640,14 +1664,8 @@ int dev_queue_xmit(struct sk_buff *skb)
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
skb_set_transport_header(skb, skb->csum_start -
|
||||
skb_headroom(skb));
|
||||
|
||||
if (!(dev->features & NETIF_F_GEN_CSUM) &&
|
||||
!((dev->features & NETIF_F_IP_CSUM) &&
|
||||
skb->protocol == htons(ETH_P_IP)) &&
|
||||
!((dev->features & NETIF_F_IPV6_CSUM) &&
|
||||
skb->protocol == htons(ETH_P_IPV6)))
|
||||
if (skb_checksum_help(skb))
|
||||
goto out_kfree_skb;
|
||||
if (!dev_can_checksum(dev, skb) && skb_checksum_help(skb))
|
||||
goto out_kfree_skb;
|
||||
}
|
||||
|
||||
gso:
|
||||
|
@ -466,9 +466,9 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
|
||||
reqp=&lopt->syn_table[i];
|
||||
while ((req = *reqp) != NULL) {
|
||||
if (time_after_eq(now, req->expires)) {
|
||||
if ((req->retrans < (inet_rsk(req)->acked ? max_retries : thresh)) &&
|
||||
(inet_rsk(req)->acked ||
|
||||
!req->rsk_ops->rtx_syn_ack(parent, req))) {
|
||||
if ((req->retrans < thresh ||
|
||||
(inet_rsk(req)->acked && req->retrans < max_retries))
|
||||
&& !req->rsk_ops->rtx_syn_ack(parent, req)) {
|
||||
unsigned long timeo;
|
||||
|
||||
if (req->retrans++ == 0)
|
||||
|
@ -556,7 +556,6 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct)
|
||||
|
||||
spin_lock_bh(&nf_nat_lock);
|
||||
hlist_del_rcu(&nat->bysource);
|
||||
nat->ct = NULL;
|
||||
spin_unlock_bh(&nf_nat_lock);
|
||||
}
|
||||
|
||||
@ -570,8 +569,8 @@ static void nf_nat_move_storage(void *new, void *old)
|
||||
return;
|
||||
|
||||
spin_lock_bh(&nf_nat_lock);
|
||||
hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource);
|
||||
new_nat->ct = ct;
|
||||
hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource);
|
||||
spin_unlock_bh(&nf_nat_lock);
|
||||
}
|
||||
|
||||
|
@ -934,7 +934,7 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
|
||||
srcp = inet->num;
|
||||
|
||||
seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
|
||||
" %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d",
|
||||
" %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n",
|
||||
i, src, srcp, dest, destp, sp->sk_state,
|
||||
atomic_read(&sp->sk_wmem_alloc),
|
||||
atomic_read(&sp->sk_rmem_alloc),
|
||||
|
@ -85,10 +85,6 @@
|
||||
int sysctl_tcp_tw_reuse __read_mostly;
|
||||
int sysctl_tcp_low_latency __read_mostly;
|
||||
|
||||
/* Check TCP sequence numbers in ICMP packets. */
|
||||
#define ICMP_MIN_LENGTH 8
|
||||
|
||||
void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb);
|
||||
|
||||
#ifdef CONFIG_TCP_MD5SIG
|
||||
static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk,
|
||||
|
@ -52,7 +52,7 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||
IP_ECN_clear(top_iph);
|
||||
|
||||
top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ?
|
||||
0 : XFRM_MODE_SKB_CB(skb)->frag_off;
|
||||
0 : (XFRM_MODE_SKB_CB(skb)->frag_off & htons(IP_DF));
|
||||
ip_select_ident(top_iph, dst->child, NULL);
|
||||
|
||||
top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT);
|
||||
|
@ -222,15 +222,18 @@ __ipip6_tunnel_locate_prl(struct ip_tunnel *t, __be32 addr)
|
||||
|
||||
}
|
||||
|
||||
static int ipip6_tunnel_get_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a)
|
||||
static int ipip6_tunnel_get_prl(struct ip_tunnel *t,
|
||||
struct ip_tunnel_prl __user *a)
|
||||
{
|
||||
struct ip_tunnel_prl *kp;
|
||||
struct ip_tunnel_prl kprl, *kp;
|
||||
struct ip_tunnel_prl_entry *prl;
|
||||
unsigned int cmax, c = 0, ca, len;
|
||||
int ret = 0;
|
||||
|
||||
cmax = a->datalen / sizeof(*a);
|
||||
if (cmax > 1 && a->addr != htonl(INADDR_ANY))
|
||||
if (copy_from_user(&kprl, a, sizeof(kprl)))
|
||||
return -EFAULT;
|
||||
cmax = kprl.datalen / sizeof(kprl);
|
||||
if (cmax > 1 && kprl.addr != htonl(INADDR_ANY))
|
||||
cmax = 1;
|
||||
|
||||
/* For simple GET or for root users,
|
||||
@ -261,26 +264,25 @@ static int ipip6_tunnel_get_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a)
|
||||
for (prl = t->prl; prl; prl = prl->next) {
|
||||
if (c > cmax)
|
||||
break;
|
||||
if (a->addr != htonl(INADDR_ANY) && prl->addr != a->addr)
|
||||
if (kprl.addr != htonl(INADDR_ANY) && prl->addr != kprl.addr)
|
||||
continue;
|
||||
kp[c].addr = prl->addr;
|
||||
kp[c].flags = prl->flags;
|
||||
c++;
|
||||
if (a->addr != htonl(INADDR_ANY))
|
||||
if (kprl.addr != htonl(INADDR_ANY))
|
||||
break;
|
||||
}
|
||||
out:
|
||||
read_unlock(&ipip6_lock);
|
||||
|
||||
len = sizeof(*kp) * c;
|
||||
ret = len ? copy_to_user(a->data, kp, len) : 0;
|
||||
ret = 0;
|
||||
if ((len && copy_to_user(a + 1, kp, len)) || put_user(len, &a->datalen))
|
||||
ret = -EFAULT;
|
||||
|
||||
kfree(kp);
|
||||
if (ret)
|
||||
return -EFAULT;
|
||||
|
||||
a->datalen = len;
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -873,11 +875,20 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
break;
|
||||
|
||||
case SIOCGETPRL:
|
||||
err = -EINVAL;
|
||||
if (dev == sitn->fb_tunnel_dev)
|
||||
goto done;
|
||||
err = -ENOENT;
|
||||
if (!(t = netdev_priv(dev)))
|
||||
goto done;
|
||||
err = ipip6_tunnel_get_prl(t, ifr->ifr_ifru.ifru_data);
|
||||
break;
|
||||
|
||||
case SIOCADDPRL:
|
||||
case SIOCDELPRL:
|
||||
case SIOCCHGPRL:
|
||||
err = -EPERM;
|
||||
if (cmd != SIOCGETPRL && !capable(CAP_NET_ADMIN))
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
goto done;
|
||||
err = -EINVAL;
|
||||
if (dev == sitn->fb_tunnel_dev)
|
||||
@ -890,12 +901,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
goto done;
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCGETPRL:
|
||||
err = ipip6_tunnel_get_prl(t, &prl);
|
||||
if (!err && copy_to_user(ifr->ifr_ifru.ifru_data,
|
||||
&prl, sizeof(prl)))
|
||||
err = -EFAULT;
|
||||
break;
|
||||
case SIOCDELPRL:
|
||||
err = ipip6_tunnel_del_prl(t, &prl);
|
||||
break;
|
||||
@ -904,8 +909,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
err = ipip6_tunnel_add_prl(t, &prl, cmd == SIOCCHGPRL);
|
||||
break;
|
||||
}
|
||||
if (cmd != SIOCGETPRL)
|
||||
netdev_state_change(dev);
|
||||
netdev_state_change(dev);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1562,13 +1562,13 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
|
||||
* be cloned. This could happen, e.g., with Linux bridge code passing
|
||||
* us broadcast frames. */
|
||||
|
||||
if (head_need > 0 || skb_header_cloned(skb)) {
|
||||
if (head_need > 0 || skb_cloned(skb)) {
|
||||
#if 0
|
||||
printk(KERN_DEBUG "%s: need to reallocate buffer for %d bytes "
|
||||
"of headroom\n", dev->name, head_need);
|
||||
#endif
|
||||
|
||||
if (skb_header_cloned(skb))
|
||||
if (skb_cloned(skb))
|
||||
I802_DEBUG_INC(local->tx_expand_skb_head_cloned);
|
||||
else
|
||||
I802_DEBUG_INC(local->tx_expand_skb_head);
|
||||
|
@ -496,7 +496,8 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
|
||||
sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
|
||||
if (sdata->u.sta.state == IEEE80211_ASSOCIATED) {
|
||||
if (sdata->u.sta.state == IEEE80211_ASSOCIATED ||
|
||||
sdata->u.sta.state == IEEE80211_IBSS_JOINED) {
|
||||
ap_addr->sa_family = ARPHRD_ETHER;
|
||||
memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
|
||||
return 0;
|
||||
|
@ -673,7 +673,7 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local,
|
||||
#ifdef CONFIG_MAC80211_HT_DEBUG
|
||||
if (net_ratelimit())
|
||||
printk(KERN_DEBUG "allocated aggregation queue"
|
||||
" %d tid %d addr %s pool=0x%lX",
|
||||
" %d tid %d addr %s pool=0x%lX\n",
|
||||
i, tid, print_mac(mac, sta->addr),
|
||||
q->qdisc_pool[0]);
|
||||
#endif /* CONFIG_MAC80211_HT_DEBUG */
|
||||
|
@ -59,12 +59,19 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp)
|
||||
if (!*ext)
|
||||
return NULL;
|
||||
|
||||
INIT_RCU_HEAD(&(*ext)->rcu);
|
||||
(*ext)->offset[id] = off;
|
||||
(*ext)->len = len;
|
||||
|
||||
return (void *)(*ext) + off;
|
||||
}
|
||||
|
||||
static void __nf_ct_ext_free_rcu(struct rcu_head *head)
|
||||
{
|
||||
struct nf_ct_ext *ext = container_of(head, struct nf_ct_ext, rcu);
|
||||
kfree(ext);
|
||||
}
|
||||
|
||||
void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
|
||||
{
|
||||
struct nf_ct_ext *new;
|
||||
@ -106,7 +113,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
|
||||
(void *)ct->ext + ct->ext->offset[i]);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
kfree(ct->ext);
|
||||
call_rcu(&ct->ext->rcu, __nf_ct_ext_free_rcu);
|
||||
ct->ext = new;
|
||||
}
|
||||
|
||||
|
@ -619,6 +619,7 @@ static const struct nf_conntrack_expect_policy h245_exp_policy = {
|
||||
static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = {
|
||||
.name = "H.245",
|
||||
.me = THIS_MODULE,
|
||||
.tuple.src.l3num = AF_UNSPEC,
|
||||
.tuple.dst.protonum = IPPROTO_UDP,
|
||||
.help = h245_help,
|
||||
.expect_policy = &h245_exp_policy,
|
||||
@ -1765,6 +1766,7 @@ static void __exit nf_conntrack_h323_fini(void)
|
||||
nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]);
|
||||
nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]);
|
||||
nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]);
|
||||
nf_conntrack_helper_unregister(&nf_conntrack_helper_h245);
|
||||
kfree(h323_buffer);
|
||||
pr_debug("nf_ct_h323: fini\n");
|
||||
}
|
||||
@ -1777,28 +1779,34 @@ static int __init nf_conntrack_h323_init(void)
|
||||
h323_buffer = kmalloc(65536, GFP_KERNEL);
|
||||
if (!h323_buffer)
|
||||
return -ENOMEM;
|
||||
ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]);
|
||||
ret = nf_conntrack_helper_register(&nf_conntrack_helper_h245);
|
||||
if (ret < 0)
|
||||
goto err1;
|
||||
ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]);
|
||||
ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]);
|
||||
if (ret < 0)
|
||||
goto err2;
|
||||
ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]);
|
||||
ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]);
|
||||
if (ret < 0)
|
||||
goto err3;
|
||||
ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]);
|
||||
ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]);
|
||||
if (ret < 0)
|
||||
goto err4;
|
||||
ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]);
|
||||
if (ret < 0)
|
||||
goto err5;
|
||||
pr_debug("nf_ct_h323: init success\n");
|
||||
return 0;
|
||||
|
||||
err4:
|
||||
err5:
|
||||
nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]);
|
||||
err3:
|
||||
err4:
|
||||
nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]);
|
||||
err2:
|
||||
err3:
|
||||
nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]);
|
||||
err2:
|
||||
nf_conntrack_helper_unregister(&nf_conntrack_helper_h245);
|
||||
err1:
|
||||
kfree(h323_buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -444,8 +444,11 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||
if (ops->dumpit == NULL)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return netlink_dump_start(genl_sock, skb, nlh,
|
||||
ops->dumpit, ops->done);
|
||||
genl_unlock();
|
||||
err = netlink_dump_start(genl_sock, skb, nlh,
|
||||
ops->dumpit, ops->done);
|
||||
genl_lock();
|
||||
return err;
|
||||
}
|
||||
|
||||
if (ops->doit == NULL)
|
||||
@ -603,9 +606,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
int chains_to_skip = cb->args[0];
|
||||
int fams_to_skip = cb->args[1];
|
||||
|
||||
if (chains_to_skip != 0)
|
||||
genl_lock();
|
||||
|
||||
for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
|
||||
if (i < chains_to_skip)
|
||||
continue;
|
||||
@ -623,9 +623,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
}
|
||||
|
||||
errout:
|
||||
if (chains_to_skip != 0)
|
||||
genl_unlock();
|
||||
|
||||
cb->args[0] = i;
|
||||
cb->args[1] = n;
|
||||
|
||||
@ -770,7 +767,7 @@ static int __init genl_init(void)
|
||||
|
||||
/* we'll bump the group number right afterwards */
|
||||
genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0,
|
||||
genl_rcv, NULL, THIS_MODULE);
|
||||
genl_rcv, &genl_mutex, THIS_MODULE);
|
||||
if (genl_sock == NULL)
|
||||
panic("GENL: Cannot initialize generic netlink\n");
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
* $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
@ -53,13 +54,17 @@
|
||||
*/
|
||||
|
||||
#define HTB_HSIZE 16 /* classid hash size */
|
||||
#define HTB_HYSTERESIS 1 /* whether to use mode hysteresis for speedup */
|
||||
static int htb_hysteresis __read_mostly = 0; /* whether to use mode hysteresis for speedup */
|
||||
#define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */
|
||||
|
||||
#if HTB_VER >> 16 != TC_HTB_PROTOVER
|
||||
#error "Mismatched sch_htb.c and pkt_sch.h"
|
||||
#endif
|
||||
|
||||
/* Module parameter and sysfs export */
|
||||
module_param (htb_hysteresis, int, 0640);
|
||||
MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate");
|
||||
|
||||
/* used internaly to keep status of single class */
|
||||
enum htb_cmode {
|
||||
HTB_CANT_SEND, /* class can't send and can't borrow */
|
||||
@ -462,19 +467,21 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl)
|
||||
htb_remove_class_from_row(q, cl, mask);
|
||||
}
|
||||
|
||||
#if HTB_HYSTERESIS
|
||||
static inline long htb_lowater(const struct htb_class *cl)
|
||||
{
|
||||
return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
|
||||
if (htb_hysteresis)
|
||||
return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
static inline long htb_hiwater(const struct htb_class *cl)
|
||||
{
|
||||
return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
|
||||
if (htb_hysteresis)
|
||||
return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define htb_lowater(cl) (0)
|
||||
#define htb_hiwater(cl) (0)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* htb_class_mode - computes and returns current class mode
|
||||
|
@ -474,6 +474,15 @@ static void sctp_association_destroy(struct sctp_association *asoc)
|
||||
void sctp_assoc_set_primary(struct sctp_association *asoc,
|
||||
struct sctp_transport *transport)
|
||||
{
|
||||
int changeover = 0;
|
||||
|
||||
/* it's a changeover only if we already have a primary path
|
||||
* that we are changing
|
||||
*/
|
||||
if (asoc->peer.primary_path != NULL &&
|
||||
asoc->peer.primary_path != transport)
|
||||
changeover = 1 ;
|
||||
|
||||
asoc->peer.primary_path = transport;
|
||||
|
||||
/* Set a default msg_name for events. */
|
||||
@ -499,12 +508,12 @@ void sctp_assoc_set_primary(struct sctp_association *asoc,
|
||||
* double switch to the same destination address.
|
||||
*/
|
||||
if (transport->cacc.changeover_active)
|
||||
transport->cacc.cycling_changeover = 1;
|
||||
transport->cacc.cycling_changeover = changeover;
|
||||
|
||||
/* 2) The sender MUST set CHANGEOVER_ACTIVE to indicate that
|
||||
* a changeover has occurred.
|
||||
*/
|
||||
transport->cacc.changeover_active = 1;
|
||||
transport->cacc.changeover_active = changeover;
|
||||
|
||||
/* 3) The sender MUST store the next TSN to be sent in
|
||||
* next_tsn_at_change.
|
||||
|
@ -108,14 +108,23 @@ static __init int sctp_proc_init(void)
|
||||
}
|
||||
|
||||
if (sctp_snmp_proc_init())
|
||||
goto out_nomem;
|
||||
goto out_snmp_proc_init;
|
||||
if (sctp_eps_proc_init())
|
||||
goto out_nomem;
|
||||
goto out_eps_proc_init;
|
||||
if (sctp_assocs_proc_init())
|
||||
goto out_nomem;
|
||||
goto out_assocs_proc_init;
|
||||
|
||||
return 0;
|
||||
|
||||
out_assocs_proc_init:
|
||||
sctp_eps_proc_exit();
|
||||
out_eps_proc_init:
|
||||
sctp_snmp_proc_exit();
|
||||
out_snmp_proc_init:
|
||||
if (proc_net_sctp) {
|
||||
proc_net_sctp = NULL;
|
||||
remove_proc_entry("sctp", init_net.proc_net);
|
||||
}
|
||||
out_nomem:
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -169,6 +169,11 @@ static inline int unix_may_send(struct sock *sk, struct sock *osk)
|
||||
return (unix_peer(osk) == NULL || unix_our_peer(sk, osk));
|
||||
}
|
||||
|
||||
static inline int unix_recvq_full(struct sock const *sk)
|
||||
{
|
||||
return skb_queue_len(&sk->sk_receive_queue) > sk->sk_max_ack_backlog;
|
||||
}
|
||||
|
||||
static struct sock *unix_peer_get(struct sock *s)
|
||||
{
|
||||
struct sock *peer;
|
||||
@ -482,6 +487,8 @@ static int unix_socketpair(struct socket *, struct socket *);
|
||||
static int unix_accept(struct socket *, struct socket *, int);
|
||||
static int unix_getname(struct socket *, struct sockaddr *, int *, int);
|
||||
static unsigned int unix_poll(struct file *, struct socket *, poll_table *);
|
||||
static unsigned int unix_datagram_poll(struct file *, struct socket *,
|
||||
poll_table *);
|
||||
static int unix_ioctl(struct socket *, unsigned int, unsigned long);
|
||||
static int unix_shutdown(struct socket *, int);
|
||||
static int unix_stream_sendmsg(struct kiocb *, struct socket *,
|
||||
@ -527,7 +534,7 @@ static const struct proto_ops unix_dgram_ops = {
|
||||
.socketpair = unix_socketpair,
|
||||
.accept = sock_no_accept,
|
||||
.getname = unix_getname,
|
||||
.poll = datagram_poll,
|
||||
.poll = unix_datagram_poll,
|
||||
.ioctl = unix_ioctl,
|
||||
.listen = sock_no_listen,
|
||||
.shutdown = unix_shutdown,
|
||||
@ -548,7 +555,7 @@ static const struct proto_ops unix_seqpacket_ops = {
|
||||
.socketpair = unix_socketpair,
|
||||
.accept = unix_accept,
|
||||
.getname = unix_getname,
|
||||
.poll = datagram_poll,
|
||||
.poll = unix_datagram_poll,
|
||||
.ioctl = unix_ioctl,
|
||||
.listen = unix_listen,
|
||||
.shutdown = unix_shutdown,
|
||||
@ -983,8 +990,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo)
|
||||
|
||||
sched = !sock_flag(other, SOCK_DEAD) &&
|
||||
!(other->sk_shutdown & RCV_SHUTDOWN) &&
|
||||
(skb_queue_len(&other->sk_receive_queue) >
|
||||
other->sk_max_ack_backlog);
|
||||
unix_recvq_full(other);
|
||||
|
||||
unix_state_unlock(other);
|
||||
|
||||
@ -1058,8 +1064,7 @@ restart:
|
||||
if (other->sk_state != TCP_LISTEN)
|
||||
goto out_unlock;
|
||||
|
||||
if (skb_queue_len(&other->sk_receive_queue) >
|
||||
other->sk_max_ack_backlog) {
|
||||
if (unix_recvq_full(other)) {
|
||||
err = -EAGAIN;
|
||||
if (!timeo)
|
||||
goto out_unlock;
|
||||
@ -1428,9 +1433,7 @@ restart:
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (unix_peer(other) != sk &&
|
||||
(skb_queue_len(&other->sk_receive_queue) >
|
||||
other->sk_max_ack_backlog)) {
|
||||
if (unix_peer(other) != sk && unix_recvq_full(other)) {
|
||||
if (!timeo) {
|
||||
err = -EAGAIN;
|
||||
goto out_unlock;
|
||||
@ -1991,6 +1994,64 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl
|
||||
return mask;
|
||||
}
|
||||
|
||||
static unsigned int unix_datagram_poll(struct file *file, struct socket *sock,
|
||||
poll_table *wait)
|
||||
{
|
||||
struct sock *sk = sock->sk, *peer;
|
||||
unsigned int mask;
|
||||
|
||||
poll_wait(file, sk->sk_sleep, wait);
|
||||
|
||||
peer = unix_peer_get(sk);
|
||||
if (peer) {
|
||||
if (peer != sk) {
|
||||
/*
|
||||
* Writability of a connected socket additionally
|
||||
* depends on the state of the receive queue of the
|
||||
* peer.
|
||||
*/
|
||||
poll_wait(file, &unix_sk(peer)->peer_wait, wait);
|
||||
} else {
|
||||
sock_put(peer);
|
||||
peer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
mask = 0;
|
||||
|
||||
/* exceptional events? */
|
||||
if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
|
||||
mask |= POLLERR;
|
||||
if (sk->sk_shutdown & RCV_SHUTDOWN)
|
||||
mask |= POLLRDHUP;
|
||||
if (sk->sk_shutdown == SHUTDOWN_MASK)
|
||||
mask |= POLLHUP;
|
||||
|
||||
/* readable? */
|
||||
if (!skb_queue_empty(&sk->sk_receive_queue) ||
|
||||
(sk->sk_shutdown & RCV_SHUTDOWN))
|
||||
mask |= POLLIN | POLLRDNORM;
|
||||
|
||||
/* Connection-based need to check for termination and startup */
|
||||
if (sk->sk_type == SOCK_SEQPACKET) {
|
||||
if (sk->sk_state == TCP_CLOSE)
|
||||
mask |= POLLHUP;
|
||||
/* connection hasn't started yet? */
|
||||
if (sk->sk_state == TCP_SYN_SENT)
|
||||
return mask;
|
||||
}
|
||||
|
||||
/* writable? */
|
||||
if (unix_writable(sk) && !(peer && unix_recvq_full(peer)))
|
||||
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
|
||||
else
|
||||
set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
|
||||
|
||||
if (peer)
|
||||
sock_put(peer);
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
static struct sock *first_unix_socket(int *i)
|
||||
|
Loading…
Reference in New Issue
Block a user