diff options
46 files changed, 246 insertions, 153 deletions
diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c index 40b914bded8c..2e72227bd071 100644 --- a/drivers/isdn/hisax/isar.c +++ b/drivers/isdn/hisax/isar.c | |||
@@ -1427,8 +1427,8 @@ modeisar(struct BCState *bcs, int mode, int bc) | |||
1427 | &bcs->hw.isar.reg->Flags)) | 1427 | &bcs->hw.isar.reg->Flags)) |
1428 | bcs->hw.isar.dpath = 1; | 1428 | bcs->hw.isar.dpath = 1; |
1429 | else { | 1429 | else { |
1430 | printk(KERN_WARNING"isar modeisar analog funktions only with DP1\n"); | 1430 | printk(KERN_WARNING"isar modeisar analog functions only with DP1\n"); |
1431 | debugl1(cs, "isar modeisar analog funktions only with DP1"); | 1431 | debugl1(cs, "isar modeisar analog functions only with DP1"); |
1432 | return(1); | 1432 | return(1); |
1433 | } | 1433 | } |
1434 | break; | 1434 | break; |
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 43579b3b24ac..53363108994e 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -3043,7 +3043,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
3043 | atl1_pcie_patch(adapter); | 3043 | atl1_pcie_patch(adapter); |
3044 | /* assume we have no link for now */ | 3044 | /* assume we have no link for now */ |
3045 | netif_carrier_off(netdev); | 3045 | netif_carrier_off(netdev); |
3046 | netif_stop_queue(netdev); | ||
3047 | 3046 | ||
3048 | setup_timer(&adapter->phy_config_timer, atl1_phy_config, | 3047 | setup_timer(&adapter->phy_config_timer, atl1_phy_config, |
3049 | (unsigned long)adapter); | 3048 | (unsigned long)adapter); |
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 9eea225decaf..863e73a85fbe 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h | |||
@@ -20,8 +20,8 @@ | |||
20 | * (you will need to reboot afterwards) */ | 20 | * (you will need to reboot afterwards) */ |
21 | /* #define BNX2X_STOP_ON_ERROR */ | 21 | /* #define BNX2X_STOP_ON_ERROR */ |
22 | 22 | ||
23 | #define DRV_MODULE_VERSION "1.60.00-3" | 23 | #define DRV_MODULE_VERSION "1.60.00-4" |
24 | #define DRV_MODULE_RELDATE "2010/10/19" | 24 | #define DRV_MODULE_RELDATE "2010/11/01" |
25 | #define BNX2X_BC_VER 0x040200 | 25 | #define BNX2X_BC_VER 0x040200 |
26 | 26 | ||
27 | #define BNX2X_MULTI_QUEUE | 27 | #define BNX2X_MULTI_QUEUE |
diff --git a/drivers/net/bnx2x/bnx2x_hsi.h b/drivers/net/bnx2x/bnx2x_hsi.h index 18c8e23a0e82..4cfd4e9b5586 100644 --- a/drivers/net/bnx2x/bnx2x_hsi.h +++ b/drivers/net/bnx2x/bnx2x_hsi.h | |||
@@ -244,7 +244,14 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ | |||
244 | 244 | ||
245 | u16 xgxs_config_tx[4]; /* 0x1A0 */ | 245 | u16 xgxs_config_tx[4]; /* 0x1A0 */ |
246 | 246 | ||
247 | u32 Reserved1[57]; /* 0x1A8 */ | 247 | u32 Reserved1[56]; /* 0x1A8 */ |
248 | u32 default_cfg; /* 0x288 */ | ||
249 | /* Enable BAM on KR */ | ||
250 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_MASK 0x00100000 | ||
251 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_SHIFT 20 | ||
252 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_DISABLED 0x00000000 | ||
253 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED 0x00100000 | ||
254 | |||
248 | u32 speed_capability_mask2; /* 0x28C */ | 255 | u32 speed_capability_mask2; /* 0x28C */ |
249 | #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK 0x0000FFFF | 256 | #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK 0x0000FFFF |
250 | #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT 0 | 257 | #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT 0 |
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c index 2326774df843..580919619252 100644 --- a/drivers/net/bnx2x/bnx2x_link.c +++ b/drivers/net/bnx2x/bnx2x_link.c | |||
@@ -610,7 +610,7 @@ static u8 bnx2x_bmac_enable(struct link_params *params, | |||
610 | /* reset and unreset the BigMac */ | 610 | /* reset and unreset the BigMac */ |
611 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, | 611 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, |
612 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); | 612 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); |
613 | udelay(10); | 613 | msleep(1); |
614 | 614 | ||
615 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, | 615 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, |
616 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); | 616 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); |
@@ -3525,13 +3525,19 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
3525 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); | 3525 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); |
3526 | 3526 | ||
3527 | /* Enable CL37 BAM */ | 3527 | /* Enable CL37 BAM */ |
3528 | bnx2x_cl45_read(bp, phy, | 3528 | if (REG_RD(bp, params->shmem_base + |
3529 | MDIO_AN_DEVAD, | 3529 | offsetof(struct shmem_region, dev_info. |
3530 | MDIO_AN_REG_8073_BAM, &val); | 3530 | port_hw_config[params->port].default_cfg)) & |
3531 | bnx2x_cl45_write(bp, phy, | 3531 | PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED) { |
3532 | MDIO_AN_DEVAD, | ||
3533 | MDIO_AN_REG_8073_BAM, val | 1); | ||
3534 | 3532 | ||
3533 | bnx2x_cl45_read(bp, phy, | ||
3534 | MDIO_AN_DEVAD, | ||
3535 | MDIO_AN_REG_8073_BAM, &val); | ||
3536 | bnx2x_cl45_write(bp, phy, | ||
3537 | MDIO_AN_DEVAD, | ||
3538 | MDIO_AN_REG_8073_BAM, val | 1); | ||
3539 | DP(NETIF_MSG_LINK, "Enable CL37 BAM on KR\n"); | ||
3540 | } | ||
3535 | if (params->loopback_mode == LOOPBACK_EXT) { | 3541 | if (params->loopback_mode == LOOPBACK_EXT) { |
3536 | bnx2x_807x_force_10G(bp, phy); | 3542 | bnx2x_807x_force_10G(bp, phy); |
3537 | DP(NETIF_MSG_LINK, "Forced speed 10G on 807X\n"); | 3543 | 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 | { | 5308 | { |
5303 | struct bnx2x *bp = params->bp; | 5309 | struct bnx2x *bp = params->bp; |
5304 | u16 autoneg_val, an_1000_val, an_10_100_val; | 5310 | u16 autoneg_val, an_1000_val, an_10_100_val; |
5305 | bnx2x_wait_reset_complete(bp, phy); | 5311 | |
5306 | bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, | 5312 | bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, |
5307 | 1 << NIG_LATCH_BC_ENABLE_MI_INT); | 5313 | 1 << NIG_LATCH_BC_ENABLE_MI_INT); |
5308 | 5314 | ||
@@ -5431,6 +5437,7 @@ static u8 bnx2x_8481_config_init(struct bnx2x_phy *phy, | |||
5431 | 5437 | ||
5432 | /* HW reset */ | 5438 | /* HW reset */ |
5433 | bnx2x_ext_phy_hw_reset(bp, params->port); | 5439 | bnx2x_ext_phy_hw_reset(bp, params->port); |
5440 | bnx2x_wait_reset_complete(bp, phy); | ||
5434 | 5441 | ||
5435 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); | 5442 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); |
5436 | return bnx2x_848xx_cmn_config_init(phy, params, vars); | 5443 | return bnx2x_848xx_cmn_config_init(phy, params, vars); |
@@ -5441,7 +5448,7 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
5441 | struct link_vars *vars) | 5448 | struct link_vars *vars) |
5442 | { | 5449 | { |
5443 | struct bnx2x *bp = params->bp; | 5450 | struct bnx2x *bp = params->bp; |
5444 | u8 port = params->port, initialize = 1; | 5451 | u8 port, initialize = 1; |
5445 | u16 val; | 5452 | u16 val; |
5446 | u16 temp; | 5453 | u16 temp; |
5447 | u32 actual_phy_selection; | 5454 | u32 actual_phy_selection; |
@@ -5450,11 +5457,16 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
5450 | /* This is just for MDIO_CTL_REG_84823_MEDIA register. */ | 5457 | /* This is just for MDIO_CTL_REG_84823_MEDIA register. */ |
5451 | 5458 | ||
5452 | msleep(1); | 5459 | msleep(1); |
5460 | if (CHIP_IS_E2(bp)) | ||
5461 | port = BP_PATH(bp); | ||
5462 | else | ||
5463 | port = params->port; | ||
5453 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, | 5464 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, |
5454 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, | 5465 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, |
5455 | port); | 5466 | port); |
5456 | msleep(200); /* 100 is not enough */ | 5467 | bnx2x_wait_reset_complete(bp, phy); |
5457 | 5468 | /* Wait for GPHY to come out of reset */ | |
5469 | msleep(50); | ||
5458 | /* BCM84823 requires that XGXS links up first @ 10G for normal | 5470 | /* BCM84823 requires that XGXS links up first @ 10G for normal |
5459 | behavior */ | 5471 | behavior */ |
5460 | temp = vars->line_speed; | 5472 | temp = vars->line_speed; |
@@ -5625,7 +5637,11 @@ static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy, | |||
5625 | struct link_params *params) | 5637 | struct link_params *params) |
5626 | { | 5638 | { |
5627 | struct bnx2x *bp = params->bp; | 5639 | struct bnx2x *bp = params->bp; |
5628 | u8 port = params->port; | 5640 | u8 port; |
5641 | if (CHIP_IS_E2(bp)) | ||
5642 | port = BP_PATH(bp); | ||
5643 | else | ||
5644 | port = params->port; | ||
5629 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, | 5645 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, |
5630 | MISC_REGISTERS_GPIO_OUTPUT_LOW, | 5646 | MISC_REGISTERS_GPIO_OUTPUT_LOW, |
5631 | port); | 5647 | port); |
@@ -6928,7 +6944,7 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, | |||
6928 | u8 reset_ext_phy) | 6944 | u8 reset_ext_phy) |
6929 | { | 6945 | { |
6930 | struct bnx2x *bp = params->bp; | 6946 | struct bnx2x *bp = params->bp; |
6931 | u8 phy_index, port = params->port; | 6947 | u8 phy_index, port = params->port, clear_latch_ind = 0; |
6932 | DP(NETIF_MSG_LINK, "Resetting the link of port %d\n", port); | 6948 | DP(NETIF_MSG_LINK, "Resetting the link of port %d\n", port); |
6933 | /* disable attentions */ | 6949 | /* disable attentions */ |
6934 | vars->link_status = 0; | 6950 | vars->link_status = 0; |
@@ -6966,9 +6982,18 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, | |||
6966 | params->phy[phy_index].link_reset( | 6982 | params->phy[phy_index].link_reset( |
6967 | ¶ms->phy[phy_index], | 6983 | ¶ms->phy[phy_index], |
6968 | params); | 6984 | params); |
6985 | if (params->phy[phy_index].flags & | ||
6986 | FLAGS_REARM_LATCH_SIGNAL) | ||
6987 | clear_latch_ind = 1; | ||
6969 | } | 6988 | } |
6970 | } | 6989 | } |
6971 | 6990 | ||
6991 | if (clear_latch_ind) { | ||
6992 | /* Clear latching indication */ | ||
6993 | bnx2x_rearm_latch_signal(bp, port, 0); | ||
6994 | bnx2x_bits_dis(bp, NIG_REG_LATCH_BC_0 + port*4, | ||
6995 | 1 << NIG_LATCH_BC_ENABLE_MI_INT); | ||
6996 | } | ||
6972 | if (params->phy[INT_PHY].link_reset) | 6997 | if (params->phy[INT_PHY].link_reset) |
6973 | params->phy[INT_PHY].link_reset( | 6998 | params->phy[INT_PHY].link_reset( |
6974 | ¶ms->phy[INT_PHY], params); | 6999 | ¶ms->phy[INT_PHY], params); |
@@ -6999,6 +7024,7 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, | |||
6999 | s8 port; | 7024 | s8 port; |
7000 | s8 port_of_path = 0; | 7025 | s8 port_of_path = 0; |
7001 | 7026 | ||
7027 | bnx2x_ext_phy_hw_reset(bp, 0); | ||
7002 | /* PART1 - Reset both phys */ | 7028 | /* PART1 - Reset both phys */ |
7003 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { | 7029 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { |
7004 | u32 shmem_base, shmem2_base; | 7030 | u32 shmem_base, shmem2_base; |
@@ -7021,7 +7047,8 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, | |||
7021 | return -EINVAL; | 7047 | return -EINVAL; |
7022 | } | 7048 | } |
7023 | /* disable attentions */ | 7049 | /* disable attentions */ |
7024 | bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, | 7050 | bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + |
7051 | port_of_path*4, | ||
7025 | (NIG_MASK_XGXS0_LINK_STATUS | | 7052 | (NIG_MASK_XGXS0_LINK_STATUS | |
7026 | NIG_MASK_XGXS0_LINK10G | | 7053 | NIG_MASK_XGXS0_LINK10G | |
7027 | NIG_MASK_SERDES0_LINK_STATUS | | 7054 | NIG_MASK_SERDES0_LINK_STATUS | |
@@ -7132,7 +7159,7 @@ static u8 bnx2x_8726_common_init_phy(struct bnx2x *bp, | |||
7132 | (1<<(MISC_REGISTERS_GPIO_3 + MISC_REGISTERS_GPIO_PORT_SHIFT))); | 7159 | (1<<(MISC_REGISTERS_GPIO_3 + MISC_REGISTERS_GPIO_PORT_SHIFT))); |
7133 | REG_WR(bp, MISC_REG_GPIO_EVENT_EN, val); | 7160 | REG_WR(bp, MISC_REG_GPIO_EVENT_EN, val); |
7134 | 7161 | ||
7135 | bnx2x_ext_phy_hw_reset(bp, 1); | 7162 | bnx2x_ext_phy_hw_reset(bp, 0); |
7136 | msleep(5); | 7163 | msleep(5); |
7137 | for (port = 0; port < PORT_MAX; port++) { | 7164 | for (port = 0; port < PORT_MAX; port++) { |
7138 | u32 shmem_base, shmem2_base; | 7165 | u32 shmem_base, shmem2_base; |
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c index 8427533fe313..8b4cea57a6c5 100644 --- a/drivers/net/caif/caif_spi.c +++ b/drivers/net/caif/caif_spi.c | |||
@@ -33,6 +33,9 @@ MODULE_LICENSE("GPL"); | |||
33 | MODULE_AUTHOR("Daniel Martensson<daniel.martensson@stericsson.com>"); | 33 | MODULE_AUTHOR("Daniel Martensson<daniel.martensson@stericsson.com>"); |
34 | MODULE_DESCRIPTION("CAIF SPI driver"); | 34 | MODULE_DESCRIPTION("CAIF SPI driver"); |
35 | 35 | ||
36 | /* Returns the number of padding bytes for alignment. */ | ||
37 | #define PAD_POW2(x, pow) ((((x)&((pow)-1))==0) ? 0 : (((pow)-((x)&((pow)-1))))) | ||
38 | |||
36 | static int spi_loop; | 39 | static int spi_loop; |
37 | module_param(spi_loop, bool, S_IRUGO); | 40 | module_param(spi_loop, bool, S_IRUGO); |
38 | MODULE_PARM_DESC(spi_loop, "SPI running in loopback mode."); | 41 | 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 | module_param(spi_frm_align, int, S_IRUGO); | 44 | module_param(spi_frm_align, int, S_IRUGO); |
42 | MODULE_PARM_DESC(spi_frm_align, "SPI frame alignment."); | 45 | MODULE_PARM_DESC(spi_frm_align, "SPI frame alignment."); |
43 | 46 | ||
44 | /* SPI padding options. */ | 47 | /* |
48 | * SPI padding options. | ||
49 | * Warning: must be a base of 2 (& operation used) and can not be zero ! | ||
50 | */ | ||
45 | module_param(spi_up_head_align, int, S_IRUGO); | 51 | module_param(spi_up_head_align, int, S_IRUGO); |
46 | MODULE_PARM_DESC(spi_up_head_align, "SPI uplink head alignment."); | 52 | MODULE_PARM_DESC(spi_up_head_align, "SPI uplink head alignment."); |
47 | 53 | ||
@@ -240,15 +246,13 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf, | |||
240 | static const struct file_operations dbgfs_state_fops = { | 246 | static const struct file_operations dbgfs_state_fops = { |
241 | .open = dbgfs_open, | 247 | .open = dbgfs_open, |
242 | .read = dbgfs_state, | 248 | .read = dbgfs_state, |
243 | .owner = THIS_MODULE, | 249 | .owner = THIS_MODULE |
244 | .llseek = default_llseek, | ||
245 | }; | 250 | }; |
246 | 251 | ||
247 | static const struct file_operations dbgfs_frame_fops = { | 252 | static const struct file_operations dbgfs_frame_fops = { |
248 | .open = dbgfs_open, | 253 | .open = dbgfs_open, |
249 | .read = dbgfs_frame, | 254 | .read = dbgfs_frame, |
250 | .owner = THIS_MODULE, | 255 | .owner = THIS_MODULE |
251 | .llseek = default_llseek, | ||
252 | }; | 256 | }; |
253 | 257 | ||
254 | static inline void dev_debugfs_add(struct cfspi *cfspi) | 258 | 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 | u8 *dst = buf; | 341 | u8 *dst = buf; |
338 | caif_assert(buf); | 342 | caif_assert(buf); |
339 | 343 | ||
344 | if (cfspi->slave && !cfspi->slave_talked) | ||
345 | cfspi->slave_talked = true; | ||
346 | |||
340 | do { | 347 | do { |
341 | struct sk_buff *skb; | 348 | struct sk_buff *skb; |
342 | struct caif_payload_info *info; | 349 | struct caif_payload_info *info; |
@@ -357,8 +364,8 @@ int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len) | |||
357 | * Compute head offset i.e. number of bytes to add to | 364 | * Compute head offset i.e. number of bytes to add to |
358 | * get the start of the payload aligned. | 365 | * get the start of the payload aligned. |
359 | */ | 366 | */ |
360 | if (spi_up_head_align) { | 367 | if (spi_up_head_align > 1) { |
361 | spad = 1 + ((info->hdr_len + 1) & spi_up_head_align); | 368 | spad = 1 + PAD_POW2((info->hdr_len + 1), spi_up_head_align); |
362 | *dst = (u8)(spad - 1); | 369 | *dst = (u8)(spad - 1); |
363 | dst += spad; | 370 | dst += spad; |
364 | } | 371 | } |
@@ -373,7 +380,7 @@ int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len) | |||
373 | * Compute tail offset i.e. number of bytes to add to | 380 | * Compute tail offset i.e. number of bytes to add to |
374 | * get the complete CAIF frame aligned. | 381 | * get the complete CAIF frame aligned. |
375 | */ | 382 | */ |
376 | epad = (skb->len + spad) & spi_up_tail_align; | 383 | epad = PAD_POW2((skb->len + spad), spi_up_tail_align); |
377 | dst += epad; | 384 | dst += epad; |
378 | 385 | ||
379 | dev_kfree_skb(skb); | 386 | dev_kfree_skb(skb); |
@@ -417,14 +424,14 @@ int cfspi_xmitlen(struct cfspi *cfspi) | |||
417 | * Compute head offset i.e. number of bytes to add to | 424 | * Compute head offset i.e. number of bytes to add to |
418 | * get the start of the payload aligned. | 425 | * get the start of the payload aligned. |
419 | */ | 426 | */ |
420 | if (spi_up_head_align) | 427 | if (spi_up_head_align > 1) |
421 | spad = 1 + ((info->hdr_len + 1) & spi_up_head_align); | 428 | spad = 1 + PAD_POW2((info->hdr_len + 1), spi_up_head_align); |
422 | 429 | ||
423 | /* | 430 | /* |
424 | * Compute tail offset i.e. number of bytes to add to | 431 | * Compute tail offset i.e. number of bytes to add to |
425 | * get the complete CAIF frame aligned. | 432 | * get the complete CAIF frame aligned. |
426 | */ | 433 | */ |
427 | epad = (skb->len + spad) & spi_up_tail_align; | 434 | epad = PAD_POW2((skb->len + spad), spi_up_tail_align); |
428 | 435 | ||
429 | if ((skb->len + spad + epad + frm_len) <= CAIF_MAX_SPI_FRAME) { | 436 | if ((skb->len + spad + epad + frm_len) <= CAIF_MAX_SPI_FRAME) { |
430 | skb_queue_tail(&cfspi->chead, skb); | 437 | skb_queue_tail(&cfspi->chead, skb); |
@@ -433,6 +440,7 @@ int cfspi_xmitlen(struct cfspi *cfspi) | |||
433 | } else { | 440 | } else { |
434 | /* Put back packet. */ | 441 | /* Put back packet. */ |
435 | skb_queue_head(&cfspi->qhead, skb); | 442 | skb_queue_head(&cfspi->qhead, skb); |
443 | break; | ||
436 | } | 444 | } |
437 | } while (pkts <= CAIF_MAX_SPI_PKTS); | 445 | } while (pkts <= CAIF_MAX_SPI_PKTS); |
438 | 446 | ||
@@ -453,6 +461,15 @@ static void cfspi_ss_cb(bool assert, struct cfspi_ifc *ifc) | |||
453 | { | 461 | { |
454 | struct cfspi *cfspi = (struct cfspi *)ifc->priv; | 462 | struct cfspi *cfspi = (struct cfspi *)ifc->priv; |
455 | 463 | ||
464 | /* | ||
465 | * The slave device is the master on the link. Interrupts before the | ||
466 | * slave has transmitted are considered spurious. | ||
467 | */ | ||
468 | if (cfspi->slave && !cfspi->slave_talked) { | ||
469 | printk(KERN_WARNING "CFSPI: Spurious SS interrupt.\n"); | ||
470 | return; | ||
471 | } | ||
472 | |||
456 | if (!in_interrupt()) | 473 | if (!in_interrupt()) |
457 | spin_lock(&cfspi->lock); | 474 | spin_lock(&cfspi->lock); |
458 | if (assert) { | 475 | if (assert) { |
@@ -465,7 +482,8 @@ static void cfspi_ss_cb(bool assert, struct cfspi_ifc *ifc) | |||
465 | spin_unlock(&cfspi->lock); | 482 | spin_unlock(&cfspi->lock); |
466 | 483 | ||
467 | /* Wake up the xfer thread. */ | 484 | /* Wake up the xfer thread. */ |
468 | wake_up_interruptible(&cfspi->wait); | 485 | if (assert) |
486 | wake_up_interruptible(&cfspi->wait); | ||
469 | } | 487 | } |
470 | 488 | ||
471 | static void cfspi_xfer_done_cb(struct cfspi_ifc *ifc) | 489 | 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 | * Compute head offset i.e. number of bytes added to | 541 | * Compute head offset i.e. number of bytes added to |
524 | * get the start of the payload aligned. | 542 | * get the start of the payload aligned. |
525 | */ | 543 | */ |
526 | if (spi_down_head_align) { | 544 | if (spi_down_head_align > 1) { |
527 | spad = 1 + *src; | 545 | spad = 1 + *src; |
528 | src += spad; | 546 | src += spad; |
529 | } | 547 | } |
@@ -564,7 +582,7 @@ int cfspi_rxfrm(struct cfspi *cfspi, u8 *buf, size_t len) | |||
564 | * Compute tail offset i.e. number of bytes added to | 582 | * Compute tail offset i.e. number of bytes added to |
565 | * get the complete CAIF frame aligned. | 583 | * get the complete CAIF frame aligned. |
566 | */ | 584 | */ |
567 | epad = (pkt_len + spad) & spi_down_tail_align; | 585 | epad = PAD_POW2((pkt_len + spad), spi_down_tail_align); |
568 | src += epad; | 586 | src += epad; |
569 | } while ((src - buf) < len); | 587 | } while ((src - buf) < len); |
570 | 588 | ||
@@ -625,11 +643,20 @@ int cfspi_spi_probe(struct platform_device *pdev) | |||
625 | cfspi->ndev = ndev; | 643 | cfspi->ndev = ndev; |
626 | cfspi->pdev = pdev; | 644 | cfspi->pdev = pdev; |
627 | 645 | ||
628 | /* Set flow info */ | 646 | /* Set flow info. */ |
629 | cfspi->flow_off_sent = 0; | 647 | cfspi->flow_off_sent = 0; |
630 | cfspi->qd_low_mark = LOW_WATER_MARK; | 648 | cfspi->qd_low_mark = LOW_WATER_MARK; |
631 | cfspi->qd_high_mark = HIGH_WATER_MARK; | 649 | cfspi->qd_high_mark = HIGH_WATER_MARK; |
632 | 650 | ||
651 | /* Set slave info. */ | ||
652 | if (!strncmp(cfspi_spi_driver.driver.name, "cfspi_sspi", 10)) { | ||
653 | cfspi->slave = true; | ||
654 | cfspi->slave_talked = false; | ||
655 | } else { | ||
656 | cfspi->slave = false; | ||
657 | cfspi->slave_talked = false; | ||
658 | } | ||
659 | |||
633 | /* Assign the SPI device. */ | 660 | /* Assign the SPI device. */ |
634 | cfspi->dev = dev; | 661 | cfspi->dev = dev; |
635 | /* Assign the device ifc to this SPI interface. */ | 662 | /* Assign the device ifc to this SPI interface. */ |
diff --git a/drivers/net/caif/caif_spi_slave.c b/drivers/net/caif/caif_spi_slave.c index 2111dbfea6fe..1b9943a4edab 100644 --- a/drivers/net/caif/caif_spi_slave.c +++ b/drivers/net/caif/caif_spi_slave.c | |||
@@ -36,10 +36,15 @@ static inline int forward_to_spi_cmd(struct cfspi *cfspi) | |||
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | int spi_frm_align = 2; | 38 | int spi_frm_align = 2; |
39 | int spi_up_head_align = 1; | 39 | |
40 | int spi_up_tail_align; | 40 | /* |
41 | int spi_down_head_align = 3; | 41 | * SPI padding options. |
42 | int spi_down_tail_align = 1; | 42 | * Warning: must be a base of 2 (& operation used) and can not be zero ! |
43 | */ | ||
44 | int spi_up_head_align = 1 << 1; | ||
45 | int spi_up_tail_align = 1 << 0; | ||
46 | int spi_down_head_align = 1 << 2; | ||
47 | int spi_down_tail_align = 1 << 1; | ||
43 | 48 | ||
44 | #ifdef CONFIG_DEBUG_FS | 49 | #ifdef CONFIG_DEBUG_FS |
45 | static inline void debugfs_store_prev(struct cfspi *cfspi) | 50 | static inline void debugfs_store_prev(struct cfspi *cfspi) |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 407d4e272075..046d846c652d 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -3341,7 +3341,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3341 | adapter->name = adapter->port[i]->name; | 3341 | adapter->name = adapter->port[i]->name; |
3342 | 3342 | ||
3343 | __set_bit(i, &adapter->registered_device_map); | 3343 | __set_bit(i, &adapter->registered_device_map); |
3344 | netif_tx_stop_all_queues(adapter->port[i]); | ||
3345 | } | 3344 | } |
3346 | } | 3345 | } |
3347 | if (!adapter->registered_device_map) { | 3346 | if (!adapter->registered_device_map) { |
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c index f17703f410b3..f50bc98310f8 100644 --- a/drivers/net/cxgb4/cxgb4_main.c +++ b/drivers/net/cxgb4/cxgb4_main.c | |||
@@ -3736,7 +3736,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3736 | 3736 | ||
3737 | __set_bit(i, &adapter->registered_device_map); | 3737 | __set_bit(i, &adapter->registered_device_map); |
3738 | adapter->chan_map[adap2pinfo(adapter, i)->tx_chan] = i; | 3738 | adapter->chan_map[adap2pinfo(adapter, i)->tx_chan] = i; |
3739 | netif_tx_stop_all_queues(adapter->port[i]); | ||
3740 | } | 3739 | } |
3741 | } | 3740 | } |
3742 | if (!adapter->registered_device_map) { | 3741 | if (!adapter->registered_device_map) { |
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c index 555ecc5a2e93..6de5e2e448a5 100644 --- a/drivers/net/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/cxgb4vf/cxgb4vf_main.c | |||
@@ -2600,7 +2600,6 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev, | |||
2600 | pi->xact_addr_filt = -1; | 2600 | pi->xact_addr_filt = -1; |
2601 | pi->rx_offload = RX_CSO; | 2601 | pi->rx_offload = RX_CSO; |
2602 | netif_carrier_off(netdev); | 2602 | netif_carrier_off(netdev); |
2603 | netif_tx_stop_all_queues(netdev); | ||
2604 | netdev->irq = pdev->irq; | 2603 | netdev->irq = pdev->irq; |
2605 | 2604 | ||
2606 | netdev->features = (NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | | 2605 | netdev->features = (NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 385dc3204cb7..06bb9b799458 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -2871,7 +2871,6 @@ static int __devinit emac_probe(struct platform_device *ofdev, | |||
2871 | SET_ETHTOOL_OPS(ndev, &emac_ethtool_ops); | 2871 | SET_ETHTOOL_OPS(ndev, &emac_ethtool_ops); |
2872 | 2872 | ||
2873 | netif_carrier_off(ndev); | 2873 | netif_carrier_off(ndev); |
2874 | netif_stop_queue(ndev); | ||
2875 | 2874 | ||
2876 | err = register_netdev(ndev); | 2875 | err = register_netdev(ndev); |
2877 | if (err) { | 2876 | if (err) { |
diff --git a/drivers/net/jme.c b/drivers/net/jme.c index d85edf3119c2..c57d9a43ceca 100644 --- a/drivers/net/jme.c +++ b/drivers/net/jme.c | |||
@@ -2955,11 +2955,7 @@ jme_init_one(struct pci_dev *pdev, | |||
2955 | * Tell stack that we are not ready to work until open() | 2955 | * Tell stack that we are not ready to work until open() |
2956 | */ | 2956 | */ |
2957 | netif_carrier_off(netdev); | 2957 | netif_carrier_off(netdev); |
2958 | netif_stop_queue(netdev); | ||
2959 | 2958 | ||
2960 | /* | ||
2961 | * Register netdev | ||
2962 | */ | ||
2963 | rc = register_netdev(netdev); | 2959 | rc = register_netdev(netdev); |
2964 | if (rc) { | 2960 | if (rc) { |
2965 | pr_err("Cannot register net device\n"); | 2961 | pr_err("Cannot register net device\n"); |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index a75ba9517404..e1d30d7f2071 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -41,9 +41,6 @@ | |||
41 | MODULE_DESCRIPTION("QLogic/NetXen (1/10) GbE Converged Ethernet Driver"); | 41 | MODULE_DESCRIPTION("QLogic/NetXen (1/10) GbE Converged Ethernet Driver"); |
42 | MODULE_LICENSE("GPL"); | 42 | MODULE_LICENSE("GPL"); |
43 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); | 43 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); |
44 | MODULE_FIRMWARE(NX_P2_MN_ROMIMAGE_NAME); | ||
45 | MODULE_FIRMWARE(NX_P3_CT_ROMIMAGE_NAME); | ||
46 | MODULE_FIRMWARE(NX_P3_MN_ROMIMAGE_NAME); | ||
47 | MODULE_FIRMWARE(NX_UNIFIED_ROMIMAGE_NAME); | 44 | MODULE_FIRMWARE(NX_UNIFIED_ROMIMAGE_NAME); |
48 | 45 | ||
49 | char netxen_nic_driver_name[] = "netxen_nic"; | 46 | char netxen_nic_driver_name[] = "netxen_nic"; |
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 7a298cdf9ab3..a3dcd04be22f 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -1450,7 +1450,6 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, | |||
1450 | netdev->irq = adapter->msix_entries[0].vector; | 1450 | netdev->irq = adapter->msix_entries[0].vector; |
1451 | 1451 | ||
1452 | netif_carrier_off(netdev); | 1452 | netif_carrier_off(netdev); |
1453 | netif_stop_queue(netdev); | ||
1454 | 1453 | ||
1455 | err = register_netdev(netdev); | 1454 | err = register_netdev(netdev); |
1456 | if (err) { | 1455 | if (err) { |
diff --git a/drivers/net/smsc911x.h b/drivers/net/smsc911x.h index 52f38e12a879..50f712e99e96 100644 --- a/drivers/net/smsc911x.h +++ b/drivers/net/smsc911x.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define __SMSC911X_H__ | 22 | #define __SMSC911X_H__ |
23 | 23 | ||
24 | #define TX_FIFO_LOW_THRESHOLD ((u32)1600) | 24 | #define TX_FIFO_LOW_THRESHOLD ((u32)1600) |
25 | #define SMSC911X_EEPROM_SIZE ((u32)7) | 25 | #define SMSC911X_EEPROM_SIZE ((u32)128) |
26 | #define USE_DEBUG 0 | 26 | #define USE_DEBUG 0 |
27 | 27 | ||
28 | /* This is the maximum number of packets to be received every | 28 | /* This is the maximum number of packets to be received every |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 28e1ffb13db9..c78a50586c1d 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -2021,7 +2021,6 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
2021 | de->media_timer.data = (unsigned long) de; | 2021 | de->media_timer.data = (unsigned long) de; |
2022 | 2022 | ||
2023 | netif_carrier_off(dev); | 2023 | netif_carrier_off(dev); |
2024 | netif_stop_queue(dev); | ||
2025 | 2024 | ||
2026 | /* wake up device, assign resources */ | 2025 | /* wake up device, assign resources */ |
2027 | rc = pci_enable_device(pdev); | 2026 | rc = pci_enable_device(pdev); |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index ca7fc9df1ccf..c04d49e31f81 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/usb/usbnet.h> | 45 | #include <linux/usb/usbnet.h> |
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/kernel.h> | 47 | #include <linux/kernel.h> |
48 | #include <linux/pm_runtime.h> | ||
48 | 49 | ||
49 | #define DRIVER_VERSION "22-Aug-2005" | 50 | #define DRIVER_VERSION "22-Aug-2005" |
50 | 51 | ||
@@ -1273,6 +1274,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1273 | struct usb_device *xdev; | 1274 | struct usb_device *xdev; |
1274 | int status; | 1275 | int status; |
1275 | const char *name; | 1276 | const char *name; |
1277 | struct usb_driver *driver = to_usb_driver(udev->dev.driver); | ||
1278 | |||
1279 | /* usbnet already took usb runtime pm, so have to enable the feature | ||
1280 | * for usb interface, otherwise usb_autopm_get_interface may return | ||
1281 | * failure if USB_SUSPEND(RUNTIME_PM) is enabled. | ||
1282 | */ | ||
1283 | if (!driver->supports_autosuspend) { | ||
1284 | driver->supports_autosuspend = 1; | ||
1285 | pm_runtime_enable(&udev->dev); | ||
1286 | } | ||
1276 | 1287 | ||
1277 | name = udev->dev.driver->name; | 1288 | name = udev->dev.driver->name; |
1278 | info = (struct driver_info *) prod->driver_info; | 1289 | info = (struct driver_info *) prod->driver_info; |
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index cb23355f52d3..fbe86ca95802 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
@@ -811,7 +811,6 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) | |||
811 | INFO(dev, "MAC %pM\n", net->dev_addr); | 811 | INFO(dev, "MAC %pM\n", net->dev_addr); |
812 | INFO(dev, "HOST MAC %pM\n", dev->host_mac); | 812 | INFO(dev, "HOST MAC %pM\n", dev->host_mac); |
813 | 813 | ||
814 | netif_stop_queue(net); | ||
815 | the_dev = dev; | 814 | the_dev = dev; |
816 | } | 815 | } |
817 | 816 | ||
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h index 6da573c75d54..8eff83b95366 100644 --- a/include/net/caif/caif_dev.h +++ b/include/net/caif/caif_dev.h | |||
@@ -28,7 +28,7 @@ struct caif_param { | |||
28 | * @sockaddr: Socket address to connect. | 28 | * @sockaddr: Socket address to connect. |
29 | * @priority: Priority of the connection. | 29 | * @priority: Priority of the connection. |
30 | * @link_selector: Link selector (high bandwidth or low latency) | 30 | * @link_selector: Link selector (high bandwidth or low latency) |
31 | * @link_name: Name of the CAIF Link Layer to use. | 31 | * @ifindex: kernel index of the interface. |
32 | * @param: Connect Request parameters (CAIF_SO_REQ_PARAM). | 32 | * @param: Connect Request parameters (CAIF_SO_REQ_PARAM). |
33 | * | 33 | * |
34 | * This struct is used when connecting a CAIF channel. | 34 | * This struct is used when connecting a CAIF channel. |
@@ -39,7 +39,7 @@ struct caif_connect_request { | |||
39 | struct sockaddr_caif sockaddr; | 39 | struct sockaddr_caif sockaddr; |
40 | enum caif_channel_priority priority; | 40 | enum caif_channel_priority priority; |
41 | enum caif_link_selector link_selector; | 41 | enum caif_link_selector link_selector; |
42 | char link_name[16]; | 42 | int ifindex; |
43 | struct caif_param param; | 43 | struct caif_param param; |
44 | }; | 44 | }; |
45 | 45 | ||
diff --git a/include/net/caif/caif_spi.h b/include/net/caif/caif_spi.h index ce4570dff020..87c3d11b8e55 100644 --- a/include/net/caif/caif_spi.h +++ b/include/net/caif/caif_spi.h | |||
@@ -121,6 +121,8 @@ struct cfspi { | |||
121 | wait_queue_head_t wait; | 121 | wait_queue_head_t wait; |
122 | spinlock_t lock; | 122 | spinlock_t lock; |
123 | bool flow_stop; | 123 | bool flow_stop; |
124 | bool slave; | ||
125 | bool slave_talked; | ||
124 | #ifdef CONFIG_DEBUG_FS | 126 | #ifdef CONFIG_DEBUG_FS |
125 | enum cfspi_state dbg_state; | 127 | enum cfspi_state dbg_state; |
126 | u16 pcmd; | 128 | u16 pcmd; |
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h index bd646faffa47..f688478bfb84 100644 --- a/include/net/caif/cfcnfg.h +++ b/include/net/caif/cfcnfg.h | |||
@@ -139,10 +139,10 @@ struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg, | |||
139 | enum cfcnfg_phy_preference phy_pref); | 139 | enum cfcnfg_phy_preference phy_pref); |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer | 142 | * cfcnfg_get_id_from_ifi() - Get the Physical Identifier of ifindex, |
143 | * it matches caif physical id with the kernel interface id. | ||
143 | * @cnfg: Configuration object | 144 | * @cnfg: Configuration object |
144 | * @name: Name of the Physical Layer (Caif Link Layer) | 145 | * @ifi: ifindex obtained from socket.c bindtodevice. |
145 | */ | 146 | */ |
146 | int cfcnfg_get_named(struct cfcnfg *cnfg, char *name); | 147 | int cfcnfg_get_id_from_ifi(struct cfcnfg *cnfg, int ifi); |
147 | |||
148 | #endif /* CFCNFG_H_ */ | 148 | #endif /* CFCNFG_H_ */ |
diff --git a/include/net/netlink.h b/include/net/netlink.h index f3b201d335b3..9801c55de5d6 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -384,7 +384,7 @@ static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen, | |||
384 | * | 384 | * |
385 | * Returns the first attribute which matches the specified type. | 385 | * Returns the first attribute which matches the specified type. |
386 | */ | 386 | */ |
387 | static inline struct nlattr *nlmsg_find_attr(struct nlmsghdr *nlh, | 387 | static inline struct nlattr *nlmsg_find_attr(const struct nlmsghdr *nlh, |
388 | int hdrlen, int attrtype) | 388 | int hdrlen, int attrtype) |
389 | { | 389 | { |
390 | return nla_find(nlmsg_attrdata(nlh, hdrlen), | 390 | return nla_find(nlmsg_attrdata(nlh, hdrlen), |
diff --git a/net/caif/caif_config_util.c b/net/caif/caif_config_util.c index 76ae68303d3a..d522d8c1703e 100644 --- a/net/caif/caif_config_util.c +++ b/net/caif/caif_config_util.c | |||
@@ -16,11 +16,18 @@ int connect_req_to_link_param(struct cfcnfg *cnfg, | |||
16 | { | 16 | { |
17 | struct dev_info *dev_info; | 17 | struct dev_info *dev_info; |
18 | enum cfcnfg_phy_preference pref; | 18 | enum cfcnfg_phy_preference pref; |
19 | int res; | ||
20 | |||
19 | memset(l, 0, sizeof(*l)); | 21 | memset(l, 0, sizeof(*l)); |
20 | l->priority = s->priority; | 22 | /* In caif protocol low value is high priority */ |
23 | l->priority = CAIF_PRIO_MAX - s->priority + 1; | ||
21 | 24 | ||
22 | if (s->link_name[0] != '\0') | 25 | if (s->ifindex != 0){ |
23 | l->phyid = cfcnfg_get_named(cnfg, s->link_name); | 26 | res = cfcnfg_get_id_from_ifi(cnfg, s->ifindex); |
27 | if (res < 0) | ||
28 | return res; | ||
29 | l->phyid = res; | ||
30 | } | ||
24 | else { | 31 | else { |
25 | switch (s->link_selector) { | 32 | switch (s->link_selector) { |
26 | case CAIF_LINK_HIGH_BANDW: | 33 | case CAIF_LINK_HIGH_BANDW: |
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index b99369a055d1..a42a408306e4 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c | |||
@@ -307,6 +307,8 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, | |||
307 | 307 | ||
308 | case NETDEV_UNREGISTER: | 308 | case NETDEV_UNREGISTER: |
309 | caifd = caif_get(dev); | 309 | caifd = caif_get(dev); |
310 | if (caifd == NULL) | ||
311 | break; | ||
310 | netdev_info(dev, "unregister\n"); | 312 | netdev_info(dev, "unregister\n"); |
311 | atomic_set(&caifd->state, what); | 313 | atomic_set(&caifd->state, what); |
312 | caif_device_destroy(dev); | 314 | caif_device_destroy(dev); |
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index 2eca2dd0000f..1bf0cf503796 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
@@ -716,8 +716,7 @@ static int setsockopt(struct socket *sock, | |||
716 | { | 716 | { |
717 | struct sock *sk = sock->sk; | 717 | struct sock *sk = sock->sk; |
718 | struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); | 718 | struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); |
719 | int prio, linksel; | 719 | int linksel; |
720 | struct ifreq ifreq; | ||
721 | 720 | ||
722 | if (cf_sk->sk.sk_socket->state != SS_UNCONNECTED) | 721 | if (cf_sk->sk.sk_socket->state != SS_UNCONNECTED) |
723 | return -ENOPROTOOPT; | 722 | return -ENOPROTOOPT; |
@@ -735,33 +734,6 @@ static int setsockopt(struct socket *sock, | |||
735 | release_sock(&cf_sk->sk); | 734 | release_sock(&cf_sk->sk); |
736 | return 0; | 735 | return 0; |
737 | 736 | ||
738 | case SO_PRIORITY: | ||
739 | if (lvl != SOL_SOCKET) | ||
740 | goto bad_sol; | ||
741 | if (ol < sizeof(int)) | ||
742 | return -EINVAL; | ||
743 | if (copy_from_user(&prio, ov, sizeof(int))) | ||
744 | return -EINVAL; | ||
745 | lock_sock(&(cf_sk->sk)); | ||
746 | cf_sk->conn_req.priority = prio; | ||
747 | release_sock(&cf_sk->sk); | ||
748 | return 0; | ||
749 | |||
750 | case SO_BINDTODEVICE: | ||
751 | if (lvl != SOL_SOCKET) | ||
752 | goto bad_sol; | ||
753 | if (ol < sizeof(struct ifreq)) | ||
754 | return -EINVAL; | ||
755 | if (copy_from_user(&ifreq, ov, sizeof(ifreq))) | ||
756 | return -EFAULT; | ||
757 | lock_sock(&(cf_sk->sk)); | ||
758 | strncpy(cf_sk->conn_req.link_name, ifreq.ifr_name, | ||
759 | sizeof(cf_sk->conn_req.link_name)); | ||
760 | cf_sk->conn_req.link_name | ||
761 | [sizeof(cf_sk->conn_req.link_name)-1] = 0; | ||
762 | release_sock(&cf_sk->sk); | ||
763 | return 0; | ||
764 | |||
765 | case CAIFSO_REQ_PARAM: | 737 | case CAIFSO_REQ_PARAM: |
766 | if (lvl != SOL_CAIF) | 738 | if (lvl != SOL_CAIF) |
767 | goto bad_sol; | 739 | goto bad_sol; |
@@ -880,6 +852,18 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, | |||
880 | sock->state = SS_CONNECTING; | 852 | sock->state = SS_CONNECTING; |
881 | sk->sk_state = CAIF_CONNECTING; | 853 | sk->sk_state = CAIF_CONNECTING; |
882 | 854 | ||
855 | /* Check priority value comming from socket */ | ||
856 | /* if priority value is out of range it will be ajusted */ | ||
857 | if (cf_sk->sk.sk_priority > CAIF_PRIO_MAX) | ||
858 | cf_sk->conn_req.priority = CAIF_PRIO_MAX; | ||
859 | else if (cf_sk->sk.sk_priority < CAIF_PRIO_MIN) | ||
860 | cf_sk->conn_req.priority = CAIF_PRIO_MIN; | ||
861 | else | ||
862 | cf_sk->conn_req.priority = cf_sk->sk.sk_priority; | ||
863 | |||
864 | /*ifindex = id of the interface.*/ | ||
865 | cf_sk->conn_req.ifindex = cf_sk->sk.sk_bound_dev_if; | ||
866 | |||
883 | dbfs_atomic_inc(&cnt.num_connect_req); | 867 | dbfs_atomic_inc(&cnt.num_connect_req); |
884 | cf_sk->layer.receive = caif_sktrecv_cb; | 868 | cf_sk->layer.receive = caif_sktrecv_cb; |
885 | err = caif_connect_client(&cf_sk->conn_req, | 869 | err = caif_connect_client(&cf_sk->conn_req, |
@@ -905,6 +889,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, | |||
905 | cf_sk->maxframe = mtu - (headroom + tailroom); | 889 | cf_sk->maxframe = mtu - (headroom + tailroom); |
906 | if (cf_sk->maxframe < 1) { | 890 | if (cf_sk->maxframe < 1) { |
907 | pr_warn("CAIF Interface MTU too small (%d)\n", dev->mtu); | 891 | pr_warn("CAIF Interface MTU too small (%d)\n", dev->mtu); |
892 | err = -ENODEV; | ||
908 | goto out; | 893 | goto out; |
909 | } | 894 | } |
910 | 895 | ||
@@ -1142,7 +1127,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol, | |||
1142 | set_rx_flow_on(cf_sk); | 1127 | set_rx_flow_on(cf_sk); |
1143 | 1128 | ||
1144 | /* Set default options on configuration */ | 1129 | /* Set default options on configuration */ |
1145 | cf_sk->conn_req.priority = CAIF_PRIO_NORMAL; | 1130 | cf_sk->sk.sk_priority= CAIF_PRIO_NORMAL; |
1146 | cf_sk->conn_req.link_selector = CAIF_LINK_LOW_LATENCY; | 1131 | cf_sk->conn_req.link_selector = CAIF_LINK_LOW_LATENCY; |
1147 | cf_sk->conn_req.protocol = protocol; | 1132 | cf_sk->conn_req.protocol = protocol; |
1148 | /* Increase the number of sockets created. */ | 1133 | /* Increase the number of sockets created. */ |
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index 41adafd18914..21ede141018a 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c | |||
@@ -173,18 +173,15 @@ static struct cfcnfg_phyinfo *cfcnfg_get_phyinfo(struct cfcnfg *cnfg, | |||
173 | return NULL; | 173 | return NULL; |
174 | } | 174 | } |
175 | 175 | ||
176 | int cfcnfg_get_named(struct cfcnfg *cnfg, char *name) | 176 | |
177 | int cfcnfg_get_id_from_ifi(struct cfcnfg *cnfg, int ifi) | ||
177 | { | 178 | { |
178 | int i; | 179 | int i; |
179 | 180 | for (i = 0; i < MAX_PHY_LAYERS; i++) | |
180 | /* Try to match with specified name */ | 181 | if (cnfg->phy_layers[i].frm_layer != NULL && |
181 | for (i = 0; i < MAX_PHY_LAYERS; i++) { | 182 | cnfg->phy_layers[i].ifindex == ifi) |
182 | if (cnfg->phy_layers[i].frm_layer != NULL | 183 | return i; |
183 | && strcmp(cnfg->phy_layers[i].phy_layer->name, | 184 | return -ENODEV; |
184 | name) == 0) | ||
185 | return cnfg->phy_layers[i].frm_layer->id; | ||
186 | } | ||
187 | return 0; | ||
188 | } | 185 | } |
189 | 186 | ||
190 | int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) | 187 | int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) |
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c index 08f267a109aa..3cd8f978e309 100644 --- a/net/caif/cfctrl.c +++ b/net/caif/cfctrl.c | |||
@@ -361,11 +361,10 @@ void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer) | |||
361 | struct cfctrl_request_info *p, *tmp; | 361 | struct cfctrl_request_info *p, *tmp; |
362 | struct cfctrl *ctrl = container_obj(layr); | 362 | struct cfctrl *ctrl = container_obj(layr); |
363 | spin_lock(&ctrl->info_list_lock); | 363 | spin_lock(&ctrl->info_list_lock); |
364 | pr_warn("enter\n"); | ||
365 | 364 | ||
366 | list_for_each_entry_safe(p, tmp, &ctrl->list, list) { | 365 | list_for_each_entry_safe(p, tmp, &ctrl->list, list) { |
367 | if (p->client_layer == adap_layer) { | 366 | if (p->client_layer == adap_layer) { |
368 | pr_warn("cancel req :%d\n", p->sequence_no); | 367 | pr_debug("cancel req :%d\n", p->sequence_no); |
369 | list_del(&p->list); | 368 | list_del(&p->list); |
370 | kfree(p); | 369 | kfree(p); |
371 | } | 370 | } |
diff --git a/net/caif/cfdbgl.c b/net/caif/cfdbgl.c index 496fda9ac66f..11a2af4c162a 100644 --- a/net/caif/cfdbgl.c +++ b/net/caif/cfdbgl.c | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <net/caif/cfsrvl.h> | 12 | #include <net/caif/cfsrvl.h> |
13 | #include <net/caif/cfpkt.h> | 13 | #include <net/caif/cfpkt.h> |
14 | 14 | ||
15 | #define container_obj(layr) ((struct cfsrvl *) layr) | ||
16 | |||
15 | static int cfdbgl_receive(struct cflayer *layr, struct cfpkt *pkt); | 17 | static int cfdbgl_receive(struct cflayer *layr, struct cfpkt *pkt); |
16 | static int cfdbgl_transmit(struct cflayer *layr, struct cfpkt *pkt); | 18 | static int cfdbgl_transmit(struct cflayer *layr, struct cfpkt *pkt); |
17 | 19 | ||
@@ -38,5 +40,17 @@ static int cfdbgl_receive(struct cflayer *layr, struct cfpkt *pkt) | |||
38 | 40 | ||
39 | static int cfdbgl_transmit(struct cflayer *layr, struct cfpkt *pkt) | 41 | static int cfdbgl_transmit(struct cflayer *layr, struct cfpkt *pkt) |
40 | { | 42 | { |
43 | struct cfsrvl *service = container_obj(layr); | ||
44 | struct caif_payload_info *info; | ||
45 | int ret; | ||
46 | |||
47 | if (!cfsrvl_ready(service, &ret)) | ||
48 | return ret; | ||
49 | |||
50 | /* Add info for MUX-layer to route the packet out */ | ||
51 | info = cfpkt_info(pkt); | ||
52 | info->channel_id = service->layer.id; | ||
53 | info->dev_info = &service->dev_info; | ||
54 | |||
41 | return layr->dn->transmit(layr->dn, pkt); | 55 | return layr->dn->transmit(layr->dn, pkt); |
42 | } | 56 | } |
diff --git a/net/caif/cfrfml.c b/net/caif/cfrfml.c index bde8481e8d25..e2fb5fa75795 100644 --- a/net/caif/cfrfml.c +++ b/net/caif/cfrfml.c | |||
@@ -193,7 +193,7 @@ out: | |||
193 | 193 | ||
194 | static int cfrfml_transmit_segment(struct cfrfml *rfml, struct cfpkt *pkt) | 194 | static int cfrfml_transmit_segment(struct cfrfml *rfml, struct cfpkt *pkt) |
195 | { | 195 | { |
196 | caif_assert(cfpkt_getlen(pkt) >= rfml->fragment_size); | 196 | caif_assert(cfpkt_getlen(pkt) < rfml->fragment_size); |
197 | 197 | ||
198 | /* Add info for MUX-layer to route the packet out. */ | 198 | /* Add info for MUX-layer to route the packet out. */ |
199 | cfpkt_info(pkt)->channel_id = rfml->serv.layer.id; | 199 | cfpkt_info(pkt)->channel_id = rfml->serv.layer.id; |
diff --git a/net/core/dev.c b/net/core/dev.c index 35dfb8318483..0dd54a69dace 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2131,7 +2131,7 @@ static struct netdev_queue *dev_pick_tx(struct net_device *dev, | |||
2131 | } else { | 2131 | } else { |
2132 | struct sock *sk = skb->sk; | 2132 | struct sock *sk = skb->sk; |
2133 | queue_index = sk_tx_queue_get(sk); | 2133 | queue_index = sk_tx_queue_get(sk); |
2134 | if (queue_index < 0) { | 2134 | if (queue_index < 0 || queue_index >= dev->real_num_tx_queues) { |
2135 | 2135 | ||
2136 | queue_index = 0; | 2136 | queue_index = 0; |
2137 | if (dev->real_num_tx_queues > 1) | 2137 | if (dev->real_num_tx_queues > 1) |
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h index a29edf2219c8..c079cc0ec651 100644 --- a/net/ipv4/fib_lookup.h +++ b/net/ipv4/fib_lookup.h | |||
@@ -47,11 +47,8 @@ extern int fib_detect_death(struct fib_info *fi, int order, | |||
47 | static inline void fib_result_assign(struct fib_result *res, | 47 | static inline void fib_result_assign(struct fib_result *res, |
48 | struct fib_info *fi) | 48 | struct fib_info *fi) |
49 | { | 49 | { |
50 | if (res->fi != NULL) | 50 | /* we used to play games with refcounts, but we now use RCU */ |
51 | fib_info_put(res->fi); | ||
52 | res->fi = fi; | 51 | res->fi = fi; |
53 | if (fi != NULL) | ||
54 | atomic_inc(&fi->fib_clntref); | ||
55 | } | 52 | } |
56 | 53 | ||
57 | #endif /* _FIB_LOOKUP_H */ | 54 | #endif /* _FIB_LOOKUP_H */ |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index ba8042665849..2ada17129fce 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -490,9 +490,11 @@ static int inet_csk_diag_dump(struct sock *sk, | |||
490 | { | 490 | { |
491 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); | 491 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); |
492 | 492 | ||
493 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { | 493 | if (nlmsg_attrlen(cb->nlh, sizeof(*r))) { |
494 | struct inet_diag_entry entry; | 494 | struct inet_diag_entry entry; |
495 | struct rtattr *bc = (struct rtattr *)(r + 1); | 495 | const struct nlattr *bc = nlmsg_find_attr(cb->nlh, |
496 | sizeof(*r), | ||
497 | INET_DIAG_REQ_BYTECODE); | ||
496 | struct inet_sock *inet = inet_sk(sk); | 498 | struct inet_sock *inet = inet_sk(sk); |
497 | 499 | ||
498 | entry.family = sk->sk_family; | 500 | entry.family = sk->sk_family; |
@@ -512,7 +514,7 @@ static int inet_csk_diag_dump(struct sock *sk, | |||
512 | entry.dport = ntohs(inet->inet_dport); | 514 | entry.dport = ntohs(inet->inet_dport); |
513 | entry.userlocks = sk->sk_userlocks; | 515 | entry.userlocks = sk->sk_userlocks; |
514 | 516 | ||
515 | if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) | 517 | if (!inet_diag_bc_run(nla_data(bc), nla_len(bc), &entry)) |
516 | return 0; | 518 | return 0; |
517 | } | 519 | } |
518 | 520 | ||
@@ -527,9 +529,11 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, | |||
527 | { | 529 | { |
528 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); | 530 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); |
529 | 531 | ||
530 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { | 532 | if (nlmsg_attrlen(cb->nlh, sizeof(*r))) { |
531 | struct inet_diag_entry entry; | 533 | struct inet_diag_entry entry; |
532 | struct rtattr *bc = (struct rtattr *)(r + 1); | 534 | const struct nlattr *bc = nlmsg_find_attr(cb->nlh, |
535 | sizeof(*r), | ||
536 | INET_DIAG_REQ_BYTECODE); | ||
533 | 537 | ||
534 | entry.family = tw->tw_family; | 538 | entry.family = tw->tw_family; |
535 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 539 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
@@ -548,7 +552,7 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, | |||
548 | entry.dport = ntohs(tw->tw_dport); | 552 | entry.dport = ntohs(tw->tw_dport); |
549 | entry.userlocks = 0; | 553 | entry.userlocks = 0; |
550 | 554 | ||
551 | if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) | 555 | if (!inet_diag_bc_run(nla_data(bc), nla_len(bc), &entry)) |
552 | return 0; | 556 | return 0; |
553 | } | 557 | } |
554 | 558 | ||
@@ -618,7 +622,7 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
618 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); | 622 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); |
619 | struct inet_connection_sock *icsk = inet_csk(sk); | 623 | struct inet_connection_sock *icsk = inet_csk(sk); |
620 | struct listen_sock *lopt; | 624 | struct listen_sock *lopt; |
621 | struct rtattr *bc = NULL; | 625 | const struct nlattr *bc = NULL; |
622 | struct inet_sock *inet = inet_sk(sk); | 626 | struct inet_sock *inet = inet_sk(sk); |
623 | int j, s_j; | 627 | int j, s_j; |
624 | int reqnum, s_reqnum; | 628 | int reqnum, s_reqnum; |
@@ -638,8 +642,9 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
638 | if (!lopt || !lopt->qlen) | 642 | if (!lopt || !lopt->qlen) |
639 | goto out; | 643 | goto out; |
640 | 644 | ||
641 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { | 645 | if (nlmsg_attrlen(cb->nlh, sizeof(*r))) { |
642 | bc = (struct rtattr *)(r + 1); | 646 | bc = nlmsg_find_attr(cb->nlh, sizeof(*r), |
647 | INET_DIAG_REQ_BYTECODE); | ||
643 | entry.sport = inet->inet_num; | 648 | entry.sport = inet->inet_num; |
644 | entry.userlocks = sk->sk_userlocks; | 649 | entry.userlocks = sk->sk_userlocks; |
645 | } | 650 | } |
@@ -672,8 +677,8 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
672 | &ireq->rmt_addr; | 677 | &ireq->rmt_addr; |
673 | entry.dport = ntohs(ireq->rmt_port); | 678 | entry.dport = ntohs(ireq->rmt_port); |
674 | 679 | ||
675 | if (!inet_diag_bc_run(RTA_DATA(bc), | 680 | if (!inet_diag_bc_run(nla_data(bc), |
676 | RTA_PAYLOAD(bc), &entry)) | 681 | nla_len(bc), &entry)) |
677 | continue; | 682 | continue; |
678 | } | 683 | } |
679 | 684 | ||
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 3cad2591ace0..3fac340a28d5 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -927,6 +927,7 @@ static int get_info(struct net *net, void __user *user, | |||
927 | private = &tmp; | 927 | private = &tmp; |
928 | } | 928 | } |
929 | #endif | 929 | #endif |
930 | memset(&info, 0, sizeof(info)); | ||
930 | info.valid_hooks = t->valid_hooks; | 931 | info.valid_hooks = t->valid_hooks; |
931 | memcpy(info.hook_entry, private->hook_entry, | 932 | memcpy(info.hook_entry, private->hook_entry, |
932 | sizeof(info.hook_entry)); | 933 | sizeof(info.hook_entry)); |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index d31b007a6d80..a846d633b3b6 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -1124,6 +1124,7 @@ static int get_info(struct net *net, void __user *user, | |||
1124 | private = &tmp; | 1124 | private = &tmp; |
1125 | } | 1125 | } |
1126 | #endif | 1126 | #endif |
1127 | memset(&info, 0, sizeof(info)); | ||
1127 | info.valid_hooks = t->valid_hooks; | 1128 | info.valid_hooks = t->valid_hooks; |
1128 | memcpy(info.hook_entry, private->hook_entry, | 1129 | memcpy(info.hook_entry, private->hook_entry, |
1129 | sizeof(info.hook_entry)); | 1130 | sizeof(info.hook_entry)); |
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 295c97431e43..c04787ce1a71 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -47,26 +47,6 @@ __nf_nat_proto_find(u_int8_t protonum) | |||
47 | return rcu_dereference(nf_nat_protos[protonum]); | 47 | return rcu_dereference(nf_nat_protos[protonum]); |
48 | } | 48 | } |
49 | 49 | ||
50 | static const struct nf_nat_protocol * | ||
51 | nf_nat_proto_find_get(u_int8_t protonum) | ||
52 | { | ||
53 | const struct nf_nat_protocol *p; | ||
54 | |||
55 | rcu_read_lock(); | ||
56 | p = __nf_nat_proto_find(protonum); | ||
57 | if (!try_module_get(p->me)) | ||
58 | p = &nf_nat_unknown_protocol; | ||
59 | rcu_read_unlock(); | ||
60 | |||
61 | return p; | ||
62 | } | ||
63 | |||
64 | static void | ||
65 | nf_nat_proto_put(const struct nf_nat_protocol *p) | ||
66 | { | ||
67 | module_put(p->me); | ||
68 | } | ||
69 | |||
70 | /* We keep an extra hash for each conntrack, for fast searching. */ | 50 | /* We keep an extra hash for each conntrack, for fast searching. */ |
71 | static inline unsigned int | 51 | static inline unsigned int |
72 | hash_by_src(const struct net *net, u16 zone, | 52 | hash_by_src(const struct net *net, u16 zone, |
@@ -588,6 +568,26 @@ static struct nf_ct_ext_type nat_extend __read_mostly = { | |||
588 | #include <linux/netfilter/nfnetlink.h> | 568 | #include <linux/netfilter/nfnetlink.h> |
589 | #include <linux/netfilter/nfnetlink_conntrack.h> | 569 | #include <linux/netfilter/nfnetlink_conntrack.h> |
590 | 570 | ||
571 | static const struct nf_nat_protocol * | ||
572 | nf_nat_proto_find_get(u_int8_t protonum) | ||
573 | { | ||
574 | const struct nf_nat_protocol *p; | ||
575 | |||
576 | rcu_read_lock(); | ||
577 | p = __nf_nat_proto_find(protonum); | ||
578 | if (!try_module_get(p->me)) | ||
579 | p = &nf_nat_unknown_protocol; | ||
580 | rcu_read_unlock(); | ||
581 | |||
582 | return p; | ||
583 | } | ||
584 | |||
585 | static void | ||
586 | nf_nat_proto_put(const struct nf_nat_protocol *p) | ||
587 | { | ||
588 | module_put(p->me); | ||
589 | } | ||
590 | |||
591 | static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = { | 591 | static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = { |
592 | [CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 }, | 592 | [CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 }, |
593 | [CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 }, | 593 | [CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 }, |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 51df035897e7..455582384ece 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -1137,6 +1137,7 @@ static int get_info(struct net *net, void __user *user, | |||
1137 | private = &tmp; | 1137 | private = &tmp; |
1138 | } | 1138 | } |
1139 | #endif | 1139 | #endif |
1140 | memset(&info, 0, sizeof(info)); | ||
1140 | info.valid_hooks = t->valid_hooks; | 1141 | info.valid_hooks = t->valid_hooks; |
1141 | memcpy(info.hook_entry, private->hook_entry, | 1142 | memcpy(info.hook_entry, private->hook_entry, |
1142 | sizeof(info.hook_entry)); | 1143 | sizeof(info.hook_entry)); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 25661f968f3f..fc328339be99 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2741,6 +2741,7 @@ static void __net_exit ip6_route_net_exit(struct net *net) | |||
2741 | kfree(net->ipv6.ip6_prohibit_entry); | 2741 | kfree(net->ipv6.ip6_prohibit_entry); |
2742 | kfree(net->ipv6.ip6_blk_hole_entry); | 2742 | kfree(net->ipv6.ip6_blk_hole_entry); |
2743 | #endif | 2743 | #endif |
2744 | dst_entries_destroy(&net->ipv6.ip6_dst_ops); | ||
2744 | } | 2745 | } |
2745 | 2746 | ||
2746 | static struct pernet_operations ip6_route_net_ops = { | 2747 | static struct pernet_operations ip6_route_net_ops = { |
@@ -2832,5 +2833,6 @@ void ip6_route_cleanup(void) | |||
2832 | xfrm6_fini(); | 2833 | xfrm6_fini(); |
2833 | fib6_gc_cleanup(); | 2834 | fib6_gc_cleanup(); |
2834 | unregister_pernet_subsys(&ip6_route_net_ops); | 2835 | unregister_pernet_subsys(&ip6_route_net_ops); |
2836 | dst_entries_destroy(&ip6_dst_blackhole_ops); | ||
2835 | kmem_cache_destroy(ip6_dst_ops_template.kmem_cachep); | 2837 | kmem_cache_destroy(ip6_dst_ops_template.kmem_cachep); |
2836 | } | 2838 | } |
diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c index 104ec3b283d4..b8dbae82fab8 100644 --- a/net/l2tp/l2tp_debugfs.c +++ b/net/l2tp/l2tp_debugfs.c | |||
@@ -249,7 +249,7 @@ static int l2tp_dfs_seq_open(struct inode *inode, struct file *file) | |||
249 | struct seq_file *seq; | 249 | struct seq_file *seq; |
250 | int rc = -ENOMEM; | 250 | int rc = -ENOMEM; |
251 | 251 | ||
252 | pd = kzalloc(GFP_KERNEL, sizeof(*pd)); | 252 | pd = kzalloc(sizeof(*pd), GFP_KERNEL); |
253 | if (pd == NULL) | 253 | if (pd == NULL) |
254 | goto out; | 254 | goto out; |
255 | 255 | ||
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 1eacf8d9966a..27a5ea6b6a0f 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1312,7 +1312,8 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls) | |||
1312 | if (!hash) { | 1312 | if (!hash) { |
1313 | *vmalloced = 1; | 1313 | *vmalloced = 1; |
1314 | printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n"); | 1314 | printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n"); |
1315 | hash = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); | 1315 | hash = __vmalloc(sz, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, |
1316 | PAGE_KERNEL); | ||
1316 | } | 1317 | } |
1317 | 1318 | ||
1318 | if (hash && nulls) | 1319 | if (hash && nulls) |
diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c index ed6d92958023..dc7bb74110df 100644 --- a/net/netfilter/nf_conntrack_proto.c +++ b/net/netfilter/nf_conntrack_proto.c | |||
@@ -292,6 +292,12 @@ int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *l4proto) | |||
292 | 292 | ||
293 | for (i = 0; i < MAX_NF_CT_PROTO; i++) | 293 | for (i = 0; i < MAX_NF_CT_PROTO; i++) |
294 | proto_array[i] = &nf_conntrack_l4proto_generic; | 294 | proto_array[i] = &nf_conntrack_l4proto_generic; |
295 | |||
296 | /* Before making proto_array visible to lockless readers, | ||
297 | * we must make sure its content is committed to memory. | ||
298 | */ | ||
299 | smp_wmb(); | ||
300 | |||
295 | nf_ct_protos[l4proto->l3proto] = proto_array; | 301 | nf_ct_protos[l4proto->l3proto] = proto_array; |
296 | } else if (nf_ct_protos[l4proto->l3proto][l4proto->l4proto] != | 302 | } else if (nf_ct_protos[l4proto->l3proto][l4proto->l4proto] != |
297 | &nf_conntrack_l4proto_generic) { | 303 | &nf_conntrack_l4proto_generic) { |
diff --git a/net/rds/loop.c b/net/rds/loop.c index c390156b426f..aeec1d483b17 100644 --- a/net/rds/loop.c +++ b/net/rds/loop.c | |||
@@ -134,8 +134,12 @@ static int rds_loop_conn_alloc(struct rds_connection *conn, gfp_t gfp) | |||
134 | static void rds_loop_conn_free(void *arg) | 134 | static void rds_loop_conn_free(void *arg) |
135 | { | 135 | { |
136 | struct rds_loop_connection *lc = arg; | 136 | struct rds_loop_connection *lc = arg; |
137 | unsigned long flags; | ||
138 | |||
137 | rdsdebug("lc %p\n", lc); | 139 | rdsdebug("lc %p\n", lc); |
140 | spin_lock_irqsave(&loop_conns_lock, flags); | ||
138 | list_del(&lc->loop_node); | 141 | list_del(&lc->loop_node); |
142 | spin_unlock_irqrestore(&loop_conns_lock, flags); | ||
139 | kfree(lc); | 143 | kfree(lc); |
140 | } | 144 | } |
141 | 145 | ||
diff --git a/net/rds/tcp.c b/net/rds/tcp.c index 08a8c6cf2d10..8e0a32001c90 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c | |||
@@ -221,7 +221,13 @@ static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp) | |||
221 | static void rds_tcp_conn_free(void *arg) | 221 | static void rds_tcp_conn_free(void *arg) |
222 | { | 222 | { |
223 | struct rds_tcp_connection *tc = arg; | 223 | struct rds_tcp_connection *tc = arg; |
224 | unsigned long flags; | ||
224 | rdsdebug("freeing tc %p\n", tc); | 225 | rdsdebug("freeing tc %p\n", tc); |
226 | |||
227 | spin_lock_irqsave(&rds_tcp_conn_lock, flags); | ||
228 | list_del(&tc->t_tcp_node); | ||
229 | spin_unlock_irqrestore(&rds_tcp_conn_lock, flags); | ||
230 | |||
225 | kmem_cache_free(rds_tcp_conn_slab, tc); | 231 | kmem_cache_free(rds_tcp_conn_slab, tc); |
226 | } | 232 | } |
227 | 233 | ||
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 37dff78e9cb1..d49c40fb7e09 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -34,8 +34,6 @@ struct cgroup_subsys net_cls_subsys = { | |||
34 | .populate = cgrp_populate, | 34 | .populate = cgrp_populate, |
35 | #ifdef CONFIG_NET_CLS_CGROUP | 35 | #ifdef CONFIG_NET_CLS_CGROUP |
36 | .subsys_id = net_cls_subsys_id, | 36 | .subsys_id = net_cls_subsys_id, |
37 | #else | ||
38 | #define net_cls_subsys_id net_cls_subsys.subsys_id | ||
39 | #endif | 37 | #endif |
40 | .module = THIS_MODULE, | 38 | .module = THIS_MODULE, |
41 | }; | 39 | }; |
diff --git a/net/sched/em_text.c b/net/sched/em_text.c index 763253257411..ea8f566e720c 100644 --- a/net/sched/em_text.c +++ b/net/sched/em_text.c | |||
@@ -103,7 +103,8 @@ retry: | |||
103 | 103 | ||
104 | static void em_text_destroy(struct tcf_proto *tp, struct tcf_ematch *m) | 104 | static void em_text_destroy(struct tcf_proto *tp, struct tcf_ematch *m) |
105 | { | 105 | { |
106 | textsearch_destroy(EM_TEXT_PRIV(m)->config); | 106 | if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config) |
107 | textsearch_destroy(EM_TEXT_PRIV(m)->config); | ||
107 | } | 108 | } |
108 | 109 | ||
109 | static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m) | 110 | static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m) |
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c index 771bab00754b..3a8c4c419cd4 100644 --- a/net/x25/x25_facilities.c +++ b/net/x25/x25_facilities.c | |||
@@ -134,15 +134,15 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
134 | case X25_FAC_CLASS_D: | 134 | case X25_FAC_CLASS_D: |
135 | switch (*p) { | 135 | switch (*p) { |
136 | case X25_FAC_CALLING_AE: | 136 | case X25_FAC_CALLING_AE: |
137 | if (p[1] > X25_MAX_DTE_FACIL_LEN) | 137 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
138 | break; | 138 | return 0; |
139 | dte_facs->calling_len = p[2]; | 139 | dte_facs->calling_len = p[2]; |
140 | memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); | 140 | memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); |
141 | *vc_fac_mask |= X25_MASK_CALLING_AE; | 141 | *vc_fac_mask |= X25_MASK_CALLING_AE; |
142 | break; | 142 | break; |
143 | case X25_FAC_CALLED_AE: | 143 | case X25_FAC_CALLED_AE: |
144 | if (p[1] > X25_MAX_DTE_FACIL_LEN) | 144 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
145 | break; | 145 | return 0; |
146 | dte_facs->called_len = p[2]; | 146 | dte_facs->called_len = p[2]; |
147 | memcpy(dte_facs->called_ae, &p[3], p[1] - 1); | 147 | memcpy(dte_facs->called_ae, &p[3], p[1] - 1); |
148 | *vc_fac_mask |= X25_MASK_CALLED_AE; | 148 | *vc_fac_mask |= X25_MASK_CALLED_AE; |
diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c index 63178961efac..f729f022be69 100644 --- a/net/x25/x25_in.c +++ b/net/x25/x25_in.c | |||
@@ -119,6 +119,8 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp | |||
119 | &x25->vc_facil_mask); | 119 | &x25->vc_facil_mask); |
120 | if (len > 0) | 120 | if (len > 0) |
121 | skb_pull(skb, len); | 121 | skb_pull(skb, len); |
122 | else | ||
123 | return -1; | ||
122 | /* | 124 | /* |
123 | * Copy any Call User Data. | 125 | * Copy any Call User Data. |
124 | */ | 126 | */ |