提交 4b4a2700 编写于 作者: L Linus Torvalds

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: (41 commits)
  inet_diag: Make sure we actually run the same bytecode we audited.
  netlink: Make nlmsg_find_attr take a const nlmsghdr*.
  fib: fib_result_assign() should not change fib refcounts
  netfilter: ip6_tables: fix information leak to userspace
  cls_cgroup: Fix crash on module unload
  memory corruption in X.25 facilities parsing
  net dst: fix percpu_counter list corruption and poison overwritten
  rds: Remove kfreed tcp conn from list
  rds: Lost locking in loop connection freeing
  de2104x: fix panic on load
  atl1 : fix panic on load
  netxen: remove unused firmware exports
  caif: Remove noisy printout when disconnecting caif socket
  caif: SPI-driver bugfix - incorrect padding.
  caif: Bugfix for socket priority, bindtodev and dbg channel.
  smsc911x: Set Ethernet EEPROM size to supported device's size
  ipv4: netfilter: ip_tables: fix information leak to userland
  ipv4: netfilter: arp_tables: fix information leak to userland
  cxgb4vf: remove call to stop TX queues at load time.
  cxgb4: remove call to stop TX queues at load time.
  ...
...@@ -1427,8 +1427,8 @@ modeisar(struct BCState *bcs, int mode, int bc) ...@@ -1427,8 +1427,8 @@ modeisar(struct BCState *bcs, int mode, int bc)
&bcs->hw.isar.reg->Flags)) &bcs->hw.isar.reg->Flags))
bcs->hw.isar.dpath = 1; bcs->hw.isar.dpath = 1;
else { else {
printk(KERN_WARNING"isar modeisar analog funktions only with DP1\n"); printk(KERN_WARNING"isar modeisar analog functions only with DP1\n");
debugl1(cs, "isar modeisar analog funktions only with DP1"); debugl1(cs, "isar modeisar analog functions only with DP1");
return(1); return(1);
} }
break; break;
......
...@@ -3043,7 +3043,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev, ...@@ -3043,7 +3043,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
atl1_pcie_patch(adapter); atl1_pcie_patch(adapter);
/* assume we have no link for now */ /* assume we have no link for now */
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev);
setup_timer(&adapter->phy_config_timer, atl1_phy_config, setup_timer(&adapter->phy_config_timer, atl1_phy_config,
(unsigned long)adapter); (unsigned long)adapter);
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
* (you will need to reboot afterwards) */ * (you will need to reboot afterwards) */
/* #define BNX2X_STOP_ON_ERROR */ /* #define BNX2X_STOP_ON_ERROR */
#define DRV_MODULE_VERSION "1.60.00-3" #define DRV_MODULE_VERSION "1.60.00-4"
#define DRV_MODULE_RELDATE "2010/10/19" #define DRV_MODULE_RELDATE "2010/11/01"
#define BNX2X_BC_VER 0x040200 #define BNX2X_BC_VER 0x040200
#define BNX2X_MULTI_QUEUE #define BNX2X_MULTI_QUEUE
......
...@@ -244,7 +244,14 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ ...@@ -244,7 +244,14 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */
u16 xgxs_config_tx[4]; /* 0x1A0 */ u16 xgxs_config_tx[4]; /* 0x1A0 */
u32 Reserved1[57]; /* 0x1A8 */ u32 Reserved1[56]; /* 0x1A8 */
u32 default_cfg; /* 0x288 */
/* Enable BAM on KR */
#define PORT_HW_CFG_ENABLE_BAM_ON_KR_MASK 0x00100000
#define PORT_HW_CFG_ENABLE_BAM_ON_KR_SHIFT 20
#define PORT_HW_CFG_ENABLE_BAM_ON_KR_DISABLED 0x00000000
#define PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED 0x00100000
u32 speed_capability_mask2; /* 0x28C */ u32 speed_capability_mask2; /* 0x28C */
#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK 0x0000FFFF #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK 0x0000FFFF
#define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT 0 #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT 0
......
...@@ -610,7 +610,7 @@ static u8 bnx2x_bmac_enable(struct link_params *params, ...@@ -610,7 +610,7 @@ static u8 bnx2x_bmac_enable(struct link_params *params,
/* reset and unreset the BigMac */ /* reset and unreset the BigMac */
REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR,
(MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
udelay(10); msleep(1);
REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET,
(MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port));
...@@ -3525,13 +3525,19 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, ...@@ -3525,13 +3525,19 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy,
DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1);
/* Enable CL37 BAM */ /* Enable CL37 BAM */
bnx2x_cl45_read(bp, phy, if (REG_RD(bp, params->shmem_base +
MDIO_AN_DEVAD, offsetof(struct shmem_region, dev_info.
MDIO_AN_REG_8073_BAM, &val); port_hw_config[params->port].default_cfg)) &
bnx2x_cl45_write(bp, phy, PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED) {
MDIO_AN_DEVAD,
MDIO_AN_REG_8073_BAM, val | 1);
bnx2x_cl45_read(bp, phy,
MDIO_AN_DEVAD,
MDIO_AN_REG_8073_BAM, &val);
bnx2x_cl45_write(bp, phy,
MDIO_AN_DEVAD,
MDIO_AN_REG_8073_BAM, val | 1);
DP(NETIF_MSG_LINK, "Enable CL37 BAM on KR\n");
}
if (params->loopback_mode == LOOPBACK_EXT) { if (params->loopback_mode == LOOPBACK_EXT) {
bnx2x_807x_force_10G(bp, phy); bnx2x_807x_force_10G(bp, phy);
DP(NETIF_MSG_LINK, "Forced speed 10G on 807X\n"); DP(NETIF_MSG_LINK, "Forced speed 10G on 807X\n");
...@@ -5302,7 +5308,7 @@ static u8 bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, ...@@ -5302,7 +5308,7 @@ static u8 bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy,
{ {
struct bnx2x *bp = params->bp; struct bnx2x *bp = params->bp;
u16 autoneg_val, an_1000_val, an_10_100_val; u16 autoneg_val, an_1000_val, an_10_100_val;
bnx2x_wait_reset_complete(bp, phy);
bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4,
1 << NIG_LATCH_BC_ENABLE_MI_INT); 1 << NIG_LATCH_BC_ENABLE_MI_INT);
...@@ -5431,6 +5437,7 @@ static u8 bnx2x_8481_config_init(struct bnx2x_phy *phy, ...@@ -5431,6 +5437,7 @@ static u8 bnx2x_8481_config_init(struct bnx2x_phy *phy,
/* HW reset */ /* HW reset */
bnx2x_ext_phy_hw_reset(bp, params->port); bnx2x_ext_phy_hw_reset(bp, params->port);
bnx2x_wait_reset_complete(bp, phy);
bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15);
return bnx2x_848xx_cmn_config_init(phy, params, vars); return bnx2x_848xx_cmn_config_init(phy, params, vars);
...@@ -5441,7 +5448,7 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, ...@@ -5441,7 +5448,7 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy,
struct link_vars *vars) struct link_vars *vars)
{ {
struct bnx2x *bp = params->bp; struct bnx2x *bp = params->bp;
u8 port = params->port, initialize = 1; u8 port, initialize = 1;
u16 val; u16 val;
u16 temp; u16 temp;
u32 actual_phy_selection; u32 actual_phy_selection;
...@@ -5450,11 +5457,16 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, ...@@ -5450,11 +5457,16 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy,
/* This is just for MDIO_CTL_REG_84823_MEDIA register. */ /* This is just for MDIO_CTL_REG_84823_MEDIA register. */
msleep(1); msleep(1);
if (CHIP_IS_E2(bp))
port = BP_PATH(bp);
else
port = params->port;
bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3,
MISC_REGISTERS_GPIO_OUTPUT_HIGH, MISC_REGISTERS_GPIO_OUTPUT_HIGH,
port); port);
msleep(200); /* 100 is not enough */ bnx2x_wait_reset_complete(bp, phy);
/* Wait for GPHY to come out of reset */
msleep(50);
/* BCM84823 requires that XGXS links up first @ 10G for normal /* BCM84823 requires that XGXS links up first @ 10G for normal
behavior */ behavior */
temp = vars->line_speed; temp = vars->line_speed;
...@@ -5625,7 +5637,11 @@ static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy, ...@@ -5625,7 +5637,11 @@ static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy,
struct link_params *params) struct link_params *params)
{ {
struct bnx2x *bp = params->bp; struct bnx2x *bp = params->bp;
u8 port = params->port; u8 port;
if (CHIP_IS_E2(bp))
port = BP_PATH(bp);
else
port = params->port;
bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3,
MISC_REGISTERS_GPIO_OUTPUT_LOW, MISC_REGISTERS_GPIO_OUTPUT_LOW,
port); port);
...@@ -6928,7 +6944,7 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, ...@@ -6928,7 +6944,7 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
u8 reset_ext_phy) u8 reset_ext_phy)
{ {
struct bnx2x *bp = params->bp; struct bnx2x *bp = params->bp;
u8 phy_index, port = params->port; u8 phy_index, port = params->port, clear_latch_ind = 0;
DP(NETIF_MSG_LINK, "Resetting the link of port %d\n", port); DP(NETIF_MSG_LINK, "Resetting the link of port %d\n", port);
/* disable attentions */ /* disable attentions */
vars->link_status = 0; vars->link_status = 0;
...@@ -6966,9 +6982,18 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, ...@@ -6966,9 +6982,18 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
params->phy[phy_index].link_reset( params->phy[phy_index].link_reset(
&params->phy[phy_index], &params->phy[phy_index],
params); params);
if (params->phy[phy_index].flags &
FLAGS_REARM_LATCH_SIGNAL)
clear_latch_ind = 1;
} }
} }
if (clear_latch_ind) {
/* Clear latching indication */
bnx2x_rearm_latch_signal(bp, port, 0);
bnx2x_bits_dis(bp, NIG_REG_LATCH_BC_0 + port*4,
1 << NIG_LATCH_BC_ENABLE_MI_INT);
}
if (params->phy[INT_PHY].link_reset) if (params->phy[INT_PHY].link_reset)
params->phy[INT_PHY].link_reset( params->phy[INT_PHY].link_reset(
&params->phy[INT_PHY], params); &params->phy[INT_PHY], params);
...@@ -6999,6 +7024,7 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, ...@@ -6999,6 +7024,7 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp,
s8 port; s8 port;
s8 port_of_path = 0; s8 port_of_path = 0;
bnx2x_ext_phy_hw_reset(bp, 0);
/* PART1 - Reset both phys */ /* PART1 - Reset both phys */
for (port = PORT_MAX - 1; port >= PORT_0; port--) { for (port = PORT_MAX - 1; port >= PORT_0; port--) {
u32 shmem_base, shmem2_base; u32 shmem_base, shmem2_base;
...@@ -7021,7 +7047,8 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, ...@@ -7021,7 +7047,8 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp,
return -EINVAL; return -EINVAL;
} }
/* disable attentions */ /* disable attentions */
bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 +
port_of_path*4,
(NIG_MASK_XGXS0_LINK_STATUS | (NIG_MASK_XGXS0_LINK_STATUS |
NIG_MASK_XGXS0_LINK10G | NIG_MASK_XGXS0_LINK10G |
NIG_MASK_SERDES0_LINK_STATUS | NIG_MASK_SERDES0_LINK_STATUS |
...@@ -7132,7 +7159,7 @@ static u8 bnx2x_8726_common_init_phy(struct bnx2x *bp, ...@@ -7132,7 +7159,7 @@ static u8 bnx2x_8726_common_init_phy(struct bnx2x *bp,
(1<<(MISC_REGISTERS_GPIO_3 + MISC_REGISTERS_GPIO_PORT_SHIFT))); (1<<(MISC_REGISTERS_GPIO_3 + MISC_REGISTERS_GPIO_PORT_SHIFT)));
REG_WR(bp, MISC_REG_GPIO_EVENT_EN, val); REG_WR(bp, MISC_REG_GPIO_EVENT_EN, val);
bnx2x_ext_phy_hw_reset(bp, 1); bnx2x_ext_phy_hw_reset(bp, 0);
msleep(5); msleep(5);
for (port = 0; port < PORT_MAX; port++) { for (port = 0; port < PORT_MAX; port++) {
u32 shmem_base, shmem2_base; u32 shmem_base, shmem2_base;
......
...@@ -33,6 +33,9 @@ MODULE_LICENSE("GPL"); ...@@ -33,6 +33,9 @@ MODULE_LICENSE("GPL");
MODULE_AUTHOR("Daniel Martensson<daniel.martensson@stericsson.com>"); MODULE_AUTHOR("Daniel Martensson<daniel.martensson@stericsson.com>");
MODULE_DESCRIPTION("CAIF SPI driver"); MODULE_DESCRIPTION("CAIF SPI driver");
/* Returns the number of padding bytes for alignment. */
#define PAD_POW2(x, pow) ((((x)&((pow)-1))==0) ? 0 : (((pow)-((x)&((pow)-1)))))
static int spi_loop; static int spi_loop;
module_param(spi_loop, bool, S_IRUGO); module_param(spi_loop, bool, S_IRUGO);
MODULE_PARM_DESC(spi_loop, "SPI running in loopback mode."); MODULE_PARM_DESC(spi_loop, "SPI running in loopback mode.");
...@@ -41,7 +44,10 @@ MODULE_PARM_DESC(spi_loop, "SPI running in loopback mode."); ...@@ -41,7 +44,10 @@ MODULE_PARM_DESC(spi_loop, "SPI running in loopback mode.");
module_param(spi_frm_align, int, S_IRUGO); module_param(spi_frm_align, int, S_IRUGO);
MODULE_PARM_DESC(spi_frm_align, "SPI frame alignment."); MODULE_PARM_DESC(spi_frm_align, "SPI frame alignment.");
/* SPI padding options. */ /*
* SPI padding options.
* Warning: must be a base of 2 (& operation used) and can not be zero !
*/
module_param(spi_up_head_align, int, S_IRUGO); module_param(spi_up_head_align, int, S_IRUGO);
MODULE_PARM_DESC(spi_up_head_align, "SPI uplink head alignment."); MODULE_PARM_DESC(spi_up_head_align, "SPI uplink head alignment.");
...@@ -240,15 +246,13 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf, ...@@ -240,15 +246,13 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf,
static const struct file_operations dbgfs_state_fops = { static const struct file_operations dbgfs_state_fops = {
.open = dbgfs_open, .open = dbgfs_open,
.read = dbgfs_state, .read = dbgfs_state,
.owner = THIS_MODULE, .owner = THIS_MODULE
.llseek = default_llseek,
}; };
static const struct file_operations dbgfs_frame_fops = { static const struct file_operations dbgfs_frame_fops = {
.open = dbgfs_open, .open = dbgfs_open,
.read = dbgfs_frame, .read = dbgfs_frame,
.owner = THIS_MODULE, .owner = THIS_MODULE
.llseek = default_llseek,
}; };
static inline void dev_debugfs_add(struct cfspi *cfspi) static inline void dev_debugfs_add(struct cfspi *cfspi)
...@@ -337,6 +341,9 @@ int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len) ...@@ -337,6 +341,9 @@ int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len)
u8 *dst = buf; u8 *dst = buf;
caif_assert(buf); caif_assert(buf);
if (cfspi->slave && !cfspi->slave_talked)
cfspi->slave_talked = true;
do { do {
struct sk_buff *skb; struct sk_buff *skb;
struct caif_payload_info *info; struct caif_payload_info *info;
...@@ -357,8 +364,8 @@ int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len) ...@@ -357,8 +364,8 @@ int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len)
* Compute head offset i.e. number of bytes to add to * Compute head offset i.e. number of bytes to add to
* get the start of the payload aligned. * get the start of the payload aligned.
*/ */
if (spi_up_head_align) { if (spi_up_head_align > 1) {
spad = 1 + ((info->hdr_len + 1) & spi_up_head_align); spad = 1 + PAD_POW2((info->hdr_len + 1), spi_up_head_align);
*dst = (u8)(spad - 1); *dst = (u8)(spad - 1);
dst += spad; dst += spad;
} }
...@@ -373,7 +380,7 @@ int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len) ...@@ -373,7 +380,7 @@ int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len)
* Compute tail offset i.e. number of bytes to add to * Compute tail offset i.e. number of bytes to add to
* get the complete CAIF frame aligned. * get the complete CAIF frame aligned.
*/ */
epad = (skb->len + spad) & spi_up_tail_align; epad = PAD_POW2((skb->len + spad), spi_up_tail_align);
dst += epad; dst += epad;
dev_kfree_skb(skb); dev_kfree_skb(skb);
...@@ -417,14 +424,14 @@ int cfspi_xmitlen(struct cfspi *cfspi) ...@@ -417,14 +424,14 @@ int cfspi_xmitlen(struct cfspi *cfspi)
* Compute head offset i.e. number of bytes to add to * Compute head offset i.e. number of bytes to add to
* get the start of the payload aligned. * get the start of the payload aligned.
*/ */
if (spi_up_head_align) if (spi_up_head_align > 1)
spad = 1 + ((info->hdr_len + 1) & spi_up_head_align); spad = 1 + PAD_POW2((info->hdr_len + 1), spi_up_head_align);
/* /*
* Compute tail offset i.e. number of bytes to add to * Compute tail offset i.e. number of bytes to add to
* get the complete CAIF frame aligned. * get the complete CAIF frame aligned.
*/ */
epad = (skb->len + spad) & spi_up_tail_align; epad = PAD_POW2((skb->len + spad), spi_up_tail_align);
if ((skb->len + spad + epad + frm_len) <= CAIF_MAX_SPI_FRAME) { if ((skb->len + spad + epad + frm_len) <= CAIF_MAX_SPI_FRAME) {
skb_queue_tail(&cfspi->chead, skb); skb_queue_tail(&cfspi->chead, skb);
...@@ -433,6 +440,7 @@ int cfspi_xmitlen(struct cfspi *cfspi) ...@@ -433,6 +440,7 @@ int cfspi_xmitlen(struct cfspi *cfspi)
} else { } else {
/* Put back packet. */ /* Put back packet. */
skb_queue_head(&cfspi->qhead, skb); skb_queue_head(&cfspi->qhead, skb);
break;
} }
} while (pkts <= CAIF_MAX_SPI_PKTS); } while (pkts <= CAIF_MAX_SPI_PKTS);
...@@ -453,6 +461,15 @@ static void cfspi_ss_cb(bool assert, struct cfspi_ifc *ifc) ...@@ -453,6 +461,15 @@ static void cfspi_ss_cb(bool assert, struct cfspi_ifc *ifc)
{ {
struct cfspi *cfspi = (struct cfspi *)ifc->priv; struct cfspi *cfspi = (struct cfspi *)ifc->priv;
/*
* The slave device is the master on the link. Interrupts before the
* slave has transmitted are considered spurious.
*/
if (cfspi->slave && !cfspi->slave_talked) {
printk(KERN_WARNING "CFSPI: Spurious SS interrupt.\n");
return;
}
if (!in_interrupt()) if (!in_interrupt())
spin_lock(&cfspi->lock); spin_lock(&cfspi->lock);
if (assert) { if (assert) {
...@@ -465,7 +482,8 @@ static void cfspi_ss_cb(bool assert, struct cfspi_ifc *ifc) ...@@ -465,7 +482,8 @@ static void cfspi_ss_cb(bool assert, struct cfspi_ifc *ifc)
spin_unlock(&cfspi->lock); spin_unlock(&cfspi->lock);
/* Wake up the xfer thread. */ /* Wake up the xfer thread. */
wake_up_interruptible(&cfspi->wait); if (assert)
wake_up_interruptible(&cfspi->wait);
} }
static void cfspi_xfer_done_cb(struct cfspi_ifc *ifc) static void cfspi_xfer_done_cb(struct cfspi_ifc *ifc)
...@@ -523,7 +541,7 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len) ...@@ -523,7 +541,7 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len)
* Compute head offset i.e. number of bytes added to * Compute head offset i.e. number of bytes added to
* get the start of the payload aligned. * get the start of the payload aligned.
*/ */
if (spi_down_head_align) { if (spi_down_head_align > 1) {
spad = 1 + *src; spad = 1 + *src;
src += spad; src += spad;
} }
...@@ -564,7 +582,7 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len) ...@@ -564,7 +582,7 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len)
* Compute tail offset i.e. number of bytes added to * Compute tail offset i.e. number of bytes added to
* get the complete CAIF frame aligned. * get the complete CAIF frame aligned.
*/ */
epad = (pkt_len + spad) & spi_down_tail_align; epad = PAD_POW2((pkt_len + spad), spi_down_tail_align);
src += epad; src += epad;
} while ((src - buf) < len); } while ((src - buf) < len);
...@@ -625,11 +643,20 @@ int cfspi_spi_probe(struct platform_device *pdev) ...@@ -625,11 +643,20 @@ int cfspi_spi_probe(struct platform_device *pdev)
cfspi->ndev = ndev; cfspi->ndev = ndev;
cfspi->pdev = pdev; cfspi->pdev = pdev;
/* Set flow info */ /* Set flow info. */
cfspi->flow_off_sent = 0; cfspi->flow_off_sent = 0;
cfspi->qd_low_mark = LOW_WATER_MARK; cfspi->qd_low_mark = LOW_WATER_MARK;
cfspi->qd_high_mark = HIGH_WATER_MARK; cfspi->qd_high_mark = HIGH_WATER_MARK;
/* Set slave info. */
if (!strncmp(cfspi_spi_driver.driver.name, "cfspi_sspi", 10)) {
cfspi->slave = true;
cfspi->slave_talked = false;
} else {
cfspi->slave = false;
cfspi->slave_talked = false;
}
/* Assign the SPI device. */ /* Assign the SPI device. */
cfspi->dev = dev; cfspi->dev = dev;
/* Assign the device ifc to this SPI interface. */ /* Assign the device ifc to this SPI interface. */
......
...@@ -36,10 +36,15 @@ static inline int forward_to_spi_cmd(struct cfspi *cfspi) ...@@ -36,10 +36,15 @@ static inline int forward_to_spi_cmd(struct cfspi *cfspi)
#endif #endif
int spi_frm_align = 2; int spi_frm_align = 2;
int spi_up_head_align = 1;
int spi_up_tail_align; /*
int spi_down_head_align = 3; * SPI padding options.
int spi_down_tail_align = 1; * Warning: must be a base of 2 (& operation used) and can not be zero !
*/
int spi_up_head_align = 1 << 1;
int spi_up_tail_align = 1 << 0;
int spi_down_head_align = 1 << 2;
int spi_down_tail_align = 1 << 1;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
static inline void debugfs_store_prev(struct cfspi *cfspi) static inline void debugfs_store_prev(struct cfspi *cfspi)
......
...@@ -3341,7 +3341,6 @@ static int __devinit init_one(struct pci_dev *pdev, ...@@ -3341,7 +3341,6 @@ static int __devinit init_one(struct pci_dev *pdev,
adapter->name = adapter->port[i]->name; adapter->name = adapter->port[i]->name;
__set_bit(i, &adapter->registered_device_map); __set_bit(i, &adapter->registered_device_map);
netif_tx_stop_all_queues(adapter->port[i]);
} }
} }
if (!adapter->registered_device_map) { if (!adapter->registered_device_map) {
......
...@@ -3736,7 +3736,6 @@ static int __devinit init_one(struct pci_dev *pdev, ...@@ -3736,7 +3736,6 @@ static int __devinit init_one(struct pci_dev *pdev,
__set_bit(i, &adapter->registered_device_map); __set_bit(i, &adapter->registered_device_map);
adapter->chan_map[adap2pinfo(adapter, i)->tx_chan] = i; adapter->chan_map[adap2pinfo(adapter, i)->tx_chan] = i;
netif_tx_stop_all_queues(adapter->port[i]);
} }
} }
if (!adapter->registered_device_map) { if (!adapter->registered_device_map) {
......
...@@ -2600,7 +2600,6 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev, ...@@ -2600,7 +2600,6 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
pi->xact_addr_filt = -1; pi->xact_addr_filt = -1;
pi->rx_offload = RX_CSO; pi->rx_offload = RX_CSO;
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev);
netdev->irq = pdev->irq; netdev->irq = pdev->irq;
netdev->features = (NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | netdev->features = (NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
......
...@@ -2871,7 +2871,6 @@ static int __devinit emac_probe(struct platform_device *ofdev, ...@@ -2871,7 +2871,6 @@ static int __devinit emac_probe(struct platform_device *ofdev,
SET_ETHTOOL_OPS(ndev, &emac_ethtool_ops); SET_ETHTOOL_OPS(ndev, &emac_ethtool_ops);
netif_carrier_off(ndev); netif_carrier_off(ndev);
netif_stop_queue(ndev);
err = register_netdev(ndev); err = register_netdev(ndev);
if (err) { if (err) {
......
...@@ -2955,11 +2955,7 @@ jme_init_one(struct pci_dev *pdev, ...@@ -2955,11 +2955,7 @@ jme_init_one(struct pci_dev *pdev,
* Tell stack that we are not ready to work until open() * Tell stack that we are not ready to work until open()
*/ */
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev);
/*
* Register netdev
*/
rc = register_netdev(netdev); rc = register_netdev(netdev);
if (rc) { if (rc) {
pr_err("Cannot register net device\n"); pr_err("Cannot register net device\n");
......
...@@ -41,9 +41,6 @@ ...@@ -41,9 +41,6 @@
MODULE_DESCRIPTION("QLogic/NetXen (1/10) GbE Converged Ethernet Driver"); MODULE_DESCRIPTION("QLogic/NetXen (1/10) GbE Converged Ethernet Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID);
MODULE_FIRMWARE(NX_P2_MN_ROMIMAGE_NAME);
MODULE_FIRMWARE(NX_P3_CT_ROMIMAGE_NAME);
MODULE_FIRMWARE(NX_P3_MN_ROMIMAGE_NAME);
MODULE_FIRMWARE(NX_UNIFIED_ROMIMAGE_NAME); MODULE_FIRMWARE(NX_UNIFIED_ROMIMAGE_NAME);
char netxen_nic_driver_name[] = "netxen_nic"; char netxen_nic_driver_name[] = "netxen_nic";
......
...@@ -1450,7 +1450,6 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, ...@@ -1450,7 +1450,6 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter,
netdev->irq = adapter->msix_entries[0].vector; netdev->irq = adapter->msix_entries[0].vector;
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev);
err = register_netdev(netdev); err = register_netdev(netdev);
if (err) { if (err) {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define __SMSC911X_H__ #define __SMSC911X_H__
#define TX_FIFO_LOW_THRESHOLD ((u32)1600) #define TX_FIFO_LOW_THRESHOLD ((u32)1600)
#define SMSC911X_EEPROM_SIZE ((u32)7) #define SMSC911X_EEPROM_SIZE ((u32)128)
#define USE_DEBUG 0 #define USE_DEBUG 0
/* This is the maximum number of packets to be received every /* This is the maximum number of packets to be received every
......
...@@ -2021,7 +2021,6 @@ static int __devinit de_init_one (struct pci_dev *pdev, ...@@ -2021,7 +2021,6 @@ static int __devinit de_init_one (struct pci_dev *pdev,
de->media_timer.data = (unsigned long) de; de->media_timer.data = (unsigned long) de;
netif_carrier_off(dev); netif_carrier_off(dev);
netif_stop_queue(dev);
/* wake up device, assign resources */ /* wake up device, assign resources */
rc = pci_enable_device(pdev); rc = pci_enable_device(pdev);
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <linux/usb/usbnet.h> #include <linux/usb/usbnet.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/pm_runtime.h>
#define DRIVER_VERSION "22-Aug-2005" #define DRIVER_VERSION "22-Aug-2005"
...@@ -1273,6 +1274,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) ...@@ -1273,6 +1274,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
struct usb_device *xdev; struct usb_device *xdev;
int status; int status;
const char *name; const char *name;
struct usb_driver *driver = to_usb_driver(udev->dev.driver);
/* usbnet already took usb runtime pm, so have to enable the feature
* for usb interface, otherwise usb_autopm_get_interface may return
* failure if USB_SUSPEND(RUNTIME_PM) is enabled.
*/
if (!driver->supports_autosuspend) {
driver->supports_autosuspend = 1;
pm_runtime_enable(&udev->dev);
}
name = udev->dev.driver->name; name = udev->dev.driver->name;
info = (struct driver_info *) prod->driver_info; info = (struct driver_info *) prod->driver_info;
......
...@@ -811,7 +811,6 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) ...@@ -811,7 +811,6 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN])
INFO(dev, "MAC %pM\n", net->dev_addr); INFO(dev, "MAC %pM\n", net->dev_addr);
INFO(dev, "HOST MAC %pM\n", dev->host_mac); INFO(dev, "HOST MAC %pM\n", dev->host_mac);
netif_stop_queue(net);
the_dev = dev; the_dev = dev;
} }
......
...@@ -28,7 +28,7 @@ struct caif_param { ...@@ -28,7 +28,7 @@ struct caif_param {
* @sockaddr: Socket address to connect. * @sockaddr: Socket address to connect.
* @priority: Priority of the connection. * @priority: Priority of the connection.
* @link_selector: Link selector (high bandwidth or low latency) * @link_selector: Link selector (high bandwidth or low latency)
* @link_name: Name of the CAIF Link Layer to use. * @ifindex: kernel index of the interface.
* @param: Connect Request parameters (CAIF_SO_REQ_PARAM). * @param: Connect Request parameters (CAIF_SO_REQ_PARAM).
* *
* This struct is used when connecting a CAIF channel. * This struct is used when connecting a CAIF channel.
...@@ -39,7 +39,7 @@ struct caif_connect_request { ...@@ -39,7 +39,7 @@ struct caif_connect_request {
struct sockaddr_caif sockaddr; struct sockaddr_caif sockaddr;
enum caif_channel_priority priority; enum caif_channel_priority priority;
enum caif_link_selector link_selector; enum caif_link_selector link_selector;
char link_name[16]; int ifindex;
struct caif_param param; struct caif_param param;
}; };
......
...@@ -121,6 +121,8 @@ struct cfspi { ...@@ -121,6 +121,8 @@ struct cfspi {
wait_queue_head_t wait; wait_queue_head_t wait;
spinlock_t lock; spinlock_t lock;
bool flow_stop; bool flow_stop;
bool slave;
bool slave_talked;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
enum cfspi_state dbg_state; enum cfspi_state dbg_state;
u16 pcmd; u16 pcmd;
......
...@@ -139,10 +139,10 @@ struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg, ...@@ -139,10 +139,10 @@ struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg,
enum cfcnfg_phy_preference phy_pref); enum cfcnfg_phy_preference phy_pref);
/** /**
* cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer * cfcnfg_get_id_from_ifi() - Get the Physical Identifier of ifindex,
* it matches caif physical id with the kernel interface id.
* @cnfg: Configuration object * @cnfg: Configuration object
* @name: Name of the Physical Layer (Caif Link Layer) * @ifi: ifindex obtained from socket.c bindtodevice.
*/ */
int cfcnfg_get_named(struct cfcnfg *cnfg, char *name); int cfcnfg_get_id_from_ifi(struct cfcnfg *cnfg, int ifi);
#endif /* CFCNFG_H_ */ #endif /* CFCNFG_H_ */
...@@ -384,7 +384,7 @@ static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen, ...@@ -384,7 +384,7 @@ static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,
* *
* Returns the first attribute which matches the specified type. * Returns the first attribute which matches the specified type.
*/ */
static inline struct nlattr *nlmsg_find_attr(struct nlmsghdr *nlh, static inline struct nlattr *nlmsg_find_attr(const struct nlmsghdr *nlh,
int hdrlen, int attrtype) int hdrlen, int attrtype)
{ {
return nla_find(nlmsg_attrdata(nlh, hdrlen), return nla_find(nlmsg_attrdata(nlh, hdrlen),
......
...@@ -16,11 +16,18 @@ int connect_req_to_link_param(struct cfcnfg *cnfg, ...@@ -16,11 +16,18 @@ int connect_req_to_link_param(struct cfcnfg *cnfg,
{ {
struct dev_info *dev_info; struct dev_info *dev_info;
enum cfcnfg_phy_preference pref; enum cfcnfg_phy_preference pref;
int res;
memset(l, 0, sizeof(*l)); memset(l, 0, sizeof(*l));
l->priority = s->priority; /* In caif protocol low value is high priority */
l->priority = CAIF_PRIO_MAX - s->priority + 1;
if (s->link_name[0] != '\0') if (s->ifindex != 0){
l->phyid = cfcnfg_get_named(cnfg, s->link_name); res = cfcnfg_get_id_from_ifi(cnfg, s->ifindex);
if (res < 0)
return res;
l->phyid = res;
}
else { else {
switch (s->link_selector) { switch (s->link_selector) {
case CAIF_LINK_HIGH_BANDW: case CAIF_LINK_HIGH_BANDW:
......
...@@ -307,6 +307,8 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, ...@@ -307,6 +307,8 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
caifd = caif_get(dev); caifd = caif_get(dev);
if (caifd == NULL)
break;
netdev_info(dev, "unregister\n"); netdev_info(dev, "unregister\n");
atomic_set(&caifd->state, what); atomic_set(&caifd->state, what);
caif_device_destroy(dev); caif_device_destroy(dev);
......
...@@ -716,8 +716,7 @@ static int setsockopt(struct socket *sock, ...@@ -716,8 +716,7 @@ static int setsockopt(struct socket *sock,
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); struct caifsock *cf_sk = container_of(sk, struct caifsock, sk);
int prio, linksel; int linksel;
struct ifreq ifreq;
if (cf_sk->sk.sk_socket->state != SS_UNCONNECTED) if (cf_sk->sk.sk_socket->state != SS_UNCONNECTED)
return -ENOPROTOOPT; return -ENOPROTOOPT;
...@@ -735,33 +734,6 @@ static int setsockopt(struct socket *sock, ...@@ -735,33 +734,6 @@ static int setsockopt(struct socket *sock,
release_sock(&cf_sk->sk); release_sock(&cf_sk->sk);
return 0; return 0;
case SO_PRIORITY:
if (lvl != SOL_SOCKET)
goto bad_sol;
if (ol < sizeof(int))
return -EINVAL;
if (copy_from_user(&prio, ov, sizeof(int)))
return -EINVAL;
lock_sock(&(cf_sk->sk));
cf_sk->conn_req.priority = prio;
release_sock(&cf_sk->sk);
return 0;
case SO_BINDTODEVICE:
if (lvl != SOL_SOCKET)
goto bad_sol;
if (ol < sizeof(struct ifreq))
return -EINVAL;
if (copy_from_user(&ifreq, ov, sizeof(ifreq)))
return -EFAULT;
lock_sock(&(cf_sk->sk));
strncpy(cf_sk->conn_req.link_name, ifreq.ifr_name,
sizeof(cf_sk->conn_req.link_name));
cf_sk->conn_req.link_name
[sizeof(cf_sk->conn_req.link_name)-1] = 0;
release_sock(&cf_sk->sk);
return 0;
case CAIFSO_REQ_PARAM: case CAIFSO_REQ_PARAM:
if (lvl != SOL_CAIF) if (lvl != SOL_CAIF)
goto bad_sol; goto bad_sol;
...@@ -880,6 +852,18 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -880,6 +852,18 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
sock->state = SS_CONNECTING; sock->state = SS_CONNECTING;
sk->sk_state = CAIF_CONNECTING; sk->sk_state = CAIF_CONNECTING;
/* Check priority value comming from socket */
/* if priority value is out of range it will be ajusted */
if (cf_sk->sk.sk_priority > CAIF_PRIO_MAX)
cf_sk->conn_req.priority = CAIF_PRIO_MAX;
else if (cf_sk->sk.sk_priority < CAIF_PRIO_MIN)
cf_sk->conn_req.priority = CAIF_PRIO_MIN;
else
cf_sk->conn_req.priority = cf_sk->sk.sk_priority;
/*ifindex = id of the interface.*/
cf_sk->conn_req.ifindex = cf_sk->sk.sk_bound_dev_if;
dbfs_atomic_inc(&cnt.num_connect_req); dbfs_atomic_inc(&cnt.num_connect_req);
cf_sk->layer.receive = caif_sktrecv_cb; cf_sk->layer.receive = caif_sktrecv_cb;
err = caif_connect_client(&cf_sk->conn_req, err = caif_connect_client(&cf_sk->conn_req,
...@@ -905,6 +889,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -905,6 +889,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
cf_sk->maxframe = mtu - (headroom + tailroom); cf_sk->maxframe = mtu - (headroom + tailroom);
if (cf_sk->maxframe < 1) { if (cf_sk->maxframe < 1) {
pr_warn("CAIF Interface MTU too small (%d)\n", dev->mtu); pr_warn("CAIF Interface MTU too small (%d)\n", dev->mtu);
err = -ENODEV;
goto out; goto out;
} }
...@@ -1142,7 +1127,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol, ...@@ -1142,7 +1127,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol,
set_rx_flow_on(cf_sk); set_rx_flow_on(cf_sk);
/* Set default options on configuration */ /* Set default options on configuration */
cf_sk->conn_req.priority = CAIF_PRIO_NORMAL; cf_sk->sk.sk_priority= CAIF_PRIO_NORMAL;
cf_sk->conn_req.link_selector = CAIF_LINK_LOW_LATENCY; cf_sk->conn_req.link_selector = CAIF_LINK_LOW_LATENCY;
cf_sk->conn_req.protocol = protocol; cf_sk->conn_req.protocol = protocol;
/* Increase the number of sockets created. */ /* Increase the number of sockets created. */
......
...@@ -173,18 +173,15 @@ static struct cfcnfg_phyinfo *cfcnfg_get_phyinfo(struct cfcnfg *cnfg, ...@@ -173,18 +173,15 @@ static struct cfcnfg_phyinfo *cfcnfg_get_phyinfo(struct cfcnfg *cnfg,
return NULL; return NULL;
} }
int cfcnfg_get_named(struct cfcnfg *cnfg, char *name)
int cfcnfg_get_id_from_ifi(struct cfcnfg *cnfg, int ifi)
{ {
int i; int i;
for (i = 0; i < MAX_PHY_LAYERS; i++)
/* Try to match with specified name */ if (cnfg->phy_layers[i].frm_layer != NULL &&
for (i = 0; i < MAX_PHY_LAYERS; i++) { cnfg->phy_layers[i].ifindex == ifi)
if (cnfg->phy_layers[i].frm_layer != NULL return i;
&& strcmp(cnfg->phy_layers[i].phy_layer->name, return -ENODEV;
name) == 0)
return cnfg->phy_layers[i].frm_layer->id;
}
return 0;
} }
int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
......
...@@ -361,11 +361,10 @@ void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer) ...@@ -361,11 +361,10 @@ void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer)
struct cfctrl_request_info *p, *tmp; struct cfctrl_request_info *p, *tmp;
struct cfctrl *ctrl = container_obj(layr); struct cfctrl *ctrl = container_obj(layr);
spin_lock(&ctrl->info_list_lock); spin_lock(&ctrl->info_list_lock);
pr_warn("enter\n");
list_for_each_entry_safe(p, tmp, &ctrl->list, list) { list_for_each_entry_safe(p, tmp, &ctrl->list, list) {
if (p->client_layer == adap_layer) { if (p->client_layer == adap_layer) {
pr_warn("cancel req :%d\n", p->sequence_no); pr_debug("cancel req :%d\n", p->sequence_no);
list_del(&p->list); list_del(&p->list);
kfree(p); kfree(p);
} }
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include <net/caif/cfsrvl.h> #include <net/caif/cfsrvl.h>
#include <net/caif/cfpkt.h> #include <net/caif/cfpkt.h>
#define container_obj(layr) ((struct cfsrvl *) layr)
static int cfdbgl_receive(struct cflayer *layr, struct cfpkt *pkt); static int cfdbgl_receive(struct cflayer *layr, struct cfpkt *pkt);
static int cfdbgl_transmit(struct cflayer *layr, struct cfpkt *pkt); static int cfdbgl_transmit(struct cflayer *layr, struct cfpkt *pkt);
...@@ -38,5 +40,17 @@ static int cfdbgl_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -38,5 +40,17 @@ static int cfdbgl_receive(struct cflayer *layr, struct cfpkt *pkt)
static int cfdbgl_transmit(struct cflayer *layr, struct cfpkt *pkt) static int cfdbgl_transmit(struct cflayer *layr, struct cfpkt *pkt)
{ {
struct cfsrvl *service = container_obj(layr);
struct caif_payload_info *info;
int ret;
if (!cfsrvl_ready(service, &ret))
return ret;
/* Add info for MUX-layer to route the packet out */
info = cfpkt_info(pkt);
info->channel_id = service->layer.id;
info->dev_info = &service->dev_info;
return layr->dn->transmit(layr->dn, pkt); return layr->dn->transmit(layr->dn, pkt);
} }
...@@ -193,7 +193,7 @@ static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -193,7 +193,7 @@ static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt)
static int cfrfml_transmit_segment(struct cfrfml *rfml, struct cfpkt *pkt) static int cfrfml_transmit_segment(struct cfrfml *rfml, struct cfpkt *pkt)
{ {
caif_assert(cfpkt_getlen(pkt) >= rfml->fragment_size); caif_assert(cfpkt_getlen(pkt) < rfml->fragment_size);
/* Add info for MUX-layer to route the packet out. */ /* Add info for MUX-layer to route the packet out. */
cfpkt_info(pkt)->channel_id = rfml->serv.layer.id; cfpkt_info(pkt)->channel_id = rfml->serv.layer.id;
......
...@@ -2131,7 +2131,7 @@ static struct netdev_queue *dev_pick_tx(struct net_device *dev, ...@@ -2131,7 +2131,7 @@ static struct netdev_queue *dev_pick_tx(struct net_device *dev,
} else { } else {
struct sock *sk = skb->sk; struct sock *sk = skb->sk;
queue_index = sk_tx_queue_get(sk); queue_index = sk_tx_queue_get(sk);
if (queue_index < 0) { if (queue_index < 0 || queue_index >= dev->real_num_tx_queues) {
queue_index = 0; queue_index = 0;
if (dev->real_num_tx_queues > 1) if (dev->real_num_tx_queues > 1)
......
...@@ -47,11 +47,8 @@ extern int fib_detect_death(struct fib_info *fi, int order, ...@@ -47,11 +47,8 @@ extern int fib_detect_death(struct fib_info *fi, int order,
static inline void fib_result_assign(struct fib_result *res, static inline void fib_result_assign(struct fib_result *res,
struct fib_info *fi) struct fib_info *fi)
{ {
if (res->fi != NULL) /* we used to play games with refcounts, but we now use RCU */
fib_info_put(res->fi);
res->fi = fi; res->fi = fi;
if (fi != NULL)
atomic_inc(&fi->fib_clntref);
} }
#endif /* _FIB_LOOKUP_H */ #endif /* _FIB_LOOKUP_H */
...@@ -490,9 +490,11 @@ static int inet_csk_diag_dump(struct sock *sk, ...@@ -490,9 +490,11 @@ static int inet_csk_diag_dump(struct sock *sk,
{ {
struct inet_diag_req *r = NLMSG_DATA(cb->nlh); struct inet_diag_req *r = NLMSG_DATA(cb->nlh);
if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { if (nlmsg_attrlen(cb->nlh, sizeof(*r))) {
struct inet_diag_entry entry; struct inet_diag_entry entry;
struct rtattr *bc = (struct rtattr *)(r + 1); const struct nlattr *bc = nlmsg_find_attr(cb->nlh,
sizeof(*r),
INET_DIAG_REQ_BYTECODE);
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
entry.family = sk->sk_family; entry.family = sk->sk_family;
...@@ -512,7 +514,7 @@ static int inet_csk_diag_dump(struct sock *sk, ...@@ -512,7 +514,7 @@ static int inet_csk_diag_dump(struct sock *sk,
entry.dport = ntohs(inet->inet_dport); entry.dport = ntohs(inet->inet_dport);
entry.userlocks = sk->sk_userlocks; entry.userlocks = sk->sk_userlocks;
if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) if (!inet_diag_bc_run(nla_data(bc), nla_len(bc), &entry))
return 0; return 0;
} }
...@@ -527,9 +529,11 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, ...@@ -527,9 +529,11 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw,
{ {
struct inet_diag_req *r = NLMSG_DATA(cb->nlh); struct inet_diag_req *r = NLMSG_DATA(cb->nlh);
if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { if (nlmsg_attrlen(cb->nlh, sizeof(*r))) {
struct inet_diag_entry entry; struct inet_diag_entry entry;
struct rtattr *bc = (struct rtattr *)(r + 1); const struct nlattr *bc = nlmsg_find_attr(cb->nlh,
sizeof(*r),
INET_DIAG_REQ_BYTECODE);
entry.family = tw->tw_family; entry.family = tw->tw_family;
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
...@@ -548,7 +552,7 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, ...@@ -548,7 +552,7 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw,
entry.dport = ntohs(tw->tw_dport); entry.dport = ntohs(tw->tw_dport);
entry.userlocks = 0; entry.userlocks = 0;
if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) if (!inet_diag_bc_run(nla_data(bc), nla_len(bc), &entry))
return 0; return 0;
} }
...@@ -618,7 +622,7 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, ...@@ -618,7 +622,7 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
struct inet_diag_req *r = NLMSG_DATA(cb->nlh); struct inet_diag_req *r = NLMSG_DATA(cb->nlh);
struct inet_connection_sock *icsk = inet_csk(sk); struct inet_connection_sock *icsk = inet_csk(sk);
struct listen_sock *lopt; struct listen_sock *lopt;
struct rtattr *bc = NULL; const struct nlattr *bc = NULL;
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
int j, s_j; int j, s_j;
int reqnum, s_reqnum; int reqnum, s_reqnum;
...@@ -638,8 +642,9 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, ...@@ -638,8 +642,9 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
if (!lopt || !lopt->qlen) if (!lopt || !lopt->qlen)
goto out; goto out;
if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { if (nlmsg_attrlen(cb->nlh, sizeof(*r))) {
bc = (struct rtattr *)(r + 1); bc = nlmsg_find_attr(cb->nlh, sizeof(*r),
INET_DIAG_REQ_BYTECODE);
entry.sport = inet->inet_num; entry.sport = inet->inet_num;
entry.userlocks = sk->sk_userlocks; entry.userlocks = sk->sk_userlocks;
} }
...@@ -672,8 +677,8 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, ...@@ -672,8 +677,8 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
&ireq->rmt_addr; &ireq->rmt_addr;
entry.dport = ntohs(ireq->rmt_port); entry.dport = ntohs(ireq->rmt_port);
if (!inet_diag_bc_run(RTA_DATA(bc), if (!inet_diag_bc_run(nla_data(bc),
RTA_PAYLOAD(bc), &entry)) nla_len(bc), &entry))
continue; continue;
} }
......
...@@ -927,6 +927,7 @@ static int get_info(struct net *net, void __user *user, ...@@ -927,6 +927,7 @@ static int get_info(struct net *net, void __user *user,
private = &tmp; private = &tmp;
} }
#endif #endif
memset(&info, 0, sizeof(info));
info.valid_hooks = t->valid_hooks; info.valid_hooks = t->valid_hooks;
memcpy(info.hook_entry, private->hook_entry, memcpy(info.hook_entry, private->hook_entry,
sizeof(info.hook_entry)); sizeof(info.hook_entry));
......
...@@ -1124,6 +1124,7 @@ static int get_info(struct net *net, void __user *user, ...@@ -1124,6 +1124,7 @@ static int get_info(struct net *net, void __user *user,
private = &tmp; private = &tmp;
} }
#endif #endif
memset(&info, 0, sizeof(info));
info.valid_hooks = t->valid_hooks; info.valid_hooks = t->valid_hooks;
memcpy(info.hook_entry, private->hook_entry, memcpy(info.hook_entry, private->hook_entry,
sizeof(info.hook_entry)); sizeof(info.hook_entry));
......
...@@ -47,26 +47,6 @@ __nf_nat_proto_find(u_int8_t protonum) ...@@ -47,26 +47,6 @@ __nf_nat_proto_find(u_int8_t protonum)
return rcu_dereference(nf_nat_protos[protonum]); return rcu_dereference(nf_nat_protos[protonum]);
} }
static const struct nf_nat_protocol *
nf_nat_proto_find_get(u_int8_t protonum)
{
const struct nf_nat_protocol *p;
rcu_read_lock();
p = __nf_nat_proto_find(protonum);
if (!try_module_get(p->me))
p = &nf_nat_unknown_protocol;
rcu_read_unlock();
return p;
}
static void
nf_nat_proto_put(const struct nf_nat_protocol *p)
{
module_put(p->me);
}
/* We keep an extra hash for each conntrack, for fast searching. */ /* We keep an extra hash for each conntrack, for fast searching. */
static inline unsigned int static inline unsigned int
hash_by_src(const struct net *net, u16 zone, hash_by_src(const struct net *net, u16 zone,
...@@ -588,6 +568,26 @@ static struct nf_ct_ext_type nat_extend __read_mostly = { ...@@ -588,6 +568,26 @@ static struct nf_ct_ext_type nat_extend __read_mostly = {
#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/nfnetlink_conntrack.h> #include <linux/netfilter/nfnetlink_conntrack.h>
static const struct nf_nat_protocol *
nf_nat_proto_find_get(u_int8_t protonum)
{
const struct nf_nat_protocol *p;
rcu_read_lock();
p = __nf_nat_proto_find(protonum);
if (!try_module_get(p->me))
p = &nf_nat_unknown_protocol;
rcu_read_unlock();
return p;
}
static void
nf_nat_proto_put(const struct nf_nat_protocol *p)
{
module_put(p->me);
}
static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = { static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = {
[CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 }, [CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 },
[CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 }, [CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 },
......
...@@ -1137,6 +1137,7 @@ static int get_info(struct net *net, void __user *user, ...@@ -1137,6 +1137,7 @@ static int get_info(struct net *net, void __user *user,
private = &tmp; private = &tmp;
} }
#endif #endif
memset(&info, 0, sizeof(info));
info.valid_hooks = t->valid_hooks; info.valid_hooks = t->valid_hooks;
memcpy(info.hook_entry, private->hook_entry, memcpy(info.hook_entry, private->hook_entry,
sizeof(info.hook_entry)); sizeof(info.hook_entry));
......
...@@ -2741,6 +2741,7 @@ static void __net_exit ip6_route_net_exit(struct net *net) ...@@ -2741,6 +2741,7 @@ static void __net_exit ip6_route_net_exit(struct net *net)
kfree(net->ipv6.ip6_prohibit_entry); kfree(net->ipv6.ip6_prohibit_entry);
kfree(net->ipv6.ip6_blk_hole_entry); kfree(net->ipv6.ip6_blk_hole_entry);
#endif #endif
dst_entries_destroy(&net->ipv6.ip6_dst_ops);
} }
static struct pernet_operations ip6_route_net_ops = { static struct pernet_operations ip6_route_net_ops = {
...@@ -2832,5 +2833,6 @@ void ip6_route_cleanup(void) ...@@ -2832,5 +2833,6 @@ void ip6_route_cleanup(void)
xfrm6_fini(); xfrm6_fini();
fib6_gc_cleanup(); fib6_gc_cleanup();
unregister_pernet_subsys(&ip6_route_net_ops); unregister_pernet_subsys(&ip6_route_net_ops);
dst_entries_destroy(&ip6_dst_blackhole_ops);
kmem_cache_destroy(ip6_dst_ops_template.kmem_cachep); kmem_cache_destroy(ip6_dst_ops_template.kmem_cachep);
} }
...@@ -249,7 +249,7 @@ static int l2tp_dfs_seq_open(struct inode *inode, struct file *file) ...@@ -249,7 +249,7 @@ static int l2tp_dfs_seq_open(struct inode *inode, struct file *file)
struct seq_file *seq; struct seq_file *seq;
int rc = -ENOMEM; int rc = -ENOMEM;
pd = kzalloc(GFP_KERNEL, sizeof(*pd)); pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (pd == NULL) if (pd == NULL)
goto out; goto out;
......
...@@ -1312,7 +1312,8 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls) ...@@ -1312,7 +1312,8 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls)
if (!hash) { if (!hash) {
*vmalloced = 1; *vmalloced = 1;
printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n"); printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n");
hash = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); hash = __vmalloc(sz, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
PAGE_KERNEL);
} }
if (hash && nulls) if (hash && nulls)
......
...@@ -292,6 +292,12 @@ int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *l4proto) ...@@ -292,6 +292,12 @@ int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *l4proto)
for (i = 0; i < MAX_NF_CT_PROTO; i++) for (i = 0; i < MAX_NF_CT_PROTO; i++)
proto_array[i] = &nf_conntrack_l4proto_generic; proto_array[i] = &nf_conntrack_l4proto_generic;
/* Before making proto_array visible to lockless readers,
* we must make sure its content is committed to memory.
*/
smp_wmb();
nf_ct_protos[l4proto->l3proto] = proto_array; nf_ct_protos[l4proto->l3proto] = proto_array;
} else if (nf_ct_protos[l4proto->l3proto][l4proto->l4proto] != } else if (nf_ct_protos[l4proto->l3proto][l4proto->l4proto] !=
&nf_conntrack_l4proto_generic) { &nf_conntrack_l4proto_generic) {
......
...@@ -134,8 +134,12 @@ static int rds_loop_conn_alloc(struct rds_connection *conn, gfp_t gfp) ...@@ -134,8 +134,12 @@ static int rds_loop_conn_alloc(struct rds_connection *conn, gfp_t gfp)
static void rds_loop_conn_free(void *arg) static void rds_loop_conn_free(void *arg)
{ {
struct rds_loop_connection *lc = arg; struct rds_loop_connection *lc = arg;
unsigned long flags;
rdsdebug("lc %p\n", lc); rdsdebug("lc %p\n", lc);
spin_lock_irqsave(&loop_conns_lock, flags);
list_del(&lc->loop_node); list_del(&lc->loop_node);
spin_unlock_irqrestore(&loop_conns_lock, flags);
kfree(lc); kfree(lc);
} }
......
...@@ -221,7 +221,13 @@ static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp) ...@@ -221,7 +221,13 @@ static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp)
static void rds_tcp_conn_free(void *arg) static void rds_tcp_conn_free(void *arg)
{ {
struct rds_tcp_connection *tc = arg; struct rds_tcp_connection *tc = arg;
unsigned long flags;
rdsdebug("freeing tc %p\n", tc); rdsdebug("freeing tc %p\n", tc);
spin_lock_irqsave(&rds_tcp_conn_lock, flags);
list_del(&tc->t_tcp_node);
spin_unlock_irqrestore(&rds_tcp_conn_lock, flags);
kmem_cache_free(rds_tcp_conn_slab, tc); kmem_cache_free(rds_tcp_conn_slab, tc);
} }
......
...@@ -34,8 +34,6 @@ struct cgroup_subsys net_cls_subsys = { ...@@ -34,8 +34,6 @@ struct cgroup_subsys net_cls_subsys = {
.populate = cgrp_populate, .populate = cgrp_populate,
#ifdef CONFIG_NET_CLS_CGROUP #ifdef CONFIG_NET_CLS_CGROUP
.subsys_id = net_cls_subsys_id, .subsys_id = net_cls_subsys_id,
#else
#define net_cls_subsys_id net_cls_subsys.subsys_id
#endif #endif
.module = THIS_MODULE, .module = THIS_MODULE,
}; };
......
...@@ -103,7 +103,8 @@ static int em_text_change(struct tcf_proto *tp, void *data, int len, ...@@ -103,7 +103,8 @@ static int em_text_change(struct tcf_proto *tp, void *data, int len,
static void em_text_destroy(struct tcf_proto *tp, struct tcf_ematch *m) static void em_text_destroy(struct tcf_proto *tp, struct tcf_ematch *m)
{ {
textsearch_destroy(EM_TEXT_PRIV(m)->config); if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config)
textsearch_destroy(EM_TEXT_PRIV(m)->config);
} }
static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m) static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
......
...@@ -134,15 +134,15 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, ...@@ -134,15 +134,15 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,
case X25_FAC_CLASS_D: case X25_FAC_CLASS_D:
switch (*p) { switch (*p) {
case X25_FAC_CALLING_AE: case X25_FAC_CALLING_AE:
if (p[1] > X25_MAX_DTE_FACIL_LEN) if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1)
break; return 0;
dte_facs->calling_len = p[2]; dte_facs->calling_len = p[2];
memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); memcpy(dte_facs->calling_ae, &p[3], p[1] - 1);
*vc_fac_mask |= X25_MASK_CALLING_AE; *vc_fac_mask |= X25_MASK_CALLING_AE;
break; break;
case X25_FAC_CALLED_AE: case X25_FAC_CALLED_AE:
if (p[1] > X25_MAX_DTE_FACIL_LEN) if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1)
break; return 0;
dte_facs->called_len = p[2]; dte_facs->called_len = p[2];
memcpy(dte_facs->called_ae, &p[3], p[1] - 1); memcpy(dte_facs->called_ae, &p[3], p[1] - 1);
*vc_fac_mask |= X25_MASK_CALLED_AE; *vc_fac_mask |= X25_MASK_CALLED_AE;
......
...@@ -119,6 +119,8 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp ...@@ -119,6 +119,8 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp
&x25->vc_facil_mask); &x25->vc_facil_mask);
if (len > 0) if (len > 0)
skb_pull(skb, len); skb_pull(skb, len);
else
return -1;
/* /*
* Copy any Call User Data. * Copy any Call User Data.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册