diff options
75 files changed, 679 insertions, 360 deletions
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c index bd00dceacaf0..bde3c88b8b27 100644 --- a/drivers/isdn/capi/kcapi.c +++ b/drivers/isdn/capi/kcapi.c | |||
@@ -1147,6 +1147,12 @@ load_unlock_out: | |||
1147 | if (ctr->state == CAPI_CTR_DETECTED) | 1147 | if (ctr->state == CAPI_CTR_DETECTED) |
1148 | goto reset_unlock_out; | 1148 | goto reset_unlock_out; |
1149 | 1149 | ||
1150 | if (ctr->reset_ctr == NULL) { | ||
1151 | printk(KERN_DEBUG "kcapi: reset: no reset function\n"); | ||
1152 | retval = -ESRCH; | ||
1153 | goto reset_unlock_out; | ||
1154 | } | ||
1155 | |||
1150 | ctr->reset_ctr(ctr); | 1156 | ctr->reset_ctr(ctr); |
1151 | 1157 | ||
1152 | retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED); | 1158 | retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED); |
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c index ac4cfeed3946..8f78f15c8ef7 100644 --- a/drivers/isdn/gigaset/capi.c +++ b/drivers/isdn/gigaset/capi.c | |||
@@ -922,30 +922,6 @@ void gigaset_isdn_stop(struct cardstate *cs) | |||
922 | */ | 922 | */ |
923 | 923 | ||
924 | /* | 924 | /* |
925 | * load firmware | ||
926 | */ | ||
927 | static int gigaset_load_firmware(struct capi_ctr *ctr, capiloaddata *data) | ||
928 | { | ||
929 | struct cardstate *cs = ctr->driverdata; | ||
930 | |||
931 | /* AVM specific operation, not needed for Gigaset -- ignore */ | ||
932 | dev_notice(cs->dev, "load_firmware ignored\n"); | ||
933 | |||
934 | return 0; | ||
935 | } | ||
936 | |||
937 | /* | ||
938 | * reset (deactivate) controller | ||
939 | */ | ||
940 | static void gigaset_reset_ctr(struct capi_ctr *ctr) | ||
941 | { | ||
942 | struct cardstate *cs = ctr->driverdata; | ||
943 | |||
944 | /* AVM specific operation, not needed for Gigaset -- ignore */ | ||
945 | dev_notice(cs->dev, "reset_ctr ignored\n"); | ||
946 | } | ||
947 | |||
948 | /* | ||
949 | * register CAPI application | 925 | * register CAPI application |
950 | */ | 926 | */ |
951 | static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl, | 927 | static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl, |
@@ -2202,8 +2178,8 @@ int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid) | |||
2202 | iif->ctr.driverdata = cs; | 2178 | iif->ctr.driverdata = cs; |
2203 | strncpy(iif->ctr.name, isdnid, sizeof(iif->ctr.name)); | 2179 | strncpy(iif->ctr.name, isdnid, sizeof(iif->ctr.name)); |
2204 | iif->ctr.driver_name = "gigaset"; | 2180 | iif->ctr.driver_name = "gigaset"; |
2205 | iif->ctr.load_firmware = gigaset_load_firmware; | 2181 | iif->ctr.load_firmware = NULL; |
2206 | iif->ctr.reset_ctr = gigaset_reset_ctr; | 2182 | iif->ctr.reset_ctr = NULL; |
2207 | iif->ctr.register_appl = gigaset_register_appl; | 2183 | iif->ctr.register_appl = gigaset_register_appl; |
2208 | iif->ctr.release_appl = gigaset_release_appl; | 2184 | iif->ctr.release_appl = gigaset_release_appl; |
2209 | iif->ctr.send_message = gigaset_send_message; | 2185 | iif->ctr.send_message = gigaset_send_message; |
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 373c1a563474..b46be490cd2a 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -283,6 +283,8 @@ struct be_adapter { | |||
283 | u8 port_type; | 283 | u8 port_type; |
284 | u8 transceiver; | 284 | u8 transceiver; |
285 | u8 generation; /* BladeEngine ASIC generation */ | 285 | u8 generation; /* BladeEngine ASIC generation */ |
286 | u32 flash_status; | ||
287 | struct completion flash_compl; | ||
286 | 288 | ||
287 | bool sriov_enabled; | 289 | bool sriov_enabled; |
288 | u32 vf_if_handle[BE_MAX_VF]; | 290 | u32 vf_if_handle[BE_MAX_VF]; |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index e79bf8b9af3b..c911bfb55b19 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -59,6 +59,13 @@ static int be_mcc_compl_process(struct be_adapter *adapter, | |||
59 | 59 | ||
60 | compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) & | 60 | compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) & |
61 | CQE_STATUS_COMPL_MASK; | 61 | CQE_STATUS_COMPL_MASK; |
62 | |||
63 | if ((compl->tag0 == OPCODE_COMMON_WRITE_FLASHROM) && | ||
64 | (compl->tag1 == CMD_SUBSYSTEM_COMMON)) { | ||
65 | adapter->flash_status = compl_status; | ||
66 | complete(&adapter->flash_compl); | ||
67 | } | ||
68 | |||
62 | if (compl_status == MCC_STATUS_SUCCESS) { | 69 | if (compl_status == MCC_STATUS_SUCCESS) { |
63 | if (compl->tag0 == OPCODE_ETH_GET_STATISTICS) { | 70 | if (compl->tag0 == OPCODE_ETH_GET_STATISTICS) { |
64 | struct be_cmd_resp_get_stats *resp = | 71 | struct be_cmd_resp_get_stats *resp = |
@@ -1417,6 +1424,7 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, | |||
1417 | int status; | 1424 | int status; |
1418 | 1425 | ||
1419 | spin_lock_bh(&adapter->mcc_lock); | 1426 | spin_lock_bh(&adapter->mcc_lock); |
1427 | adapter->flash_status = 0; | ||
1420 | 1428 | ||
1421 | wrb = wrb_from_mccq(adapter); | 1429 | wrb = wrb_from_mccq(adapter); |
1422 | if (!wrb) { | 1430 | if (!wrb) { |
@@ -1428,6 +1436,7 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, | |||
1428 | 1436 | ||
1429 | be_wrb_hdr_prepare(wrb, cmd->size, false, 1, | 1437 | be_wrb_hdr_prepare(wrb, cmd->size, false, 1, |
1430 | OPCODE_COMMON_WRITE_FLASHROM); | 1438 | OPCODE_COMMON_WRITE_FLASHROM); |
1439 | wrb->tag1 = CMD_SUBSYSTEM_COMMON; | ||
1431 | 1440 | ||
1432 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, | 1441 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, |
1433 | OPCODE_COMMON_WRITE_FLASHROM, cmd->size); | 1442 | OPCODE_COMMON_WRITE_FLASHROM, cmd->size); |
@@ -1439,10 +1448,16 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, | |||
1439 | req->params.op_code = cpu_to_le32(flash_opcode); | 1448 | req->params.op_code = cpu_to_le32(flash_opcode); |
1440 | req->params.data_buf_size = cpu_to_le32(buf_size); | 1449 | req->params.data_buf_size = cpu_to_le32(buf_size); |
1441 | 1450 | ||
1442 | status = be_mcc_notify_wait(adapter); | 1451 | be_mcc_notify(adapter); |
1452 | spin_unlock_bh(&adapter->mcc_lock); | ||
1453 | |||
1454 | if (!wait_for_completion_timeout(&adapter->flash_compl, | ||
1455 | msecs_to_jiffies(12000))) | ||
1456 | status = -1; | ||
1457 | else | ||
1458 | status = adapter->flash_status; | ||
1443 | 1459 | ||
1444 | err: | 1460 | err: |
1445 | spin_unlock_bh(&adapter->mcc_lock); | ||
1446 | return status; | 1461 | return status; |
1447 | } | 1462 | } |
1448 | 1463 | ||
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 058d7f95f5ae..aa065c71ddd8 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -2319,6 +2319,7 @@ static int be_ctrl_init(struct be_adapter *adapter) | |||
2319 | spin_lock_init(&adapter->mcc_lock); | 2319 | spin_lock_init(&adapter->mcc_lock); |
2320 | spin_lock_init(&adapter->mcc_cq_lock); | 2320 | spin_lock_init(&adapter->mcc_cq_lock); |
2321 | 2321 | ||
2322 | init_completion(&adapter->flash_compl); | ||
2322 | pci_save_state(adapter->pdev); | 2323 | pci_save_state(adapter->pdev); |
2323 | return 0; | 2324 | return 0; |
2324 | 2325 | ||
@@ -2487,10 +2488,6 @@ static int __devinit be_probe(struct pci_dev *pdev, | |||
2487 | status = be_cmd_POST(adapter); | 2488 | status = be_cmd_POST(adapter); |
2488 | if (status) | 2489 | if (status) |
2489 | goto ctrl_clean; | 2490 | goto ctrl_clean; |
2490 | |||
2491 | status = be_cmd_reset_function(adapter); | ||
2492 | if (status) | ||
2493 | goto ctrl_clean; | ||
2494 | } | 2491 | } |
2495 | 2492 | ||
2496 | /* tell fw we're ready to fire cmds */ | 2493 | /* tell fw we're ready to fire cmds */ |
@@ -2498,6 +2495,12 @@ static int __devinit be_probe(struct pci_dev *pdev, | |||
2498 | if (status) | 2495 | if (status) |
2499 | goto ctrl_clean; | 2496 | goto ctrl_clean; |
2500 | 2497 | ||
2498 | if (be_physfn(adapter)) { | ||
2499 | status = be_cmd_reset_function(adapter); | ||
2500 | if (status) | ||
2501 | goto ctrl_clean; | ||
2502 | } | ||
2503 | |||
2501 | status = be_stats_init(adapter); | 2504 | status = be_stats_init(adapter); |
2502 | if (status) | 2505 | if (status) |
2503 | goto ctrl_clean; | 2506 | goto ctrl_clean; |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 39a54bad397f..368f33313fb6 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -1626,6 +1626,7 @@ static int __devinit bfin_mii_bus_probe(struct platform_device *pdev) | |||
1626 | return 0; | 1626 | return 0; |
1627 | 1627 | ||
1628 | out_err_mdiobus_register: | 1628 | out_err_mdiobus_register: |
1629 | kfree(miibus->irq); | ||
1629 | mdiobus_free(miibus); | 1630 | mdiobus_free(miibus); |
1630 | out_err_alloc: | 1631 | out_err_alloc: |
1631 | peripheral_free_list(pin_req); | 1632 | peripheral_free_list(pin_req); |
@@ -1638,6 +1639,7 @@ static int __devexit bfin_mii_bus_remove(struct platform_device *pdev) | |||
1638 | struct mii_bus *miibus = platform_get_drvdata(pdev); | 1639 | struct mii_bus *miibus = platform_get_drvdata(pdev); |
1639 | platform_set_drvdata(pdev, NULL); | 1640 | platform_set_drvdata(pdev, NULL); |
1640 | mdiobus_unregister(miibus); | 1641 | mdiobus_unregister(miibus); |
1642 | kfree(miibus->irq); | ||
1641 | mdiobus_free(miibus); | 1643 | mdiobus_free(miibus); |
1642 | peripheral_free_list(pin_req); | 1644 | peripheral_free_list(pin_req); |
1643 | return 0; | 1645 | return 0; |
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 85f7cbfe8e5f..0a8de01d52f7 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -599,6 +599,8 @@ struct net_device *alloc_sja1000dev(int sizeof_priv) | |||
599 | priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | | 599 | priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | |
600 | CAN_CTRLMODE_BERR_REPORTING; | 600 | CAN_CTRLMODE_BERR_REPORTING; |
601 | 601 | ||
602 | spin_lock_init(&priv->cmdreg_lock); | ||
603 | |||
602 | if (sizeof_priv) | 604 | if (sizeof_priv) |
603 | priv->priv = (void *)priv + sizeof(struct sja1000_priv); | 605 | priv->priv = (void *)priv + sizeof(struct sja1000_priv); |
604 | 606 | ||
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index e125113759a5..6586b5c7e4b6 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c | |||
@@ -1034,9 +1034,10 @@ static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac, | |||
1034 | { | 1034 | { |
1035 | struct vic_provinfo *vp; | 1035 | struct vic_provinfo *vp; |
1036 | u8 oui[3] = VIC_PROVINFO_CISCO_OUI; | 1036 | u8 oui[3] = VIC_PROVINFO_CISCO_OUI; |
1037 | unsigned short *uuid; | 1037 | u8 *uuid; |
1038 | char uuid_str[38]; | 1038 | char uuid_str[38]; |
1039 | static char *uuid_fmt = "%04X%04X-%04X-%04X-%04X-%04X%04X%04X"; | 1039 | static char *uuid_fmt = "%02X%02X%02X%02X-%02X%02X-%02X%02X-" |
1040 | "%02X%02X-%02X%02X%02X%02X%0X%02X"; | ||
1040 | int err; | 1041 | int err; |
1041 | 1042 | ||
1042 | if (!name) | 1043 | if (!name) |
@@ -1058,20 +1059,24 @@ static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac, | |||
1058 | ETH_ALEN, mac); | 1059 | ETH_ALEN, mac); |
1059 | 1060 | ||
1060 | if (instance_uuid) { | 1061 | if (instance_uuid) { |
1061 | uuid = (unsigned short *)instance_uuid; | 1062 | uuid = instance_uuid; |
1062 | sprintf(uuid_str, uuid_fmt, | 1063 | sprintf(uuid_str, uuid_fmt, |
1063 | uuid[0], uuid[1], uuid[2], uuid[3], | 1064 | uuid[0], uuid[1], uuid[2], uuid[3], |
1064 | uuid[4], uuid[5], uuid[6], uuid[7]); | 1065 | uuid[4], uuid[5], uuid[6], uuid[7], |
1066 | uuid[8], uuid[9], uuid[10], uuid[11], | ||
1067 | uuid[12], uuid[13], uuid[14], uuid[15]); | ||
1065 | vic_provinfo_add_tlv(vp, | 1068 | vic_provinfo_add_tlv(vp, |
1066 | VIC_LINUX_PROV_TLV_CLIENT_UUID_STR, | 1069 | VIC_LINUX_PROV_TLV_CLIENT_UUID_STR, |
1067 | sizeof(uuid_str), uuid_str); | 1070 | sizeof(uuid_str), uuid_str); |
1068 | } | 1071 | } |
1069 | 1072 | ||
1070 | if (host_uuid) { | 1073 | if (host_uuid) { |
1071 | uuid = (unsigned short *)host_uuid; | 1074 | uuid = host_uuid; |
1072 | sprintf(uuid_str, uuid_fmt, | 1075 | sprintf(uuid_str, uuid_fmt, |
1073 | uuid[0], uuid[1], uuid[2], uuid[3], | 1076 | uuid[0], uuid[1], uuid[2], uuid[3], |
1074 | uuid[4], uuid[5], uuid[6], uuid[7]); | 1077 | uuid[4], uuid[5], uuid[6], uuid[7], |
1078 | uuid[8], uuid[9], uuid[10], uuid[11], | ||
1079 | uuid[12], uuid[13], uuid[14], uuid[15]); | ||
1075 | vic_provinfo_add_tlv(vp, | 1080 | vic_provinfo_add_tlv(vp, |
1076 | VIC_LINUX_PROV_TLV_HOST_UUID_STR, | 1081 | VIC_LINUX_PROV_TLV_HOST_UUID_STR, |
1077 | sizeof(uuid_str), uuid_str); | 1082 | sizeof(uuid_str), uuid_str); |
@@ -1127,6 +1132,14 @@ static int enic_set_vf_port(struct net_device *netdev, int vf, | |||
1127 | switch (request) { | 1132 | switch (request) { |
1128 | case PORT_REQUEST_ASSOCIATE: | 1133 | case PORT_REQUEST_ASSOCIATE: |
1129 | 1134 | ||
1135 | /* If the interface mac addr hasn't been assigned, | ||
1136 | * assign a random mac addr before setting port- | ||
1137 | * profile. | ||
1138 | */ | ||
1139 | |||
1140 | if (is_zero_ether_addr(netdev->dev_addr)) | ||
1141 | random_ether_addr(netdev->dev_addr); | ||
1142 | |||
1130 | if (port[IFLA_PORT_PROFILE]) | 1143 | if (port[IFLA_PORT_PROFILE]) |
1131 | name = nla_data(port[IFLA_PORT_PROFILE]); | 1144 | name = nla_data(port[IFLA_PORT_PROFILE]); |
1132 | 1145 | ||
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index 14cbde5cf68e..6ed2df14ec84 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c | |||
@@ -174,6 +174,7 @@ MODULE_PARM_DESC(buffer_size, "DMA buffer allocation size"); | |||
174 | * @iobase: pointer to I/O memory region | 174 | * @iobase: pointer to I/O memory region |
175 | * @membase: pointer to buffer memory region | 175 | * @membase: pointer to buffer memory region |
176 | * @dma_alloc: dma allocated buffer size | 176 | * @dma_alloc: dma allocated buffer size |
177 | * @io_region_size: I/O memory region size | ||
177 | * @num_tx: number of send buffers | 178 | * @num_tx: number of send buffers |
178 | * @cur_tx: last send buffer written | 179 | * @cur_tx: last send buffer written |
179 | * @dty_tx: last buffer actually sent | 180 | * @dty_tx: last buffer actually sent |
@@ -193,6 +194,7 @@ struct ethoc { | |||
193 | void __iomem *iobase; | 194 | void __iomem *iobase; |
194 | void __iomem *membase; | 195 | void __iomem *membase; |
195 | int dma_alloc; | 196 | int dma_alloc; |
197 | resource_size_t io_region_size; | ||
196 | 198 | ||
197 | unsigned int num_tx; | 199 | unsigned int num_tx; |
198 | unsigned int cur_tx; | 200 | unsigned int cur_tx; |
@@ -943,6 +945,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
943 | priv = netdev_priv(netdev); | 945 | priv = netdev_priv(netdev); |
944 | priv->netdev = netdev; | 946 | priv->netdev = netdev; |
945 | priv->dma_alloc = 0; | 947 | priv->dma_alloc = 0; |
948 | priv->io_region_size = mmio->end - mmio->start + 1; | ||
946 | 949 | ||
947 | priv->iobase = devm_ioremap_nocache(&pdev->dev, netdev->base_addr, | 950 | priv->iobase = devm_ioremap_nocache(&pdev->dev, netdev->base_addr, |
948 | resource_size(mmio)); | 951 | resource_size(mmio)); |
@@ -1047,20 +1050,34 @@ static int ethoc_probe(struct platform_device *pdev) | |||
1047 | ret = register_netdev(netdev); | 1050 | ret = register_netdev(netdev); |
1048 | if (ret < 0) { | 1051 | if (ret < 0) { |
1049 | dev_err(&netdev->dev, "failed to register interface\n"); | 1052 | dev_err(&netdev->dev, "failed to register interface\n"); |
1050 | goto error; | 1053 | goto error2; |
1051 | } | 1054 | } |
1052 | 1055 | ||
1053 | goto out; | 1056 | goto out; |
1054 | 1057 | ||
1058 | error2: | ||
1059 | netif_napi_del(&priv->napi); | ||
1055 | error: | 1060 | error: |
1056 | mdiobus_unregister(priv->mdio); | 1061 | mdiobus_unregister(priv->mdio); |
1057 | free_mdio: | 1062 | free_mdio: |
1058 | kfree(priv->mdio->irq); | 1063 | kfree(priv->mdio->irq); |
1059 | mdiobus_free(priv->mdio); | 1064 | mdiobus_free(priv->mdio); |
1060 | free: | 1065 | free: |
1061 | if (priv->dma_alloc) | 1066 | if (priv) { |
1062 | dma_free_coherent(NULL, priv->dma_alloc, priv->membase, | 1067 | if (priv->dma_alloc) |
1063 | netdev->mem_start); | 1068 | dma_free_coherent(NULL, priv->dma_alloc, priv->membase, |
1069 | netdev->mem_start); | ||
1070 | else if (priv->membase) | ||
1071 | devm_iounmap(&pdev->dev, priv->membase); | ||
1072 | if (priv->iobase) | ||
1073 | devm_iounmap(&pdev->dev, priv->iobase); | ||
1074 | } | ||
1075 | if (mem) | ||
1076 | devm_release_mem_region(&pdev->dev, mem->start, | ||
1077 | mem->end - mem->start + 1); | ||
1078 | if (mmio) | ||
1079 | devm_release_mem_region(&pdev->dev, mmio->start, | ||
1080 | mmio->end - mmio->start + 1); | ||
1064 | free_netdev(netdev); | 1081 | free_netdev(netdev); |
1065 | out: | 1082 | out: |
1066 | return ret; | 1083 | return ret; |
@@ -1078,6 +1095,7 @@ static int ethoc_remove(struct platform_device *pdev) | |||
1078 | platform_set_drvdata(pdev, NULL); | 1095 | platform_set_drvdata(pdev, NULL); |
1079 | 1096 | ||
1080 | if (netdev) { | 1097 | if (netdev) { |
1098 | netif_napi_del(&priv->napi); | ||
1081 | phy_disconnect(priv->phy); | 1099 | phy_disconnect(priv->phy); |
1082 | priv->phy = NULL; | 1100 | priv->phy = NULL; |
1083 | 1101 | ||
@@ -1089,6 +1107,14 @@ static int ethoc_remove(struct platform_device *pdev) | |||
1089 | if (priv->dma_alloc) | 1107 | if (priv->dma_alloc) |
1090 | dma_free_coherent(NULL, priv->dma_alloc, priv->membase, | 1108 | dma_free_coherent(NULL, priv->dma_alloc, priv->membase, |
1091 | netdev->mem_start); | 1109 | netdev->mem_start); |
1110 | else { | ||
1111 | devm_iounmap(&pdev->dev, priv->membase); | ||
1112 | devm_release_mem_region(&pdev->dev, netdev->mem_start, | ||
1113 | netdev->mem_end - netdev->mem_start + 1); | ||
1114 | } | ||
1115 | devm_iounmap(&pdev->dev, priv->iobase); | ||
1116 | devm_release_mem_region(&pdev->dev, netdev->base_addr, | ||
1117 | priv->io_region_size); | ||
1092 | unregister_netdev(netdev); | 1118 | unregister_netdev(netdev); |
1093 | free_netdev(netdev); | 1119 | free_netdev(netdev); |
1094 | } | 1120 | } |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 42d9ac9ba395..326465ffbb23 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/clk.h> | 41 | #include <linux/clk.h> |
42 | #include <linux/platform_device.h> | 42 | #include <linux/platform_device.h> |
43 | #include <linux/phy.h> | 43 | #include <linux/phy.h> |
44 | #include <linux/fec.h> | ||
44 | 45 | ||
45 | #include <asm/cacheflush.h> | 46 | #include <asm/cacheflush.h> |
46 | 47 | ||
@@ -182,6 +183,7 @@ struct fec_enet_private { | |||
182 | struct phy_device *phy_dev; | 183 | struct phy_device *phy_dev; |
183 | int mii_timeout; | 184 | int mii_timeout; |
184 | uint phy_speed; | 185 | uint phy_speed; |
186 | phy_interface_t phy_interface; | ||
185 | int index; | 187 | int index; |
186 | int link; | 188 | int link; |
187 | int full_duplex; | 189 | int full_duplex; |
@@ -1191,6 +1193,21 @@ fec_restart(struct net_device *dev, int duplex) | |||
1191 | /* Set MII speed */ | 1193 | /* Set MII speed */ |
1192 | writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); | 1194 | writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); |
1193 | 1195 | ||
1196 | #ifdef FEC_MIIGSK_ENR | ||
1197 | if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) { | ||
1198 | /* disable the gasket and wait */ | ||
1199 | writel(0, fep->hwp + FEC_MIIGSK_ENR); | ||
1200 | while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4) | ||
1201 | udelay(1); | ||
1202 | |||
1203 | /* configure the gasket: RMII, 50 MHz, no loopback, no echo */ | ||
1204 | writel(1, fep->hwp + FEC_MIIGSK_CFGR); | ||
1205 | |||
1206 | /* re-enable the gasket */ | ||
1207 | writel(2, fep->hwp + FEC_MIIGSK_ENR); | ||
1208 | } | ||
1209 | #endif | ||
1210 | |||
1194 | /* And last, enable the transmit and receive processing */ | 1211 | /* And last, enable the transmit and receive processing */ |
1195 | writel(2, fep->hwp + FEC_ECNTRL); | 1212 | writel(2, fep->hwp + FEC_ECNTRL); |
1196 | writel(0, fep->hwp + FEC_R_DES_ACTIVE); | 1213 | writel(0, fep->hwp + FEC_R_DES_ACTIVE); |
@@ -1226,6 +1243,7 @@ static int __devinit | |||
1226 | fec_probe(struct platform_device *pdev) | 1243 | fec_probe(struct platform_device *pdev) |
1227 | { | 1244 | { |
1228 | struct fec_enet_private *fep; | 1245 | struct fec_enet_private *fep; |
1246 | struct fec_platform_data *pdata; | ||
1229 | struct net_device *ndev; | 1247 | struct net_device *ndev; |
1230 | int i, irq, ret = 0; | 1248 | int i, irq, ret = 0; |
1231 | struct resource *r; | 1249 | struct resource *r; |
@@ -1259,6 +1277,10 @@ fec_probe(struct platform_device *pdev) | |||
1259 | 1277 | ||
1260 | platform_set_drvdata(pdev, ndev); | 1278 | platform_set_drvdata(pdev, ndev); |
1261 | 1279 | ||
1280 | pdata = pdev->dev.platform_data; | ||
1281 | if (pdata) | ||
1282 | fep->phy_interface = pdata->phy; | ||
1283 | |||
1262 | /* This device has up to three irqs on some platforms */ | 1284 | /* This device has up to three irqs on some platforms */ |
1263 | for (i = 0; i < 3; i++) { | 1285 | for (i = 0; i < 3; i++) { |
1264 | irq = platform_get_irq(pdev, i); | 1286 | irq = platform_get_irq(pdev, i); |
diff --git a/drivers/net/fec.h b/drivers/net/fec.h index cc47f3f057c7..2c48b25668d5 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h | |||
@@ -43,6 +43,8 @@ | |||
43 | #define FEC_R_DES_START 0x180 /* Receive descriptor ring */ | 43 | #define FEC_R_DES_START 0x180 /* Receive descriptor ring */ |
44 | #define FEC_X_DES_START 0x184 /* Transmit descriptor ring */ | 44 | #define FEC_X_DES_START 0x184 /* Transmit descriptor ring */ |
45 | #define FEC_R_BUFF_SIZE 0x188 /* Maximum receive buff size */ | 45 | #define FEC_R_BUFF_SIZE 0x188 /* Maximum receive buff size */ |
46 | #define FEC_MIIGSK_CFGR 0x300 /* MIIGSK Configuration reg */ | ||
47 | #define FEC_MIIGSK_ENR 0x308 /* MIIGSK Enable reg */ | ||
46 | 48 | ||
47 | #else | 49 | #else |
48 | 50 | ||
diff --git a/drivers/net/irda/bfin_sir.c b/drivers/net/irda/bfin_sir.c index 911c082cee5a..f940dfa1f7f8 100644 --- a/drivers/net/irda/bfin_sir.c +++ b/drivers/net/irda/bfin_sir.c | |||
@@ -107,8 +107,12 @@ static int bfin_sir_set_speed(struct bfin_sir_port *port, int speed) | |||
107 | case 57600: | 107 | case 57600: |
108 | case 115200: | 108 | case 115200: |
109 | 109 | ||
110 | quot = (port->clk + (8 * speed)) / (16 * speed)\ | 110 | /* |
111 | - ANOMALY_05000230; | 111 | * IRDA is not affected by anomaly 05000230, so there is no |
112 | * need to tweak the divisor like he UART driver (which will | ||
113 | * slightly speed up the baud rate on us). | ||
114 | */ | ||
115 | quot = (port->clk + (8 * speed)) / (16 * speed); | ||
112 | 116 | ||
113 | do { | 117 | do { |
114 | udelay(utime); | 118 | udelay(utime); |
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index d0ea3d6dea95..ffae480587ae 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -360,6 +360,7 @@ struct ixgbe_adapter { | |||
360 | u32 flags2; | 360 | u32 flags2; |
361 | #define IXGBE_FLAG2_RSC_CAPABLE (u32)(1) | 361 | #define IXGBE_FLAG2_RSC_CAPABLE (u32)(1) |
362 | #define IXGBE_FLAG2_RSC_ENABLED (u32)(1 << 1) | 362 | #define IXGBE_FLAG2_RSC_ENABLED (u32)(1 << 1) |
363 | #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE (u32)(1 << 2) | ||
363 | /* default to trying for four seconds */ | 364 | /* default to trying for four seconds */ |
364 | #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ) | 365 | #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ) |
365 | 366 | ||
@@ -407,6 +408,8 @@ struct ixgbe_adapter { | |||
407 | u16 eeprom_version; | 408 | u16 eeprom_version; |
408 | 409 | ||
409 | int node; | 410 | int node; |
411 | struct work_struct check_overtemp_task; | ||
412 | u32 interrupt_event; | ||
410 | 413 | ||
411 | /* SR-IOV */ | 414 | /* SR-IOV */ |
412 | DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS); | 415 | DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS); |
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index f2b7ff44215b..9c02d6014cc4 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
@@ -1236,6 +1236,7 @@ static struct ixgbe_phy_operations phy_ops_82598 = { | |||
1236 | .setup_link = &ixgbe_setup_phy_link_generic, | 1236 | .setup_link = &ixgbe_setup_phy_link_generic, |
1237 | .setup_link_speed = &ixgbe_setup_phy_link_speed_generic, | 1237 | .setup_link_speed = &ixgbe_setup_phy_link_speed_generic, |
1238 | .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_82598, | 1238 | .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_82598, |
1239 | .check_overtemp = &ixgbe_tn_check_overtemp, | ||
1239 | }; | 1240 | }; |
1240 | 1241 | ||
1241 | struct ixgbe_info ixgbe_82598_info = { | 1242 | struct ixgbe_info ixgbe_82598_info = { |
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c index e9706eb8e4ff..a4e2901f2f08 100644 --- a/drivers/net/ixgbe/ixgbe_82599.c +++ b/drivers/net/ixgbe/ixgbe_82599.c | |||
@@ -2395,6 +2395,7 @@ static struct ixgbe_phy_operations phy_ops_82599 = { | |||
2395 | .write_i2c_byte = &ixgbe_write_i2c_byte_generic, | 2395 | .write_i2c_byte = &ixgbe_write_i2c_byte_generic, |
2396 | .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic, | 2396 | .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic, |
2397 | .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic, | 2397 | .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic, |
2398 | .check_overtemp = &ixgbe_tn_check_overtemp, | ||
2398 | }; | 2399 | }; |
2399 | 2400 | ||
2400 | struct ixgbe_info ixgbe_82599_info = { | 2401 | struct ixgbe_info ixgbe_82599_info = { |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 9551cbb7bf01..d571d101de08 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -108,6 +108,8 @@ static DEFINE_PCI_DEVICE_TABLE(ixgbe_pci_tbl) = { | |||
108 | board_82599 }, | 108 | board_82599 }, |
109 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_CX4), | 109 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_CX4), |
110 | board_82599 }, | 110 | board_82599 }, |
111 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_T3_LOM), | ||
112 | board_82599 }, | ||
111 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_COMBO_BACKPLANE), | 113 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_COMBO_BACKPLANE), |
112 | board_82599 }, | 114 | board_82599 }, |
113 | 115 | ||
@@ -1618,6 +1620,48 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector) | |||
1618 | } | 1620 | } |
1619 | } | 1621 | } |
1620 | 1622 | ||
1623 | /** | ||
1624 | * ixgbe_check_overtemp_task - worker thread to check over tempurature | ||
1625 | * @work: pointer to work_struct containing our data | ||
1626 | **/ | ||
1627 | static void ixgbe_check_overtemp_task(struct work_struct *work) | ||
1628 | { | ||
1629 | struct ixgbe_adapter *adapter = container_of(work, | ||
1630 | struct ixgbe_adapter, | ||
1631 | check_overtemp_task); | ||
1632 | struct ixgbe_hw *hw = &adapter->hw; | ||
1633 | u32 eicr = adapter->interrupt_event; | ||
1634 | |||
1635 | if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) { | ||
1636 | switch (hw->device_id) { | ||
1637 | case IXGBE_DEV_ID_82599_T3_LOM: { | ||
1638 | u32 autoneg; | ||
1639 | bool link_up = false; | ||
1640 | |||
1641 | if (hw->mac.ops.check_link) | ||
1642 | hw->mac.ops.check_link(hw, &autoneg, &link_up, false); | ||
1643 | |||
1644 | if (((eicr & IXGBE_EICR_GPI_SDP0) && (!link_up)) || | ||
1645 | (eicr & IXGBE_EICR_LSC)) | ||
1646 | /* Check if this is due to overtemp */ | ||
1647 | if (hw->phy.ops.check_overtemp(hw) == IXGBE_ERR_OVERTEMP) | ||
1648 | break; | ||
1649 | } | ||
1650 | return; | ||
1651 | default: | ||
1652 | if (!(eicr & IXGBE_EICR_GPI_SDP0)) | ||
1653 | return; | ||
1654 | break; | ||
1655 | } | ||
1656 | DPRINTK(DRV, ERR, "Network adapter has been stopped because it " | ||
1657 | "has over heated. Restart the computer. If the problem " | ||
1658 | "persists, power off the system and replace the " | ||
1659 | "adapter\n"); | ||
1660 | /* write to clear the interrupt */ | ||
1661 | IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0); | ||
1662 | } | ||
1663 | } | ||
1664 | |||
1621 | static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr) | 1665 | static void ixgbe_check_fan_failure(struct ixgbe_adapter *adapter, u32 eicr) |
1622 | { | 1666 | { |
1623 | struct ixgbe_hw *hw = &adapter->hw; | 1667 | struct ixgbe_hw *hw = &adapter->hw; |
@@ -1689,6 +1733,10 @@ static irqreturn_t ixgbe_msix_lsc(int irq, void *data) | |||
1689 | 1733 | ||
1690 | if (hw->mac.type == ixgbe_mac_82599EB) { | 1734 | if (hw->mac.type == ixgbe_mac_82599EB) { |
1691 | ixgbe_check_sfp_event(adapter, eicr); | 1735 | ixgbe_check_sfp_event(adapter, eicr); |
1736 | adapter->interrupt_event = eicr; | ||
1737 | if ((adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) && | ||
1738 | ((eicr & IXGBE_EICR_GPI_SDP0) || (eicr & IXGBE_EICR_LSC))) | ||
1739 | schedule_work(&adapter->check_overtemp_task); | ||
1692 | 1740 | ||
1693 | /* Handle Flow Director Full threshold interrupt */ | 1741 | /* Handle Flow Director Full threshold interrupt */ |
1694 | if (eicr & IXGBE_EICR_FLOW_DIR) { | 1742 | if (eicr & IXGBE_EICR_FLOW_DIR) { |
@@ -2190,6 +2238,8 @@ static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter) | |||
2190 | u32 mask; | 2238 | u32 mask; |
2191 | 2239 | ||
2192 | mask = (IXGBE_EIMS_ENABLE_MASK & ~IXGBE_EIMS_RTX_QUEUE); | 2240 | mask = (IXGBE_EIMS_ENABLE_MASK & ~IXGBE_EIMS_RTX_QUEUE); |
2241 | if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) | ||
2242 | mask |= IXGBE_EIMS_GPI_SDP0; | ||
2193 | if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) | 2243 | if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) |
2194 | mask |= IXGBE_EIMS_GPI_SDP1; | 2244 | mask |= IXGBE_EIMS_GPI_SDP1; |
2195 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | 2245 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) { |
@@ -2250,6 +2300,9 @@ static irqreturn_t ixgbe_intr(int irq, void *data) | |||
2250 | ixgbe_check_sfp_event(adapter, eicr); | 2300 | ixgbe_check_sfp_event(adapter, eicr); |
2251 | 2301 | ||
2252 | ixgbe_check_fan_failure(adapter, eicr); | 2302 | ixgbe_check_fan_failure(adapter, eicr); |
2303 | if ((adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) && | ||
2304 | ((eicr & IXGBE_EICR_GPI_SDP0) || (eicr & IXGBE_EICR_LSC))) | ||
2305 | schedule_work(&adapter->check_overtemp_task); | ||
2253 | 2306 | ||
2254 | if (napi_schedule_prep(&(q_vector->napi))) { | 2307 | if (napi_schedule_prep(&(q_vector->napi))) { |
2255 | adapter->tx_ring[0]->total_packets = 0; | 2308 | adapter->tx_ring[0]->total_packets = 0; |
@@ -3265,6 +3318,13 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
3265 | IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE); | 3318 | IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE); |
3266 | } | 3319 | } |
3267 | 3320 | ||
3321 | /* Enable Thermal over heat sensor interrupt */ | ||
3322 | if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) { | ||
3323 | gpie = IXGBE_READ_REG(hw, IXGBE_GPIE); | ||
3324 | gpie |= IXGBE_SDP0_GPIEN; | ||
3325 | IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie); | ||
3326 | } | ||
3327 | |||
3268 | /* Enable fan failure interrupt if media type is copper */ | 3328 | /* Enable fan failure interrupt if media type is copper */ |
3269 | if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) { | 3329 | if (adapter->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) { |
3270 | gpie = IXGBE_READ_REG(hw, IXGBE_GPIE); | 3330 | gpie = IXGBE_READ_REG(hw, IXGBE_GPIE); |
@@ -3666,6 +3726,9 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
3666 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) | 3726 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) |
3667 | cancel_work_sync(&adapter->fdir_reinit_task); | 3727 | cancel_work_sync(&adapter->fdir_reinit_task); |
3668 | 3728 | ||
3729 | if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) | ||
3730 | cancel_work_sync(&adapter->check_overtemp_task); | ||
3731 | |||
3669 | /* disable transmits in the hardware now that interrupts are off */ | 3732 | /* disable transmits in the hardware now that interrupts are off */ |
3670 | for (i = 0; i < adapter->num_tx_queues; i++) { | 3733 | for (i = 0; i < adapter->num_tx_queues; i++) { |
3671 | j = adapter->tx_ring[i]->reg_idx; | 3734 | j = adapter->tx_ring[i]->reg_idx; |
@@ -4645,6 +4708,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
4645 | adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599; | 4708 | adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599; |
4646 | adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE; | 4709 | adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE; |
4647 | adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; | 4710 | adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; |
4711 | if (hw->device_id == IXGBE_DEV_ID_82599_T3_LOM) | ||
4712 | adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_CAPABLE; | ||
4648 | if (dev->features & NETIF_F_NTUPLE) { | 4713 | if (dev->features & NETIF_F_NTUPLE) { |
4649 | /* Flow Director perfect filter enabled */ | 4714 | /* Flow Director perfect filter enabled */ |
4650 | adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | 4715 | adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE; |
@@ -6561,7 +6626,9 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
6561 | } | 6626 | } |
6562 | 6627 | ||
6563 | /* reset_hw fills in the perm_addr as well */ | 6628 | /* reset_hw fills in the perm_addr as well */ |
6629 | hw->phy.reset_if_overtemp = true; | ||
6564 | err = hw->mac.ops.reset_hw(hw); | 6630 | err = hw->mac.ops.reset_hw(hw); |
6631 | hw->phy.reset_if_overtemp = false; | ||
6565 | if (err == IXGBE_ERR_SFP_NOT_PRESENT && | 6632 | if (err == IXGBE_ERR_SFP_NOT_PRESENT && |
6566 | hw->mac.type == ixgbe_mac_82598EB) { | 6633 | hw->mac.type == ixgbe_mac_82598EB) { |
6567 | /* | 6634 | /* |
@@ -6730,6 +6797,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
6730 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) | 6797 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) |
6731 | INIT_WORK(&adapter->fdir_reinit_task, ixgbe_fdir_reinit_task); | 6798 | INIT_WORK(&adapter->fdir_reinit_task, ixgbe_fdir_reinit_task); |
6732 | 6799 | ||
6800 | if (adapter->flags2 & IXGBE_FLAG2_TEMP_SENSOR_CAPABLE) | ||
6801 | INIT_WORK(&adapter->check_overtemp_task, ixgbe_check_overtemp_task); | ||
6733 | #ifdef CONFIG_IXGBE_DCA | 6802 | #ifdef CONFIG_IXGBE_DCA |
6734 | if (dca_add_requester(&pdev->dev) == 0) { | 6803 | if (dca_add_requester(&pdev->dev) == 0) { |
6735 | adapter->flags |= IXGBE_FLAG_DCA_ENABLED; | 6804 | adapter->flags |= IXGBE_FLAG_DCA_ENABLED; |
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c index 22d21af14783..09e1911ff510 100644 --- a/drivers/net/ixgbe/ixgbe_phy.c +++ b/drivers/net/ixgbe/ixgbe_phy.c | |||
@@ -135,6 +135,11 @@ static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id) | |||
135 | **/ | 135 | **/ |
136 | s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw) | 136 | s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw) |
137 | { | 137 | { |
138 | /* Don't reset PHY if it's shut down due to overtemp. */ | ||
139 | if (!hw->phy.reset_if_overtemp && | ||
140 | (IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp(hw))) | ||
141 | return 0; | ||
142 | |||
138 | /* | 143 | /* |
139 | * Perform soft PHY reset to the PHY_XS. | 144 | * Perform soft PHY reset to the PHY_XS. |
140 | * This will cause a soft reset to the PHY | 145 | * This will cause a soft reset to the PHY |
@@ -1345,3 +1350,28 @@ s32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw, | |||
1345 | return status; | 1350 | return status; |
1346 | } | 1351 | } |
1347 | 1352 | ||
1353 | /** | ||
1354 | * ixgbe_tn_check_overtemp - Checks if an overtemp occured. | ||
1355 | * @hw: pointer to hardware structure | ||
1356 | * | ||
1357 | * Checks if the LASI temp alarm status was triggered due to overtemp | ||
1358 | **/ | ||
1359 | s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw) | ||
1360 | { | ||
1361 | s32 status = 0; | ||
1362 | u16 phy_data = 0; | ||
1363 | |||
1364 | if (hw->device_id != IXGBE_DEV_ID_82599_T3_LOM) | ||
1365 | goto out; | ||
1366 | |||
1367 | /* Check that the LASI temp alarm status was triggered */ | ||
1368 | hw->phy.ops.read_reg(hw, IXGBE_TN_LASI_STATUS_REG, | ||
1369 | MDIO_MMD_PMAPMD, &phy_data); | ||
1370 | |||
1371 | if (!(phy_data & IXGBE_TN_LASI_STATUS_TEMP_ALARM)) | ||
1372 | goto out; | ||
1373 | |||
1374 | status = IXGBE_ERR_OVERTEMP; | ||
1375 | out: | ||
1376 | return status; | ||
1377 | } | ||
diff --git a/drivers/net/ixgbe/ixgbe_phy.h b/drivers/net/ixgbe/ixgbe_phy.h index c9c545941407..ef4ba834c593 100644 --- a/drivers/net/ixgbe/ixgbe_phy.h +++ b/drivers/net/ixgbe/ixgbe_phy.h | |||
@@ -80,6 +80,8 @@ | |||
80 | #define IXGBE_I2C_T_SU_STO 4 | 80 | #define IXGBE_I2C_T_SU_STO 4 |
81 | #define IXGBE_I2C_T_BUF 5 | 81 | #define IXGBE_I2C_T_BUF 5 |
82 | 82 | ||
83 | #define IXGBE_TN_LASI_STATUS_REG 0x9005 | ||
84 | #define IXGBE_TN_LASI_STATUS_TEMP_ALARM 0x0008 | ||
83 | 85 | ||
84 | s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw); | 86 | s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw); |
85 | s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw); | 87 | s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw); |
@@ -106,6 +108,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw); | |||
106 | s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, | 108 | s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, |
107 | u16 *list_offset, | 109 | u16 *list_offset, |
108 | u16 *data_offset); | 110 | u16 *data_offset); |
111 | s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw); | ||
109 | s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, | 112 | s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, |
110 | u8 dev_addr, u8 *data); | 113 | u8 dev_addr, u8 *data); |
111 | s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, | 114 | s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index 39b9be897439..2eb6e151016c 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -51,6 +51,7 @@ | |||
51 | #define IXGBE_DEV_ID_82599_KX4 0x10F7 | 51 | #define IXGBE_DEV_ID_82599_KX4 0x10F7 |
52 | #define IXGBE_DEV_ID_82599_KX4_MEZZ 0x1514 | 52 | #define IXGBE_DEV_ID_82599_KX4_MEZZ 0x1514 |
53 | #define IXGBE_DEV_ID_82599_KR 0x1517 | 53 | #define IXGBE_DEV_ID_82599_KR 0x1517 |
54 | #define IXGBE_DEV_ID_82599_T3_LOM 0x151C | ||
54 | #define IXGBE_DEV_ID_82599_CX4 0x10F9 | 55 | #define IXGBE_DEV_ID_82599_CX4 0x10F9 |
55 | #define IXGBE_DEV_ID_82599_SFP 0x10FB | 56 | #define IXGBE_DEV_ID_82599_SFP 0x10FB |
56 | #define IXGBE_DEV_ID_82599_SFP_EM 0x1507 | 57 | #define IXGBE_DEV_ID_82599_SFP_EM 0x1507 |
@@ -2470,6 +2471,7 @@ struct ixgbe_phy_operations { | |||
2470 | s32 (*write_i2c_byte)(struct ixgbe_hw *, u8, u8, u8); | 2471 | s32 (*write_i2c_byte)(struct ixgbe_hw *, u8, u8, u8); |
2471 | s32 (*read_i2c_eeprom)(struct ixgbe_hw *, u8 , u8 *); | 2472 | s32 (*read_i2c_eeprom)(struct ixgbe_hw *, u8 , u8 *); |
2472 | s32 (*write_i2c_eeprom)(struct ixgbe_hw *, u8, u8); | 2473 | s32 (*write_i2c_eeprom)(struct ixgbe_hw *, u8, u8); |
2474 | s32 (*check_overtemp)(struct ixgbe_hw *); | ||
2473 | }; | 2475 | }; |
2474 | 2476 | ||
2475 | struct ixgbe_eeprom_info { | 2477 | struct ixgbe_eeprom_info { |
@@ -2518,6 +2520,7 @@ struct ixgbe_phy_info { | |||
2518 | enum ixgbe_smart_speed smart_speed; | 2520 | enum ixgbe_smart_speed smart_speed; |
2519 | bool smart_speed_active; | 2521 | bool smart_speed_active; |
2520 | bool multispeed_fiber; | 2522 | bool multispeed_fiber; |
2523 | bool reset_if_overtemp; | ||
2521 | }; | 2524 | }; |
2522 | 2525 | ||
2523 | #include "ixgbe_mbx.h" | 2526 | #include "ixgbe_mbx.h" |
@@ -2605,6 +2608,7 @@ struct ixgbe_info { | |||
2605 | #define IXGBE_ERR_FDIR_REINIT_FAILED -23 | 2608 | #define IXGBE_ERR_FDIR_REINIT_FAILED -23 |
2606 | #define IXGBE_ERR_EEPROM_VERSION -24 | 2609 | #define IXGBE_ERR_EEPROM_VERSION -24 |
2607 | #define IXGBE_ERR_NO_SPACE -25 | 2610 | #define IXGBE_ERR_NO_SPACE -25 |
2611 | #define IXGBE_ERR_OVERTEMP -26 | ||
2608 | #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF | 2612 | #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF |
2609 | 2613 | ||
2610 | #endif /* _IXGBE_TYPE_H_ */ | 2614 | #endif /* _IXGBE_TYPE_H_ */ |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 4e238afab4a3..87e8d4cb4057 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -634,11 +634,18 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, | |||
634 | 634 | ||
635 | err = register_netdevice(dev); | 635 | err = register_netdevice(dev); |
636 | if (err < 0) | 636 | if (err < 0) |
637 | return err; | 637 | goto destroy_port; |
638 | 638 | ||
639 | list_add_tail(&vlan->list, &port->vlans); | 639 | list_add_tail(&vlan->list, &port->vlans); |
640 | netif_stacked_transfer_operstate(lowerdev, dev); | 640 | netif_stacked_transfer_operstate(lowerdev, dev); |
641 | |||
641 | return 0; | 642 | return 0; |
643 | |||
644 | destroy_port: | ||
645 | if (list_empty(&port->vlans)) | ||
646 | macvlan_port_destroy(lowerdev); | ||
647 | |||
648 | return err; | ||
642 | } | 649 | } |
643 | EXPORT_SYMBOL_GPL(macvlan_common_newlink); | 650 | EXPORT_SYMBOL_GPL(macvlan_common_newlink); |
644 | 651 | ||
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index b1b93ff2351f..805b64d1e893 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -289,6 +289,7 @@ static void pppoe_flush_dev(struct net_device *dev) | |||
289 | struct pppoe_net *pn; | 289 | struct pppoe_net *pn; |
290 | int i; | 290 | int i; |
291 | 291 | ||
292 | pn = pppoe_pernet(dev_net(dev)); | ||
292 | write_lock_bh(&pn->hash_lock); | 293 | write_lock_bh(&pn->hash_lock); |
293 | for (i = 0; i < PPPOE_HASH_SIZE; i++) { | 294 | for (i = 0; i < PPPOE_HASH_SIZE; i++) { |
294 | struct pppox_sock *po = pn->hash_table[i]; | 295 | struct pppox_sock *po = pn->hash_table[i]; |
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 586ed0915a29..501a55ffce57 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
@@ -1294,6 +1294,9 @@ static int sh_mdio_release(struct net_device *ndev) | |||
1294 | /* remove mdio bus info from net_device */ | 1294 | /* remove mdio bus info from net_device */ |
1295 | dev_set_drvdata(&ndev->dev, NULL); | 1295 | dev_set_drvdata(&ndev->dev, NULL); |
1296 | 1296 | ||
1297 | /* free interrupts memory */ | ||
1298 | kfree(bus->irq); | ||
1299 | |||
1297 | /* free bitbang info */ | 1300 | /* free bitbang info */ |
1298 | free_mdio_bitbang(bus); | 1301 | free_mdio_bitbang(bus); |
1299 | 1302 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 005cad689578..6ad6fe706312 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -526,6 +526,8 @@ static inline struct sk_buff *tun_alloc_skb(struct tun_struct *tun, | |||
526 | struct sk_buff *skb; | 526 | struct sk_buff *skb; |
527 | int err; | 527 | int err; |
528 | 528 | ||
529 | sock_update_classid(sk); | ||
530 | |||
529 | /* Under a page? Don't bother with paged skb. */ | 531 | /* Under a page? Don't bother with paged skb. */ |
530 | if (prepad + len < PAGE_SIZE || !linear) | 532 | if (prepad + len < PAGE_SIZE || !linear) |
531 | linear = len; | 533 | linear = len; |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 31b73310ec77..1f802e90474c 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -322,7 +322,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
322 | size = (u16) (header & 0x0000ffff); | 322 | size = (u16) (header & 0x0000ffff); |
323 | 323 | ||
324 | if ((skb->len) - ((size + 1) & 0xfffe) == 0) { | 324 | if ((skb->len) - ((size + 1) & 0xfffe) == 0) { |
325 | u8 alignment = (u32)skb->data & 0x3; | 325 | u8 alignment = (unsigned long)skb->data & 0x3; |
326 | if (alignment != 0x2) { | 326 | if (alignment != 0x2) { |
327 | /* | 327 | /* |
328 | * not 16bit aligned so use the room provided by | 328 | * not 16bit aligned so use the room provided by |
@@ -351,7 +351,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
351 | } | 351 | } |
352 | ax_skb = skb_clone(skb, GFP_ATOMIC); | 352 | ax_skb = skb_clone(skb, GFP_ATOMIC); |
353 | if (ax_skb) { | 353 | if (ax_skb) { |
354 | u8 alignment = (u32)packet & 0x3; | 354 | u8 alignment = (unsigned long)packet & 0x3; |
355 | ax_skb->len = size; | 355 | ax_skb->len = size; |
356 | 356 | ||
357 | if (alignment != 0x2) { | 357 | if (alignment != 0x2) { |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 9964df199511..0a3c41faea9c 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -475,6 +475,9 @@ static const struct usb_device_id hso_ids[] = { | |||
475 | {USB_DEVICE(0x0af0, 0x8302)}, | 475 | {USB_DEVICE(0x0af0, 0x8302)}, |
476 | {USB_DEVICE(0x0af0, 0x8304)}, | 476 | {USB_DEVICE(0x0af0, 0x8304)}, |
477 | {USB_DEVICE(0x0af0, 0x8400)}, | 477 | {USB_DEVICE(0x0af0, 0x8400)}, |
478 | {USB_DEVICE(0x0af0, 0x8600)}, | ||
479 | {USB_DEVICE(0x0af0, 0x8800)}, | ||
480 | {USB_DEVICE(0x0af0, 0x8900)}, | ||
478 | {USB_DEVICE(0x0af0, 0xd035)}, | 481 | {USB_DEVICE(0x0af0, 0xd035)}, |
479 | {USB_DEVICE(0x0af0, 0xd055)}, | 482 | {USB_DEVICE(0x0af0, 0xd055)}, |
480 | {USB_DEVICE(0x0af0, 0xd155)}, | 483 | {USB_DEVICE(0x0af0, 0xd155)}, |
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c index 6537593fae66..8cc9e319f435 100644 --- a/drivers/net/wimax/i2400m/rx.c +++ b/drivers/net/wimax/i2400m/rx.c | |||
@@ -1027,12 +1027,12 @@ void i2400m_rx_edata(struct i2400m *i2400m, struct sk_buff *skb_rx, | |||
1027 | ro_sn = (reorder >> I2400M_RO_SN_SHIFT) & I2400M_RO_SN; | 1027 | ro_sn = (reorder >> I2400M_RO_SN_SHIFT) & I2400M_RO_SN; |
1028 | 1028 | ||
1029 | spin_lock_irqsave(&i2400m->rx_lock, flags); | 1029 | spin_lock_irqsave(&i2400m->rx_lock, flags); |
1030 | roq = &i2400m->rx_roq[ro_cin]; | 1030 | if (i2400m->rx_roq == NULL) { |
1031 | if (roq == NULL) { | ||
1032 | kfree_skb(skb); /* rx_roq is already destroyed */ | 1031 | kfree_skb(skb); /* rx_roq is already destroyed */ |
1033 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); | 1032 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); |
1034 | goto error; | 1033 | goto error; |
1035 | } | 1034 | } |
1035 | roq = &i2400m->rx_roq[ro_cin]; | ||
1036 | kref_get(&i2400m->rx_roq_refcount); | 1036 | kref_get(&i2400m->rx_roq_refcount); |
1037 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); | 1037 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); |
1038 | 1038 | ||
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 5f04cf38a5bc..cc6d41dec332 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1214,6 +1214,7 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf) | |||
1214 | struct ath5k_hw *ah = sc->ah; | 1214 | struct ath5k_hw *ah = sc->ah; |
1215 | struct sk_buff *skb = bf->skb; | 1215 | struct sk_buff *skb = bf->skb; |
1216 | struct ath5k_desc *ds; | 1216 | struct ath5k_desc *ds; |
1217 | int ret; | ||
1217 | 1218 | ||
1218 | if (!skb) { | 1219 | if (!skb) { |
1219 | skb = ath5k_rx_skb_alloc(sc, &bf->skbaddr); | 1220 | skb = ath5k_rx_skb_alloc(sc, &bf->skbaddr); |
@@ -1240,9 +1241,9 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf) | |||
1240 | ds = bf->desc; | 1241 | ds = bf->desc; |
1241 | ds->ds_link = bf->daddr; /* link to self */ | 1242 | ds->ds_link = bf->daddr; /* link to self */ |
1242 | ds->ds_data = bf->skbaddr; | 1243 | ds->ds_data = bf->skbaddr; |
1243 | ah->ah_setup_rx_desc(ah, ds, | 1244 | ret = ah->ah_setup_rx_desc(ah, ds, ah->common.rx_bufsize, 0); |
1244 | skb_tailroom(skb), /* buffer size */ | 1245 | if (ret) |
1245 | 0); | 1246 | return ret; |
1246 | 1247 | ||
1247 | if (sc->rxlink != NULL) | 1248 | if (sc->rxlink != NULL) |
1248 | *sc->rxlink = bf->daddr; | 1249 | *sc->rxlink = bf->daddr; |
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index c8a4558f79ba..f43d85a302c4 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -76,22 +76,13 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp, | |||
76 | ds = bf->bf_desc; | 76 | ds = bf->bf_desc; |
77 | flags = ATH9K_TXDESC_NOACK; | 77 | flags = ATH9K_TXDESC_NOACK; |
78 | 78 | ||
79 | if (((sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || | 79 | ds->ds_link = 0; |
80 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) && | 80 | /* |
81 | (ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) { | 81 | * Switch antenna every beacon. |
82 | ds->ds_link = bf->bf_daddr; /* self-linked */ | 82 | * Should only switch every beacon period, not for every SWBA |
83 | flags |= ATH9K_TXDESC_VEOL; | 83 | * XXX assumes two antennae |
84 | /* Let hardware handle antenna switching. */ | 84 | */ |
85 | antenna = 0; | 85 | antenna = ((sc->beacon.ast_be_xmit / sc->nbcnvifs) & 1 ? 2 : 1); |
86 | } else { | ||
87 | ds->ds_link = 0; | ||
88 | /* | ||
89 | * Switch antenna every beacon. | ||
90 | * Should only switch every beacon period, not for every SWBA | ||
91 | * XXX assumes two antennae | ||
92 | */ | ||
93 | antenna = ((sc->beacon.ast_be_xmit / sc->nbcnvifs) & 1 ? 2 : 1); | ||
94 | } | ||
95 | 86 | ||
96 | sband = &sc->sbands[common->hw->conf.channel->band]; | 87 | sband = &sc->sbands[common->hw->conf.channel->band]; |
97 | rate = sband->bitrates[rateidx].hw_value; | 88 | rate = sband->bitrates[rateidx].hw_value; |
@@ -215,36 +206,6 @@ static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw, | |||
215 | return bf; | 206 | return bf; |
216 | } | 207 | } |
217 | 208 | ||
218 | /* | ||
219 | * Startup beacon transmission for adhoc mode when they are sent entirely | ||
220 | * by the hardware using the self-linked descriptor + veol trick. | ||
221 | */ | ||
222 | static void ath_beacon_start_adhoc(struct ath_softc *sc, | ||
223 | struct ieee80211_vif *vif) | ||
224 | { | ||
225 | struct ath_hw *ah = sc->sc_ah; | ||
226 | struct ath_common *common = ath9k_hw_common(ah); | ||
227 | struct ath_buf *bf; | ||
228 | struct ath_vif *avp; | ||
229 | struct sk_buff *skb; | ||
230 | |||
231 | avp = (void *)vif->drv_priv; | ||
232 | |||
233 | if (avp->av_bcbuf == NULL) | ||
234 | return; | ||
235 | |||
236 | bf = avp->av_bcbuf; | ||
237 | skb = bf->bf_mpdu; | ||
238 | |||
239 | ath_beacon_setup(sc, avp, bf, 0); | ||
240 | |||
241 | /* NB: caller is known to have already stopped tx dma */ | ||
242 | ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bf->bf_daddr); | ||
243 | ath9k_hw_txstart(ah, sc->beacon.beaconq); | ||
244 | ath_print(common, ATH_DBG_BEACON, "TXDP%u = %llx (%p)\n", | ||
245 | sc->beacon.beaconq, ito64(bf->bf_daddr), bf->bf_desc); | ||
246 | } | ||
247 | |||
248 | int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif) | 209 | int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif) |
249 | { | 210 | { |
250 | struct ath_softc *sc = aphy->sc; | 211 | struct ath_softc *sc = aphy->sc; |
@@ -265,7 +226,8 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif) | |||
265 | list_del(&avp->av_bcbuf->list); | 226 | list_del(&avp->av_bcbuf->list); |
266 | 227 | ||
267 | if (sc->sc_ah->opmode == NL80211_IFTYPE_AP || | 228 | if (sc->sc_ah->opmode == NL80211_IFTYPE_AP || |
268 | !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) { | 229 | sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC || |
230 | sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) { | ||
269 | int slot; | 231 | int slot; |
270 | /* | 232 | /* |
271 | * Assign the vif to a beacon xmit slot. As | 233 | * Assign the vif to a beacon xmit slot. As |
@@ -274,17 +236,11 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif) | |||
274 | avp->av_bslot = 0; | 236 | avp->av_bslot = 0; |
275 | for (slot = 0; slot < ATH_BCBUF; slot++) | 237 | for (slot = 0; slot < ATH_BCBUF; slot++) |
276 | if (sc->beacon.bslot[slot] == NULL) { | 238 | if (sc->beacon.bslot[slot] == NULL) { |
277 | /* | ||
278 | * XXX hack, space out slots to better | ||
279 | * deal with misses | ||
280 | */ | ||
281 | if (slot+1 < ATH_BCBUF && | ||
282 | sc->beacon.bslot[slot+1] == NULL) { | ||
283 | avp->av_bslot = slot+1; | ||
284 | break; | ||
285 | } | ||
286 | avp->av_bslot = slot; | 239 | avp->av_bslot = slot; |
240 | |||
287 | /* NB: keep looking for a double slot */ | 241 | /* NB: keep looking for a double slot */ |
242 | if (slot == 0 || !sc->beacon.bslot[slot-1]) | ||
243 | break; | ||
288 | } | 244 | } |
289 | BUG_ON(sc->beacon.bslot[avp->av_bslot] != NULL); | 245 | BUG_ON(sc->beacon.bslot[avp->av_bslot] != NULL); |
290 | sc->beacon.bslot[avp->av_bslot] = vif; | 246 | sc->beacon.bslot[avp->av_bslot] = vif; |
@@ -721,8 +677,7 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc, | |||
721 | * self-linked tx descriptor and let the hardware deal with things. | 677 | * self-linked tx descriptor and let the hardware deal with things. |
722 | */ | 678 | */ |
723 | intval |= ATH9K_BEACON_ENA; | 679 | intval |= ATH9K_BEACON_ENA; |
724 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) | 680 | ah->imask |= ATH9K_INT_SWBA; |
725 | ah->imask |= ATH9K_INT_SWBA; | ||
726 | 681 | ||
727 | ath_beaconq_config(sc); | 682 | ath_beaconq_config(sc); |
728 | 683 | ||
@@ -732,10 +687,6 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc, | |||
732 | ath9k_beacon_init(sc, nexttbtt, intval); | 687 | ath9k_beacon_init(sc, nexttbtt, intval); |
733 | sc->beacon.bmisscnt = 0; | 688 | sc->beacon.bmisscnt = 0; |
734 | ath9k_hw_set_interrupts(ah, ah->imask); | 689 | ath9k_hw_set_interrupts(ah, ah->imask); |
735 | |||
736 | /* FIXME: Handle properly when vif is NULL */ | ||
737 | if (vif && ah->caps.hw_caps & ATH9K_HW_CAP_VEOL) | ||
738 | ath_beacon_start_adhoc(sc, vif); | ||
739 | } | 690 | } |
740 | 691 | ||
741 | void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif) | 692 | void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif) |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 46dc41a16faa..77b359162d6c 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -107,12 +107,14 @@ static inline void ath9k_skb_queue_purge(struct hif_device_usb *hif_dev, | |||
107 | static void hif_usb_tx_cb(struct urb *urb) | 107 | static void hif_usb_tx_cb(struct urb *urb) |
108 | { | 108 | { |
109 | struct tx_buf *tx_buf = (struct tx_buf *) urb->context; | 109 | struct tx_buf *tx_buf = (struct tx_buf *) urb->context; |
110 | struct hif_device_usb *hif_dev = tx_buf->hif_dev; | 110 | struct hif_device_usb *hif_dev; |
111 | struct sk_buff *skb; | 111 | struct sk_buff *skb; |
112 | 112 | ||
113 | if (!hif_dev || !tx_buf) | 113 | if (!tx_buf || !tx_buf->hif_dev) |
114 | return; | 114 | return; |
115 | 115 | ||
116 | hif_dev = tx_buf->hif_dev; | ||
117 | |||
116 | switch (urb->status) { | 118 | switch (urb->status) { |
117 | case 0: | 119 | case 0: |
118 | break; | 120 | break; |
@@ -607,6 +609,10 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev) | |||
607 | 609 | ||
608 | return 0; | 610 | return 0; |
609 | err: | 611 | err: |
612 | if (tx_buf) { | ||
613 | kfree(tx_buf->buf); | ||
614 | kfree(tx_buf); | ||
615 | } | ||
610 | ath9k_hif_usb_dealloc_tx_urbs(hif_dev); | 616 | ath9k_hif_usb_dealloc_tx_urbs(hif_dev); |
611 | return -ENOMEM; | 617 | return -ENOMEM; |
612 | } | 618 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index ad556aa8da39..c251603ab032 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/skbuff.h> | 23 | #include <linux/skbuff.h> |
24 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
25 | #include <linux/leds.h> | 25 | #include <linux/leds.h> |
26 | #include <linux/slab.h> | ||
26 | #include <net/mac80211.h> | 27 | #include <net/mac80211.h> |
27 | 28 | ||
28 | #include "common.h" | 29 | #include "common.h" |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 257b10ba6f57..1ec836cf1c0d 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -28,7 +28,6 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = { | |||
28 | { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */ | 28 | { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */ |
29 | { PCI_VDEVICE(ATHEROS, 0x002D) }, /* PCI */ | 29 | { PCI_VDEVICE(ATHEROS, 0x002D) }, /* PCI */ |
30 | { PCI_VDEVICE(ATHEROS, 0x002E) }, /* PCI-E */ | 30 | { PCI_VDEVICE(ATHEROS, 0x002E) }, /* PCI-E */ |
31 | { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E AR9300 */ | ||
32 | { 0 } | 31 | { 0 } |
33 | }; | 32 | }; |
34 | 33 | ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index ba139132c85f..ca6065b71b46 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -19,6 +19,12 @@ | |||
19 | 19 | ||
20 | #define SKB_CB_ATHBUF(__skb) (*((struct ath_buf **)__skb->cb)) | 20 | #define SKB_CB_ATHBUF(__skb) (*((struct ath_buf **)__skb->cb)) |
21 | 21 | ||
22 | static inline bool ath9k_check_auto_sleep(struct ath_softc *sc) | ||
23 | { | ||
24 | return sc->ps_enabled && | ||
25 | (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP); | ||
26 | } | ||
27 | |||
22 | static struct ieee80211_hw * ath_get_virt_hw(struct ath_softc *sc, | 28 | static struct ieee80211_hw * ath_get_virt_hw(struct ath_softc *sc, |
23 | struct ieee80211_hdr *hdr) | 29 | struct ieee80211_hdr *hdr) |
24 | { | 30 | { |
@@ -616,8 +622,8 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb) | |||
616 | hdr = (struct ieee80211_hdr *)skb->data; | 622 | hdr = (struct ieee80211_hdr *)skb->data; |
617 | 623 | ||
618 | /* Process Beacon and CAB receive in PS state */ | 624 | /* Process Beacon and CAB receive in PS state */ |
619 | if ((sc->ps_flags & PS_WAIT_FOR_BEACON) && | 625 | if (((sc->ps_flags & PS_WAIT_FOR_BEACON) || ath9k_check_auto_sleep(sc)) |
620 | ieee80211_is_beacon(hdr->frame_control)) | 626 | && ieee80211_is_beacon(hdr->frame_control)) |
621 | ath_rx_ps_beacon(sc, skb); | 627 | ath_rx_ps_beacon(sc, skb); |
622 | else if ((sc->ps_flags & PS_WAIT_FOR_CAB) && | 628 | else if ((sc->ps_flags & PS_WAIT_FOR_CAB) && |
623 | (ieee80211_is_data(hdr->frame_control) || | 629 | (ieee80211_is_data(hdr->frame_control) || |
@@ -932,9 +938,10 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
932 | sc->rx.rxotherant = 0; | 938 | sc->rx.rxotherant = 0; |
933 | } | 939 | } |
934 | 940 | ||
935 | if (unlikely(sc->ps_flags & (PS_WAIT_FOR_BEACON | | 941 | if (unlikely(ath9k_check_auto_sleep(sc) || |
936 | PS_WAIT_FOR_CAB | | 942 | (sc->ps_flags & (PS_WAIT_FOR_BEACON | |
937 | PS_WAIT_FOR_PSPOLL_DATA))) | 943 | PS_WAIT_FOR_CAB | |
944 | PS_WAIT_FOR_PSPOLL_DATA)))) | ||
938 | ath_rx_ps(sc, skb); | 945 | ath_rx_ps(sc, skb); |
939 | 946 | ||
940 | ath_rx_send_to_mac80211(hw, sc, skb, rxs); | 947 | ath_rx_send_to_mac80211(hw, sc, skb, rxs); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ict.c b/drivers/net/wireless/iwlwifi/iwl-agn-ict.c index a273e373b7b0..c92b2c0cbd91 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ict.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ict.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/etherdevice.h> | 31 | #include <linux/etherdevice.h> |
32 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
33 | #include <linux/gfp.h> | ||
33 | #include <net/mac80211.h> | 34 | #include <net/mac80211.h> |
34 | 35 | ||
35 | #include "iwl-dev.h" | 36 | #include "iwl-dev.h" |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 107e173112f6..5d3f51ff2f0d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -376,6 +376,11 @@ void iwl_bg_start_internal_scan(struct work_struct *work) | |||
376 | 376 | ||
377 | mutex_lock(&priv->mutex); | 377 | mutex_lock(&priv->mutex); |
378 | 378 | ||
379 | if (priv->is_internal_short_scan == true) { | ||
380 | IWL_DEBUG_SCAN(priv, "Internal scan already in progress\n"); | ||
381 | goto unlock; | ||
382 | } | ||
383 | |||
379 | if (!iwl_is_ready_rf(priv)) { | 384 | if (!iwl_is_ready_rf(priv)) { |
380 | IWL_DEBUG_SCAN(priv, "not ready or exit pending\n"); | 385 | IWL_DEBUG_SCAN(priv, "not ready or exit pending\n"); |
381 | goto unlock; | 386 | goto unlock; |
@@ -497,17 +502,27 @@ void iwl_bg_scan_completed(struct work_struct *work) | |||
497 | { | 502 | { |
498 | struct iwl_priv *priv = | 503 | struct iwl_priv *priv = |
499 | container_of(work, struct iwl_priv, scan_completed); | 504 | container_of(work, struct iwl_priv, scan_completed); |
505 | bool internal = false; | ||
500 | 506 | ||
501 | IWL_DEBUG_SCAN(priv, "SCAN complete scan\n"); | 507 | IWL_DEBUG_SCAN(priv, "SCAN complete scan\n"); |
502 | 508 | ||
503 | cancel_delayed_work(&priv->scan_check); | 509 | cancel_delayed_work(&priv->scan_check); |
504 | 510 | ||
505 | if (!priv->is_internal_short_scan) | 511 | mutex_lock(&priv->mutex); |
506 | ieee80211_scan_completed(priv->hw, false); | 512 | if (priv->is_internal_short_scan) { |
507 | else { | ||
508 | priv->is_internal_short_scan = false; | 513 | priv->is_internal_short_scan = false; |
509 | IWL_DEBUG_SCAN(priv, "internal short scan completed\n"); | 514 | IWL_DEBUG_SCAN(priv, "internal short scan completed\n"); |
515 | internal = true; | ||
510 | } | 516 | } |
517 | mutex_unlock(&priv->mutex); | ||
518 | |||
519 | /* | ||
520 | * Do not hold mutex here since this will cause mac80211 to call | ||
521 | * into driver again into functions that will attempt to take | ||
522 | * mutex. | ||
523 | */ | ||
524 | if (!internal) | ||
525 | ieee80211_scan_completed(priv->hw, false); | ||
511 | 526 | ||
512 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 527 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
513 | return; | 528 | return; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index 85ed235ac901..83a26361a9b5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -431,7 +431,7 @@ int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs, | |||
431 | struct iwl_link_quality_cmd *link_cmd; | 431 | struct iwl_link_quality_cmd *link_cmd; |
432 | unsigned long flags; | 432 | unsigned long flags; |
433 | 433 | ||
434 | if (*sta_id_r) | 434 | if (sta_id_r) |
435 | *sta_id_r = IWL_INVALID_STATION; | 435 | *sta_id_r = IWL_INVALID_STATION; |
436 | 436 | ||
437 | ret = iwl_add_station_common(priv, addr, 0, NULL, &sta_id); | 437 | ret = iwl_add_station_common(priv, addr, 0, NULL, &sta_id); |
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 2d2890878dea..4bd61ee627c0 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -2572,14 +2572,18 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev) | |||
2572 | 2572 | ||
2573 | static void rndis_wlan_do_link_down_work(struct usbnet *usbdev) | 2573 | static void rndis_wlan_do_link_down_work(struct usbnet *usbdev) |
2574 | { | 2574 | { |
2575 | union iwreq_data evt; | 2575 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); |
2576 | 2576 | ||
2577 | netif_carrier_off(usbdev->net); | 2577 | if (priv->connected) { |
2578 | priv->connected = false; | ||
2579 | memset(priv->bssid, 0, ETH_ALEN); | ||
2580 | |||
2581 | deauthenticate(usbdev); | ||
2578 | 2582 | ||
2579 | evt.data.flags = 0; | 2583 | cfg80211_disconnected(usbdev->net, 0, NULL, 0, GFP_KERNEL); |
2580 | evt.data.length = 0; | 2584 | } |
2581 | memset(evt.ap_addr.sa_data, 0, ETH_ALEN); | 2585 | |
2582 | wireless_send_event(usbdev->net, SIOCGIWAP, &evt, NULL); | 2586 | netif_carrier_off(usbdev->net); |
2583 | } | 2587 | } |
2584 | 2588 | ||
2585 | static void rndis_wlan_worker(struct work_struct *work) | 2589 | static void rndis_wlan_worker(struct work_struct *work) |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 4ba7b038928f..ad2c98af7e9d 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -926,7 +926,7 @@ static void rt2400pci_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
926 | static int rt2400pci_set_state(struct rt2x00_dev *rt2x00dev, | 926 | static int rt2400pci_set_state(struct rt2x00_dev *rt2x00dev, |
927 | enum dev_state state) | 927 | enum dev_state state) |
928 | { | 928 | { |
929 | u32 reg; | 929 | u32 reg, reg2; |
930 | unsigned int i; | 930 | unsigned int i; |
931 | char put_to_sleep; | 931 | char put_to_sleep; |
932 | char bbp_state; | 932 | char bbp_state; |
@@ -947,11 +947,12 @@ static int rt2400pci_set_state(struct rt2x00_dev *rt2x00dev, | |||
947 | * device has entered the correct state. | 947 | * device has entered the correct state. |
948 | */ | 948 | */ |
949 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | 949 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { |
950 | rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®); | 950 | rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®2); |
951 | bbp_state = rt2x00_get_field32(reg, PWRCSR1_BBP_CURR_STATE); | 951 | bbp_state = rt2x00_get_field32(reg2, PWRCSR1_BBP_CURR_STATE); |
952 | rf_state = rt2x00_get_field32(reg, PWRCSR1_RF_CURR_STATE); | 952 | rf_state = rt2x00_get_field32(reg2, PWRCSR1_RF_CURR_STATE); |
953 | if (bbp_state == state && rf_state == state) | 953 | if (bbp_state == state && rf_state == state) |
954 | return 0; | 954 | return 0; |
955 | rt2x00pci_register_write(rt2x00dev, PWRCSR1, reg); | ||
955 | msleep(10); | 956 | msleep(10); |
956 | } | 957 | } |
957 | 958 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 89d132d4af12..41da3d218c65 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1084,7 +1084,7 @@ static void rt2500pci_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
1084 | static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev, | 1084 | static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev, |
1085 | enum dev_state state) | 1085 | enum dev_state state) |
1086 | { | 1086 | { |
1087 | u32 reg; | 1087 | u32 reg, reg2; |
1088 | unsigned int i; | 1088 | unsigned int i; |
1089 | char put_to_sleep; | 1089 | char put_to_sleep; |
1090 | char bbp_state; | 1090 | char bbp_state; |
@@ -1105,11 +1105,12 @@ static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev, | |||
1105 | * device has entered the correct state. | 1105 | * device has entered the correct state. |
1106 | */ | 1106 | */ |
1107 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | 1107 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { |
1108 | rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®); | 1108 | rt2x00pci_register_read(rt2x00dev, PWRCSR1, ®2); |
1109 | bbp_state = rt2x00_get_field32(reg, PWRCSR1_BBP_CURR_STATE); | 1109 | bbp_state = rt2x00_get_field32(reg2, PWRCSR1_BBP_CURR_STATE); |
1110 | rf_state = rt2x00_get_field32(reg, PWRCSR1_RF_CURR_STATE); | 1110 | rf_state = rt2x00_get_field32(reg2, PWRCSR1_RF_CURR_STATE); |
1111 | if (bbp_state == state && rf_state == state) | 1111 | if (bbp_state == state && rf_state == state) |
1112 | return 0; | 1112 | return 0; |
1113 | rt2x00pci_register_write(rt2x00dev, PWRCSR1, reg); | ||
1113 | msleep(10); | 1114 | msleep(10); |
1114 | } | 1115 | } |
1115 | 1116 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 0f8b84b7224c..699161327d65 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -413,7 +413,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
413 | */ | 413 | */ |
414 | rt2x00_desc_read(txi, 0, &word); | 414 | rt2x00_desc_read(txi, 0, &word); |
415 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, | 415 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, |
416 | skb->len + TXWI_DESC_SIZE); | 416 | skb->len - TXINFO_DESC_SIZE); |
417 | rt2x00_set_field32(&word, TXINFO_W0_WIV, | 417 | rt2x00_set_field32(&word, TXINFO_W0_WIV, |
418 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); | 418 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); |
419 | rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2); | 419 | rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index a016f7ccde29..f71eee67f977 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -206,7 +206,7 @@ void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
206 | /* | 206 | /* |
207 | * Free irq line. | 207 | * Free irq line. |
208 | */ | 208 | */ |
209 | free_irq(to_pci_dev(rt2x00dev->dev)->irq, rt2x00dev); | 209 | free_irq(rt2x00dev->irq, rt2x00dev); |
210 | 210 | ||
211 | /* | 211 | /* |
212 | * Free DMA | 212 | * Free DMA |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 2e3076f67535..6a74baf4e934 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1689,7 +1689,7 @@ static void rt61pci_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
1689 | 1689 | ||
1690 | static int rt61pci_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state) | 1690 | static int rt61pci_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state) |
1691 | { | 1691 | { |
1692 | u32 reg; | 1692 | u32 reg, reg2; |
1693 | unsigned int i; | 1693 | unsigned int i; |
1694 | char put_to_sleep; | 1694 | char put_to_sleep; |
1695 | 1695 | ||
@@ -1706,10 +1706,11 @@ static int rt61pci_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state) | |||
1706 | * device has entered the correct state. | 1706 | * device has entered the correct state. |
1707 | */ | 1707 | */ |
1708 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | 1708 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { |
1709 | rt2x00pci_register_read(rt2x00dev, MAC_CSR12, ®); | 1709 | rt2x00pci_register_read(rt2x00dev, MAC_CSR12, ®2); |
1710 | state = rt2x00_get_field32(reg, MAC_CSR12_BBP_CURRENT_STATE); | 1710 | state = rt2x00_get_field32(reg2, MAC_CSR12_BBP_CURRENT_STATE); |
1711 | if (state == !put_to_sleep) | 1711 | if (state == !put_to_sleep) |
1712 | return 0; | 1712 | return 0; |
1713 | rt2x00pci_register_write(rt2x00dev, MAC_CSR12, reg); | ||
1713 | msleep(10); | 1714 | msleep(10); |
1714 | } | 1715 | } |
1715 | 1716 | ||
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index e35bd19c3c5a..6e0d82efe924 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1366,7 +1366,7 @@ static void rt73usb_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
1366 | 1366 | ||
1367 | static int rt73usb_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state) | 1367 | static int rt73usb_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state) |
1368 | { | 1368 | { |
1369 | u32 reg; | 1369 | u32 reg, reg2; |
1370 | unsigned int i; | 1370 | unsigned int i; |
1371 | char put_to_sleep; | 1371 | char put_to_sleep; |
1372 | 1372 | ||
@@ -1383,10 +1383,11 @@ static int rt73usb_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state) | |||
1383 | * device has entered the correct state. | 1383 | * device has entered the correct state. |
1384 | */ | 1384 | */ |
1385 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | 1385 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { |
1386 | rt2x00usb_register_read(rt2x00dev, MAC_CSR12, ®); | 1386 | rt2x00usb_register_read(rt2x00dev, MAC_CSR12, ®2); |
1387 | state = rt2x00_get_field32(reg, MAC_CSR12_BBP_CURRENT_STATE); | 1387 | state = rt2x00_get_field32(reg2, MAC_CSR12_BBP_CURRENT_STATE); |
1388 | if (state == !put_to_sleep) | 1388 | if (state == !put_to_sleep) |
1389 | return 0; | 1389 | return 0; |
1390 | rt2x00usb_register_write(rt2x00dev, MAC_CSR12, reg); | ||
1390 | msleep(10); | 1391 | msleep(10); |
1391 | } | 1392 | } |
1392 | 1393 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c index 57f4bfd959c8..b98fb643fab0 100644 --- a/drivers/net/wireless/wl12xx/wl1271_rx.c +++ b/drivers/net/wireless/wl12xx/wl1271_rx.c | |||
@@ -113,6 +113,8 @@ static void wl1271_rx_handle_data(struct wl1271 *wl, u32 length) | |||
113 | wl1271_debug(DEBUG_RX, "rx skb 0x%p: %d B %s", skb, skb->len, | 113 | wl1271_debug(DEBUG_RX, "rx skb 0x%p: %d B %s", skb, skb->len, |
114 | beacon ? "beacon" : ""); | 114 | beacon ? "beacon" : ""); |
115 | 115 | ||
116 | skb_trim(skb, skb->len - desc->pad_len); | ||
117 | |||
116 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); | 118 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); |
117 | ieee80211_rx_ni(wl->hw, skb); | 119 | ieee80211_rx_ni(wl->hw, skb); |
118 | } | 120 | } |
diff --git a/include/linux/fec.h b/include/linux/fec.h new file mode 100644 index 000000000000..5d3523d8dd0c --- /dev/null +++ b/include/linux/fec.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* include/linux/fec.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Orex Computed Radiography | ||
4 | * Baruch Siach <baruch@tkos.co.il> | ||
5 | * | ||
6 | * Header file for the FEC platform data | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __LINUX_FEC_H__ | ||
13 | #define __LINUX_FEC_H__ | ||
14 | |||
15 | #include <linux/phy.h> | ||
16 | |||
17 | struct fec_platform_data { | ||
18 | phy_interface_t phy; | ||
19 | }; | ||
20 | |||
21 | #endif | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a1bff6518166..40291f375024 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1407,17 +1407,25 @@ struct softnet_data { | |||
1407 | struct softnet_data *rps_ipi_next; | 1407 | struct softnet_data *rps_ipi_next; |
1408 | unsigned int cpu; | 1408 | unsigned int cpu; |
1409 | unsigned int input_queue_head; | 1409 | unsigned int input_queue_head; |
1410 | unsigned int input_queue_tail; | ||
1410 | #endif | 1411 | #endif |
1411 | unsigned dropped; | 1412 | unsigned dropped; |
1412 | struct sk_buff_head input_pkt_queue; | 1413 | struct sk_buff_head input_pkt_queue; |
1413 | struct napi_struct backlog; | 1414 | struct napi_struct backlog; |
1414 | }; | 1415 | }; |
1415 | 1416 | ||
1416 | static inline void input_queue_head_add(struct softnet_data *sd, | 1417 | static inline void input_queue_head_incr(struct softnet_data *sd) |
1417 | unsigned int len) | ||
1418 | { | 1418 | { |
1419 | #ifdef CONFIG_RPS | 1419 | #ifdef CONFIG_RPS |
1420 | sd->input_queue_head += len; | 1420 | sd->input_queue_head++; |
1421 | #endif | ||
1422 | } | ||
1423 | |||
1424 | static inline void input_queue_tail_incr_save(struct softnet_data *sd, | ||
1425 | unsigned int *qtail) | ||
1426 | { | ||
1427 | #ifdef CONFIG_RPS | ||
1428 | *qtail = ++sd->input_queue_tail; | ||
1421 | #endif | 1429 | #endif |
1422 | } | 1430 | } |
1423 | 1431 | ||
@@ -2326,7 +2334,7 @@ do { \ | |||
2326 | #define netif_vdbg(priv, type, dev, format, args...) \ | 2334 | #define netif_vdbg(priv, type, dev, format, args...) \ |
2327 | ({ \ | 2335 | ({ \ |
2328 | if (0) \ | 2336 | if (0) \ |
2329 | netif_printk(KERN_DEBUG, dev, format, ##args); \ | 2337 | netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ |
2330 | 0; \ | 2338 | 0; \ |
2331 | }) | 2339 | }) |
2332 | #endif | 2340 | #endif |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index c2ee5d8550cf..c00cc0c4d0b7 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -333,7 +333,7 @@ struct xt_target { | |||
333 | /* Called when user tries to insert an entry of this type: | 333 | /* Called when user tries to insert an entry of this type: |
334 | hook_mask is a bitmask of hooks from which it can be | 334 | hook_mask is a bitmask of hooks from which it can be |
335 | called. */ | 335 | called. */ |
336 | /* Should return true or false, or an error code (-Exxxx). */ | 336 | /* Should return 0 on success or an error code otherwise (-Exxxx). */ |
337 | int (*checkentry)(const struct xt_tgchk_param *); | 337 | int (*checkentry)(const struct xt_tgchk_param *); |
338 | 338 | ||
339 | /* Called when entry of this type deleted. */ | 339 | /* Called when entry of this type deleted. */ |
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h index 997603f2bf4c..9402543fc20d 100644 --- a/include/net/caif/cfctrl.h +++ b/include/net/caif/cfctrl.h | |||
@@ -94,8 +94,8 @@ struct cfctrl_request_info { | |||
94 | enum cfctrl_cmd cmd; | 94 | enum cfctrl_cmd cmd; |
95 | u8 channel_id; | 95 | u8 channel_id; |
96 | struct cfctrl_link_param param; | 96 | struct cfctrl_link_param param; |
97 | struct cfctrl_request_info *next; | ||
98 | struct cflayer *client_layer; | 97 | struct cflayer *client_layer; |
98 | struct list_head list; | ||
99 | }; | 99 | }; |
100 | 100 | ||
101 | struct cfctrl { | 101 | struct cfctrl { |
@@ -103,7 +103,7 @@ struct cfctrl { | |||
103 | struct cfctrl_rsp res; | 103 | struct cfctrl_rsp res; |
104 | atomic_t req_seq_no; | 104 | atomic_t req_seq_no; |
105 | atomic_t rsp_seq_no; | 105 | atomic_t rsp_seq_no; |
106 | struct cfctrl_request_info *first_req; | 106 | struct list_head list; |
107 | /* Protects from simultaneous access to first_req list */ | 107 | /* Protects from simultaneous access to first_req list */ |
108 | spinlock_t info_list_lock; | 108 | spinlock_t info_list_lock; |
109 | #ifndef CAIF_NO_LOOP | 109 | #ifndef CAIF_NO_LOOP |
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h new file mode 100644 index 000000000000..6cf44866cecd --- /dev/null +++ b/include/net/cls_cgroup.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * cls_cgroup.h Control Group Classifier | ||
3 | * | ||
4 | * Authors: Thomas Graf <tgraf@suug.ch> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation; either version 2 of the License, or (at your option) | ||
9 | * any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef _NET_CLS_CGROUP_H | ||
14 | #define _NET_CLS_CGROUP_H | ||
15 | |||
16 | #include <linux/cgroup.h> | ||
17 | #include <linux/hardirq.h> | ||
18 | #include <linux/rcupdate.h> | ||
19 | |||
20 | #ifdef CONFIG_CGROUPS | ||
21 | struct cgroup_cls_state | ||
22 | { | ||
23 | struct cgroup_subsys_state css; | ||
24 | u32 classid; | ||
25 | }; | ||
26 | |||
27 | #ifdef CONFIG_NET_CLS_CGROUP | ||
28 | static inline u32 task_cls_classid(struct task_struct *p) | ||
29 | { | ||
30 | if (in_interrupt()) | ||
31 | return 0; | ||
32 | |||
33 | return container_of(task_subsys_state(p, net_cls_subsys_id), | ||
34 | struct cgroup_cls_state, css)->classid; | ||
35 | } | ||
36 | #else | ||
37 | extern int net_cls_subsys_id; | ||
38 | |||
39 | static inline u32 task_cls_classid(struct task_struct *p) | ||
40 | { | ||
41 | int id; | ||
42 | u32 classid; | ||
43 | |||
44 | if (in_interrupt()) | ||
45 | return 0; | ||
46 | |||
47 | rcu_read_lock(); | ||
48 | id = rcu_dereference(net_cls_subsys_id); | ||
49 | if (id >= 0) | ||
50 | classid = container_of(task_subsys_state(p, id), | ||
51 | struct cgroup_cls_state, css)->classid; | ||
52 | rcu_read_unlock(); | ||
53 | |||
54 | return classid; | ||
55 | } | ||
56 | #endif | ||
57 | #else | ||
58 | static inline u32 task_cls_classid(struct task_struct *p) | ||
59 | { | ||
60 | return 0; | ||
61 | } | ||
62 | #endif | ||
63 | #endif /* _NET_CLS_CGROUP_H */ | ||
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index e24b0363e6cb..de22cbfef232 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -815,6 +815,7 @@ enum ieee80211_key_flags { | |||
815 | * encrypted in hardware. | 815 | * encrypted in hardware. |
816 | * @alg: The key algorithm. | 816 | * @alg: The key algorithm. |
817 | * @flags: key flags, see &enum ieee80211_key_flags. | 817 | * @flags: key flags, see &enum ieee80211_key_flags. |
818 | * @ap_addr: AP's MAC address | ||
818 | * @keyidx: the key index (0-3) | 819 | * @keyidx: the key index (0-3) |
819 | * @keylen: key material length | 820 | * @keylen: key material length |
820 | * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte) | 821 | * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte) |
@@ -1637,6 +1638,8 @@ enum ieee80211_ampdu_mlme_action { | |||
1637 | * Returns a negative error code on failure. | 1638 | * Returns a negative error code on failure. |
1638 | * The callback must be atomic. | 1639 | * The callback must be atomic. |
1639 | * | 1640 | * |
1641 | * @get_survey: Return per-channel survey information | ||
1642 | * | ||
1640 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also | 1643 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also |
1641 | * need to set wiphy->rfkill_poll to %true before registration, | 1644 | * need to set wiphy->rfkill_poll to %true before registration, |
1642 | * and need to call wiphy_rfkill_set_hw_state() in the callback. | 1645 | * and need to call wiphy_rfkill_set_hw_state() in the callback. |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index dffde8e6920e..3d7524fba194 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -61,7 +61,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb) | |||
61 | int ret = NF_ACCEPT; | 61 | int ret = NF_ACCEPT; |
62 | 62 | ||
63 | if (ct && ct != &nf_conntrack_untracked) { | 63 | if (ct && ct != &nf_conntrack_untracked) { |
64 | if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) | 64 | if (!nf_ct_is_confirmed(ct)) |
65 | ret = __nf_conntrack_confirm(skb); | 65 | ret = __nf_conntrack_confirm(skb); |
66 | if (likely(ret == NF_ACCEPT)) | 66 | if (likely(ret == NF_ACCEPT)) |
67 | nf_ct_deliver_cached_events(ct); | 67 | nf_ct_deliver_cached_events(ct); |
diff --git a/include/net/sock.h b/include/net/sock.h index 5697caf8cc76..d2a71b04a5ae 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -312,7 +312,7 @@ struct sock { | |||
312 | void *sk_security; | 312 | void *sk_security; |
313 | #endif | 313 | #endif |
314 | __u32 sk_mark; | 314 | __u32 sk_mark; |
315 | /* XXX 4 bytes hole on 64 bit */ | 315 | u32 sk_classid; |
316 | void (*sk_state_change)(struct sock *sk); | 316 | void (*sk_state_change)(struct sock *sk); |
317 | void (*sk_data_ready)(struct sock *sk, int bytes); | 317 | void (*sk_data_ready)(struct sock *sk, int bytes); |
318 | void (*sk_write_space)(struct sock *sk); | 318 | void (*sk_write_space)(struct sock *sk); |
@@ -1074,6 +1074,14 @@ extern void *sock_kmalloc(struct sock *sk, int size, | |||
1074 | extern void sock_kfree_s(struct sock *sk, void *mem, int size); | 1074 | extern void sock_kfree_s(struct sock *sk, void *mem, int size); |
1075 | extern void sk_send_sigurg(struct sock *sk); | 1075 | extern void sk_send_sigurg(struct sock *sk); |
1076 | 1076 | ||
1077 | #ifdef CONFIG_CGROUPS | ||
1078 | extern void sock_update_classid(struct sock *sk); | ||
1079 | #else | ||
1080 | static inline void sock_update_classid(struct sock *sk) | ||
1081 | { | ||
1082 | } | ||
1083 | #endif | ||
1084 | |||
1077 | /* | 1085 | /* |
1078 | * Functions to fill in entries in struct proto_ops when a protocol | 1086 | * Functions to fill in entries in struct proto_ops when a protocol |
1079 | * does not implement a particular function. | 1087 | * does not implement a particular function. |
@@ -1404,7 +1412,7 @@ static inline int sk_has_allocations(const struct sock *sk) | |||
1404 | 1412 | ||
1405 | /** | 1413 | /** |
1406 | * wq_has_sleeper - check if there are any waiting processes | 1414 | * wq_has_sleeper - check if there are any waiting processes |
1407 | * @sk: struct socket_wq | 1415 | * @wq: struct socket_wq |
1408 | * | 1416 | * |
1409 | * Returns true if socket_wq has waiting processes | 1417 | * Returns true if socket_wq has waiting processes |
1410 | * | 1418 | * |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 84ff5e75c084..997080f00e0b 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -2287,6 +2287,8 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, | |||
2287 | if (write) { | 2287 | if (write) { |
2288 | left -= proc_skip_spaces(&kbuf); | 2288 | left -= proc_skip_spaces(&kbuf); |
2289 | 2289 | ||
2290 | if (!left) | ||
2291 | break; | ||
2290 | err = proc_get_long(&kbuf, &left, &lval, &neg, | 2292 | err = proc_get_long(&kbuf, &left, &lval, &neg, |
2291 | proc_wspace_sep, | 2293 | proc_wspace_sep, |
2292 | sizeof(proc_wspace_sep), NULL); | 2294 | sizeof(proc_wspace_sep), NULL); |
@@ -2313,7 +2315,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, | |||
2313 | 2315 | ||
2314 | if (!write && !first && left && !err) | 2316 | if (!write && !first && left && !err) |
2315 | err = proc_put_char(&buffer, &left, '\n'); | 2317 | err = proc_put_char(&buffer, &left, '\n'); |
2316 | if (write && !err) | 2318 | if (write && !err && left) |
2317 | left -= proc_skip_spaces(&kbuf); | 2319 | left -= proc_skip_spaces(&kbuf); |
2318 | free: | 2320 | free: |
2319 | if (write) { | 2321 | if (write) { |
diff --git a/net/caif/Kconfig b/net/caif/Kconfig index cd1daf6008bd..ed651786f16b 100644 --- a/net/caif/Kconfig +++ b/net/caif/Kconfig | |||
@@ -2,10 +2,8 @@ | |||
2 | # CAIF net configurations | 2 | # CAIF net configurations |
3 | # | 3 | # |
4 | 4 | ||
5 | #menu "CAIF Support" | ||
6 | comment "CAIF Support" | ||
7 | menuconfig CAIF | 5 | menuconfig CAIF |
8 | tristate "Enable CAIF support" | 6 | tristate "CAIF support" |
9 | select CRC_CCITT | 7 | select CRC_CCITT |
10 | default n | 8 | default n |
11 | ---help--- | 9 | ---help--- |
@@ -45,4 +43,3 @@ config CAIF_NETDEV | |||
45 | If unsure say Y. | 43 | If unsure say Y. |
46 | 44 | ||
47 | endif | 45 | endif |
48 | #endmenu | ||
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index c3a70c5c893a..3d0e09584fae 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
@@ -60,7 +60,7 @@ struct debug_fs_counter { | |||
60 | atomic_t num_rx_flow_off; | 60 | atomic_t num_rx_flow_off; |
61 | atomic_t num_rx_flow_on; | 61 | atomic_t num_rx_flow_on; |
62 | }; | 62 | }; |
63 | struct debug_fs_counter cnt; | 63 | static struct debug_fs_counter cnt; |
64 | #define dbfs_atomic_inc(v) atomic_inc(v) | 64 | #define dbfs_atomic_inc(v) atomic_inc(v) |
65 | #define dbfs_atomic_dec(v) atomic_dec(v) | 65 | #define dbfs_atomic_dec(v) atomic_dec(v) |
66 | #else | 66 | #else |
@@ -128,17 +128,17 @@ static void caif_read_unlock(struct sock *sk) | |||
128 | mutex_unlock(&cf_sk->readlock); | 128 | mutex_unlock(&cf_sk->readlock); |
129 | } | 129 | } |
130 | 130 | ||
131 | int sk_rcvbuf_lowwater(struct caifsock *cf_sk) | 131 | static int sk_rcvbuf_lowwater(struct caifsock *cf_sk) |
132 | { | 132 | { |
133 | /* A quarter of full buffer is used a low water mark */ | 133 | /* A quarter of full buffer is used a low water mark */ |
134 | return cf_sk->sk.sk_rcvbuf / 4; | 134 | return cf_sk->sk.sk_rcvbuf / 4; |
135 | } | 135 | } |
136 | 136 | ||
137 | void caif_flow_ctrl(struct sock *sk, int mode) | 137 | static void caif_flow_ctrl(struct sock *sk, int mode) |
138 | { | 138 | { |
139 | struct caifsock *cf_sk; | 139 | struct caifsock *cf_sk; |
140 | cf_sk = container_of(sk, struct caifsock, sk); | 140 | cf_sk = container_of(sk, struct caifsock, sk); |
141 | if (cf_sk->layer.dn) | 141 | if (cf_sk->layer.dn && cf_sk->layer.dn->modemcmd) |
142 | cf_sk->layer.dn->modemcmd(cf_sk->layer.dn, mode); | 142 | cf_sk->layer.dn->modemcmd(cf_sk->layer.dn, mode); |
143 | } | 143 | } |
144 | 144 | ||
@@ -146,7 +146,7 @@ void caif_flow_ctrl(struct sock *sk, int mode) | |||
146 | * Copied from sock.c:sock_queue_rcv_skb(), but changed so packets are | 146 | * Copied from sock.c:sock_queue_rcv_skb(), but changed so packets are |
147 | * not dropped, but CAIF is sending flow off instead. | 147 | * not dropped, but CAIF is sending flow off instead. |
148 | */ | 148 | */ |
149 | int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | 149 | static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) |
150 | { | 150 | { |
151 | int err; | 151 | int err; |
152 | int skb_len; | 152 | int skb_len; |
@@ -162,9 +162,8 @@ int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
162 | atomic_read(&cf_sk->sk.sk_rmem_alloc), | 162 | atomic_read(&cf_sk->sk.sk_rmem_alloc), |
163 | sk_rcvbuf_lowwater(cf_sk)); | 163 | sk_rcvbuf_lowwater(cf_sk)); |
164 | set_rx_flow_off(cf_sk); | 164 | set_rx_flow_off(cf_sk); |
165 | if (cf_sk->layer.dn) | 165 | dbfs_atomic_inc(&cnt.num_rx_flow_off); |
166 | cf_sk->layer.dn->modemcmd(cf_sk->layer.dn, | 166 | caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_OFF_REQ); |
167 | CAIF_MODEMCMD_FLOW_OFF_REQ); | ||
168 | } | 167 | } |
169 | 168 | ||
170 | err = sk_filter(sk, skb); | 169 | err = sk_filter(sk, skb); |
@@ -175,9 +174,8 @@ int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
175 | trace_printk("CAIF: %s():" | 174 | trace_printk("CAIF: %s():" |
176 | " sending flow OFF due to rmem_schedule\n", | 175 | " sending flow OFF due to rmem_schedule\n", |
177 | __func__); | 176 | __func__); |
178 | if (cf_sk->layer.dn) | 177 | dbfs_atomic_inc(&cnt.num_rx_flow_off); |
179 | cf_sk->layer.dn->modemcmd(cf_sk->layer.dn, | 178 | caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_OFF_REQ); |
180 | CAIF_MODEMCMD_FLOW_OFF_REQ); | ||
181 | } | 179 | } |
182 | skb->dev = NULL; | 180 | skb->dev = NULL; |
183 | skb_set_owner_r(skb, sk); | 181 | skb_set_owner_r(skb, sk); |
@@ -285,65 +283,51 @@ static void caif_check_flow_release(struct sock *sk) | |||
285 | { | 283 | { |
286 | struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); | 284 | struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); |
287 | 285 | ||
288 | if (cf_sk->layer.dn == NULL || cf_sk->layer.dn->modemcmd == NULL) | ||
289 | return; | ||
290 | if (rx_flow_is_on(cf_sk)) | 286 | if (rx_flow_is_on(cf_sk)) |
291 | return; | 287 | return; |
292 | 288 | ||
293 | if (atomic_read(&sk->sk_rmem_alloc) <= sk_rcvbuf_lowwater(cf_sk)) { | 289 | if (atomic_read(&sk->sk_rmem_alloc) <= sk_rcvbuf_lowwater(cf_sk)) { |
294 | dbfs_atomic_inc(&cnt.num_rx_flow_on); | 290 | dbfs_atomic_inc(&cnt.num_rx_flow_on); |
295 | set_rx_flow_on(cf_sk); | 291 | set_rx_flow_on(cf_sk); |
296 | cf_sk->layer.dn->modemcmd(cf_sk->layer.dn, | 292 | caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_ON_REQ); |
297 | CAIF_MODEMCMD_FLOW_ON_REQ); | ||
298 | } | 293 | } |
299 | } | 294 | } |
295 | |||
300 | /* | 296 | /* |
301 | * Copied from sock.c:sock_queue_rcv_skb(), and added check that user buffer | 297 | * Copied from unix_dgram_recvmsg, but removed credit checks, |
302 | * has sufficient size. | 298 | * changed locking, address handling and added MSG_TRUNC. |
303 | */ | 299 | */ |
304 | |||
305 | static int caif_seqpkt_recvmsg(struct kiocb *iocb, struct socket *sock, | 300 | static int caif_seqpkt_recvmsg(struct kiocb *iocb, struct socket *sock, |
306 | struct msghdr *m, size_t buf_len, int flags) | 301 | struct msghdr *m, size_t len, int flags) |
307 | 302 | ||
308 | { | 303 | { |
309 | struct sock *sk = sock->sk; | 304 | struct sock *sk = sock->sk; |
310 | struct sk_buff *skb; | 305 | struct sk_buff *skb; |
311 | int ret = 0; | 306 | int ret; |
312 | int len; | 307 | int copylen; |
313 | 308 | ||
314 | if (unlikely(!buf_len)) | 309 | ret = -EOPNOTSUPP; |
315 | return -EINVAL; | 310 | if (m->msg_flags&MSG_OOB) |
311 | goto read_error; | ||
316 | 312 | ||
317 | skb = skb_recv_datagram(sk, flags, 0 , &ret); | 313 | skb = skb_recv_datagram(sk, flags, 0 , &ret); |
318 | if (!skb) | 314 | if (!skb) |
319 | goto read_error; | 315 | goto read_error; |
320 | 316 | copylen = skb->len; | |
321 | len = skb->len; | 317 | if (len < copylen) { |
322 | 318 | m->msg_flags |= MSG_TRUNC; | |
323 | if (skb && skb->len > buf_len && !(flags & MSG_PEEK)) { | 319 | copylen = len; |
324 | len = buf_len; | ||
325 | /* | ||
326 | * Push skb back on receive queue if buffer too small. | ||
327 | * This has a built-in race where multi-threaded receive | ||
328 | * may get packet in wrong order, but multiple read does | ||
329 | * not really guarantee ordered delivery anyway. | ||
330 | * Let's optimize for speed without taking locks. | ||
331 | */ | ||
332 | |||
333 | skb_queue_head(&sk->sk_receive_queue, skb); | ||
334 | ret = -EMSGSIZE; | ||
335 | goto read_error; | ||
336 | } | 320 | } |
337 | 321 | ||
338 | ret = skb_copy_datagram_iovec(skb, 0, m->msg_iov, len); | 322 | ret = skb_copy_datagram_iovec(skb, 0, m->msg_iov, copylen); |
339 | if (ret) | 323 | if (ret) |
340 | goto read_error; | 324 | goto out_free; |
341 | 325 | ||
326 | ret = (flags & MSG_TRUNC) ? skb->len : copylen; | ||
327 | out_free: | ||
342 | skb_free_datagram(sk, skb); | 328 | skb_free_datagram(sk, skb); |
343 | |||
344 | caif_check_flow_release(sk); | 329 | caif_check_flow_release(sk); |
345 | 330 | return ret; | |
346 | return len; | ||
347 | 331 | ||
348 | read_error: | 332 | read_error: |
349 | return ret; | 333 | return ret; |
@@ -920,17 +904,17 @@ wait_connect: | |||
920 | timeo = sock_sndtimeo(sk, flags & O_NONBLOCK); | 904 | timeo = sock_sndtimeo(sk, flags & O_NONBLOCK); |
921 | 905 | ||
922 | release_sock(sk); | 906 | release_sock(sk); |
923 | err = wait_event_interruptible_timeout(*sk_sleep(sk), | 907 | err = -ERESTARTSYS; |
908 | timeo = wait_event_interruptible_timeout(*sk_sleep(sk), | ||
924 | sk->sk_state != CAIF_CONNECTING, | 909 | sk->sk_state != CAIF_CONNECTING, |
925 | timeo); | 910 | timeo); |
926 | lock_sock(sk); | 911 | lock_sock(sk); |
927 | if (err < 0) | 912 | if (timeo < 0) |
928 | goto out; /* -ERESTARTSYS */ | 913 | goto out; /* -ERESTARTSYS */ |
929 | if (err == 0 && sk->sk_state != CAIF_CONNECTED) { | ||
930 | err = -ETIMEDOUT; | ||
931 | goto out; | ||
932 | } | ||
933 | 914 | ||
915 | err = -ETIMEDOUT; | ||
916 | if (timeo == 0 && sk->sk_state != CAIF_CONNECTED) | ||
917 | goto out; | ||
934 | if (sk->sk_state != CAIF_CONNECTED) { | 918 | if (sk->sk_state != CAIF_CONNECTED) { |
935 | sock->state = SS_UNCONNECTED; | 919 | sock->state = SS_UNCONNECTED; |
936 | err = sock_error(sk); | 920 | err = sock_error(sk); |
@@ -945,7 +929,6 @@ out: | |||
945 | return err; | 929 | return err; |
946 | } | 930 | } |
947 | 931 | ||
948 | |||
949 | /* | 932 | /* |
950 | * caif_release() - Disconnect a CAIF Socket | 933 | * caif_release() - Disconnect a CAIF Socket |
951 | * Copied and modified af_irda.c:irda_release(). | 934 | * Copied and modified af_irda.c:irda_release(). |
@@ -1019,10 +1002,6 @@ static unsigned int caif_poll(struct file *file, | |||
1019 | (sk->sk_shutdown & RCV_SHUTDOWN)) | 1002 | (sk->sk_shutdown & RCV_SHUTDOWN)) |
1020 | mask |= POLLIN | POLLRDNORM; | 1003 | mask |= POLLIN | POLLRDNORM; |
1021 | 1004 | ||
1022 | /* Connection-based need to check for termination and startup */ | ||
1023 | if (sk->sk_state == CAIF_DISCONNECTED) | ||
1024 | mask |= POLLHUP; | ||
1025 | |||
1026 | /* | 1005 | /* |
1027 | * we set writable also when the other side has shut down the | 1006 | * we set writable also when the other side has shut down the |
1028 | * connection. This prevents stuck sockets. | 1007 | * connection. This prevents stuck sockets. |
@@ -1194,7 +1173,7 @@ static struct net_proto_family caif_family_ops = { | |||
1194 | .owner = THIS_MODULE, | 1173 | .owner = THIS_MODULE, |
1195 | }; | 1174 | }; |
1196 | 1175 | ||
1197 | int af_caif_init(void) | 1176 | static int af_caif_init(void) |
1198 | { | 1177 | { |
1199 | int err = sock_register(&caif_family_ops); | 1178 | int err = sock_register(&caif_family_ops); |
1200 | if (!err) | 1179 | if (!err) |
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c index 0ffe1e1ce901..fcfda98a5e6d 100644 --- a/net/caif/cfctrl.c +++ b/net/caif/cfctrl.c | |||
@@ -44,13 +44,14 @@ struct cflayer *cfctrl_create(void) | |||
44 | dev_info.id = 0xff; | 44 | dev_info.id = 0xff; |
45 | memset(this, 0, sizeof(*this)); | 45 | memset(this, 0, sizeof(*this)); |
46 | cfsrvl_init(&this->serv, 0, &dev_info); | 46 | cfsrvl_init(&this->serv, 0, &dev_info); |
47 | spin_lock_init(&this->info_list_lock); | ||
48 | atomic_set(&this->req_seq_no, 1); | 47 | atomic_set(&this->req_seq_no, 1); |
49 | atomic_set(&this->rsp_seq_no, 1); | 48 | atomic_set(&this->rsp_seq_no, 1); |
50 | this->serv.layer.receive = cfctrl_recv; | 49 | this->serv.layer.receive = cfctrl_recv; |
51 | sprintf(this->serv.layer.name, "ctrl"); | 50 | sprintf(this->serv.layer.name, "ctrl"); |
52 | this->serv.layer.ctrlcmd = cfctrl_ctrlcmd; | 51 | this->serv.layer.ctrlcmd = cfctrl_ctrlcmd; |
53 | spin_lock_init(&this->loop_linkid_lock); | 52 | spin_lock_init(&this->loop_linkid_lock); |
53 | spin_lock_init(&this->info_list_lock); | ||
54 | INIT_LIST_HEAD(&this->list); | ||
54 | this->loop_linkid = 1; | 55 | this->loop_linkid = 1; |
55 | return &this->serv.layer; | 56 | return &this->serv.layer; |
56 | } | 57 | } |
@@ -112,20 +113,10 @@ bool cfctrl_req_eq(struct cfctrl_request_info *r1, | |||
112 | void cfctrl_insert_req(struct cfctrl *ctrl, | 113 | void cfctrl_insert_req(struct cfctrl *ctrl, |
113 | struct cfctrl_request_info *req) | 114 | struct cfctrl_request_info *req) |
114 | { | 115 | { |
115 | struct cfctrl_request_info *p; | ||
116 | spin_lock(&ctrl->info_list_lock); | 116 | spin_lock(&ctrl->info_list_lock); |
117 | req->next = NULL; | ||
118 | atomic_inc(&ctrl->req_seq_no); | 117 | atomic_inc(&ctrl->req_seq_no); |
119 | req->sequence_no = atomic_read(&ctrl->req_seq_no); | 118 | req->sequence_no = atomic_read(&ctrl->req_seq_no); |
120 | if (ctrl->first_req == NULL) { | 119 | list_add_tail(&req->list, &ctrl->list); |
121 | ctrl->first_req = req; | ||
122 | spin_unlock(&ctrl->info_list_lock); | ||
123 | return; | ||
124 | } | ||
125 | p = ctrl->first_req; | ||
126 | while (p->next != NULL) | ||
127 | p = p->next; | ||
128 | p->next = req; | ||
129 | spin_unlock(&ctrl->info_list_lock); | 120 | spin_unlock(&ctrl->info_list_lock); |
130 | } | 121 | } |
131 | 122 | ||
@@ -133,46 +124,28 @@ void cfctrl_insert_req(struct cfctrl *ctrl, | |||
133 | struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl, | 124 | struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl, |
134 | struct cfctrl_request_info *req) | 125 | struct cfctrl_request_info *req) |
135 | { | 126 | { |
136 | struct cfctrl_request_info *p; | 127 | struct cfctrl_request_info *p, *tmp, *first; |
137 | struct cfctrl_request_info *ret; | ||
138 | 128 | ||
139 | spin_lock(&ctrl->info_list_lock); | 129 | spin_lock(&ctrl->info_list_lock); |
140 | if (ctrl->first_req == NULL) { | 130 | first = list_first_entry(&ctrl->list, struct cfctrl_request_info, list); |
141 | spin_unlock(&ctrl->info_list_lock); | ||
142 | return NULL; | ||
143 | } | ||
144 | |||
145 | if (cfctrl_req_eq(req, ctrl->first_req)) { | ||
146 | ret = ctrl->first_req; | ||
147 | caif_assert(ctrl->first_req); | ||
148 | atomic_set(&ctrl->rsp_seq_no, | ||
149 | ctrl->first_req->sequence_no); | ||
150 | ctrl->first_req = ctrl->first_req->next; | ||
151 | spin_unlock(&ctrl->info_list_lock); | ||
152 | return ret; | ||
153 | } | ||
154 | 131 | ||
155 | p = ctrl->first_req; | 132 | list_for_each_entry_safe(p, tmp, &ctrl->list, list) { |
156 | 133 | if (cfctrl_req_eq(req, p)) { | |
157 | while (p->next != NULL) { | 134 | if (p != first) |
158 | if (cfctrl_req_eq(req, p->next)) { | 135 | pr_warning("CAIF: %s(): Requests are not " |
159 | pr_warning("CAIF: %s(): Requests are not " | ||
160 | "received in order\n", | 136 | "received in order\n", |
161 | __func__); | 137 | __func__); |
162 | ret = p->next; | 138 | |
163 | atomic_set(&ctrl->rsp_seq_no, | 139 | atomic_set(&ctrl->rsp_seq_no, |
164 | p->next->sequence_no); | 140 | p->sequence_no); |
165 | p->next = p->next->next; | 141 | list_del(&p->list); |
166 | spin_unlock(&ctrl->info_list_lock); | 142 | goto out; |
167 | return ret; | ||
168 | } | 143 | } |
169 | p = p->next; | ||
170 | } | 144 | } |
145 | p = NULL; | ||
146 | out: | ||
171 | spin_unlock(&ctrl->info_list_lock); | 147 | spin_unlock(&ctrl->info_list_lock); |
172 | 148 | return p; | |
173 | pr_warning("CAIF: %s(): Request does not match\n", | ||
174 | __func__); | ||
175 | return NULL; | ||
176 | } | 149 | } |
177 | 150 | ||
178 | struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer) | 151 | struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer) |
@@ -388,31 +361,18 @@ void cfctrl_getstartreason_req(struct cflayer *layer) | |||
388 | 361 | ||
389 | void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer) | 362 | void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer) |
390 | { | 363 | { |
391 | struct cfctrl_request_info *p, *req; | 364 | struct cfctrl_request_info *p, *tmp; |
392 | struct cfctrl *ctrl = container_obj(layr); | 365 | struct cfctrl *ctrl = container_obj(layr); |
393 | spin_lock(&ctrl->info_list_lock); | 366 | spin_lock(&ctrl->info_list_lock); |
394 | 367 | pr_warning("CAIF: %s(): enter\n", __func__); | |
395 | if (ctrl->first_req == NULL) { | 368 | |
396 | spin_unlock(&ctrl->info_list_lock); | 369 | list_for_each_entry_safe(p, tmp, &ctrl->list, list) { |
397 | return; | 370 | if (p->client_layer == adap_layer) { |
398 | } | 371 | pr_warning("CAIF: %s(): cancel req :%d\n", __func__, |
399 | 372 | p->sequence_no); | |
400 | if (ctrl->first_req->client_layer == adap_layer) { | 373 | list_del(&p->list); |
401 | 374 | kfree(p); | |
402 | req = ctrl->first_req; | ||
403 | ctrl->first_req = ctrl->first_req->next; | ||
404 | kfree(req); | ||
405 | } | ||
406 | |||
407 | p = ctrl->first_req; | ||
408 | while (p != NULL && p->next != NULL) { | ||
409 | if (p->next->client_layer == adap_layer) { | ||
410 | |||
411 | req = p->next; | ||
412 | p->next = p->next->next; | ||
413 | kfree(p->next); | ||
414 | } | 375 | } |
415 | p = p->next; | ||
416 | } | 376 | } |
417 | 377 | ||
418 | spin_unlock(&ctrl->info_list_lock); | 378 | spin_unlock(&ctrl->info_list_lock); |
@@ -634,7 +594,7 @@ static void cfctrl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, | |||
634 | case _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND: | 594 | case _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND: |
635 | case CAIF_CTRLCMD_FLOW_OFF_IND: | 595 | case CAIF_CTRLCMD_FLOW_OFF_IND: |
636 | spin_lock(&this->info_list_lock); | 596 | spin_lock(&this->info_list_lock); |
637 | if (this->first_req != NULL) { | 597 | if (!list_empty(&this->list)) { |
638 | pr_debug("CAIF: %s(): Received flow off in " | 598 | pr_debug("CAIF: %s(): Received flow off in " |
639 | "control layer", __func__); | 599 | "control layer", __func__); |
640 | } | 600 | } |
diff --git a/net/caif/cfmuxl.c b/net/caif/cfmuxl.c index 7372f27f1d32..80c8d332b258 100644 --- a/net/caif/cfmuxl.c +++ b/net/caif/cfmuxl.c | |||
@@ -174,10 +174,11 @@ struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 id) | |||
174 | spin_lock(&muxl->receive_lock); | 174 | spin_lock(&muxl->receive_lock); |
175 | up = get_up(muxl, id); | 175 | up = get_up(muxl, id); |
176 | if (up == NULL) | 176 | if (up == NULL) |
177 | return NULL; | 177 | goto out; |
178 | memset(muxl->up_cache, 0, sizeof(muxl->up_cache)); | 178 | memset(muxl->up_cache, 0, sizeof(muxl->up_cache)); |
179 | list_del(&up->node); | 179 | list_del(&up->node); |
180 | cfsrvl_put(up); | 180 | cfsrvl_put(up); |
181 | out: | ||
181 | spin_unlock(&muxl->receive_lock); | 182 | spin_unlock(&muxl->receive_lock); |
182 | return up; | 183 | return up; |
183 | } | 184 | } |
diff --git a/net/caif/cfpkt_skbuff.c b/net/caif/cfpkt_skbuff.c index 83fff2ff6658..a6fdf899741a 100644 --- a/net/caif/cfpkt_skbuff.c +++ b/net/caif/cfpkt_skbuff.c | |||
@@ -238,6 +238,7 @@ int cfpkt_add_head(struct cfpkt *pkt, const void *data2, u16 len) | |||
238 | struct sk_buff *lastskb; | 238 | struct sk_buff *lastskb; |
239 | u8 *to; | 239 | u8 *to; |
240 | const u8 *data = data2; | 240 | const u8 *data = data2; |
241 | int ret; | ||
241 | if (unlikely(is_erronous(pkt))) | 242 | if (unlikely(is_erronous(pkt))) |
242 | return -EPROTO; | 243 | return -EPROTO; |
243 | if (unlikely(skb_headroom(skb) < len)) { | 244 | if (unlikely(skb_headroom(skb) < len)) { |
@@ -246,9 +247,10 @@ int cfpkt_add_head(struct cfpkt *pkt, const void *data2, u16 len) | |||
246 | } | 247 | } |
247 | 248 | ||
248 | /* Make sure data is writable */ | 249 | /* Make sure data is writable */ |
249 | if (unlikely(skb_cow_data(skb, 0, &lastskb) < 0)) { | 250 | ret = skb_cow_data(skb, 0, &lastskb); |
251 | if (unlikely(ret < 0)) { | ||
250 | PKT_ERROR(pkt, "cfpkt_add_head: cow failed\n"); | 252 | PKT_ERROR(pkt, "cfpkt_add_head: cow failed\n"); |
251 | return -EPROTO; | 253 | return ret; |
252 | } | 254 | } |
253 | 255 | ||
254 | to = skb_push(skb, len); | 256 | to = skb_push(skb, len); |
@@ -316,6 +318,8 @@ EXPORT_SYMBOL(cfpkt_setlen); | |||
316 | struct cfpkt *cfpkt_create_uplink(const unsigned char *data, unsigned int len) | 318 | struct cfpkt *cfpkt_create_uplink(const unsigned char *data, unsigned int len) |
317 | { | 319 | { |
318 | struct cfpkt *pkt = cfpkt_create_pfx(len + PKT_POSTFIX, PKT_PREFIX); | 320 | struct cfpkt *pkt = cfpkt_create_pfx(len + PKT_POSTFIX, PKT_PREFIX); |
321 | if (!pkt) | ||
322 | return NULL; | ||
319 | if (unlikely(data != NULL)) | 323 | if (unlikely(data != NULL)) |
320 | cfpkt_add_body(pkt, data, len); | 324 | cfpkt_add_body(pkt, data, len); |
321 | return pkt; | 325 | return pkt; |
@@ -344,12 +348,13 @@ struct cfpkt *cfpkt_append(struct cfpkt *dstpkt, | |||
344 | 348 | ||
345 | if (dst->tail + neededtailspace > dst->end) { | 349 | if (dst->tail + neededtailspace > dst->end) { |
346 | /* Create a dumplicate of 'dst' with more tail space */ | 350 | /* Create a dumplicate of 'dst' with more tail space */ |
351 | struct cfpkt *tmppkt; | ||
347 | dstlen = skb_headlen(dst); | 352 | dstlen = skb_headlen(dst); |
348 | createlen = dstlen + neededtailspace; | 353 | createlen = dstlen + neededtailspace; |
349 | tmp = pkt_to_skb( | 354 | tmppkt = cfpkt_create(createlen + PKT_PREFIX + PKT_POSTFIX); |
350 | cfpkt_create(createlen + PKT_PREFIX + PKT_POSTFIX)); | 355 | if (tmppkt == NULL) |
351 | if (!tmp) | ||
352 | return NULL; | 356 | return NULL; |
357 | tmp = pkt_to_skb(tmppkt); | ||
353 | skb_set_tail_pointer(tmp, dstlen); | 358 | skb_set_tail_pointer(tmp, dstlen); |
354 | tmp->len = dstlen; | 359 | tmp->len = dstlen; |
355 | memcpy(tmp->data, dst->data, dstlen); | 360 | memcpy(tmp->data, dst->data, dstlen); |
@@ -368,6 +373,7 @@ struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos) | |||
368 | { | 373 | { |
369 | struct sk_buff *skb2; | 374 | struct sk_buff *skb2; |
370 | struct sk_buff *skb = pkt_to_skb(pkt); | 375 | struct sk_buff *skb = pkt_to_skb(pkt); |
376 | struct cfpkt *tmppkt; | ||
371 | u8 *split = skb->data + pos; | 377 | u8 *split = skb->data + pos; |
372 | u16 len2nd = skb_tail_pointer(skb) - split; | 378 | u16 len2nd = skb_tail_pointer(skb) - split; |
373 | 379 | ||
@@ -381,9 +387,12 @@ struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos) | |||
381 | } | 387 | } |
382 | 388 | ||
383 | /* Create a new packet for the second part of the data */ | 389 | /* Create a new packet for the second part of the data */ |
384 | skb2 = pkt_to_skb( | 390 | tmppkt = cfpkt_create_pfx(len2nd + PKT_PREFIX + PKT_POSTFIX, |
385 | cfpkt_create_pfx(len2nd + PKT_PREFIX + PKT_POSTFIX, | 391 | PKT_PREFIX); |
386 | PKT_PREFIX)); | 392 | if (tmppkt == NULL) |
393 | return NULL; | ||
394 | skb2 = pkt_to_skb(tmppkt); | ||
395 | |||
387 | 396 | ||
388 | if (skb2 == NULL) | 397 | if (skb2 == NULL) |
389 | return NULL; | 398 | return NULL; |
diff --git a/net/caif/cfserl.c b/net/caif/cfserl.c index 06029ea2da2f..cb4325a3dc83 100644 --- a/net/caif/cfserl.c +++ b/net/caif/cfserl.c | |||
@@ -67,6 +67,8 @@ static int cfserl_receive(struct cflayer *l, struct cfpkt *newpkt) | |||
67 | layr->incomplete_frm = | 67 | layr->incomplete_frm = |
68 | cfpkt_append(layr->incomplete_frm, newpkt, expectlen); | 68 | cfpkt_append(layr->incomplete_frm, newpkt, expectlen); |
69 | pkt = layr->incomplete_frm; | 69 | pkt = layr->incomplete_frm; |
70 | if (pkt == NULL) | ||
71 | return -ENOMEM; | ||
70 | } else { | 72 | } else { |
71 | pkt = newpkt; | 73 | pkt = newpkt; |
72 | } | 74 | } |
@@ -154,7 +156,6 @@ static int cfserl_receive(struct cflayer *l, struct cfpkt *newpkt) | |||
154 | if (layr->usestx) { | 156 | if (layr->usestx) { |
155 | if (tail_pkt != NULL) | 157 | if (tail_pkt != NULL) |
156 | pkt = cfpkt_append(pkt, tail_pkt, 0); | 158 | pkt = cfpkt_append(pkt, tail_pkt, 0); |
157 | |||
158 | /* Start search for next STX if frame failed */ | 159 | /* Start search for next STX if frame failed */ |
159 | continue; | 160 | continue; |
160 | } else { | 161 | } else { |
diff --git a/net/caif/cfsrvl.c b/net/caif/cfsrvl.c index aff31f34528f..6e5b7079a684 100644 --- a/net/caif/cfsrvl.c +++ b/net/caif/cfsrvl.c | |||
@@ -123,6 +123,12 @@ static int cfservl_modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl) | |||
123 | struct caif_payload_info *info; | 123 | struct caif_payload_info *info; |
124 | u8 flow_off = SRVL_FLOW_OFF; | 124 | u8 flow_off = SRVL_FLOW_OFF; |
125 | pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE); | 125 | pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE); |
126 | if (!pkt) { | ||
127 | pr_warning("CAIF: %s(): Out of memory\n", | ||
128 | __func__); | ||
129 | return -ENOMEM; | ||
130 | } | ||
131 | |||
126 | if (cfpkt_add_head(pkt, &flow_off, 1) < 0) { | 132 | if (cfpkt_add_head(pkt, &flow_off, 1) < 0) { |
127 | pr_err("CAIF: %s(): Packet is erroneous!\n", | 133 | pr_err("CAIF: %s(): Packet is erroneous!\n", |
128 | __func__); | 134 | __func__); |
diff --git a/net/core/dev.c b/net/core/dev.c index d273e4e3ecdc..1845b08c624e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -954,18 +954,22 @@ int dev_alloc_name(struct net_device *dev, const char *name) | |||
954 | } | 954 | } |
955 | EXPORT_SYMBOL(dev_alloc_name); | 955 | EXPORT_SYMBOL(dev_alloc_name); |
956 | 956 | ||
957 | static int dev_get_valid_name(struct net *net, const char *name, char *buf, | 957 | static int dev_get_valid_name(struct net_device *dev, const char *name, bool fmt) |
958 | bool fmt) | ||
959 | { | 958 | { |
959 | struct net *net; | ||
960 | |||
961 | BUG_ON(!dev_net(dev)); | ||
962 | net = dev_net(dev); | ||
963 | |||
960 | if (!dev_valid_name(name)) | 964 | if (!dev_valid_name(name)) |
961 | return -EINVAL; | 965 | return -EINVAL; |
962 | 966 | ||
963 | if (fmt && strchr(name, '%')) | 967 | if (fmt && strchr(name, '%')) |
964 | return __dev_alloc_name(net, name, buf); | 968 | return dev_alloc_name(dev, name); |
965 | else if (__dev_get_by_name(net, name)) | 969 | else if (__dev_get_by_name(net, name)) |
966 | return -EEXIST; | 970 | return -EEXIST; |
967 | else if (buf != name) | 971 | else if (dev->name != name) |
968 | strlcpy(buf, name, IFNAMSIZ); | 972 | strlcpy(dev->name, name, IFNAMSIZ); |
969 | 973 | ||
970 | return 0; | 974 | return 0; |
971 | } | 975 | } |
@@ -997,7 +1001,7 @@ int dev_change_name(struct net_device *dev, const char *newname) | |||
997 | 1001 | ||
998 | memcpy(oldname, dev->name, IFNAMSIZ); | 1002 | memcpy(oldname, dev->name, IFNAMSIZ); |
999 | 1003 | ||
1000 | err = dev_get_valid_name(net, newname, dev->name, 1); | 1004 | err = dev_get_valid_name(dev, newname, 1); |
1001 | if (err < 0) | 1005 | if (err < 0) |
1002 | return err; | 1006 | return err; |
1003 | 1007 | ||
@@ -2421,10 +2425,7 @@ static int enqueue_to_backlog(struct sk_buff *skb, int cpu, | |||
2421 | if (skb_queue_len(&sd->input_pkt_queue)) { | 2425 | if (skb_queue_len(&sd->input_pkt_queue)) { |
2422 | enqueue: | 2426 | enqueue: |
2423 | __skb_queue_tail(&sd->input_pkt_queue, skb); | 2427 | __skb_queue_tail(&sd->input_pkt_queue, skb); |
2424 | #ifdef CONFIG_RPS | 2428 | input_queue_tail_incr_save(sd, qtail); |
2425 | *qtail = sd->input_queue_head + | ||
2426 | skb_queue_len(&sd->input_pkt_queue); | ||
2427 | #endif | ||
2428 | rps_unlock(sd); | 2429 | rps_unlock(sd); |
2429 | local_irq_restore(flags); | 2430 | local_irq_restore(flags); |
2430 | return NET_RX_SUCCESS; | 2431 | return NET_RX_SUCCESS; |
@@ -2959,7 +2960,7 @@ static void flush_backlog(void *arg) | |||
2959 | if (skb->dev == dev) { | 2960 | if (skb->dev == dev) { |
2960 | __skb_unlink(skb, &sd->input_pkt_queue); | 2961 | __skb_unlink(skb, &sd->input_pkt_queue); |
2961 | kfree_skb(skb); | 2962 | kfree_skb(skb); |
2962 | input_queue_head_add(sd, 1); | 2963 | input_queue_head_incr(sd); |
2963 | } | 2964 | } |
2964 | } | 2965 | } |
2965 | rps_unlock(sd); | 2966 | rps_unlock(sd); |
@@ -2968,6 +2969,7 @@ static void flush_backlog(void *arg) | |||
2968 | if (skb->dev == dev) { | 2969 | if (skb->dev == dev) { |
2969 | __skb_unlink(skb, &sd->process_queue); | 2970 | __skb_unlink(skb, &sd->process_queue); |
2970 | kfree_skb(skb); | 2971 | kfree_skb(skb); |
2972 | input_queue_head_incr(sd); | ||
2971 | } | 2973 | } |
2972 | } | 2974 | } |
2973 | } | 2975 | } |
@@ -3323,18 +3325,20 @@ static int process_backlog(struct napi_struct *napi, int quota) | |||
3323 | while ((skb = __skb_dequeue(&sd->process_queue))) { | 3325 | while ((skb = __skb_dequeue(&sd->process_queue))) { |
3324 | local_irq_enable(); | 3326 | local_irq_enable(); |
3325 | __netif_receive_skb(skb); | 3327 | __netif_receive_skb(skb); |
3326 | if (++work >= quota) | ||
3327 | return work; | ||
3328 | local_irq_disable(); | 3328 | local_irq_disable(); |
3329 | input_queue_head_incr(sd); | ||
3330 | if (++work >= quota) { | ||
3331 | local_irq_enable(); | ||
3332 | return work; | ||
3333 | } | ||
3329 | } | 3334 | } |
3330 | 3335 | ||
3331 | rps_lock(sd); | 3336 | rps_lock(sd); |
3332 | qlen = skb_queue_len(&sd->input_pkt_queue); | 3337 | qlen = skb_queue_len(&sd->input_pkt_queue); |
3333 | if (qlen) { | 3338 | if (qlen) |
3334 | input_queue_head_add(sd, qlen); | ||
3335 | skb_queue_splice_tail_init(&sd->input_pkt_queue, | 3339 | skb_queue_splice_tail_init(&sd->input_pkt_queue, |
3336 | &sd->process_queue); | 3340 | &sd->process_queue); |
3337 | } | 3341 | |
3338 | if (qlen < quota - work) { | 3342 | if (qlen < quota - work) { |
3339 | /* | 3343 | /* |
3340 | * Inline a custom version of __napi_complete(). | 3344 | * Inline a custom version of __napi_complete(). |
@@ -4960,7 +4964,7 @@ int register_netdevice(struct net_device *dev) | |||
4960 | } | 4964 | } |
4961 | } | 4965 | } |
4962 | 4966 | ||
4963 | ret = dev_get_valid_name(net, dev->name, dev->name, 0); | 4967 | ret = dev_get_valid_name(dev, dev->name, 0); |
4964 | if (ret) | 4968 | if (ret) |
4965 | goto err_uninit; | 4969 | goto err_uninit; |
4966 | 4970 | ||
@@ -5558,7 +5562,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
5558 | /* We get here if we can't use the current device name */ | 5562 | /* We get here if we can't use the current device name */ |
5559 | if (!pat) | 5563 | if (!pat) |
5560 | goto out; | 5564 | goto out; |
5561 | if (dev_get_valid_name(net, pat, dev->name, 1)) | 5565 | if (dev_get_valid_name(dev, pat, 1)) |
5562 | goto out; | 5566 | goto out; |
5563 | } | 5567 | } |
5564 | 5568 | ||
@@ -5661,12 +5665,14 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
5661 | local_irq_enable(); | 5665 | local_irq_enable(); |
5662 | 5666 | ||
5663 | /* Process offline CPU's input_pkt_queue */ | 5667 | /* Process offline CPU's input_pkt_queue */ |
5664 | while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) { | 5668 | while ((skb = __skb_dequeue(&oldsd->process_queue))) { |
5665 | netif_rx(skb); | 5669 | netif_rx(skb); |
5666 | input_queue_head_add(oldsd, 1); | 5670 | input_queue_head_incr(oldsd); |
5667 | } | 5671 | } |
5668 | while ((skb = __skb_dequeue(&oldsd->process_queue))) | 5672 | while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) { |
5669 | netif_rx(skb); | 5673 | netif_rx(skb); |
5674 | input_queue_head_incr(oldsd); | ||
5675 | } | ||
5670 | 5676 | ||
5671 | return NOTIFY_OK; | 5677 | return NOTIFY_OK; |
5672 | } | 5678 | } |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index e4b9870e4706..7ab86f3a1ea4 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1199,8 +1199,10 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, | |||
1199 | struct nlattr *attr; | 1199 | struct nlattr *attr; |
1200 | int rem; | 1200 | int rem; |
1201 | nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) { | 1201 | nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) { |
1202 | if (nla_type(attr) != IFLA_VF_INFO) | 1202 | if (nla_type(attr) != IFLA_VF_INFO) { |
1203 | err = -EINVAL; | ||
1203 | goto errout; | 1204 | goto errout; |
1205 | } | ||
1204 | err = do_setvfinfo(dev, attr); | 1206 | err = do_setvfinfo(dev, attr); |
1205 | if (err < 0) | 1207 | if (err < 0) |
1206 | goto errout; | 1208 | goto errout; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 66d9c416851e..f8abf68e3988 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2722,6 +2722,7 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2722 | *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p); | 2722 | *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p); |
2723 | skb_shinfo(nskb)->frag_list = p; | 2723 | skb_shinfo(nskb)->frag_list = p; |
2724 | skb_shinfo(nskb)->gso_size = pinfo->gso_size; | 2724 | skb_shinfo(nskb)->gso_size = pinfo->gso_size; |
2725 | pinfo->gso_size = 0; | ||
2725 | skb_header_release(p); | 2726 | skb_header_release(p); |
2726 | nskb->prev = p; | 2727 | nskb->prev = p; |
2727 | 2728 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index bf88a167c8f2..37fe9b6adade 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -123,6 +123,7 @@ | |||
123 | #include <linux/net_tstamp.h> | 123 | #include <linux/net_tstamp.h> |
124 | #include <net/xfrm.h> | 124 | #include <net/xfrm.h> |
125 | #include <linux/ipsec.h> | 125 | #include <linux/ipsec.h> |
126 | #include <net/cls_cgroup.h> | ||
126 | 127 | ||
127 | #include <linux/filter.h> | 128 | #include <linux/filter.h> |
128 | 129 | ||
@@ -217,6 +218,11 @@ __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX; | |||
217 | int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512); | 218 | int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512); |
218 | EXPORT_SYMBOL(sysctl_optmem_max); | 219 | EXPORT_SYMBOL(sysctl_optmem_max); |
219 | 220 | ||
221 | #if defined(CONFIG_CGROUPS) && !defined(CONFIG_NET_CLS_CGROUP) | ||
222 | int net_cls_subsys_id = -1; | ||
223 | EXPORT_SYMBOL_GPL(net_cls_subsys_id); | ||
224 | #endif | ||
225 | |||
220 | static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) | 226 | static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) |
221 | { | 227 | { |
222 | struct timeval tv; | 228 | struct timeval tv; |
@@ -1050,6 +1056,17 @@ static void sk_prot_free(struct proto *prot, struct sock *sk) | |||
1050 | module_put(owner); | 1056 | module_put(owner); |
1051 | } | 1057 | } |
1052 | 1058 | ||
1059 | #ifdef CONFIG_CGROUPS | ||
1060 | void sock_update_classid(struct sock *sk) | ||
1061 | { | ||
1062 | u32 classid = task_cls_classid(current); | ||
1063 | |||
1064 | if (classid && classid != sk->sk_classid) | ||
1065 | sk->sk_classid = classid; | ||
1066 | } | ||
1067 | EXPORT_SYMBOL(sock_update_classid); | ||
1068 | #endif | ||
1069 | |||
1053 | /** | 1070 | /** |
1054 | * sk_alloc - All socket objects are allocated here | 1071 | * sk_alloc - All socket objects are allocated here |
1055 | * @net: the applicable net namespace | 1072 | * @net: the applicable net namespace |
@@ -1073,6 +1090,8 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | |||
1073 | sock_lock_init(sk); | 1090 | sock_lock_init(sk); |
1074 | sock_net_set(sk, get_net(net)); | 1091 | sock_net_set(sk, get_net(net)); |
1075 | atomic_set(&sk->sk_wmem_alloc, 1); | 1092 | atomic_set(&sk->sk_wmem_alloc, 1); |
1093 | |||
1094 | sock_update_classid(sk); | ||
1076 | } | 1095 | } |
1077 | 1096 | ||
1078 | return sk; | 1097 | return sk; |
diff --git a/net/dccp/input.c b/net/dccp/input.c index 58f7bc156850..6beb6a7d6fba 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -124,9 +124,9 @@ static int dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb) | |||
124 | return queued; | 124 | return queued; |
125 | } | 125 | } |
126 | 126 | ||
127 | static u8 dccp_reset_code_convert(const u8 code) | 127 | static u16 dccp_reset_code_convert(const u8 code) |
128 | { | 128 | { |
129 | const u8 error_code[] = { | 129 | const u16 error_code[] = { |
130 | [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */ | 130 | [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */ |
131 | [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */ | 131 | [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */ |
132 | [DCCP_RESET_CODE_ABORTED] = ECONNRESET, | 132 | [DCCP_RESET_CODE_ABORTED] = ECONNRESET, |
@@ -148,7 +148,7 @@ static u8 dccp_reset_code_convert(const u8 code) | |||
148 | 148 | ||
149 | static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb) | 149 | static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb) |
150 | { | 150 | { |
151 | u8 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code); | 151 | u16 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code); |
152 | 152 | ||
153 | sk->sk_err = err; | 153 | sk->sk_err = err; |
154 | 154 | ||
diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c index 3d803a1b9fb6..1627ef2e8522 100644 --- a/net/ieee802154/wpan-class.c +++ b/net/ieee802154/wpan-class.c | |||
@@ -147,13 +147,15 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size) | |||
147 | struct wpan_phy *phy = kzalloc(sizeof(*phy) + priv_size, | 147 | struct wpan_phy *phy = kzalloc(sizeof(*phy) + priv_size, |
148 | GFP_KERNEL); | 148 | GFP_KERNEL); |
149 | 149 | ||
150 | if (!phy) | ||
151 | goto out; | ||
150 | mutex_lock(&wpan_phy_mutex); | 152 | mutex_lock(&wpan_phy_mutex); |
151 | phy->idx = wpan_phy_idx++; | 153 | phy->idx = wpan_phy_idx++; |
152 | if (unlikely(!wpan_phy_idx_valid(phy->idx))) { | 154 | if (unlikely(!wpan_phy_idx_valid(phy->idx))) { |
153 | wpan_phy_idx--; | 155 | wpan_phy_idx--; |
154 | mutex_unlock(&wpan_phy_mutex); | 156 | mutex_unlock(&wpan_phy_mutex); |
155 | kfree(phy); | 157 | kfree(phy); |
156 | return NULL; | 158 | goto out; |
157 | } | 159 | } |
158 | mutex_unlock(&wpan_phy_mutex); | 160 | mutex_unlock(&wpan_phy_mutex); |
159 | 161 | ||
@@ -168,6 +170,9 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size) | |||
168 | phy->current_page = 0; /* for compatibility */ | 170 | phy->current_page = 0; /* for compatibility */ |
169 | 171 | ||
170 | return phy; | 172 | return phy; |
173 | |||
174 | out: | ||
175 | return NULL; | ||
171 | } | 176 | } |
172 | EXPORT_SYMBOL(wpan_phy_alloc); | 177 | EXPORT_SYMBOL(wpan_phy_alloc); |
173 | 178 | ||
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 48a5e80957f0..df9d45544ca5 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -145,7 +145,7 @@ enum plink_state { | |||
145 | /** | 145 | /** |
146 | * struct sta_ampdu_mlme - STA aggregation information. | 146 | * struct sta_ampdu_mlme - STA aggregation information. |
147 | * | 147 | * |
148 | * @tid_state_rx: TID's state in Rx session state machine. | 148 | * @tid_active_rx: TID's state in Rx session state machine. |
149 | * @tid_rx: aggregation info for Rx per TID | 149 | * @tid_rx: aggregation info for Rx per TID |
150 | * @tid_state_tx: TID's state in Tx session state machine. | 150 | * @tid_state_tx: TID's state in Tx session state machine. |
151 | * @tid_tx: aggregation info for Tx per TID | 151 | * @tid_tx: aggregation info for Tx per TID |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index b83c530c5e0a..eeeb8bc73982 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -424,6 +424,16 @@ __nf_conntrack_confirm(struct sk_buff *skb) | |||
424 | 424 | ||
425 | spin_lock_bh(&nf_conntrack_lock); | 425 | spin_lock_bh(&nf_conntrack_lock); |
426 | 426 | ||
427 | /* We have to check the DYING flag inside the lock to prevent | ||
428 | a race against nf_ct_get_next_corpse() possibly called from | ||
429 | user context, else we insert an already 'dead' hash, blocking | ||
430 | further use of that particular connection -JM */ | ||
431 | |||
432 | if (unlikely(nf_ct_is_dying(ct))) { | ||
433 | spin_unlock_bh(&nf_conntrack_lock); | ||
434 | return NF_ACCEPT; | ||
435 | } | ||
436 | |||
427 | /* See if there's one in the list already, including reverse: | 437 | /* See if there's one in the list already, including reverse: |
428 | NAT could have grabbed it without realizing, since we're | 438 | NAT could have grabbed it without realizing, since we're |
429 | not in the hash. If there is, we lost race. */ | 439 | not in the hash. If there is, we lost race. */ |
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c index b20f4275893c..53d892210a04 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c | |||
@@ -1393,10 +1393,8 @@ static int sip_help_tcp(struct sk_buff *skb, unsigned int protoff, | |||
1393 | 1393 | ||
1394 | nf_ct_refresh(ct, skb, sip_timeout * HZ); | 1394 | nf_ct_refresh(ct, skb, sip_timeout * HZ); |
1395 | 1395 | ||
1396 | if (skb_is_nonlinear(skb)) { | 1396 | if (unlikely(skb_linearize(skb))) |
1397 | pr_debug("Copy of skbuff not supported yet.\n"); | 1397 | return NF_DROP; |
1398 | return NF_ACCEPT; | ||
1399 | } | ||
1400 | 1398 | ||
1401 | dptr = skb->data + dataoff; | 1399 | dptr = skb->data + dataoff; |
1402 | datalen = skb->len - dataoff; | 1400 | datalen = skb->len - dataoff; |
@@ -1455,10 +1453,8 @@ static int sip_help_udp(struct sk_buff *skb, unsigned int protoff, | |||
1455 | 1453 | ||
1456 | nf_ct_refresh(ct, skb, sip_timeout * HZ); | 1454 | nf_ct_refresh(ct, skb, sip_timeout * HZ); |
1457 | 1455 | ||
1458 | if (skb_is_nonlinear(skb)) { | 1456 | if (unlikely(skb_linearize(skb))) |
1459 | pr_debug("Copy of skbuff not supported yet.\n"); | 1457 | return NF_DROP; |
1460 | return NF_ACCEPT; | ||
1461 | } | ||
1462 | 1458 | ||
1463 | dptr = skb->data + dataoff; | 1459 | dptr = skb->data + dataoff; |
1464 | datalen = skb->len - dataoff; | 1460 | datalen = skb->len - dataoff; |
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index af4d38bc3b22..7b048a35ca58 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
@@ -626,6 +626,7 @@ static void pep_sock_close(struct sock *sk, long timeout) | |||
626 | struct pep_sock *pn = pep_sk(sk); | 626 | struct pep_sock *pn = pep_sk(sk); |
627 | int ifindex = 0; | 627 | int ifindex = 0; |
628 | 628 | ||
629 | sock_hold(sk); /* keep a reference after sk_common_release() */ | ||
629 | sk_common_release(sk); | 630 | sk_common_release(sk); |
630 | 631 | ||
631 | lock_sock(sk); | 632 | lock_sock(sk); |
@@ -644,6 +645,7 @@ static void pep_sock_close(struct sock *sk, long timeout) | |||
644 | 645 | ||
645 | if (ifindex) | 646 | if (ifindex) |
646 | gprs_detach(sk); | 647 | gprs_detach(sk); |
648 | sock_put(sk); | ||
647 | } | 649 | } |
648 | 650 | ||
649 | static int pep_wait_connreq(struct sock *sk, int noblock) | 651 | static int pep_wait_connreq(struct sock *sk, int noblock) |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 221180384fd7..78ef2c5e130b 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -16,14 +16,11 @@ | |||
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | #include <linux/skbuff.h> | 17 | #include <linux/skbuff.h> |
18 | #include <linux/cgroup.h> | 18 | #include <linux/cgroup.h> |
19 | #include <linux/rcupdate.h> | ||
19 | #include <net/rtnetlink.h> | 20 | #include <net/rtnetlink.h> |
20 | #include <net/pkt_cls.h> | 21 | #include <net/pkt_cls.h> |
21 | 22 | #include <net/sock.h> | |
22 | struct cgroup_cls_state | 23 | #include <net/cls_cgroup.h> |
23 | { | ||
24 | struct cgroup_subsys_state css; | ||
25 | u32 classid; | ||
26 | }; | ||
27 | 24 | ||
28 | static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss, | 25 | static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss, |
29 | struct cgroup *cgrp); | 26 | struct cgroup *cgrp); |
@@ -112,6 +109,10 @@ static int cls_cgroup_classify(struct sk_buff *skb, struct tcf_proto *tp, | |||
112 | struct cls_cgroup_head *head = tp->root; | 109 | struct cls_cgroup_head *head = tp->root; |
113 | u32 classid; | 110 | u32 classid; |
114 | 111 | ||
112 | rcu_read_lock(); | ||
113 | classid = task_cls_state(current)->classid; | ||
114 | rcu_read_unlock(); | ||
115 | |||
115 | /* | 116 | /* |
116 | * Due to the nature of the classifier it is required to ignore all | 117 | * Due to the nature of the classifier it is required to ignore all |
117 | * packets originating from softirq context as accessing `current' | 118 | * packets originating from softirq context as accessing `current' |
@@ -122,12 +123,12 @@ static int cls_cgroup_classify(struct sk_buff *skb, struct tcf_proto *tp, | |||
122 | * calls by looking at the number of nested bh disable calls because | 123 | * calls by looking at the number of nested bh disable calls because |
123 | * softirqs always disables bh. | 124 | * softirqs always disables bh. |
124 | */ | 125 | */ |
125 | if (softirq_count() != SOFTIRQ_OFFSET) | 126 | if (softirq_count() != SOFTIRQ_OFFSET) { |
126 | return -1; | 127 | /* If there is an sk_classid we'll use that. */ |
127 | 128 | if (!skb->sk) | |
128 | rcu_read_lock(); | 129 | return -1; |
129 | classid = task_cls_state(current)->classid; | 130 | classid = skb->sk->sk_classid; |
130 | rcu_read_unlock(); | 131 | } |
131 | 132 | ||
132 | if (!classid) | 133 | if (!classid) |
133 | return -1; | 134 | return -1; |
@@ -289,18 +290,35 @@ static struct tcf_proto_ops cls_cgroup_ops __read_mostly = { | |||
289 | 290 | ||
290 | static int __init init_cgroup_cls(void) | 291 | static int __init init_cgroup_cls(void) |
291 | { | 292 | { |
292 | int ret = register_tcf_proto_ops(&cls_cgroup_ops); | 293 | int ret; |
293 | if (ret) | 294 | |
294 | return ret; | ||
295 | ret = cgroup_load_subsys(&net_cls_subsys); | 295 | ret = cgroup_load_subsys(&net_cls_subsys); |
296 | if (ret) | 296 | if (ret) |
297 | unregister_tcf_proto_ops(&cls_cgroup_ops); | 297 | goto out; |
298 | |||
299 | #ifndef CONFIG_NET_CLS_CGROUP | ||
300 | /* We can't use rcu_assign_pointer because this is an int. */ | ||
301 | smp_wmb(); | ||
302 | net_cls_subsys_id = net_cls_subsys.subsys_id; | ||
303 | #endif | ||
304 | |||
305 | ret = register_tcf_proto_ops(&cls_cgroup_ops); | ||
306 | if (ret) | ||
307 | cgroup_unload_subsys(&net_cls_subsys); | ||
308 | |||
309 | out: | ||
298 | return ret; | 310 | return ret; |
299 | } | 311 | } |
300 | 312 | ||
301 | static void __exit exit_cgroup_cls(void) | 313 | static void __exit exit_cgroup_cls(void) |
302 | { | 314 | { |
303 | unregister_tcf_proto_ops(&cls_cgroup_ops); | 315 | unregister_tcf_proto_ops(&cls_cgroup_ops); |
316 | |||
317 | #ifndef CONFIG_NET_CLS_CGROUP | ||
318 | net_cls_subsys_id = -1; | ||
319 | synchronize_rcu(); | ||
320 | #endif | ||
321 | |||
304 | cgroup_unload_subsys(&net_cls_subsys); | 322 | cgroup_unload_subsys(&net_cls_subsys); |
305 | } | 323 | } |
306 | 324 | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index fe35c1f338c2..b9e8c3b7d406 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -1195,6 +1195,11 @@ nla_put_failure: | |||
1195 | return -1; | 1195 | return -1; |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | static bool tc_qdisc_dump_ignore(struct Qdisc *q) | ||
1199 | { | ||
1200 | return (q->flags & TCQ_F_BUILTIN) ? true : false; | ||
1201 | } | ||
1202 | |||
1198 | static int qdisc_notify(struct net *net, struct sk_buff *oskb, | 1203 | static int qdisc_notify(struct net *net, struct sk_buff *oskb, |
1199 | struct nlmsghdr *n, u32 clid, | 1204 | struct nlmsghdr *n, u32 clid, |
1200 | struct Qdisc *old, struct Qdisc *new) | 1205 | struct Qdisc *old, struct Qdisc *new) |
@@ -1206,11 +1211,11 @@ static int qdisc_notify(struct net *net, struct sk_buff *oskb, | |||
1206 | if (!skb) | 1211 | if (!skb) |
1207 | return -ENOBUFS; | 1212 | return -ENOBUFS; |
1208 | 1213 | ||
1209 | if (old && old->handle) { | 1214 | if (old && !tc_qdisc_dump_ignore(old)) { |
1210 | if (tc_fill_qdisc(skb, old, clid, pid, n->nlmsg_seq, 0, RTM_DELQDISC) < 0) | 1215 | if (tc_fill_qdisc(skb, old, clid, pid, n->nlmsg_seq, 0, RTM_DELQDISC) < 0) |
1211 | goto err_out; | 1216 | goto err_out; |
1212 | } | 1217 | } |
1213 | if (new) { | 1218 | if (new && !tc_qdisc_dump_ignore(new)) { |
1214 | if (tc_fill_qdisc(skb, new, clid, pid, n->nlmsg_seq, old ? NLM_F_REPLACE : 0, RTM_NEWQDISC) < 0) | 1219 | if (tc_fill_qdisc(skb, new, clid, pid, n->nlmsg_seq, old ? NLM_F_REPLACE : 0, RTM_NEWQDISC) < 0) |
1215 | goto err_out; | 1220 | goto err_out; |
1216 | } | 1221 | } |
@@ -1223,11 +1228,6 @@ err_out: | |||
1223 | return -EINVAL; | 1228 | return -EINVAL; |
1224 | } | 1229 | } |
1225 | 1230 | ||
1226 | static bool tc_qdisc_dump_ignore(struct Qdisc *q) | ||
1227 | { | ||
1228 | return (q->flags & TCQ_F_BUILTIN) ? true : false; | ||
1229 | } | ||
1230 | |||
1231 | static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb, | 1231 | static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb, |
1232 | struct netlink_callback *cb, | 1232 | struct netlink_callback *cb, |
1233 | int *q_idx_p, int s_q_idx) | 1233 | int *q_idx_p, int s_q_idx) |
diff --git a/net/socket.c b/net/socket.c index f9f7d0872cac..367d5477d00f 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -94,6 +94,7 @@ | |||
94 | 94 | ||
95 | #include <net/compat.h> | 95 | #include <net/compat.h> |
96 | #include <net/wext.h> | 96 | #include <net/wext.h> |
97 | #include <net/cls_cgroup.h> | ||
97 | 98 | ||
98 | #include <net/sock.h> | 99 | #include <net/sock.h> |
99 | #include <linux/netfilter.h> | 100 | #include <linux/netfilter.h> |
@@ -558,6 +559,8 @@ static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
558 | struct sock_iocb *si = kiocb_to_siocb(iocb); | 559 | struct sock_iocb *si = kiocb_to_siocb(iocb); |
559 | int err; | 560 | int err; |
560 | 561 | ||
562 | sock_update_classid(sock->sk); | ||
563 | |||
561 | si->sock = sock; | 564 | si->sock = sock; |
562 | si->scm = NULL; | 565 | si->scm = NULL; |
563 | si->msg = msg; | 566 | si->msg = msg; |
@@ -684,6 +687,8 @@ static inline int __sock_recvmsg_nosec(struct kiocb *iocb, struct socket *sock, | |||
684 | { | 687 | { |
685 | struct sock_iocb *si = kiocb_to_siocb(iocb); | 688 | struct sock_iocb *si = kiocb_to_siocb(iocb); |
686 | 689 | ||
690 | sock_update_classid(sock->sk); | ||
691 | |||
687 | si->sock = sock; | 692 | si->sock = sock; |
688 | si->scm = NULL; | 693 | si->scm = NULL; |
689 | si->msg = msg; | 694 | si->msg = msg; |
@@ -777,6 +782,8 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos, | |||
777 | if (unlikely(!sock->ops->splice_read)) | 782 | if (unlikely(!sock->ops->splice_read)) |
778 | return -EINVAL; | 783 | return -EINVAL; |
779 | 784 | ||
785 | sock_update_classid(sock->sk); | ||
786 | |||
780 | return sock->ops->splice_read(sock, ppos, pipe, len, flags); | 787 | return sock->ops->splice_read(sock, ppos, pipe, len, flags); |
781 | } | 788 | } |
782 | 789 | ||
@@ -3069,6 +3076,8 @@ int kernel_setsockopt(struct socket *sock, int level, int optname, | |||
3069 | int kernel_sendpage(struct socket *sock, struct page *page, int offset, | 3076 | int kernel_sendpage(struct socket *sock, struct page *page, int offset, |
3070 | size_t size, int flags) | 3077 | size_t size, int flags) |
3071 | { | 3078 | { |
3079 | sock_update_classid(sock->sk); | ||
3080 | |||
3072 | if (sock->ops->sendpage) | 3081 | if (sock->ops->sendpage) |
3073 | return sock->ops->sendpage(sock, page, offset, size, flags); | 3082 | return sock->ops->sendpage(sock, page, offset, size, flags); |
3074 | 3083 | ||
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index d92d088026bf..b01a6f6397d7 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c | |||
@@ -50,7 +50,7 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev, | |||
50 | struct ieee80211_channel *chan; | 50 | struct ieee80211_channel *chan; |
51 | int result; | 51 | int result; |
52 | 52 | ||
53 | if (wdev->iftype == NL80211_IFTYPE_MONITOR) | 53 | if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) |
54 | wdev = NULL; | 54 | wdev = NULL; |
55 | 55 | ||
56 | if (wdev) { | 56 | if (wdev) { |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index aaa1aad566cd..db71150b8040 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -4443,9 +4443,10 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, | |||
4443 | if (channel_type != NL80211_CHAN_NO_HT && | 4443 | if (channel_type != NL80211_CHAN_NO_HT && |
4444 | channel_type != NL80211_CHAN_HT20 && | 4444 | channel_type != NL80211_CHAN_HT20 && |
4445 | channel_type != NL80211_CHAN_HT40PLUS && | 4445 | channel_type != NL80211_CHAN_HT40PLUS && |
4446 | channel_type != NL80211_CHAN_HT40MINUS) | 4446 | channel_type != NL80211_CHAN_HT40MINUS) { |
4447 | err = -EINVAL; | 4447 | err = -EINVAL; |
4448 | goto out; | 4448 | goto out; |
4449 | } | ||
4449 | } | 4450 | } |
4450 | 4451 | ||
4451 | freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); | 4452 | freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); |
@@ -4717,9 +4718,10 @@ static int nl80211_action(struct sk_buff *skb, struct genl_info *info) | |||
4717 | if (channel_type != NL80211_CHAN_NO_HT && | 4718 | if (channel_type != NL80211_CHAN_NO_HT && |
4718 | channel_type != NL80211_CHAN_HT20 && | 4719 | channel_type != NL80211_CHAN_HT20 && |
4719 | channel_type != NL80211_CHAN_HT40PLUS && | 4720 | channel_type != NL80211_CHAN_HT40PLUS && |
4720 | channel_type != NL80211_CHAN_HT40MINUS) | 4721 | channel_type != NL80211_CHAN_HT40MINUS) { |
4721 | err = -EINVAL; | 4722 | err = -EINVAL; |
4722 | goto out; | 4723 | goto out; |
4724 | } | ||
4723 | } | 4725 | } |
4724 | 4726 | ||
4725 | freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); | 4727 | freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index a026c6d56bd3..58401d246bda 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -515,7 +515,7 @@ cfg80211_inform_bss(struct wiphy *wiphy, | |||
515 | 515 | ||
516 | privsz = wiphy->bss_priv_size; | 516 | privsz = wiphy->bss_priv_size; |
517 | 517 | ||
518 | if (WARN_ON(wiphy->signal_type == NL80211_BSS_SIGNAL_UNSPEC && | 518 | if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && |
519 | (signal < 0 || signal > 100))) | 519 | (signal < 0 || signal > 100))) |
520 | return NULL; | 520 | return NULL; |
521 | 521 | ||
@@ -571,7 +571,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
571 | u.probe_resp.variable); | 571 | u.probe_resp.variable); |
572 | size_t privsz = wiphy->bss_priv_size; | 572 | size_t privsz = wiphy->bss_priv_size; |
573 | 573 | ||
574 | if (WARN_ON(wiphy->signal_type == NL80211_BSS_SIGNAL_UNSPEC && | 574 | if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && |
575 | (signal < 0 || signal > 100))) | 575 | (signal < 0 || signal > 100))) |
576 | return NULL; | 576 | return NULL; |
577 | 577 | ||