diff options
Diffstat (limited to 'drivers')
241 files changed, 2650 insertions, 1533 deletions
diff --git a/drivers/acpi/acpi_dbg.c b/drivers/acpi/acpi_dbg.c index 1f4128487dd4..dee86925a9a1 100644 --- a/drivers/acpi/acpi_dbg.c +++ b/drivers/acpi/acpi_dbg.c | |||
| @@ -602,7 +602,7 @@ static int acpi_aml_read_user(char __user *buf, int len) | |||
| 602 | crc->tail = (crc->tail + n) & (ACPI_AML_BUF_SIZE - 1); | 602 | crc->tail = (crc->tail + n) & (ACPI_AML_BUF_SIZE - 1); |
| 603 | ret = n; | 603 | ret = n; |
| 604 | out: | 604 | out: |
| 605 | acpi_aml_unlock_fifo(ACPI_AML_OUT_USER, !ret); | 605 | acpi_aml_unlock_fifo(ACPI_AML_OUT_USER, ret >= 0); |
| 606 | return ret; | 606 | return ret; |
| 607 | } | 607 | } |
| 608 | 608 | ||
| @@ -672,7 +672,7 @@ static int acpi_aml_write_user(const char __user *buf, int len) | |||
| 672 | crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); | 672 | crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); |
| 673 | ret = n; | 673 | ret = n; |
| 674 | out: | 674 | out: |
| 675 | acpi_aml_unlock_fifo(ACPI_AML_IN_USER, !ret); | 675 | acpi_aml_unlock_fifo(ACPI_AML_IN_USER, ret >= 0); |
| 676 | return n; | 676 | return n; |
| 677 | } | 677 | } |
| 678 | 678 | ||
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 21932d640a41..a1d177d58254 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
| @@ -108,9 +108,7 @@ acpi_ex_add_table(u32 table_index, | |||
| 108 | 108 | ||
| 109 | /* Add the table to the namespace */ | 109 | /* Add the table to the namespace */ |
| 110 | 110 | ||
| 111 | acpi_ex_exit_interpreter(); | ||
| 112 | status = acpi_ns_load_table(table_index, parent_node); | 111 | status = acpi_ns_load_table(table_index, parent_node); |
| 113 | acpi_ex_enter_interpreter(); | ||
| 114 | if (ACPI_FAILURE(status)) { | 112 | if (ACPI_FAILURE(status)) { |
| 115 | acpi_ut_remove_reference(obj_desc); | 113 | acpi_ut_remove_reference(obj_desc); |
| 116 | *ddb_handle = NULL; | 114 | *ddb_handle = NULL; |
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 1783cd7e1446..f631a47724f0 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c | |||
| @@ -47,7 +47,6 @@ | |||
| 47 | #include "acparser.h" | 47 | #include "acparser.h" |
| 48 | #include "acdispat.h" | 48 | #include "acdispat.h" |
| 49 | #include "actables.h" | 49 | #include "actables.h" |
| 50 | #include "acinterp.h" | ||
| 51 | 50 | ||
| 52 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
| 53 | ACPI_MODULE_NAME("nsparse") | 52 | ACPI_MODULE_NAME("nsparse") |
| @@ -171,8 +170,6 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) | |||
| 171 | 170 | ||
| 172 | ACPI_FUNCTION_TRACE(ns_parse_table); | 171 | ACPI_FUNCTION_TRACE(ns_parse_table); |
| 173 | 172 | ||
| 174 | acpi_ex_enter_interpreter(); | ||
| 175 | |||
| 176 | /* | 173 | /* |
| 177 | * AML Parse, pass 1 | 174 | * AML Parse, pass 1 |
| 178 | * | 175 | * |
| @@ -188,7 +185,7 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) | |||
| 188 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, | 185 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, |
| 189 | table_index, start_node); | 186 | table_index, start_node); |
| 190 | if (ACPI_FAILURE(status)) { | 187 | if (ACPI_FAILURE(status)) { |
| 191 | goto error_exit; | 188 | return_ACPI_STATUS(status); |
| 192 | } | 189 | } |
| 193 | 190 | ||
| 194 | /* | 191 | /* |
| @@ -204,10 +201,8 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) | |||
| 204 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, | 201 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, |
| 205 | table_index, start_node); | 202 | table_index, start_node); |
| 206 | if (ACPI_FAILURE(status)) { | 203 | if (ACPI_FAILURE(status)) { |
| 207 | goto error_exit; | 204 | return_ACPI_STATUS(status); |
| 208 | } | 205 | } |
| 209 | 206 | ||
| 210 | error_exit: | ||
| 211 | acpi_ex_exit_interpreter(); | ||
| 212 | return_ACPI_STATUS(status); | 207 | return_ACPI_STATUS(status); |
| 213 | } | 208 | } |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 73c76d646064..290d6f5be44b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -1331,8 +1331,6 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
| 1331 | 1331 | ||
| 1332 | static void ec_remove_handlers(struct acpi_ec *ec) | 1332 | static void ec_remove_handlers(struct acpi_ec *ec) |
| 1333 | { | 1333 | { |
| 1334 | acpi_ec_stop(ec, false); | ||
| 1335 | |||
| 1336 | if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) { | 1334 | if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) { |
| 1337 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, | 1335 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
| 1338 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) | 1336 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
| @@ -1340,6 +1338,19 @@ static void ec_remove_handlers(struct acpi_ec *ec) | |||
| 1340 | clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags); | 1338 | clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags); |
| 1341 | } | 1339 | } |
| 1342 | 1340 | ||
| 1341 | /* | ||
| 1342 | * Stops handling the EC transactions after removing the operation | ||
| 1343 | * region handler. This is required because _REG(DISCONNECT) | ||
| 1344 | * invoked during the removal can result in new EC transactions. | ||
| 1345 | * | ||
| 1346 | * Flushes the EC requests and thus disables the GPE before | ||
| 1347 | * removing the GPE handler. This is required by the current ACPICA | ||
| 1348 | * GPE core. ACPICA GPE core will automatically disable a GPE when | ||
| 1349 | * it is indicated but there is no way to handle it. So the drivers | ||
| 1350 | * must disable the GPEs prior to removing the GPE handlers. | ||
| 1351 | */ | ||
| 1352 | acpi_ec_stop(ec, false); | ||
| 1353 | |||
| 1343 | if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) { | 1354 | if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) { |
| 1344 | if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, | 1355 | if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, |
| 1345 | &acpi_ec_gpe_handler))) | 1356 | &acpi_ec_gpe_handler))) |
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 2215fc847fa9..1f0e06065ae6 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c | |||
| @@ -928,7 +928,7 @@ static ssize_t format_show(struct device *dev, | |||
| 928 | { | 928 | { |
| 929 | struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev); | 929 | struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev); |
| 930 | 930 | ||
| 931 | return sprintf(buf, "0x%04x\n", be16_to_cpu(dcr->code)); | 931 | return sprintf(buf, "0x%04x\n", le16_to_cpu(dcr->code)); |
| 932 | } | 932 | } |
| 933 | static DEVICE_ATTR_RO(format); | 933 | static DEVICE_ATTR_RO(format); |
| 934 | 934 | ||
| @@ -961,8 +961,8 @@ static ssize_t format1_show(struct device *dev, | |||
| 961 | continue; | 961 | continue; |
| 962 | if (nfit_dcr->dcr->code == dcr->code) | 962 | if (nfit_dcr->dcr->code == dcr->code) |
| 963 | continue; | 963 | continue; |
| 964 | rc = sprintf(buf, "%#x\n", | 964 | rc = sprintf(buf, "0x%04x\n", |
| 965 | be16_to_cpu(nfit_dcr->dcr->code)); | 965 | le16_to_cpu(nfit_dcr->dcr->code)); |
| 966 | break; | 966 | break; |
| 967 | } | 967 | } |
| 968 | if (rc != ENXIO) | 968 | if (rc != ENXIO) |
| @@ -1151,9 +1151,10 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc, | |||
| 1151 | if (disable_vendor_specific) | 1151 | if (disable_vendor_specific) |
| 1152 | dsm_mask &= ~(1 << 8); | 1152 | dsm_mask &= ~(1 << 8); |
| 1153 | } else { | 1153 | } else { |
| 1154 | dev_err(dev, "unknown dimm command family\n"); | 1154 | dev_dbg(dev, "unknown dimm command family\n"); |
| 1155 | nfit_mem->family = -1; | 1155 | nfit_mem->family = -1; |
| 1156 | return force_enable_dimms ? 0 : -ENODEV; | 1156 | /* DSMs are optional, continue loading the driver... */ |
| 1157 | return 0; | ||
| 1157 | } | 1158 | } |
| 1158 | 1159 | ||
| 1159 | uuid = to_nfit_uuid(nfit_mem->family); | 1160 | uuid = to_nfit_uuid(nfit_mem->family); |
diff --git a/drivers/acpi/nfit.h b/drivers/acpi/nfit.h index 11cb38348aef..02b9ea1e8d2e 100644 --- a/drivers/acpi/nfit.h +++ b/drivers/acpi/nfit.h | |||
| @@ -53,12 +53,12 @@ enum nfit_uuids { | |||
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | /* | 55 | /* |
| 56 | * Region format interface codes are stored as an array of bytes in the | 56 | * Region format interface codes are stored with the interface as the |
| 57 | * NFIT DIMM Control Region structure | 57 | * LSB and the function as the MSB. |
| 58 | */ | 58 | */ |
| 59 | #define NFIT_FIC_BYTE cpu_to_be16(0x101) /* byte-addressable energy backed */ | 59 | #define NFIT_FIC_BYTE cpu_to_le16(0x101) /* byte-addressable energy backed */ |
| 60 | #define NFIT_FIC_BLK cpu_to_be16(0x201) /* block-addressable non-energy backed */ | 60 | #define NFIT_FIC_BLK cpu_to_le16(0x201) /* block-addressable non-energy backed */ |
| 61 | #define NFIT_FIC_BYTEN cpu_to_be16(0x301) /* byte-addressable non-energy backed */ | 61 | #define NFIT_FIC_BYTEN cpu_to_le16(0x301) /* byte-addressable non-energy backed */ |
| 62 | 62 | ||
| 63 | enum { | 63 | enum { |
| 64 | NFIT_BLK_READ_FLUSH = 1, | 64 | NFIT_BLK_READ_FLUSH = 1, |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 8fc7323ed3e8..c983bf733ad3 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -470,6 +470,7 @@ static int acpi_irq_pci_sharing_penalty(int irq) | |||
| 470 | { | 470 | { |
| 471 | struct acpi_pci_link *link; | 471 | struct acpi_pci_link *link; |
| 472 | int penalty = 0; | 472 | int penalty = 0; |
| 473 | int i; | ||
| 473 | 474 | ||
| 474 | list_for_each_entry(link, &acpi_link_list, list) { | 475 | list_for_each_entry(link, &acpi_link_list, list) { |
| 475 | /* | 476 | /* |
| @@ -478,18 +479,14 @@ static int acpi_irq_pci_sharing_penalty(int irq) | |||
| 478 | */ | 479 | */ |
| 479 | if (link->irq.active && link->irq.active == irq) | 480 | if (link->irq.active && link->irq.active == irq) |
| 480 | penalty += PIRQ_PENALTY_PCI_USING; | 481 | penalty += PIRQ_PENALTY_PCI_USING; |
| 481 | else { | 482 | |
| 482 | int i; | 483 | /* |
| 483 | 484 | * penalize the IRQs PCI might use, but not as severely. | |
| 484 | /* | 485 | */ |
| 485 | * If a link is inactive, penalize the IRQs it | 486 | for (i = 0; i < link->irq.possible_count; i++) |
| 486 | * might use, but not as severely. | 487 | if (link->irq.possible[i] == irq) |
| 487 | */ | 488 | penalty += PIRQ_PENALTY_PCI_POSSIBLE / |
| 488 | for (i = 0; i < link->irq.possible_count; i++) | 489 | link->irq.possible_count; |
| 489 | if (link->irq.possible[i] == irq) | ||
| 490 | penalty += PIRQ_PENALTY_PCI_POSSIBLE / | ||
| 491 | link->irq.possible_count; | ||
| 492 | } | ||
| 493 | } | 490 | } |
| 494 | 491 | ||
| 495 | return penalty; | 492 | return penalty; |
| @@ -499,9 +496,6 @@ static int acpi_irq_get_penalty(int irq) | |||
| 499 | { | 496 | { |
| 500 | int penalty = 0; | 497 | int penalty = 0; |
| 501 | 498 | ||
| 502 | if (irq < ACPI_MAX_ISA_IRQS) | ||
| 503 | penalty += acpi_isa_irq_penalty[irq]; | ||
| 504 | |||
| 505 | /* | 499 | /* |
| 506 | * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict | 500 | * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict |
| 507 | * with PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be | 501 | * with PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be |
| @@ -516,10 +510,49 @@ static int acpi_irq_get_penalty(int irq) | |||
| 516 | penalty += PIRQ_PENALTY_PCI_USING; | 510 | penalty += PIRQ_PENALTY_PCI_USING; |
| 517 | } | 511 | } |
| 518 | 512 | ||
| 513 | if (irq < ACPI_MAX_ISA_IRQS) | ||
| 514 | return penalty + acpi_isa_irq_penalty[irq]; | ||
| 515 | |||
| 519 | penalty += acpi_irq_pci_sharing_penalty(irq); | 516 | penalty += acpi_irq_pci_sharing_penalty(irq); |
| 520 | return penalty; | 517 | return penalty; |
| 521 | } | 518 | } |
| 522 | 519 | ||
| 520 | int __init acpi_irq_penalty_init(void) | ||
| 521 | { | ||
| 522 | struct acpi_pci_link *link; | ||
| 523 | int i; | ||
| 524 | |||
| 525 | /* | ||
| 526 | * Update penalties to facilitate IRQ balancing. | ||
| 527 | */ | ||
| 528 | list_for_each_entry(link, &acpi_link_list, list) { | ||
| 529 | |||
| 530 | /* | ||
| 531 | * reflect the possible and active irqs in the penalty table -- | ||
| 532 | * useful for breaking ties. | ||
| 533 | */ | ||
| 534 | if (link->irq.possible_count) { | ||
| 535 | int penalty = | ||
| 536 | PIRQ_PENALTY_PCI_POSSIBLE / | ||
| 537 | link->irq.possible_count; | ||
| 538 | |||
| 539 | for (i = 0; i < link->irq.possible_count; i++) { | ||
| 540 | if (link->irq.possible[i] < ACPI_MAX_ISA_IRQS) | ||
| 541 | acpi_isa_irq_penalty[link->irq. | ||
| 542 | possible[i]] += | ||
| 543 | penalty; | ||
| 544 | } | ||
| 545 | |||
| 546 | } else if (link->irq.active && | ||
| 547 | (link->irq.active < ACPI_MAX_ISA_IRQS)) { | ||
| 548 | acpi_isa_irq_penalty[link->irq.active] += | ||
| 549 | PIRQ_PENALTY_PCI_POSSIBLE; | ||
| 550 | } | ||
| 551 | } | ||
| 552 | |||
| 553 | return 0; | ||
| 554 | } | ||
| 555 | |||
| 523 | static int acpi_irq_balance = -1; /* 0: static, 1: balance */ | 556 | static int acpi_irq_balance = -1; /* 0: static, 1: balance */ |
| 524 | 557 | ||
| 525 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) | 558 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) |
| @@ -839,7 +872,7 @@ void acpi_penalize_isa_irq(int irq, int active) | |||
| 839 | { | 872 | { |
| 840 | if ((irq >= 0) && (irq < ARRAY_SIZE(acpi_isa_irq_penalty))) | 873 | if ((irq >= 0) && (irq < ARRAY_SIZE(acpi_isa_irq_penalty))) |
| 841 | acpi_isa_irq_penalty[irq] = acpi_irq_get_penalty(irq) + | 874 | acpi_isa_irq_penalty[irq] = acpi_irq_get_penalty(irq) + |
| 842 | active ? PIRQ_PENALTY_ISA_USED : PIRQ_PENALTY_PCI_USING; | 875 | (active ? PIRQ_PENALTY_ISA_USED : PIRQ_PENALTY_PCI_USING); |
| 843 | } | 876 | } |
| 844 | 877 | ||
| 845 | bool acpi_isa_irq_available(int irq) | 878 | bool acpi_isa_irq_available(int irq) |
diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c index 6e702ab57220..1d31c0c0fc20 100644 --- a/drivers/ata/ahci_seattle.c +++ b/drivers/ata/ahci_seattle.c | |||
| @@ -137,7 +137,7 @@ static const struct ata_port_info *ahci_seattle_get_port_info( | |||
| 137 | u32 val; | 137 | u32 val; |
| 138 | 138 | ||
| 139 | plat_data = devm_kzalloc(dev, sizeof(*plat_data), GFP_KERNEL); | 139 | plat_data = devm_kzalloc(dev, sizeof(*plat_data), GFP_KERNEL); |
| 140 | if (IS_ERR(plat_data)) | 140 | if (!plat_data) |
| 141 | return &ahci_port_info; | 141 | return &ahci_port_info; |
| 142 | 142 | ||
| 143 | plat_data->sgpio_ctrl = devm_ioremap_resource(dev, | 143 | plat_data->sgpio_ctrl = devm_ioremap_resource(dev, |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 6be7770f68e9..31c183aed368 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4314,6 +4314,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 4314 | */ | 4314 | */ |
| 4315 | { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 }, | 4315 | { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 }, |
| 4316 | 4316 | ||
| 4317 | /* | ||
| 4318 | * Device times out with higher max sects. | ||
| 4319 | * https://bugzilla.kernel.org/show_bug.cgi?id=121671 | ||
| 4320 | */ | ||
| 4321 | { "LITEON CX1-JB256-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 }, | ||
| 4322 | |||
| 4317 | /* Devices we expect to fail diagnostics */ | 4323 | /* Devices we expect to fail diagnostics */ |
| 4318 | 4324 | ||
| 4319 | /* Devices where NCQ should be avoided */ | 4325 | /* Devices where NCQ should be avoided */ |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index bd74ee555278..745489a1c86a 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
| @@ -986,7 +986,7 @@ static inline void mv_write_cached_reg(void __iomem *addr, u32 *old, u32 new) | |||
| 986 | * Looks like a lot of fuss, but it avoids an unnecessary | 986 | * Looks like a lot of fuss, but it avoids an unnecessary |
| 987 | * +1 usec read-after-write delay for unaffected registers. | 987 | * +1 usec read-after-write delay for unaffected registers. |
| 988 | */ | 988 | */ |
| 989 | laddr = (long)addr & 0xffff; | 989 | laddr = (unsigned long)addr & 0xffff; |
| 990 | if (laddr >= 0x300 && laddr <= 0x33c) { | 990 | if (laddr >= 0x300 && laddr <= 0x33c) { |
| 991 | laddr &= 0x000f; | 991 | laddr &= 0x000f; |
| 992 | if (laddr == 0x4 || laddr == 0xc) { | 992 | if (laddr == 0x4 || laddr == 0xc) { |
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index eda09090cb52..f642c4264c27 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h | |||
| @@ -8,8 +8,6 @@ | |||
| 8 | #include <linux/bcma/bcma.h> | 8 | #include <linux/bcma/bcma.h> |
| 9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
| 10 | 10 | ||
| 11 | #define BCMA_CORE_SIZE 0x1000 | ||
| 12 | |||
| 13 | #define bcma_err(bus, fmt, ...) \ | 11 | #define bcma_err(bus, fmt, ...) \ |
| 14 | pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) | 12 | pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) |
| 15 | #define bcma_warn(bus, fmt, ...) \ | 13 | #define bcma_warn(bus, fmt, ...) \ |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 2e6d1e9c3345..fcc5b4e0aef2 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
| @@ -207,6 +207,9 @@ struct blkfront_info | |||
| 207 | struct blk_mq_tag_set tag_set; | 207 | struct blk_mq_tag_set tag_set; |
| 208 | struct blkfront_ring_info *rinfo; | 208 | struct blkfront_ring_info *rinfo; |
| 209 | unsigned int nr_rings; | 209 | unsigned int nr_rings; |
| 210 | /* Save uncomplete reqs and bios for migration. */ | ||
| 211 | struct list_head requests; | ||
| 212 | struct bio_list bio_list; | ||
| 210 | }; | 213 | }; |
| 211 | 214 | ||
| 212 | static unsigned int nr_minors; | 215 | static unsigned int nr_minors; |
| @@ -2002,69 +2005,22 @@ static int blkif_recover(struct blkfront_info *info) | |||
| 2002 | { | 2005 | { |
| 2003 | unsigned int i, r_index; | 2006 | unsigned int i, r_index; |
| 2004 | struct request *req, *n; | 2007 | struct request *req, *n; |
| 2005 | struct blk_shadow *copy; | ||
| 2006 | int rc; | 2008 | int rc; |
| 2007 | struct bio *bio, *cloned_bio; | 2009 | struct bio *bio, *cloned_bio; |
| 2008 | struct bio_list bio_list, merge_bio; | ||
| 2009 | unsigned int segs, offset; | 2010 | unsigned int segs, offset; |
| 2010 | int pending, size; | 2011 | int pending, size; |
| 2011 | struct split_bio *split_bio; | 2012 | struct split_bio *split_bio; |
| 2012 | struct list_head requests; | ||
| 2013 | 2013 | ||
| 2014 | blkfront_gather_backend_features(info); | 2014 | blkfront_gather_backend_features(info); |
| 2015 | segs = info->max_indirect_segments ? : BLKIF_MAX_SEGMENTS_PER_REQUEST; | 2015 | segs = info->max_indirect_segments ? : BLKIF_MAX_SEGMENTS_PER_REQUEST; |
| 2016 | blk_queue_max_segments(info->rq, segs); | 2016 | blk_queue_max_segments(info->rq, segs); |
| 2017 | bio_list_init(&bio_list); | ||
| 2018 | INIT_LIST_HEAD(&requests); | ||
| 2019 | 2017 | ||
| 2020 | for (r_index = 0; r_index < info->nr_rings; r_index++) { | 2018 | for (r_index = 0; r_index < info->nr_rings; r_index++) { |
| 2021 | struct blkfront_ring_info *rinfo; | 2019 | struct blkfront_ring_info *rinfo = &info->rinfo[r_index]; |
| 2022 | |||
| 2023 | rinfo = &info->rinfo[r_index]; | ||
| 2024 | /* Stage 1: Make a safe copy of the shadow state. */ | ||
| 2025 | copy = kmemdup(rinfo->shadow, sizeof(rinfo->shadow), | ||
| 2026 | GFP_NOIO | __GFP_REPEAT | __GFP_HIGH); | ||
| 2027 | if (!copy) | ||
| 2028 | return -ENOMEM; | ||
| 2029 | |||
| 2030 | /* Stage 2: Set up free list. */ | ||
| 2031 | memset(&rinfo->shadow, 0, sizeof(rinfo->shadow)); | ||
| 2032 | for (i = 0; i < BLK_RING_SIZE(info); i++) | ||
| 2033 | rinfo->shadow[i].req.u.rw.id = i+1; | ||
| 2034 | rinfo->shadow_free = rinfo->ring.req_prod_pvt; | ||
| 2035 | rinfo->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff; | ||
| 2036 | 2020 | ||
| 2037 | rc = blkfront_setup_indirect(rinfo); | 2021 | rc = blkfront_setup_indirect(rinfo); |
| 2038 | if (rc) { | 2022 | if (rc) |
| 2039 | kfree(copy); | ||
| 2040 | return rc; | 2023 | return rc; |
| 2041 | } | ||
| 2042 | |||
| 2043 | for (i = 0; i < BLK_RING_SIZE(info); i++) { | ||
| 2044 | /* Not in use? */ | ||
| 2045 | if (!copy[i].request) | ||
| 2046 | continue; | ||
| 2047 | |||
| 2048 | /* | ||
| 2049 | * Get the bios in the request so we can re-queue them. | ||
| 2050 | */ | ||
| 2051 | if (copy[i].request->cmd_flags & | ||
| 2052 | (REQ_FLUSH | REQ_FUA | REQ_DISCARD | REQ_SECURE)) { | ||
| 2053 | /* | ||
| 2054 | * Flush operations don't contain bios, so | ||
| 2055 | * we need to requeue the whole request | ||
| 2056 | */ | ||
| 2057 | list_add(©[i].request->queuelist, &requests); | ||
| 2058 | continue; | ||
| 2059 | } | ||
| 2060 | merge_bio.head = copy[i].request->bio; | ||
| 2061 | merge_bio.tail = copy[i].request->biotail; | ||
| 2062 | bio_list_merge(&bio_list, &merge_bio); | ||
| 2063 | copy[i].request->bio = NULL; | ||
| 2064 | blk_end_request_all(copy[i].request, 0); | ||
| 2065 | } | ||
| 2066 | |||
| 2067 | kfree(copy); | ||
| 2068 | } | 2024 | } |
| 2069 | xenbus_switch_state(info->xbdev, XenbusStateConnected); | 2025 | xenbus_switch_state(info->xbdev, XenbusStateConnected); |
| 2070 | 2026 | ||
| @@ -2079,7 +2035,7 @@ static int blkif_recover(struct blkfront_info *info) | |||
| 2079 | kick_pending_request_queues(rinfo); | 2035 | kick_pending_request_queues(rinfo); |
| 2080 | } | 2036 | } |
| 2081 | 2037 | ||
| 2082 | list_for_each_entry_safe(req, n, &requests, queuelist) { | 2038 | list_for_each_entry_safe(req, n, &info->requests, queuelist) { |
| 2083 | /* Requeue pending requests (flush or discard) */ | 2039 | /* Requeue pending requests (flush or discard) */ |
| 2084 | list_del_init(&req->queuelist); | 2040 | list_del_init(&req->queuelist); |
| 2085 | BUG_ON(req->nr_phys_segments > segs); | 2041 | BUG_ON(req->nr_phys_segments > segs); |
| @@ -2087,7 +2043,7 @@ static int blkif_recover(struct blkfront_info *info) | |||
| 2087 | } | 2043 | } |
| 2088 | blk_mq_kick_requeue_list(info->rq); | 2044 | blk_mq_kick_requeue_list(info->rq); |
| 2089 | 2045 | ||
| 2090 | while ((bio = bio_list_pop(&bio_list)) != NULL) { | 2046 | while ((bio = bio_list_pop(&info->bio_list)) != NULL) { |
| 2091 | /* Traverse the list of pending bios and re-queue them */ | 2047 | /* Traverse the list of pending bios and re-queue them */ |
| 2092 | if (bio_segments(bio) > segs) { | 2048 | if (bio_segments(bio) > segs) { |
| 2093 | /* | 2049 | /* |
| @@ -2133,9 +2089,42 @@ static int blkfront_resume(struct xenbus_device *dev) | |||
| 2133 | { | 2089 | { |
| 2134 | struct blkfront_info *info = dev_get_drvdata(&dev->dev); | 2090 | struct blkfront_info *info = dev_get_drvdata(&dev->dev); |
| 2135 | int err = 0; | 2091 | int err = 0; |
| 2092 | unsigned int i, j; | ||
| 2136 | 2093 | ||
| 2137 | dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename); | 2094 | dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename); |
| 2138 | 2095 | ||
| 2096 | bio_list_init(&info->bio_list); | ||
| 2097 | INIT_LIST_HEAD(&info->requests); | ||
| 2098 | for (i = 0; i < info->nr_rings; i++) { | ||
| 2099 | struct blkfront_ring_info *rinfo = &info->rinfo[i]; | ||
| 2100 | struct bio_list merge_bio; | ||
| 2101 | struct blk_shadow *shadow = rinfo->shadow; | ||
| 2102 | |||
| 2103 | for (j = 0; j < BLK_RING_SIZE(info); j++) { | ||
| 2104 | /* Not in use? */ | ||
| 2105 | if (!shadow[j].request) | ||
| 2106 | continue; | ||
| 2107 | |||
| 2108 | /* | ||
| 2109 | * Get the bios in the request so we can re-queue them. | ||
| 2110 | */ | ||
| 2111 | if (shadow[j].request->cmd_flags & | ||
| 2112 | (REQ_FLUSH | REQ_FUA | REQ_DISCARD | REQ_SECURE)) { | ||
| 2113 | /* | ||
| 2114 | * Flush operations don't contain bios, so | ||
| 2115 | * we need to requeue the whole request | ||
| 2116 | */ | ||
| 2117 | list_add(&shadow[j].request->queuelist, &info->requests); | ||
| 2118 | continue; | ||
| 2119 | } | ||
| 2120 | merge_bio.head = shadow[j].request->bio; | ||
| 2121 | merge_bio.tail = shadow[j].request->biotail; | ||
| 2122 | bio_list_merge(&info->bio_list, &merge_bio); | ||
| 2123 | shadow[j].request->bio = NULL; | ||
| 2124 | blk_mq_end_request(shadow[j].request, 0); | ||
| 2125 | } | ||
| 2126 | } | ||
| 2127 | |||
| 2139 | blkif_free(info, info->connected == BLKIF_STATE_CONNECTED); | 2128 | blkif_free(info, info->connected == BLKIF_STATE_CONNECTED); |
| 2140 | 2129 | ||
| 2141 | err = negotiate_mq(info); | 2130 | err = negotiate_mq(info); |
diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c index 10f846cc8db1..25d5906640c3 100644 --- a/drivers/clk/at91/clk-programmable.c +++ b/drivers/clk/at91/clk-programmable.c | |||
| @@ -99,7 +99,7 @@ static int clk_programmable_set_parent(struct clk_hw *hw, u8 index) | |||
| 99 | struct clk_programmable *prog = to_clk_programmable(hw); | 99 | struct clk_programmable *prog = to_clk_programmable(hw); |
| 100 | const struct clk_programmable_layout *layout = prog->layout; | 100 | const struct clk_programmable_layout *layout = prog->layout; |
| 101 | unsigned int mask = layout->css_mask; | 101 | unsigned int mask = layout->css_mask; |
| 102 | unsigned int pckr = 0; | 102 | unsigned int pckr = index; |
| 103 | 103 | ||
| 104 | if (layout->have_slck_mck) | 104 | if (layout->have_slck_mck) |
| 105 | mask |= AT91_PMC_CSSMCK_MCK; | 105 | mask |= AT91_PMC_CSSMCK_MCK; |
diff --git a/drivers/clk/clk-oxnas.c b/drivers/clk/clk-oxnas.c index efba7d4dbcfc..79bcb2e42060 100644 --- a/drivers/clk/clk-oxnas.c +++ b/drivers/clk/clk-oxnas.c | |||
| @@ -144,9 +144,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev) | |||
| 144 | return -ENOMEM; | 144 | return -ENOMEM; |
| 145 | 145 | ||
| 146 | regmap = syscon_node_to_regmap(of_get_parent(np)); | 146 | regmap = syscon_node_to_regmap(of_get_parent(np)); |
| 147 | if (!regmap) { | 147 | if (IS_ERR(regmap)) { |
| 148 | dev_err(&pdev->dev, "failed to have parent regmap\n"); | 148 | dev_err(&pdev->dev, "failed to have parent regmap\n"); |
| 149 | return -EINVAL; | 149 | return PTR_ERR(regmap); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | for (i = 0; i < ARRAY_SIZE(clk_oxnas_init); i++) { | 152 | for (i = 0; i < ARRAY_SIZE(clk_oxnas_init); i++) { |
diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c index 4bb130cd0062..05b3d73bfefa 100644 --- a/drivers/clk/rockchip/clk-cpu.c +++ b/drivers/clk/rockchip/clk-cpu.c | |||
| @@ -321,9 +321,9 @@ struct clk *rockchip_clk_register_cpuclk(const char *name, | |||
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | cclk = clk_register(NULL, &cpuclk->hw); | 323 | cclk = clk_register(NULL, &cpuclk->hw); |
| 324 | if (IS_ERR(clk)) { | 324 | if (IS_ERR(cclk)) { |
| 325 | pr_err("%s: could not register cpuclk %s\n", __func__, name); | 325 | pr_err("%s: could not register cpuclk %s\n", __func__, name); |
| 326 | ret = PTR_ERR(clk); | 326 | ret = PTR_ERR(cclk); |
| 327 | goto free_rate_table; | 327 | goto free_rate_table; |
| 328 | } | 328 | } |
| 329 | 329 | ||
diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c index bc856f21f6b2..077fcdc7908b 100644 --- a/drivers/clk/rockchip/clk-mmc-phase.c +++ b/drivers/clk/rockchip/clk-mmc-phase.c | |||
| @@ -41,8 +41,6 @@ static unsigned long rockchip_mmc_recalc(struct clk_hw *hw, | |||
| 41 | #define ROCKCHIP_MMC_DEGREE_MASK 0x3 | 41 | #define ROCKCHIP_MMC_DEGREE_MASK 0x3 |
| 42 | #define ROCKCHIP_MMC_DELAYNUM_OFFSET 2 | 42 | #define ROCKCHIP_MMC_DELAYNUM_OFFSET 2 |
| 43 | #define ROCKCHIP_MMC_DELAYNUM_MASK (0xff << ROCKCHIP_MMC_DELAYNUM_OFFSET) | 43 | #define ROCKCHIP_MMC_DELAYNUM_MASK (0xff << ROCKCHIP_MMC_DELAYNUM_OFFSET) |
| 44 | #define ROCKCHIP_MMC_INIT_STATE_RESET 0x1 | ||
| 45 | #define ROCKCHIP_MMC_INIT_STATE_SHIFT 1 | ||
| 46 | 44 | ||
| 47 | #define PSECS_PER_SEC 1000000000000LL | 45 | #define PSECS_PER_SEC 1000000000000LL |
| 48 | 46 | ||
| @@ -154,6 +152,7 @@ struct clk *rockchip_clk_register_mmc(const char *name, | |||
| 154 | return ERR_PTR(-ENOMEM); | 152 | return ERR_PTR(-ENOMEM); |
| 155 | 153 | ||
| 156 | init.name = name; | 154 | init.name = name; |
| 155 | init.flags = 0; | ||
| 157 | init.num_parents = num_parents; | 156 | init.num_parents = num_parents; |
| 158 | init.parent_names = parent_names; | 157 | init.parent_names = parent_names; |
| 159 | init.ops = &rockchip_mmc_clk_ops; | 158 | init.ops = &rockchip_mmc_clk_ops; |
| @@ -162,15 +161,6 @@ struct clk *rockchip_clk_register_mmc(const char *name, | |||
| 162 | mmc_clock->reg = reg; | 161 | mmc_clock->reg = reg; |
| 163 | mmc_clock->shift = shift; | 162 | mmc_clock->shift = shift; |
| 164 | 163 | ||
| 165 | /* | ||
| 166 | * Assert init_state to soft reset the CLKGEN | ||
| 167 | * for mmc tuning phase and degree | ||
| 168 | */ | ||
| 169 | if (mmc_clock->shift == ROCKCHIP_MMC_INIT_STATE_SHIFT) | ||
| 170 | writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_RESET, | ||
| 171 | ROCKCHIP_MMC_INIT_STATE_RESET, | ||
| 172 | mmc_clock->shift), mmc_clock->reg); | ||
| 173 | |||
| 174 | clk = clk_register(NULL, &mmc_clock->hw); | 164 | clk = clk_register(NULL, &mmc_clock->hw); |
| 175 | if (IS_ERR(clk)) | 165 | if (IS_ERR(clk)) |
| 176 | kfree(mmc_clock); | 166 | kfree(mmc_clock); |
diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c index 291543f52caa..8059a8d3ea36 100644 --- a/drivers/clk/rockchip/clk-rk3399.c +++ b/drivers/clk/rockchip/clk-rk3399.c | |||
| @@ -832,9 +832,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { | |||
| 832 | RK3399_CLKGATE_CON(13), 1, GFLAGS), | 832 | RK3399_CLKGATE_CON(13), 1, GFLAGS), |
| 833 | 833 | ||
| 834 | /* perihp */ | 834 | /* perihp */ |
| 835 | GATE(0, "cpll_aclk_perihp_src", "gpll", CLK_IGNORE_UNUSED, | 835 | GATE(0, "cpll_aclk_perihp_src", "cpll", CLK_IGNORE_UNUSED, |
| 836 | RK3399_CLKGATE_CON(5), 0, GFLAGS), | 836 | RK3399_CLKGATE_CON(5), 0, GFLAGS), |
| 837 | GATE(0, "gpll_aclk_perihp_src", "cpll", CLK_IGNORE_UNUSED, | 837 | GATE(0, "gpll_aclk_perihp_src", "gpll", CLK_IGNORE_UNUSED, |
| 838 | RK3399_CLKGATE_CON(5), 1, GFLAGS), | 838 | RK3399_CLKGATE_CON(5), 1, GFLAGS), |
| 839 | COMPOSITE(ACLK_PERIHP, "aclk_perihp", mux_aclk_perihp_p, CLK_IGNORE_UNUSED, | 839 | COMPOSITE(ACLK_PERIHP, "aclk_perihp", mux_aclk_perihp_p, CLK_IGNORE_UNUSED, |
| 840 | RK3399_CLKSEL_CON(14), 7, 1, MFLAGS, 0, 5, DFLAGS, | 840 | RK3399_CLKSEL_CON(14), 7, 1, MFLAGS, 0, 5, DFLAGS, |
| @@ -1466,6 +1466,8 @@ static struct rockchip_clk_branch rk3399_clk_pmu_branches[] __initdata = { | |||
| 1466 | 1466 | ||
| 1467 | static const char *const rk3399_cru_critical_clocks[] __initconst = { | 1467 | static const char *const rk3399_cru_critical_clocks[] __initconst = { |
| 1468 | "aclk_cci_pre", | 1468 | "aclk_cci_pre", |
| 1469 | "aclk_gic", | ||
| 1470 | "aclk_gic_noc", | ||
| 1469 | "pclk_perilp0", | 1471 | "pclk_perilp0", |
| 1470 | "pclk_perilp0", | 1472 | "pclk_perilp0", |
| 1471 | "hclk_perilp0", | 1473 | "hclk_perilp0", |
| @@ -1508,6 +1510,7 @@ static void __init rk3399_clk_init(struct device_node *np) | |||
| 1508 | ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS); | 1510 | ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS); |
| 1509 | if (IS_ERR(ctx)) { | 1511 | if (IS_ERR(ctx)) { |
| 1510 | pr_err("%s: rockchip clk init failed\n", __func__); | 1512 | pr_err("%s: rockchip clk init failed\n", __func__); |
| 1513 | iounmap(reg_base); | ||
| 1511 | return; | 1514 | return; |
| 1512 | } | 1515 | } |
| 1513 | 1516 | ||
| @@ -1553,6 +1556,7 @@ static void __init rk3399_pmu_clk_init(struct device_node *np) | |||
| 1553 | ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS); | 1556 | ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS); |
| 1554 | if (IS_ERR(ctx)) { | 1557 | if (IS_ERR(ctx)) { |
| 1555 | pr_err("%s: rockchip pmu clk init failed\n", __func__); | 1558 | pr_err("%s: rockchip pmu clk init failed\n", __func__); |
| 1559 | iounmap(reg_base); | ||
| 1556 | return; | 1560 | return; |
| 1557 | } | 1561 | } |
| 1558 | 1562 | ||
diff --git a/drivers/clk/sunxi/clk-sun4i-display.c b/drivers/clk/sunxi/clk-sun4i-display.c index 445a7498d6df..9780fac6d029 100644 --- a/drivers/clk/sunxi/clk-sun4i-display.c +++ b/drivers/clk/sunxi/clk-sun4i-display.c | |||
| @@ -33,6 +33,8 @@ struct sun4i_a10_display_clk_data { | |||
| 33 | 33 | ||
| 34 | u8 width_div; | 34 | u8 width_div; |
| 35 | u8 width_mux; | 35 | u8 width_mux; |
| 36 | |||
| 37 | u32 flags; | ||
| 36 | }; | 38 | }; |
| 37 | 39 | ||
| 38 | struct reset_data { | 40 | struct reset_data { |
| @@ -166,7 +168,7 @@ static void __init sun4i_a10_display_init(struct device_node *node, | |||
| 166 | data->has_div ? &div->hw : NULL, | 168 | data->has_div ? &div->hw : NULL, |
| 167 | data->has_div ? &clk_divider_ops : NULL, | 169 | data->has_div ? &clk_divider_ops : NULL, |
| 168 | &gate->hw, &clk_gate_ops, | 170 | &gate->hw, &clk_gate_ops, |
| 169 | 0); | 171 | data->flags); |
| 170 | if (IS_ERR(clk)) { | 172 | if (IS_ERR(clk)) { |
| 171 | pr_err("%s: Couldn't register the clock\n", clk_name); | 173 | pr_err("%s: Couldn't register the clock\n", clk_name); |
| 172 | goto free_div; | 174 | goto free_div; |
| @@ -232,6 +234,7 @@ static const struct sun4i_a10_display_clk_data sun4i_a10_tcon_ch0_data __initcon | |||
| 232 | .offset_rst = 29, | 234 | .offset_rst = 29, |
| 233 | .offset_mux = 24, | 235 | .offset_mux = 24, |
| 234 | .width_mux = 2, | 236 | .width_mux = 2, |
| 237 | .flags = CLK_SET_RATE_PARENT, | ||
| 235 | }; | 238 | }; |
| 236 | 239 | ||
| 237 | static void __init sun4i_a10_tcon_ch0_setup(struct device_node *node) | 240 | static void __init sun4i_a10_tcon_ch0_setup(struct device_node *node) |
diff --git a/drivers/clk/sunxi/clk-sun4i-tcon-ch1.c b/drivers/clk/sunxi/clk-sun4i-tcon-ch1.c index 98a4582de56a..b6d29d1bedca 100644 --- a/drivers/clk/sunxi/clk-sun4i-tcon-ch1.c +++ b/drivers/clk/sunxi/clk-sun4i-tcon-ch1.c | |||
| @@ -79,15 +79,11 @@ static int tcon_ch1_is_enabled(struct clk_hw *hw) | |||
| 79 | static u8 tcon_ch1_get_parent(struct clk_hw *hw) | 79 | static u8 tcon_ch1_get_parent(struct clk_hw *hw) |
| 80 | { | 80 | { |
| 81 | struct tcon_ch1_clk *tclk = hw_to_tclk(hw); | 81 | struct tcon_ch1_clk *tclk = hw_to_tclk(hw); |
| 82 | int num_parents = clk_hw_get_num_parents(hw); | ||
| 83 | u32 reg; | 82 | u32 reg; |
| 84 | 83 | ||
| 85 | reg = readl(tclk->reg) >> TCON_CH1_SCLK2_MUX_SHIFT; | 84 | reg = readl(tclk->reg) >> TCON_CH1_SCLK2_MUX_SHIFT; |
| 86 | reg &= reg >> TCON_CH1_SCLK2_MUX_MASK; | 85 | reg &= reg >> TCON_CH1_SCLK2_MUX_MASK; |
| 87 | 86 | ||
| 88 | if (reg >= num_parents) | ||
| 89 | return -EINVAL; | ||
| 90 | |||
| 91 | return reg; | 87 | return reg; |
| 92 | } | 88 | } |
| 93 | 89 | ||
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 15d06fcf0b50..b02f9c606e0b 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
| @@ -56,11 +56,21 @@ static struct cb_id cn_proc_event_id = { CN_IDX_PROC, CN_VAL_PROC }; | |||
| 56 | /* proc_event_counts is used as the sequence number of the netlink message */ | 56 | /* proc_event_counts is used as the sequence number of the netlink message */ |
| 57 | static DEFINE_PER_CPU(__u32, proc_event_counts) = { 0 }; | 57 | static DEFINE_PER_CPU(__u32, proc_event_counts) = { 0 }; |
| 58 | 58 | ||
| 59 | static inline void get_seq(__u32 *ts, int *cpu) | 59 | static inline void send_msg(struct cn_msg *msg) |
| 60 | { | 60 | { |
| 61 | preempt_disable(); | 61 | preempt_disable(); |
| 62 | *ts = __this_cpu_inc_return(proc_event_counts) - 1; | 62 | |
| 63 | *cpu = smp_processor_id(); | 63 | msg->seq = __this_cpu_inc_return(proc_event_counts) - 1; |
| 64 | ((struct proc_event *)msg->data)->cpu = smp_processor_id(); | ||
| 65 | |||
| 66 | /* | ||
| 67 | * Preemption remains disabled during send to ensure the messages are | ||
| 68 | * ordered according to their sequence numbers. | ||
| 69 | * | ||
| 70 | * If cn_netlink_send() fails, the data is not sent. | ||
| 71 | */ | ||
| 72 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_NOWAIT); | ||
| 73 | |||
| 64 | preempt_enable(); | 74 | preempt_enable(); |
| 65 | } | 75 | } |
| 66 | 76 | ||
| @@ -77,7 +87,6 @@ void proc_fork_connector(struct task_struct *task) | |||
| 77 | msg = buffer_to_cn_msg(buffer); | 87 | msg = buffer_to_cn_msg(buffer); |
| 78 | ev = (struct proc_event *)msg->data; | 88 | ev = (struct proc_event *)msg->data; |
| 79 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 89 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
| 80 | get_seq(&msg->seq, &ev->cpu); | ||
| 81 | ev->timestamp_ns = ktime_get_ns(); | 90 | ev->timestamp_ns = ktime_get_ns(); |
| 82 | ev->what = PROC_EVENT_FORK; | 91 | ev->what = PROC_EVENT_FORK; |
| 83 | rcu_read_lock(); | 92 | rcu_read_lock(); |
| @@ -92,8 +101,7 @@ void proc_fork_connector(struct task_struct *task) | |||
| 92 | msg->ack = 0; /* not used */ | 101 | msg->ack = 0; /* not used */ |
| 93 | msg->len = sizeof(*ev); | 102 | msg->len = sizeof(*ev); |
| 94 | msg->flags = 0; /* not used */ | 103 | msg->flags = 0; /* not used */ |
| 95 | /* If cn_netlink_send() failed, the data is not sent */ | 104 | send_msg(msg); |
| 96 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL); | ||
| 97 | } | 105 | } |
| 98 | 106 | ||
| 99 | void proc_exec_connector(struct task_struct *task) | 107 | void proc_exec_connector(struct task_struct *task) |
| @@ -108,7 +116,6 @@ void proc_exec_connector(struct task_struct *task) | |||
| 108 | msg = buffer_to_cn_msg(buffer); | 116 | msg = buffer_to_cn_msg(buffer); |
| 109 | ev = (struct proc_event *)msg->data; | 117 | ev = (struct proc_event *)msg->data; |
| 110 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 118 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
| 111 | get_seq(&msg->seq, &ev->cpu); | ||
| 112 | ev->timestamp_ns = ktime_get_ns(); | 119 | ev->timestamp_ns = ktime_get_ns(); |
| 113 | ev->what = PROC_EVENT_EXEC; | 120 | ev->what = PROC_EVENT_EXEC; |
| 114 | ev->event_data.exec.process_pid = task->pid; | 121 | ev->event_data.exec.process_pid = task->pid; |
| @@ -118,7 +125,7 @@ void proc_exec_connector(struct task_struct *task) | |||
| 118 | msg->ack = 0; /* not used */ | 125 | msg->ack = 0; /* not used */ |
| 119 | msg->len = sizeof(*ev); | 126 | msg->len = sizeof(*ev); |
| 120 | msg->flags = 0; /* not used */ | 127 | msg->flags = 0; /* not used */ |
| 121 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL); | 128 | send_msg(msg); |
| 122 | } | 129 | } |
| 123 | 130 | ||
| 124 | void proc_id_connector(struct task_struct *task, int which_id) | 131 | void proc_id_connector(struct task_struct *task, int which_id) |
| @@ -150,14 +157,13 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
| 150 | return; | 157 | return; |
| 151 | } | 158 | } |
| 152 | rcu_read_unlock(); | 159 | rcu_read_unlock(); |
| 153 | get_seq(&msg->seq, &ev->cpu); | ||
| 154 | ev->timestamp_ns = ktime_get_ns(); | 160 | ev->timestamp_ns = ktime_get_ns(); |
| 155 | 161 | ||
| 156 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 162 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
| 157 | msg->ack = 0; /* not used */ | 163 | msg->ack = 0; /* not used */ |
| 158 | msg->len = sizeof(*ev); | 164 | msg->len = sizeof(*ev); |
| 159 | msg->flags = 0; /* not used */ | 165 | msg->flags = 0; /* not used */ |
| 160 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL); | 166 | send_msg(msg); |
| 161 | } | 167 | } |
| 162 | 168 | ||
| 163 | void proc_sid_connector(struct task_struct *task) | 169 | void proc_sid_connector(struct task_struct *task) |
| @@ -172,7 +178,6 @@ void proc_sid_connector(struct task_struct *task) | |||
| 172 | msg = buffer_to_cn_msg(buffer); | 178 | msg = buffer_to_cn_msg(buffer); |
| 173 | ev = (struct proc_event *)msg->data; | 179 | ev = (struct proc_event *)msg->data; |
| 174 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 180 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
| 175 | get_seq(&msg->seq, &ev->cpu); | ||
| 176 | ev->timestamp_ns = ktime_get_ns(); | 181 | ev->timestamp_ns = ktime_get_ns(); |
| 177 | ev->what = PROC_EVENT_SID; | 182 | ev->what = PROC_EVENT_SID; |
| 178 | ev->event_data.sid.process_pid = task->pid; | 183 | ev->event_data.sid.process_pid = task->pid; |
| @@ -182,7 +187,7 @@ void proc_sid_connector(struct task_struct *task) | |||
| 182 | msg->ack = 0; /* not used */ | 187 | msg->ack = 0; /* not used */ |
| 183 | msg->len = sizeof(*ev); | 188 | msg->len = sizeof(*ev); |
| 184 | msg->flags = 0; /* not used */ | 189 | msg->flags = 0; /* not used */ |
| 185 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL); | 190 | send_msg(msg); |
| 186 | } | 191 | } |
| 187 | 192 | ||
| 188 | void proc_ptrace_connector(struct task_struct *task, int ptrace_id) | 193 | void proc_ptrace_connector(struct task_struct *task, int ptrace_id) |
| @@ -197,7 +202,6 @@ void proc_ptrace_connector(struct task_struct *task, int ptrace_id) | |||
| 197 | msg = buffer_to_cn_msg(buffer); | 202 | msg = buffer_to_cn_msg(buffer); |
| 198 | ev = (struct proc_event *)msg->data; | 203 | ev = (struct proc_event *)msg->data; |
| 199 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 204 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
| 200 | get_seq(&msg->seq, &ev->cpu); | ||
| 201 | ev->timestamp_ns = ktime_get_ns(); | 205 | ev->timestamp_ns = ktime_get_ns(); |
| 202 | ev->what = PROC_EVENT_PTRACE; | 206 | ev->what = PROC_EVENT_PTRACE; |
| 203 | ev->event_data.ptrace.process_pid = task->pid; | 207 | ev->event_data.ptrace.process_pid = task->pid; |
| @@ -215,7 +219,7 @@ void proc_ptrace_connector(struct task_struct *task, int ptrace_id) | |||
| 215 | msg->ack = 0; /* not used */ | 219 | msg->ack = 0; /* not used */ |
| 216 | msg->len = sizeof(*ev); | 220 | msg->len = sizeof(*ev); |
| 217 | msg->flags = 0; /* not used */ | 221 | msg->flags = 0; /* not used */ |
| 218 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL); | 222 | send_msg(msg); |
| 219 | } | 223 | } |
| 220 | 224 | ||
| 221 | void proc_comm_connector(struct task_struct *task) | 225 | void proc_comm_connector(struct task_struct *task) |
| @@ -230,7 +234,6 @@ void proc_comm_connector(struct task_struct *task) | |||
| 230 | msg = buffer_to_cn_msg(buffer); | 234 | msg = buffer_to_cn_msg(buffer); |
| 231 | ev = (struct proc_event *)msg->data; | 235 | ev = (struct proc_event *)msg->data; |
| 232 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 236 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
| 233 | get_seq(&msg->seq, &ev->cpu); | ||
| 234 | ev->timestamp_ns = ktime_get_ns(); | 237 | ev->timestamp_ns = ktime_get_ns(); |
| 235 | ev->what = PROC_EVENT_COMM; | 238 | ev->what = PROC_EVENT_COMM; |
| 236 | ev->event_data.comm.process_pid = task->pid; | 239 | ev->event_data.comm.process_pid = task->pid; |
| @@ -241,7 +244,7 @@ void proc_comm_connector(struct task_struct *task) | |||
| 241 | msg->ack = 0; /* not used */ | 244 | msg->ack = 0; /* not used */ |
| 242 | msg->len = sizeof(*ev); | 245 | msg->len = sizeof(*ev); |
| 243 | msg->flags = 0; /* not used */ | 246 | msg->flags = 0; /* not used */ |
| 244 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL); | 247 | send_msg(msg); |
| 245 | } | 248 | } |
| 246 | 249 | ||
| 247 | void proc_coredump_connector(struct task_struct *task) | 250 | void proc_coredump_connector(struct task_struct *task) |
| @@ -256,7 +259,6 @@ void proc_coredump_connector(struct task_struct *task) | |||
| 256 | msg = buffer_to_cn_msg(buffer); | 259 | msg = buffer_to_cn_msg(buffer); |
| 257 | ev = (struct proc_event *)msg->data; | 260 | ev = (struct proc_event *)msg->data; |
| 258 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 261 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
| 259 | get_seq(&msg->seq, &ev->cpu); | ||
| 260 | ev->timestamp_ns = ktime_get_ns(); | 262 | ev->timestamp_ns = ktime_get_ns(); |
| 261 | ev->what = PROC_EVENT_COREDUMP; | 263 | ev->what = PROC_EVENT_COREDUMP; |
| 262 | ev->event_data.coredump.process_pid = task->pid; | 264 | ev->event_data.coredump.process_pid = task->pid; |
| @@ -266,7 +268,7 @@ void proc_coredump_connector(struct task_struct *task) | |||
| 266 | msg->ack = 0; /* not used */ | 268 | msg->ack = 0; /* not used */ |
| 267 | msg->len = sizeof(*ev); | 269 | msg->len = sizeof(*ev); |
| 268 | msg->flags = 0; /* not used */ | 270 | msg->flags = 0; /* not used */ |
| 269 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL); | 271 | send_msg(msg); |
| 270 | } | 272 | } |
| 271 | 273 | ||
| 272 | void proc_exit_connector(struct task_struct *task) | 274 | void proc_exit_connector(struct task_struct *task) |
| @@ -281,7 +283,6 @@ void proc_exit_connector(struct task_struct *task) | |||
| 281 | msg = buffer_to_cn_msg(buffer); | 283 | msg = buffer_to_cn_msg(buffer); |
| 282 | ev = (struct proc_event *)msg->data; | 284 | ev = (struct proc_event *)msg->data; |
| 283 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 285 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
| 284 | get_seq(&msg->seq, &ev->cpu); | ||
| 285 | ev->timestamp_ns = ktime_get_ns(); | 286 | ev->timestamp_ns = ktime_get_ns(); |
| 286 | ev->what = PROC_EVENT_EXIT; | 287 | ev->what = PROC_EVENT_EXIT; |
| 287 | ev->event_data.exit.process_pid = task->pid; | 288 | ev->event_data.exit.process_pid = task->pid; |
| @@ -293,7 +294,7 @@ void proc_exit_connector(struct task_struct *task) | |||
| 293 | msg->ack = 0; /* not used */ | 294 | msg->ack = 0; /* not used */ |
| 294 | msg->len = sizeof(*ev); | 295 | msg->len = sizeof(*ev); |
| 295 | msg->flags = 0; /* not used */ | 296 | msg->flags = 0; /* not used */ |
| 296 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL); | 297 | send_msg(msg); |
| 297 | } | 298 | } |
| 298 | 299 | ||
| 299 | /* | 300 | /* |
| @@ -325,7 +326,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
| 325 | msg->ack = rcvd_ack + 1; | 326 | msg->ack = rcvd_ack + 1; |
| 326 | msg->len = sizeof(*ev); | 327 | msg->len = sizeof(*ev); |
| 327 | msg->flags = 0; /* not used */ | 328 | msg->flags = 0; /* not used */ |
| 328 | cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_KERNEL); | 329 | send_msg(msg); |
| 329 | } | 330 | } |
| 330 | 331 | ||
| 331 | /** | 332 | /** |
diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c index 3646b143bbf5..0bb44d5b5df4 100644 --- a/drivers/cpufreq/cpufreq-dt-platdev.c +++ b/drivers/cpufreq/cpufreq-dt-platdev.c | |||
| @@ -79,15 +79,16 @@ static const struct of_device_id machines[] __initconst = { | |||
| 79 | static int __init cpufreq_dt_platdev_init(void) | 79 | static int __init cpufreq_dt_platdev_init(void) |
| 80 | { | 80 | { |
| 81 | struct device_node *np = of_find_node_by_path("/"); | 81 | struct device_node *np = of_find_node_by_path("/"); |
| 82 | const struct of_device_id *match; | ||
| 82 | 83 | ||
| 83 | if (!np) | 84 | if (!np) |
| 84 | return -ENODEV; | 85 | return -ENODEV; |
| 85 | 86 | ||
| 86 | if (!of_match_node(machines, np)) | 87 | match = of_match_node(machines, np); |
| 88 | of_node_put(np); | ||
| 89 | if (!match) | ||
| 87 | return -ENODEV; | 90 | return -ENODEV; |
| 88 | 91 | ||
| 89 | of_node_put(of_root); | ||
| 90 | |||
| 91 | return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1, | 92 | return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1, |
| 92 | NULL, 0)); | 93 | NULL, 0)); |
| 93 | } | 94 | } |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 9009295f5134..5617c7087d77 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -2261,6 +2261,10 @@ int cpufreq_update_policy(unsigned int cpu) | |||
| 2261 | * -> ask driver for current freq and notify governors about a change | 2261 | * -> ask driver for current freq and notify governors about a change |
| 2262 | */ | 2262 | */ |
| 2263 | if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { | 2263 | if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { |
| 2264 | if (cpufreq_suspended) { | ||
| 2265 | ret = -EAGAIN; | ||
| 2266 | goto unlock; | ||
| 2267 | } | ||
| 2264 | new_policy.cur = cpufreq_update_current_freq(policy); | 2268 | new_policy.cur = cpufreq_update_current_freq(policy); |
| 2265 | if (WARN_ON(!new_policy.cur)) { | 2269 | if (WARN_ON(!new_policy.cur)) { |
| 2266 | ret = -EIO; | 2270 | ret = -EIO; |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index fe9dc17ea873..1fa1a32928d7 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
| @@ -1400,6 +1400,9 @@ static void intel_pstate_set_update_util_hook(unsigned int cpu_num) | |||
| 1400 | { | 1400 | { |
| 1401 | struct cpudata *cpu = all_cpu_data[cpu_num]; | 1401 | struct cpudata *cpu = all_cpu_data[cpu_num]; |
| 1402 | 1402 | ||
| 1403 | if (cpu->update_util_set) | ||
| 1404 | return; | ||
| 1405 | |||
| 1403 | /* Prevent intel_pstate_update_util() from using stale data. */ | 1406 | /* Prevent intel_pstate_update_util() from using stale data. */ |
| 1404 | cpu->sample.time = 0; | 1407 | cpu->sample.time = 0; |
| 1405 | cpufreq_add_update_util_hook(cpu_num, &cpu->update_util, | 1408 | cpufreq_add_update_util_hook(cpu_num, &cpu->update_util, |
| @@ -1440,8 +1443,6 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
| 1440 | if (!policy->cpuinfo.max_freq) | 1443 | if (!policy->cpuinfo.max_freq) |
| 1441 | return -ENODEV; | 1444 | return -ENODEV; |
| 1442 | 1445 | ||
| 1443 | intel_pstate_clear_update_util_hook(policy->cpu); | ||
| 1444 | |||
| 1445 | pr_debug("set_policy cpuinfo.max %u policy->max %u\n", | 1446 | pr_debug("set_policy cpuinfo.max %u policy->max %u\n", |
| 1446 | policy->cpuinfo.max_freq, policy->max); | 1447 | policy->cpuinfo.max_freq, policy->max); |
| 1447 | 1448 | ||
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index a4d0059e232c..c73207abb5a4 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
| @@ -173,7 +173,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | |||
| 173 | 173 | ||
| 174 | struct cpuidle_state *target_state = &drv->states[index]; | 174 | struct cpuidle_state *target_state = &drv->states[index]; |
| 175 | bool broadcast = !!(target_state->flags & CPUIDLE_FLAG_TIMER_STOP); | 175 | bool broadcast = !!(target_state->flags & CPUIDLE_FLAG_TIMER_STOP); |
| 176 | u64 time_start, time_end; | 176 | ktime_t time_start, time_end; |
| 177 | s64 diff; | 177 | s64 diff; |
| 178 | 178 | ||
| 179 | /* | 179 | /* |
| @@ -195,13 +195,13 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | |||
| 195 | sched_idle_set_state(target_state); | 195 | sched_idle_set_state(target_state); |
| 196 | 196 | ||
| 197 | trace_cpu_idle_rcuidle(index, dev->cpu); | 197 | trace_cpu_idle_rcuidle(index, dev->cpu); |
| 198 | time_start = local_clock(); | 198 | time_start = ns_to_ktime(local_clock()); |
| 199 | 199 | ||
| 200 | stop_critical_timings(); | 200 | stop_critical_timings(); |
| 201 | entered_state = target_state->enter(dev, drv, index); | 201 | entered_state = target_state->enter(dev, drv, index); |
| 202 | start_critical_timings(); | 202 | start_critical_timings(); |
| 203 | 203 | ||
| 204 | time_end = local_clock(); | 204 | time_end = ns_to_ktime(local_clock()); |
| 205 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); | 205 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); |
| 206 | 206 | ||
| 207 | /* The cpu is no longer idle or about to enter idle. */ | 207 | /* The cpu is no longer idle or about to enter idle. */ |
| @@ -217,11 +217,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | |||
| 217 | if (!cpuidle_state_is_coupled(drv, index)) | 217 | if (!cpuidle_state_is_coupled(drv, index)) |
| 218 | local_irq_enable(); | 218 | local_irq_enable(); |
| 219 | 219 | ||
| 220 | /* | 220 | diff = ktime_us_delta(time_end, time_start); |
| 221 | * local_clock() returns the time in nanosecond, let's shift | ||
| 222 | * by 10 (divide by 1024) to have microsecond based time. | ||
| 223 | */ | ||
| 224 | diff = (time_end - time_start) >> 10; | ||
| 225 | if (diff > INT_MAX) | 221 | if (diff > INT_MAX) |
| 226 | diff = INT_MAX; | 222 | diff = INT_MAX; |
| 227 | 223 | ||
diff --git a/drivers/crypto/qat/qat_common/Makefile b/drivers/crypto/qat/qat_common/Makefile index 6d74b91f2152..5fc3dbb9ada0 100644 --- a/drivers/crypto/qat/qat_common/Makefile +++ b/drivers/crypto/qat/qat_common/Makefile | |||
| @@ -2,6 +2,7 @@ $(obj)/qat_rsapubkey-asn1.o: $(obj)/qat_rsapubkey-asn1.c \ | |||
| 2 | $(obj)/qat_rsapubkey-asn1.h | 2 | $(obj)/qat_rsapubkey-asn1.h |
| 3 | $(obj)/qat_rsaprivkey-asn1.o: $(obj)/qat_rsaprivkey-asn1.c \ | 3 | $(obj)/qat_rsaprivkey-asn1.o: $(obj)/qat_rsaprivkey-asn1.c \ |
| 4 | $(obj)/qat_rsaprivkey-asn1.h | 4 | $(obj)/qat_rsaprivkey-asn1.h |
| 5 | $(obj)/qat_asym_algs.o: $(obj)/qat_rsapubkey-asn1.h $(obj)/qat_rsaprivkey-asn1.h | ||
| 5 | 6 | ||
| 6 | clean-files += qat_rsapubkey-asn1.c qat_rsapubkey-asn1.h | 7 | clean-files += qat_rsapubkey-asn1.c qat_rsapubkey-asn1.h |
| 7 | clean-files += qat_rsaprivkey-asn1.c qat_rsaprivkey-asn1.h | 8 | clean-files += qat_rsaprivkey-asn1.c qat_rsaprivkey-asn1.h |
diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 574e87c7f2b8..9acccad26928 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c | |||
| @@ -781,7 +781,7 @@ static int hash_process_data(struct hash_device_data *device_data, | |||
| 781 | &device_data->state); | 781 | &device_data->state); |
| 782 | memmove(req_ctx->state.buffer, | 782 | memmove(req_ctx->state.buffer, |
| 783 | device_data->state.buffer, | 783 | device_data->state.buffer, |
| 784 | HASH_BLOCK_SIZE / sizeof(u32)); | 784 | HASH_BLOCK_SIZE); |
| 785 | if (ret) { | 785 | if (ret) { |
| 786 | dev_err(device_data->dev, | 786 | dev_err(device_data->dev, |
| 787 | "%s: hash_resume_state() failed!\n", | 787 | "%s: hash_resume_state() failed!\n", |
| @@ -832,7 +832,7 @@ static int hash_process_data(struct hash_device_data *device_data, | |||
| 832 | 832 | ||
| 833 | memmove(device_data->state.buffer, | 833 | memmove(device_data->state.buffer, |
| 834 | req_ctx->state.buffer, | 834 | req_ctx->state.buffer, |
| 835 | HASH_BLOCK_SIZE / sizeof(u32)); | 835 | HASH_BLOCK_SIZE); |
| 836 | if (ret) { | 836 | if (ret) { |
| 837 | dev_err(device_data->dev, "%s: hash_save_state() failed!\n", | 837 | dev_err(device_data->dev, "%s: hash_save_state() failed!\n", |
| 838 | __func__); | 838 | __func__); |
diff --git a/drivers/crypto/vmx/aes_cbc.c b/drivers/crypto/vmx/aes_cbc.c index 495577b6d31b..94ad5c0adbcb 100644 --- a/drivers/crypto/vmx/aes_cbc.c +++ b/drivers/crypto/vmx/aes_cbc.c | |||
| @@ -182,7 +182,7 @@ struct crypto_alg p8_aes_cbc_alg = { | |||
| 182 | .cra_name = "cbc(aes)", | 182 | .cra_name = "cbc(aes)", |
| 183 | .cra_driver_name = "p8_aes_cbc", | 183 | .cra_driver_name = "p8_aes_cbc", |
| 184 | .cra_module = THIS_MODULE, | 184 | .cra_module = THIS_MODULE, |
| 185 | .cra_priority = 1000, | 185 | .cra_priority = 2000, |
| 186 | .cra_type = &crypto_blkcipher_type, | 186 | .cra_type = &crypto_blkcipher_type, |
| 187 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_NEED_FALLBACK, | 187 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_NEED_FALLBACK, |
| 188 | .cra_alignmask = 0, | 188 | .cra_alignmask = 0, |
diff --git a/drivers/crypto/vmx/aes_ctr.c b/drivers/crypto/vmx/aes_ctr.c index 0a3c1b04cf3c..38ed10d761d0 100644 --- a/drivers/crypto/vmx/aes_ctr.c +++ b/drivers/crypto/vmx/aes_ctr.c | |||
| @@ -166,7 +166,7 @@ struct crypto_alg p8_aes_ctr_alg = { | |||
| 166 | .cra_name = "ctr(aes)", | 166 | .cra_name = "ctr(aes)", |
| 167 | .cra_driver_name = "p8_aes_ctr", | 167 | .cra_driver_name = "p8_aes_ctr", |
| 168 | .cra_module = THIS_MODULE, | 168 | .cra_module = THIS_MODULE, |
| 169 | .cra_priority = 1000, | 169 | .cra_priority = 2000, |
| 170 | .cra_type = &crypto_blkcipher_type, | 170 | .cra_type = &crypto_blkcipher_type, |
| 171 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_NEED_FALLBACK, | 171 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_NEED_FALLBACK, |
| 172 | .cra_alignmask = 0, | 172 | .cra_alignmask = 0, |
diff --git a/drivers/crypto/vmx/ppc-xlate.pl b/drivers/crypto/vmx/ppc-xlate.pl index 9f4994cabcc7..b18e67d0e065 100644 --- a/drivers/crypto/vmx/ppc-xlate.pl +++ b/drivers/crypto/vmx/ppc-xlate.pl | |||
| @@ -141,7 +141,7 @@ my $vmr = sub { | |||
| 141 | 141 | ||
| 142 | # Some ABIs specify vrsave, special-purpose register #256, as reserved | 142 | # Some ABIs specify vrsave, special-purpose register #256, as reserved |
| 143 | # for system use. | 143 | # for system use. |
| 144 | my $no_vrsave = ($flavour =~ /aix|linux64le/); | 144 | my $no_vrsave = ($flavour =~ /linux-ppc64le/); |
| 145 | my $mtspr = sub { | 145 | my $mtspr = sub { |
| 146 | my ($f,$idx,$ra) = @_; | 146 | my ($f,$idx,$ra) = @_; |
| 147 | if ($idx == 256 && $no_vrsave) { | 147 | if ($idx == 256 && $no_vrsave) { |
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index 6744d88bdea8..4fb2eb7c800d 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c | |||
| @@ -2378,22 +2378,19 @@ static int sbridge_get_onedevice(struct pci_dev **prev, | |||
| 2378 | * @num_mc: pointer to the memory controllers count, to be incremented in case | 2378 | * @num_mc: pointer to the memory controllers count, to be incremented in case |
| 2379 | * of success. | 2379 | * of success. |
| 2380 | * @table: model specific table | 2380 | * @table: model specific table |
| 2381 | * @allow_dups: allow for multiple devices to exist with the same device id | ||
| 2382 | * (as implemented, this isn't expected to work correctly in the | ||
| 2383 | * multi-socket case). | ||
| 2384 | * @multi_bus: don't assume devices on different buses belong to different | ||
| 2385 | * memory controllers. | ||
| 2386 | * | 2381 | * |
| 2387 | * returns 0 in case of success or error code | 2382 | * returns 0 in case of success or error code |
| 2388 | */ | 2383 | */ |
| 2389 | static int sbridge_get_all_devices_full(u8 *num_mc, | 2384 | static int sbridge_get_all_devices(u8 *num_mc, |
| 2390 | const struct pci_id_table *table, | 2385 | const struct pci_id_table *table) |
| 2391 | int allow_dups, | ||
| 2392 | int multi_bus) | ||
| 2393 | { | 2386 | { |
| 2394 | int i, rc; | 2387 | int i, rc; |
| 2395 | struct pci_dev *pdev = NULL; | 2388 | struct pci_dev *pdev = NULL; |
| 2389 | int allow_dups = 0; | ||
| 2390 | int multi_bus = 0; | ||
| 2396 | 2391 | ||
| 2392 | if (table->type == KNIGHTS_LANDING) | ||
| 2393 | allow_dups = multi_bus = 1; | ||
| 2397 | while (table && table->descr) { | 2394 | while (table && table->descr) { |
| 2398 | for (i = 0; i < table->n_devs; i++) { | 2395 | for (i = 0; i < table->n_devs; i++) { |
| 2399 | if (!allow_dups || i == 0 || | 2396 | if (!allow_dups || i == 0 || |
| @@ -2420,11 +2417,6 @@ static int sbridge_get_all_devices_full(u8 *num_mc, | |||
| 2420 | return 0; | 2417 | return 0; |
| 2421 | } | 2418 | } |
| 2422 | 2419 | ||
| 2423 | #define sbridge_get_all_devices(num_mc, table) \ | ||
| 2424 | sbridge_get_all_devices_full(num_mc, table, 0, 0) | ||
| 2425 | #define sbridge_get_all_devices_knl(num_mc, table) \ | ||
| 2426 | sbridge_get_all_devices_full(num_mc, table, 1, 1) | ||
| 2427 | |||
| 2428 | static int sbridge_mci_bind_devs(struct mem_ctl_info *mci, | 2420 | static int sbridge_mci_bind_devs(struct mem_ctl_info *mci, |
| 2429 | struct sbridge_dev *sbridge_dev) | 2421 | struct sbridge_dev *sbridge_dev) |
| 2430 | { | 2422 | { |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index cebcb405812e..d7860614f87f 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
| @@ -49,7 +49,7 @@ config GPIO_DEVRES | |||
| 49 | 49 | ||
| 50 | config OF_GPIO | 50 | config OF_GPIO |
| 51 | def_bool y | 51 | def_bool y |
| 52 | depends on OF || COMPILE_TEST | 52 | depends on OF |
| 53 | 53 | ||
| 54 | config GPIO_ACPI | 54 | config GPIO_ACPI |
| 55 | def_bool y | 55 | def_bool y |
| @@ -402,9 +402,12 @@ config GPIO_TB10X | |||
| 402 | select OF_GPIO | 402 | select OF_GPIO |
| 403 | 403 | ||
| 404 | config GPIO_TEGRA | 404 | config GPIO_TEGRA |
| 405 | bool | 405 | bool "NVIDIA Tegra GPIO support" |
| 406 | default y | 406 | default ARCH_TEGRA |
| 407 | depends on ARCH_TEGRA || COMPILE_TEST | 407 | depends on ARCH_TEGRA || COMPILE_TEST |
| 408 | depends on OF | ||
| 409 | help | ||
| 410 | Say yes here to support GPIO pins on NVIDIA Tegra SoCs. | ||
| 408 | 411 | ||
| 409 | config GPIO_TS4800 | 412 | config GPIO_TS4800 |
| 410 | tristate "TS-4800 DIO blocks and compatibles" | 413 | tristate "TS-4800 DIO blocks and compatibles" |
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c index e85e7539cf5d..eb43ae4835c1 100644 --- a/drivers/gpio/gpio-sch.c +++ b/drivers/gpio/gpio-sch.c | |||
| @@ -61,9 +61,8 @@ static unsigned sch_gpio_bit(struct sch_gpio *sch, unsigned gpio) | |||
| 61 | return gpio % 8; | 61 | return gpio % 8; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | static int sch_gpio_reg_get(struct gpio_chip *gc, unsigned gpio, unsigned reg) | 64 | static int sch_gpio_reg_get(struct sch_gpio *sch, unsigned gpio, unsigned reg) |
| 65 | { | 65 | { |
| 66 | struct sch_gpio *sch = gpiochip_get_data(gc); | ||
| 67 | unsigned short offset, bit; | 66 | unsigned short offset, bit; |
| 68 | u8 reg_val; | 67 | u8 reg_val; |
| 69 | 68 | ||
| @@ -75,10 +74,9 @@ static int sch_gpio_reg_get(struct gpio_chip *gc, unsigned gpio, unsigned reg) | |||
| 75 | return reg_val; | 74 | return reg_val; |
| 76 | } | 75 | } |
| 77 | 76 | ||
| 78 | static void sch_gpio_reg_set(struct gpio_chip *gc, unsigned gpio, unsigned reg, | 77 | static void sch_gpio_reg_set(struct sch_gpio *sch, unsigned gpio, unsigned reg, |
| 79 | int val) | 78 | int val) |
| 80 | { | 79 | { |
| 81 | struct sch_gpio *sch = gpiochip_get_data(gc); | ||
| 82 | unsigned short offset, bit; | 80 | unsigned short offset, bit; |
| 83 | u8 reg_val; | 81 | u8 reg_val; |
| 84 | 82 | ||
| @@ -98,14 +96,15 @@ static int sch_gpio_direction_in(struct gpio_chip *gc, unsigned gpio_num) | |||
| 98 | struct sch_gpio *sch = gpiochip_get_data(gc); | 96 | struct sch_gpio *sch = gpiochip_get_data(gc); |
| 99 | 97 | ||
| 100 | spin_lock(&sch->lock); | 98 | spin_lock(&sch->lock); |
| 101 | sch_gpio_reg_set(gc, gpio_num, GIO, 1); | 99 | sch_gpio_reg_set(sch, gpio_num, GIO, 1); |
| 102 | spin_unlock(&sch->lock); | 100 | spin_unlock(&sch->lock); |
| 103 | return 0; | 101 | return 0; |
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | static int sch_gpio_get(struct gpio_chip *gc, unsigned gpio_num) | 104 | static int sch_gpio_get(struct gpio_chip *gc, unsigned gpio_num) |
| 107 | { | 105 | { |
| 108 | return sch_gpio_reg_get(gc, gpio_num, GLV); | 106 | struct sch_gpio *sch = gpiochip_get_data(gc); |
| 107 | return sch_gpio_reg_get(sch, gpio_num, GLV); | ||
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | static void sch_gpio_set(struct gpio_chip *gc, unsigned gpio_num, int val) | 110 | static void sch_gpio_set(struct gpio_chip *gc, unsigned gpio_num, int val) |
| @@ -113,7 +112,7 @@ static void sch_gpio_set(struct gpio_chip *gc, unsigned gpio_num, int val) | |||
| 113 | struct sch_gpio *sch = gpiochip_get_data(gc); | 112 | struct sch_gpio *sch = gpiochip_get_data(gc); |
| 114 | 113 | ||
| 115 | spin_lock(&sch->lock); | 114 | spin_lock(&sch->lock); |
| 116 | sch_gpio_reg_set(gc, gpio_num, GLV, val); | 115 | sch_gpio_reg_set(sch, gpio_num, GLV, val); |
| 117 | spin_unlock(&sch->lock); | 116 | spin_unlock(&sch->lock); |
| 118 | } | 117 | } |
| 119 | 118 | ||
| @@ -123,7 +122,7 @@ static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned gpio_num, | |||
| 123 | struct sch_gpio *sch = gpiochip_get_data(gc); | 122 | struct sch_gpio *sch = gpiochip_get_data(gc); |
| 124 | 123 | ||
| 125 | spin_lock(&sch->lock); | 124 | spin_lock(&sch->lock); |
| 126 | sch_gpio_reg_set(gc, gpio_num, GIO, 0); | 125 | sch_gpio_reg_set(sch, gpio_num, GIO, 0); |
| 127 | spin_unlock(&sch->lock); | 126 | spin_unlock(&sch->lock); |
| 128 | 127 | ||
| 129 | /* | 128 | /* |
| @@ -182,13 +181,13 @@ static int sch_gpio_probe(struct platform_device *pdev) | |||
| 182 | * GPIO7 is configured by the CMC as SLPIOVR | 181 | * GPIO7 is configured by the CMC as SLPIOVR |
| 183 | * Enable GPIO[9:8] core powered gpios explicitly | 182 | * Enable GPIO[9:8] core powered gpios explicitly |
| 184 | */ | 183 | */ |
| 185 | sch_gpio_reg_set(&sch->chip, 8, GEN, 1); | 184 | sch_gpio_reg_set(sch, 8, GEN, 1); |
| 186 | sch_gpio_reg_set(&sch->chip, 9, GEN, 1); | 185 | sch_gpio_reg_set(sch, 9, GEN, 1); |
| 187 | /* | 186 | /* |
| 188 | * SUS_GPIO[2:0] enabled by default | 187 | * SUS_GPIO[2:0] enabled by default |
| 189 | * Enable SUS_GPIO3 resume powered gpio explicitly | 188 | * Enable SUS_GPIO3 resume powered gpio explicitly |
| 190 | */ | 189 | */ |
| 191 | sch_gpio_reg_set(&sch->chip, 13, GEN, 1); | 190 | sch_gpio_reg_set(sch, 13, GEN, 1); |
| 192 | break; | 191 | break; |
| 193 | 192 | ||
| 194 | case PCI_DEVICE_ID_INTEL_ITC_LPC: | 193 | case PCI_DEVICE_ID_INTEL_ITC_LPC: |
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index ec891a27952f..661b0e34e067 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
| @@ -98,7 +98,6 @@ struct tegra_gpio_info { | |||
| 98 | const struct tegra_gpio_soc_config *soc; | 98 | const struct tegra_gpio_soc_config *soc; |
| 99 | struct gpio_chip gc; | 99 | struct gpio_chip gc; |
| 100 | struct irq_chip ic; | 100 | struct irq_chip ic; |
| 101 | struct lock_class_key lock_class; | ||
| 102 | u32 bank_count; | 101 | u32 bank_count; |
| 103 | }; | 102 | }; |
| 104 | 103 | ||
| @@ -547,6 +546,12 @@ static const struct dev_pm_ops tegra_gpio_pm_ops = { | |||
| 547 | SET_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume) | 546 | SET_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume) |
| 548 | }; | 547 | }; |
| 549 | 548 | ||
| 549 | /* | ||
| 550 | * This lock class tells lockdep that GPIO irqs are in a different category | ||
| 551 | * than their parents, so it won't report false recursion. | ||
| 552 | */ | ||
| 553 | static struct lock_class_key gpio_lock_class; | ||
| 554 | |||
| 550 | static int tegra_gpio_probe(struct platform_device *pdev) | 555 | static int tegra_gpio_probe(struct platform_device *pdev) |
| 551 | { | 556 | { |
| 552 | const struct tegra_gpio_soc_config *config; | 557 | const struct tegra_gpio_soc_config *config; |
| @@ -660,7 +665,7 @@ static int tegra_gpio_probe(struct platform_device *pdev) | |||
| 660 | 665 | ||
| 661 | bank = &tgi->bank_info[GPIO_BANK(gpio)]; | 666 | bank = &tgi->bank_info[GPIO_BANK(gpio)]; |
| 662 | 667 | ||
| 663 | irq_set_lockdep_class(irq, &tgi->lock_class); | 668 | irq_set_lockdep_class(irq, &gpio_lock_class); |
| 664 | irq_set_chip_data(irq, bank); | 669 | irq_set_chip_data(irq, bank); |
| 665 | irq_set_chip_and_handler(irq, &tgi->ic, handle_simple_irq); | 670 | irq_set_chip_and_handler(irq, &tgi->ic, handle_simple_irq); |
| 666 | } | 671 | } |
diff --git a/drivers/gpio/gpiolib-legacy.c b/drivers/gpio/gpiolib-legacy.c index 3a5c7011ad3b..8b830996fe02 100644 --- a/drivers/gpio/gpiolib-legacy.c +++ b/drivers/gpio/gpiolib-legacy.c | |||
| @@ -28,6 +28,10 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) | |||
| 28 | if (!desc && gpio_is_valid(gpio)) | 28 | if (!desc && gpio_is_valid(gpio)) |
| 29 | return -EPROBE_DEFER; | 29 | return -EPROBE_DEFER; |
| 30 | 30 | ||
| 31 | err = gpiod_request(desc, label); | ||
| 32 | if (err) | ||
| 33 | return err; | ||
| 34 | |||
| 31 | if (flags & GPIOF_OPEN_DRAIN) | 35 | if (flags & GPIOF_OPEN_DRAIN) |
| 32 | set_bit(FLAG_OPEN_DRAIN, &desc->flags); | 36 | set_bit(FLAG_OPEN_DRAIN, &desc->flags); |
| 33 | 37 | ||
| @@ -37,10 +41,6 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) | |||
| 37 | if (flags & GPIOF_ACTIVE_LOW) | 41 | if (flags & GPIOF_ACTIVE_LOW) |
| 38 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); | 42 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); |
| 39 | 43 | ||
| 40 | err = gpiod_request(desc, label); | ||
| 41 | if (err) | ||
| 42 | return err; | ||
| 43 | |||
| 44 | if (flags & GPIOF_DIR_IN) | 44 | if (flags & GPIOF_DIR_IN) |
| 45 | err = gpiod_direction_input(desc); | 45 | err = gpiod_direction_input(desc); |
| 46 | else | 46 | else |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 570771ed19e6..be74bd370f1f 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -1352,14 +1352,6 @@ static int __gpiod_request(struct gpio_desc *desc, const char *label) | |||
| 1352 | spin_lock_irqsave(&gpio_lock, flags); | 1352 | spin_lock_irqsave(&gpio_lock, flags); |
| 1353 | } | 1353 | } |
| 1354 | done: | 1354 | done: |
| 1355 | if (status < 0) { | ||
| 1356 | /* Clear flags that might have been set by the caller before | ||
| 1357 | * requesting the GPIO. | ||
| 1358 | */ | ||
| 1359 | clear_bit(FLAG_ACTIVE_LOW, &desc->flags); | ||
| 1360 | clear_bit(FLAG_OPEN_DRAIN, &desc->flags); | ||
| 1361 | clear_bit(FLAG_OPEN_SOURCE, &desc->flags); | ||
| 1362 | } | ||
| 1363 | spin_unlock_irqrestore(&gpio_lock, flags); | 1355 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 1364 | return status; | 1356 | return status; |
| 1365 | } | 1357 | } |
| @@ -2587,28 +2579,13 @@ struct gpio_desc *__must_check gpiod_get_optional(struct device *dev, | |||
| 2587 | } | 2579 | } |
| 2588 | EXPORT_SYMBOL_GPL(gpiod_get_optional); | 2580 | EXPORT_SYMBOL_GPL(gpiod_get_optional); |
| 2589 | 2581 | ||
| 2590 | /** | ||
| 2591 | * gpiod_parse_flags - helper function to parse GPIO lookup flags | ||
| 2592 | * @desc: gpio to be setup | ||
| 2593 | * @lflags: gpio_lookup_flags - returned from of_find_gpio() or | ||
| 2594 | * of_get_gpio_hog() | ||
| 2595 | * | ||
| 2596 | * Set the GPIO descriptor flags based on the given GPIO lookup flags. | ||
| 2597 | */ | ||
| 2598 | static void gpiod_parse_flags(struct gpio_desc *desc, unsigned long lflags) | ||
| 2599 | { | ||
| 2600 | if (lflags & GPIO_ACTIVE_LOW) | ||
| 2601 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); | ||
| 2602 | if (lflags & GPIO_OPEN_DRAIN) | ||
| 2603 | set_bit(FLAG_OPEN_DRAIN, &desc->flags); | ||
| 2604 | if (lflags & GPIO_OPEN_SOURCE) | ||
| 2605 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | ||
| 2606 | } | ||
| 2607 | 2582 | ||
| 2608 | /** | 2583 | /** |
| 2609 | * gpiod_configure_flags - helper function to configure a given GPIO | 2584 | * gpiod_configure_flags - helper function to configure a given GPIO |
| 2610 | * @desc: gpio whose value will be assigned | 2585 | * @desc: gpio whose value will be assigned |
| 2611 | * @con_id: function within the GPIO consumer | 2586 | * @con_id: function within the GPIO consumer |
| 2587 | * @lflags: gpio_lookup_flags - returned from of_find_gpio() or | ||
| 2588 | * of_get_gpio_hog() | ||
| 2612 | * @dflags: gpiod_flags - optional GPIO initialization flags | 2589 | * @dflags: gpiod_flags - optional GPIO initialization flags |
| 2613 | * | 2590 | * |
| 2614 | * Return 0 on success, -ENOENT if no GPIO has been assigned to the | 2591 | * Return 0 on success, -ENOENT if no GPIO has been assigned to the |
| @@ -2616,10 +2593,17 @@ static void gpiod_parse_flags(struct gpio_desc *desc, unsigned long lflags) | |||
| 2616 | * occurred while trying to acquire the GPIO. | 2593 | * occurred while trying to acquire the GPIO. |
| 2617 | */ | 2594 | */ |
| 2618 | static int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, | 2595 | static int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, |
| 2619 | enum gpiod_flags dflags) | 2596 | unsigned long lflags, enum gpiod_flags dflags) |
| 2620 | { | 2597 | { |
| 2621 | int status; | 2598 | int status; |
| 2622 | 2599 | ||
| 2600 | if (lflags & GPIO_ACTIVE_LOW) | ||
| 2601 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); | ||
| 2602 | if (lflags & GPIO_OPEN_DRAIN) | ||
| 2603 | set_bit(FLAG_OPEN_DRAIN, &desc->flags); | ||
| 2604 | if (lflags & GPIO_OPEN_SOURCE) | ||
| 2605 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | ||
| 2606 | |||
| 2623 | /* No particular flag request, return here... */ | 2607 | /* No particular flag request, return here... */ |
| 2624 | if (!(dflags & GPIOD_FLAGS_BIT_DIR_SET)) { | 2608 | if (!(dflags & GPIOD_FLAGS_BIT_DIR_SET)) { |
| 2625 | pr_debug("no flags found for %s\n", con_id); | 2609 | pr_debug("no flags found for %s\n", con_id); |
| @@ -2686,13 +2670,11 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
| 2686 | return desc; | 2670 | return desc; |
| 2687 | } | 2671 | } |
| 2688 | 2672 | ||
| 2689 | gpiod_parse_flags(desc, lookupflags); | ||
| 2690 | |||
| 2691 | status = gpiod_request(desc, con_id); | 2673 | status = gpiod_request(desc, con_id); |
| 2692 | if (status < 0) | 2674 | if (status < 0) |
| 2693 | return ERR_PTR(status); | 2675 | return ERR_PTR(status); |
| 2694 | 2676 | ||
| 2695 | status = gpiod_configure_flags(desc, con_id, flags); | 2677 | status = gpiod_configure_flags(desc, con_id, lookupflags, flags); |
| 2696 | if (status < 0) { | 2678 | if (status < 0) { |
| 2697 | dev_dbg(dev, "setup of GPIO %s failed\n", con_id); | 2679 | dev_dbg(dev, "setup of GPIO %s failed\n", con_id); |
| 2698 | gpiod_put(desc); | 2680 | gpiod_put(desc); |
| @@ -2748,6 +2730,10 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, | |||
| 2748 | if (IS_ERR(desc)) | 2730 | if (IS_ERR(desc)) |
| 2749 | return desc; | 2731 | return desc; |
| 2750 | 2732 | ||
| 2733 | ret = gpiod_request(desc, NULL); | ||
| 2734 | if (ret) | ||
| 2735 | return ERR_PTR(ret); | ||
| 2736 | |||
| 2751 | if (active_low) | 2737 | if (active_low) |
| 2752 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); | 2738 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); |
| 2753 | 2739 | ||
| @@ -2758,10 +2744,6 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, | |||
| 2758 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | 2744 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); |
| 2759 | } | 2745 | } |
| 2760 | 2746 | ||
| 2761 | ret = gpiod_request(desc, NULL); | ||
| 2762 | if (ret) | ||
| 2763 | return ERR_PTR(ret); | ||
| 2764 | |||
| 2765 | return desc; | 2747 | return desc; |
| 2766 | } | 2748 | } |
| 2767 | EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod); | 2749 | EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod); |
| @@ -2814,8 +2796,6 @@ int gpiod_hog(struct gpio_desc *desc, const char *name, | |||
| 2814 | chip = gpiod_to_chip(desc); | 2796 | chip = gpiod_to_chip(desc); |
| 2815 | hwnum = gpio_chip_hwgpio(desc); | 2797 | hwnum = gpio_chip_hwgpio(desc); |
| 2816 | 2798 | ||
| 2817 | gpiod_parse_flags(desc, lflags); | ||
| 2818 | |||
| 2819 | local_desc = gpiochip_request_own_desc(chip, hwnum, name); | 2799 | local_desc = gpiochip_request_own_desc(chip, hwnum, name); |
| 2820 | if (IS_ERR(local_desc)) { | 2800 | if (IS_ERR(local_desc)) { |
| 2821 | status = PTR_ERR(local_desc); | 2801 | status = PTR_ERR(local_desc); |
| @@ -2824,7 +2804,7 @@ int gpiod_hog(struct gpio_desc *desc, const char *name, | |||
| 2824 | return status; | 2804 | return status; |
| 2825 | } | 2805 | } |
| 2826 | 2806 | ||
| 2827 | status = gpiod_configure_flags(desc, name, dflags); | 2807 | status = gpiod_configure_flags(desc, name, lflags, dflags); |
| 2828 | if (status < 0) { | 2808 | if (status < 0) { |
| 2829 | pr_err("setup of hog GPIO %s (chip %s, offset %d) failed, %d\n", | 2809 | pr_err("setup of hog GPIO %s (chip %s, offset %d) failed, %d\n", |
| 2830 | name, chip->label, hwnum, status); | 2810 | name, chip->label, hwnum, status); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index e19520c4b4b6..d9c88d13f8db 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | |||
| @@ -1106,6 +1106,10 @@ static void amdgpu_uvd_idle_work_handler(struct work_struct *work) | |||
| 1106 | if (fences == 0 && handles == 0) { | 1106 | if (fences == 0 && handles == 0) { |
| 1107 | if (adev->pm.dpm_enabled) { | 1107 | if (adev->pm.dpm_enabled) { |
| 1108 | amdgpu_dpm_enable_uvd(adev, false); | 1108 | amdgpu_dpm_enable_uvd(adev, false); |
| 1109 | /* just work around for uvd clock remain high even | ||
| 1110 | * when uvd dpm disabled on Polaris10 */ | ||
| 1111 | if (adev->asic_type == CHIP_POLARIS10) | ||
| 1112 | amdgpu_asic_set_uvd_clocks(adev, 0, 0); | ||
| 1109 | } else { | 1113 | } else { |
| 1110 | amdgpu_asic_set_uvd_clocks(adev, 0, 0); | 1114 | amdgpu_asic_set_uvd_clocks(adev, 0, 0); |
| 1111 | } | 1115 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c index 13cdb01e9b45..bc56c8a181e6 100644 --- a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c +++ b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c | |||
| @@ -156,3 +156,18 @@ u32 amdgpu_atombios_i2c_func(struct i2c_adapter *adap) | |||
| 156 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 156 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | void amdgpu_atombios_i2c_channel_trans(struct amdgpu_device* adev, u8 slave_addr, u8 line_number, u8 offset, u8 data) | ||
| 160 | { | ||
| 161 | PROCESS_I2C_CHANNEL_TRANSACTION_PS_ALLOCATION args; | ||
| 162 | int index = GetIndexIntoMasterTable(COMMAND, ProcessI2cChannelTransaction); | ||
| 163 | |||
| 164 | args.ucRegIndex = offset; | ||
| 165 | args.lpI2CDataOut = data; | ||
| 166 | args.ucFlag = 1; | ||
| 167 | args.ucI2CSpeed = TARGET_HW_I2C_CLOCK; | ||
| 168 | args.ucTransBytes = 1; | ||
| 169 | args.ucSlaveAddr = slave_addr; | ||
| 170 | args.ucLineNumber = line_number; | ||
| 171 | |||
| 172 | amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 173 | } | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.h b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.h index d6128d9de56e..251aaf41f65d 100644 --- a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.h +++ b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.h | |||
| @@ -27,5 +27,7 @@ | |||
| 27 | int amdgpu_atombios_i2c_xfer(struct i2c_adapter *i2c_adap, | 27 | int amdgpu_atombios_i2c_xfer(struct i2c_adapter *i2c_adap, |
| 28 | struct i2c_msg *msgs, int num); | 28 | struct i2c_msg *msgs, int num); |
| 29 | u32 amdgpu_atombios_i2c_func(struct i2c_adapter *adap); | 29 | u32 amdgpu_atombios_i2c_func(struct i2c_adapter *adap); |
| 30 | void amdgpu_atombios_i2c_channel_trans(struct amdgpu_device* adev, | ||
| 31 | u8 slave_addr, u8 line_number, u8 offset, u8 data); | ||
| 30 | 32 | ||
| 31 | #endif | 33 | #endif |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index c30b6ac25d89..aabaf2f92575 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include "vid.h" | 28 | #include "vid.h" |
| 29 | #include "amdgpu_ucode.h" | 29 | #include "amdgpu_ucode.h" |
| 30 | #include "amdgpu_atombios.h" | 30 | #include "amdgpu_atombios.h" |
| 31 | #include "atombios_i2c.h" | ||
| 31 | #include "clearstate_vi.h" | 32 | #include "clearstate_vi.h" |
| 32 | 33 | ||
| 33 | #include "gmc/gmc_8_2_d.h" | 34 | #include "gmc/gmc_8_2_d.h" |
| @@ -47,6 +48,8 @@ | |||
| 47 | #include "dce/dce_10_0_d.h" | 48 | #include "dce/dce_10_0_d.h" |
| 48 | #include "dce/dce_10_0_sh_mask.h" | 49 | #include "dce/dce_10_0_sh_mask.h" |
| 49 | 50 | ||
| 51 | #include "smu/smu_7_1_3_d.h" | ||
| 52 | |||
| 50 | #define GFX8_NUM_GFX_RINGS 1 | 53 | #define GFX8_NUM_GFX_RINGS 1 |
| 51 | #define GFX8_NUM_COMPUTE_RINGS 8 | 54 | #define GFX8_NUM_COMPUTE_RINGS 8 |
| 52 | 55 | ||
| @@ -282,6 +285,7 @@ static const u32 golden_settings_polaris11_a11[] = | |||
| 282 | mmTCP_ADDR_CONFIG, 0x000003ff, 0x000000f3, | 285 | mmTCP_ADDR_CONFIG, 0x000003ff, 0x000000f3, |
| 283 | mmTCP_CHAN_STEER_HI, 0xffffffff, 0x00000000, | 286 | mmTCP_CHAN_STEER_HI, 0xffffffff, 0x00000000, |
| 284 | mmTCP_CHAN_STEER_LO, 0xffffffff, 0x00003210, | 287 | mmTCP_CHAN_STEER_LO, 0xffffffff, 0x00003210, |
| 288 | mmVGT_RESET_DEBUG, 0x00000004, 0x00000004, | ||
| 285 | }; | 289 | }; |
| 286 | 290 | ||
| 287 | static const u32 polaris11_golden_common_all[] = | 291 | static const u32 polaris11_golden_common_all[] = |
| @@ -312,6 +316,7 @@ static const u32 golden_settings_polaris10_a11[] = | |||
| 312 | mmTCC_CTRL, 0x00100000, 0xf31fff7f, | 316 | mmTCC_CTRL, 0x00100000, 0xf31fff7f, |
| 313 | mmTCP_ADDR_CONFIG, 0x000003ff, 0x000000f7, | 317 | mmTCP_ADDR_CONFIG, 0x000003ff, 0x000000f7, |
| 314 | mmTCP_CHAN_STEER_HI, 0xffffffff, 0x00000000, | 318 | mmTCP_CHAN_STEER_HI, 0xffffffff, 0x00000000, |
| 319 | mmVGT_RESET_DEBUG, 0x00000004, 0x00000004, | ||
| 315 | }; | 320 | }; |
| 316 | 321 | ||
| 317 | static const u32 polaris10_golden_common_all[] = | 322 | static const u32 polaris10_golden_common_all[] = |
| @@ -693,6 +698,11 @@ static void gfx_v8_0_init_golden_registers(struct amdgpu_device *adev) | |||
| 693 | amdgpu_program_register_sequence(adev, | 698 | amdgpu_program_register_sequence(adev, |
| 694 | polaris10_golden_common_all, | 699 | polaris10_golden_common_all, |
| 695 | (const u32)ARRAY_SIZE(polaris10_golden_common_all)); | 700 | (const u32)ARRAY_SIZE(polaris10_golden_common_all)); |
| 701 | WREG32_SMC(ixCG_ACLK_CNTL, 0x0000001C); | ||
| 702 | if (adev->pdev->revision == 0xc7) { | ||
| 703 | amdgpu_atombios_i2c_channel_trans(adev, 0x10, 0x96, 0x1E, 0xDD); | ||
| 704 | amdgpu_atombios_i2c_channel_trans(adev, 0x10, 0x96, 0x1F, 0xD0); | ||
| 705 | } | ||
| 696 | break; | 706 | break; |
| 697 | case CHIP_CARRIZO: | 707 | case CHIP_CARRIZO: |
| 698 | amdgpu_program_register_sequence(adev, | 708 | amdgpu_program_register_sequence(adev, |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c index 9d764c4d253e..a6c9b4201e25 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | |||
| @@ -780,7 +780,7 @@ static int polaris10_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, | |||
| 780 | table->Smio[level] |= | 780 | table->Smio[level] |= |
| 781 | data->mvdd_voltage_table.entries[level].smio_low; | 781 | data->mvdd_voltage_table.entries[level].smio_low; |
| 782 | } | 782 | } |
| 783 | table->SmioMask2 = data->vddci_voltage_table.mask_low; | 783 | table->SmioMask2 = data->mvdd_voltage_table.mask_low; |
| 784 | 784 | ||
| 785 | table->MvddLevelCount = (uint32_t) PP_HOST_TO_SMC_UL(count); | 785 | table->MvddLevelCount = (uint32_t) PP_HOST_TO_SMC_UL(count); |
| 786 | } | 786 | } |
| @@ -1470,22 +1470,19 @@ static int polaris10_populate_smc_acpi_level(struct pp_hwmgr *hwmgr, | |||
| 1470 | 1470 | ||
| 1471 | table->ACPILevel.Flags &= ~PPSMC_SWSTATE_FLAG_DC; | 1471 | table->ACPILevel.Flags &= ~PPSMC_SWSTATE_FLAG_DC; |
| 1472 | 1472 | ||
| 1473 | if (!data->sclk_dpm_key_disabled) { | 1473 | |
| 1474 | /* Get MinVoltage and Frequency from DPM0, | 1474 | /* Get MinVoltage and Frequency from DPM0, |
| 1475 | * already converted to SMC_UL */ | 1475 | * already converted to SMC_UL */ |
| 1476 | sclk_frequency = data->dpm_table.sclk_table.dpm_levels[0].value; | 1476 | sclk_frequency = data->dpm_table.sclk_table.dpm_levels[0].value; |
| 1477 | result = polaris10_get_dependency_volt_by_clk(hwmgr, | 1477 | result = polaris10_get_dependency_volt_by_clk(hwmgr, |
| 1478 | table_info->vdd_dep_on_sclk, | 1478 | table_info->vdd_dep_on_sclk, |
| 1479 | table->ACPILevel.SclkFrequency, | 1479 | sclk_frequency, |
| 1480 | &table->ACPILevel.MinVoltage, &mvdd); | 1480 | &table->ACPILevel.MinVoltage, &mvdd); |
| 1481 | PP_ASSERT_WITH_CODE((0 == result), | 1481 | PP_ASSERT_WITH_CODE((0 == result), |
| 1482 | "Cannot find ACPI VDDC voltage value " | 1482 | "Cannot find ACPI VDDC voltage value " |
| 1483 | "in Clock Dependency Table", ); | 1483 | "in Clock Dependency Table", |
| 1484 | } else { | 1484 | ); |
| 1485 | sclk_frequency = data->vbios_boot_state.sclk_bootup_value; | 1485 | |
| 1486 | table->ACPILevel.MinVoltage = | ||
| 1487 | data->vbios_boot_state.vddc_bootup_value * VOLTAGE_SCALE; | ||
| 1488 | } | ||
| 1489 | 1486 | ||
| 1490 | result = polaris10_calculate_sclk_params(hwmgr, sclk_frequency, &(table->ACPILevel.SclkSetting)); | 1487 | result = polaris10_calculate_sclk_params(hwmgr, sclk_frequency, &(table->ACPILevel.SclkSetting)); |
| 1491 | PP_ASSERT_WITH_CODE(result == 0, "Error retrieving Engine Clock dividers from VBIOS.", return result); | 1488 | PP_ASSERT_WITH_CODE(result == 0, "Error retrieving Engine Clock dividers from VBIOS.", return result); |
| @@ -1510,24 +1507,18 @@ static int polaris10_populate_smc_acpi_level(struct pp_hwmgr *hwmgr, | |||
| 1510 | CONVERT_FROM_HOST_TO_SMC_US(table->ACPILevel.SclkSetting.Fcw1_frac); | 1507 | CONVERT_FROM_HOST_TO_SMC_US(table->ACPILevel.SclkSetting.Fcw1_frac); |
| 1511 | CONVERT_FROM_HOST_TO_SMC_US(table->ACPILevel.SclkSetting.Sclk_ss_slew_rate); | 1508 | CONVERT_FROM_HOST_TO_SMC_US(table->ACPILevel.SclkSetting.Sclk_ss_slew_rate); |
| 1512 | 1509 | ||
| 1513 | if (!data->mclk_dpm_key_disabled) { | 1510 | |
| 1514 | /* Get MinVoltage and Frequency from DPM0, already converted to SMC_UL */ | 1511 | /* Get MinVoltage and Frequency from DPM0, already converted to SMC_UL */ |
| 1515 | table->MemoryACPILevel.MclkFrequency = | 1512 | table->MemoryACPILevel.MclkFrequency = |
| 1516 | data->dpm_table.mclk_table.dpm_levels[0].value; | 1513 | data->dpm_table.mclk_table.dpm_levels[0].value; |
| 1517 | result = polaris10_get_dependency_volt_by_clk(hwmgr, | 1514 | result = polaris10_get_dependency_volt_by_clk(hwmgr, |
| 1518 | table_info->vdd_dep_on_mclk, | 1515 | table_info->vdd_dep_on_mclk, |
| 1519 | table->MemoryACPILevel.MclkFrequency, | 1516 | table->MemoryACPILevel.MclkFrequency, |
| 1520 | &table->MemoryACPILevel.MinVoltage, &mvdd); | 1517 | &table->MemoryACPILevel.MinVoltage, &mvdd); |
| 1521 | PP_ASSERT_WITH_CODE((0 == result), | 1518 | PP_ASSERT_WITH_CODE((0 == result), |
| 1522 | "Cannot find ACPI VDDCI voltage value " | 1519 | "Cannot find ACPI VDDCI voltage value " |
| 1523 | "in Clock Dependency Table", | 1520 | "in Clock Dependency Table", |
| 1524 | ); | 1521 | ); |
| 1525 | } else { | ||
| 1526 | table->MemoryACPILevel.MclkFrequency = | ||
| 1527 | data->vbios_boot_state.mclk_bootup_value; | ||
| 1528 | table->MemoryACPILevel.MinVoltage = | ||
| 1529 | data->vbios_boot_state.vddci_bootup_value * VOLTAGE_SCALE; | ||
| 1530 | } | ||
| 1531 | 1522 | ||
| 1532 | us_mvdd = 0; | 1523 | us_mvdd = 0; |
| 1533 | if ((POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control) || | 1524 | if ((POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control) || |
| @@ -1572,6 +1563,7 @@ static int polaris10_populate_smc_vce_level(struct pp_hwmgr *hwmgr, | |||
| 1572 | struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = | 1563 | struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = |
| 1573 | table_info->mm_dep_table; | 1564 | table_info->mm_dep_table; |
| 1574 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | 1565 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); |
| 1566 | uint32_t vddci; | ||
| 1575 | 1567 | ||
| 1576 | table->VceLevelCount = (uint8_t)(mm_table->count); | 1568 | table->VceLevelCount = (uint8_t)(mm_table->count); |
| 1577 | table->VceBootLevel = 0; | 1569 | table->VceBootLevel = 0; |
| @@ -1581,9 +1573,18 @@ static int polaris10_populate_smc_vce_level(struct pp_hwmgr *hwmgr, | |||
| 1581 | table->VceLevel[count].MinVoltage = 0; | 1573 | table->VceLevel[count].MinVoltage = 0; |
| 1582 | table->VceLevel[count].MinVoltage |= | 1574 | table->VceLevel[count].MinVoltage |= |
| 1583 | (mm_table->entries[count].vddc * VOLTAGE_SCALE) << VDDC_SHIFT; | 1575 | (mm_table->entries[count].vddc * VOLTAGE_SCALE) << VDDC_SHIFT; |
| 1576 | |||
| 1577 | if (POLARIS10_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) | ||
| 1578 | vddci = (uint32_t)phm_find_closest_vddci(&(data->vddci_voltage_table), | ||
| 1579 | mm_table->entries[count].vddc - VDDC_VDDCI_DELTA); | ||
| 1580 | else if (POLARIS10_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) | ||
| 1581 | vddci = mm_table->entries[count].vddc - VDDC_VDDCI_DELTA; | ||
| 1582 | else | ||
| 1583 | vddci = (data->vbios_boot_state.vddci_bootup_value * VOLTAGE_SCALE) << VDDCI_SHIFT; | ||
| 1584 | |||
| 1585 | |||
| 1584 | table->VceLevel[count].MinVoltage |= | 1586 | table->VceLevel[count].MinVoltage |= |
| 1585 | ((mm_table->entries[count].vddc - data->vddc_vddci_delta) * | 1587 | (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; |
| 1586 | VOLTAGE_SCALE) << VDDCI_SHIFT; | ||
| 1587 | table->VceLevel[count].MinVoltage |= 1 << PHASES_SHIFT; | 1588 | table->VceLevel[count].MinVoltage |= 1 << PHASES_SHIFT; |
| 1588 | 1589 | ||
| 1589 | /*retrieve divider value for VBIOS */ | 1590 | /*retrieve divider value for VBIOS */ |
| @@ -1612,6 +1613,7 @@ static int polaris10_populate_smc_samu_level(struct pp_hwmgr *hwmgr, | |||
| 1612 | struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = | 1613 | struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = |
| 1613 | table_info->mm_dep_table; | 1614 | table_info->mm_dep_table; |
| 1614 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | 1615 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); |
| 1616 | uint32_t vddci; | ||
| 1615 | 1617 | ||
| 1616 | table->SamuBootLevel = 0; | 1618 | table->SamuBootLevel = 0; |
| 1617 | table->SamuLevelCount = (uint8_t)(mm_table->count); | 1619 | table->SamuLevelCount = (uint8_t)(mm_table->count); |
| @@ -1622,8 +1624,16 @@ static int polaris10_populate_smc_samu_level(struct pp_hwmgr *hwmgr, | |||
| 1622 | table->SamuLevel[count].Frequency = mm_table->entries[count].samclock; | 1624 | table->SamuLevel[count].Frequency = mm_table->entries[count].samclock; |
| 1623 | table->SamuLevel[count].MinVoltage |= (mm_table->entries[count].vddc * | 1625 | table->SamuLevel[count].MinVoltage |= (mm_table->entries[count].vddc * |
| 1624 | VOLTAGE_SCALE) << VDDC_SHIFT; | 1626 | VOLTAGE_SCALE) << VDDC_SHIFT; |
| 1625 | table->SamuLevel[count].MinVoltage |= ((mm_table->entries[count].vddc - | 1627 | |
| 1626 | data->vddc_vddci_delta) * VOLTAGE_SCALE) << VDDCI_SHIFT; | 1628 | if (POLARIS10_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) |
| 1629 | vddci = (uint32_t)phm_find_closest_vddci(&(data->vddci_voltage_table), | ||
| 1630 | mm_table->entries[count].vddc - VDDC_VDDCI_DELTA); | ||
| 1631 | else if (POLARIS10_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) | ||
| 1632 | vddci = mm_table->entries[count].vddc - VDDC_VDDCI_DELTA; | ||
| 1633 | else | ||
| 1634 | vddci = (data->vbios_boot_state.vddci_bootup_value * VOLTAGE_SCALE) << VDDCI_SHIFT; | ||
| 1635 | |||
| 1636 | table->SamuLevel[count].MinVoltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; | ||
| 1627 | table->SamuLevel[count].MinVoltage |= 1 << PHASES_SHIFT; | 1637 | table->SamuLevel[count].MinVoltage |= 1 << PHASES_SHIFT; |
| 1628 | 1638 | ||
| 1629 | /* retrieve divider value for VBIOS */ | 1639 | /* retrieve divider value for VBIOS */ |
| @@ -1706,6 +1716,7 @@ static int polaris10_populate_smc_uvd_level(struct pp_hwmgr *hwmgr, | |||
| 1706 | struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = | 1716 | struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_table = |
| 1707 | table_info->mm_dep_table; | 1717 | table_info->mm_dep_table; |
| 1708 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | 1718 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); |
| 1719 | uint32_t vddci; | ||
| 1709 | 1720 | ||
| 1710 | table->UvdLevelCount = (uint8_t)(mm_table->count); | 1721 | table->UvdLevelCount = (uint8_t)(mm_table->count); |
| 1711 | table->UvdBootLevel = 0; | 1722 | table->UvdBootLevel = 0; |
| @@ -1716,8 +1727,16 @@ static int polaris10_populate_smc_uvd_level(struct pp_hwmgr *hwmgr, | |||
| 1716 | table->UvdLevel[count].DclkFrequency = mm_table->entries[count].dclk; | 1727 | table->UvdLevel[count].DclkFrequency = mm_table->entries[count].dclk; |
| 1717 | table->UvdLevel[count].MinVoltage |= (mm_table->entries[count].vddc * | 1728 | table->UvdLevel[count].MinVoltage |= (mm_table->entries[count].vddc * |
| 1718 | VOLTAGE_SCALE) << VDDC_SHIFT; | 1729 | VOLTAGE_SCALE) << VDDC_SHIFT; |
| 1719 | table->UvdLevel[count].MinVoltage |= ((mm_table->entries[count].vddc - | 1730 | |
| 1720 | data->vddc_vddci_delta) * VOLTAGE_SCALE) << VDDCI_SHIFT; | 1731 | if (POLARIS10_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) |
| 1732 | vddci = (uint32_t)phm_find_closest_vddci(&(data->vddci_voltage_table), | ||
| 1733 | mm_table->entries[count].vddc - VDDC_VDDCI_DELTA); | ||
| 1734 | else if (POLARIS10_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) | ||
| 1735 | vddci = mm_table->entries[count].vddc - VDDC_VDDCI_DELTA; | ||
| 1736 | else | ||
| 1737 | vddci = (data->vbios_boot_state.vddci_bootup_value * VOLTAGE_SCALE) << VDDCI_SHIFT; | ||
| 1738 | |||
| 1739 | table->UvdLevel[count].MinVoltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; | ||
| 1721 | table->UvdLevel[count].MinVoltage |= 1 << PHASES_SHIFT; | 1740 | table->UvdLevel[count].MinVoltage |= 1 << PHASES_SHIFT; |
| 1722 | 1741 | ||
| 1723 | /* retrieve divider value for VBIOS */ | 1742 | /* retrieve divider value for VBIOS */ |
| @@ -1738,8 +1757,8 @@ static int polaris10_populate_smc_uvd_level(struct pp_hwmgr *hwmgr, | |||
| 1738 | CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].VclkFrequency); | 1757 | CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].VclkFrequency); |
| 1739 | CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].DclkFrequency); | 1758 | CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].DclkFrequency); |
| 1740 | CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].MinVoltage); | 1759 | CONVERT_FROM_HOST_TO_SMC_UL(table->UvdLevel[count].MinVoltage); |
| 1741 | |||
| 1742 | } | 1760 | } |
| 1761 | |||
| 1743 | return result; | 1762 | return result; |
| 1744 | } | 1763 | } |
| 1745 | 1764 | ||
| @@ -1839,20 +1858,26 @@ static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) | |||
| 1839 | for (i = 0; i < sclk_table->count; i++) { | 1858 | for (i = 0; i < sclk_table->count; i++) { |
| 1840 | data->smc_state_table.Sclk_CKS_masterEn0_7 |= | 1859 | data->smc_state_table.Sclk_CKS_masterEn0_7 |= |
| 1841 | sclk_table->entries[i].cks_enable << i; | 1860 | sclk_table->entries[i].cks_enable << i; |
| 1842 | 1861 | if (hwmgr->chip_id == CHIP_POLARIS10) { | |
| 1843 | volt_without_cks = (uint32_t)(((ro - 40) * 1000 - 2753594 - sclk_table->entries[i].clk/100 * 136418 /1000) / \ | 1862 | volt_without_cks = (uint32_t)((2753594000U + (sclk_table->entries[i].clk/100) * 136418 -(ro - 70) * 1000000) / \ |
| 1844 | (sclk_table->entries[i].clk/100 * 1132925 /10000 - 242418)/100); | 1863 | (2424180 - (sclk_table->entries[i].clk/100) * 1132925/1000)); |
| 1845 | 1864 | volt_with_cks = (uint32_t)((2797202000U + sclk_table->entries[i].clk/100 * 3232 - (ro - 65) * 1000000) / \ | |
| 1846 | volt_with_cks = (uint32_t)((ro * 1000 -2396351 - sclk_table->entries[i].clk/100 * 329021/1000) / \ | 1865 | (2522480 - sclk_table->entries[i].clk/100 * 115764/100)); |
| 1847 | (sclk_table->entries[i].clk/10000 * 649434 /1000 - 18005)/10); | 1866 | } else { |
| 1867 | volt_without_cks = (uint32_t)((2416794800U + (sclk_table->entries[i].clk/100) * 1476925/10 -(ro - 50) * 1000000) / \ | ||
| 1868 | (2625416 - (sclk_table->entries[i].clk/100) * (12586807/10000))); | ||
| 1869 | volt_with_cks = (uint32_t)((2999656000U - sclk_table->entries[i].clk/100 * 392803 - (ro - 44) * 1000000) / \ | ||
| 1870 | (3422454 - sclk_table->entries[i].clk/100 * (18886376/10000))); | ||
| 1871 | } | ||
| 1848 | 1872 | ||
| 1849 | if (volt_without_cks >= volt_with_cks) | 1873 | if (volt_without_cks >= volt_with_cks) |
| 1850 | volt_offset = (uint8_t)(((volt_without_cks - volt_with_cks + | 1874 | volt_offset = (uint8_t)(((volt_without_cks - volt_with_cks + |
| 1851 | sclk_table->entries[i].cks_voffset) * 100 / 625) + 1); | 1875 | sclk_table->entries[i].cks_voffset) * 100 + 624) / 625); |
| 1852 | 1876 | ||
| 1853 | data->smc_state_table.Sclk_voltageOffset[i] = volt_offset; | 1877 | data->smc_state_table.Sclk_voltageOffset[i] = volt_offset; |
| 1854 | } | 1878 | } |
| 1855 | 1879 | ||
| 1880 | data->smc_state_table.LdoRefSel = (table_info->cac_dtp_table->ucCKS_LDO_REFSEL != 0) ? table_info->cac_dtp_table->ucCKS_LDO_REFSEL : 6; | ||
| 1856 | /* Populate CKS Lookup Table */ | 1881 | /* Populate CKS Lookup Table */ |
| 1857 | if (stretch_amount == 1 || stretch_amount == 2 || stretch_amount == 5) | 1882 | if (stretch_amount == 1 || stretch_amount == 2 || stretch_amount == 5) |
| 1858 | stretch_amount2 = 0; | 1883 | stretch_amount2 = 0; |
| @@ -2629,6 +2654,8 @@ int polaris10_enable_dpm_tasks(struct pp_hwmgr *hwmgr) | |||
| 2629 | PP_ASSERT_WITH_CODE((0 == tmp_result), | 2654 | PP_ASSERT_WITH_CODE((0 == tmp_result), |
| 2630 | "Failed to enable VR hot GPIO interrupt!", result = tmp_result); | 2655 | "Failed to enable VR hot GPIO interrupt!", result = tmp_result); |
| 2631 | 2656 | ||
| 2657 | smum_send_msg_to_smc(hwmgr->smumgr, (PPSMC_Msg)PPSMC_HasDisplay); | ||
| 2658 | |||
| 2632 | tmp_result = polaris10_enable_sclk_control(hwmgr); | 2659 | tmp_result = polaris10_enable_sclk_control(hwmgr); |
| 2633 | PP_ASSERT_WITH_CODE((0 == tmp_result), | 2660 | PP_ASSERT_WITH_CODE((0 == tmp_result), |
| 2634 | "Failed to enable SCLK control!", result = tmp_result); | 2661 | "Failed to enable SCLK control!", result = tmp_result); |
| @@ -2847,7 +2874,7 @@ static int polaris10_get_evv_voltages(struct pp_hwmgr *hwmgr) | |||
| 2847 | { | 2874 | { |
| 2848 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | 2875 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); |
| 2849 | uint16_t vv_id; | 2876 | uint16_t vv_id; |
| 2850 | uint16_t vddc = 0; | 2877 | uint32_t vddc = 0; |
| 2851 | uint16_t i, j; | 2878 | uint16_t i, j; |
| 2852 | uint32_t sclk = 0; | 2879 | uint32_t sclk = 0; |
| 2853 | struct phm_ppt_v1_information *table_info = | 2880 | struct phm_ppt_v1_information *table_info = |
| @@ -2878,8 +2905,9 @@ static int polaris10_get_evv_voltages(struct pp_hwmgr *hwmgr) | |||
| 2878 | continue; | 2905 | continue; |
| 2879 | } | 2906 | } |
| 2880 | 2907 | ||
| 2881 | /* need to make sure vddc is less than 2v or else, it could burn the ASIC. */ | 2908 | /* need to make sure vddc is less than 2v or else, it could burn the ASIC. |
| 2882 | PP_ASSERT_WITH_CODE((vddc < 2000 && vddc != 0), | 2909 | * real voltage level in unit of 0.01mv */ |
| 2910 | PP_ASSERT_WITH_CODE((vddc < 200000 && vddc != 0), | ||
| 2883 | "Invalid VDDC value", result = -EINVAL;); | 2911 | "Invalid VDDC value", result = -EINVAL;); |
| 2884 | 2912 | ||
| 2885 | /* the voltage should not be zero nor equal to leakage ID */ | 2913 | /* the voltage should not be zero nor equal to leakage ID */ |
| @@ -3105,6 +3133,31 @@ static int polaris10_set_private_data_based_on_pptable(struct pp_hwmgr *hwmgr) | |||
| 3105 | return 0; | 3133 | return 0; |
| 3106 | } | 3134 | } |
| 3107 | 3135 | ||
| 3136 | int polaris10_patch_voltage_workaround(struct pp_hwmgr *hwmgr) | ||
| 3137 | { | ||
| 3138 | struct phm_ppt_v1_information *table_info = | ||
| 3139 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | ||
| 3140 | struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table = | ||
| 3141 | table_info->vdd_dep_on_mclk; | ||
| 3142 | struct phm_ppt_v1_voltage_lookup_table *lookup_table = | ||
| 3143 | table_info->vddc_lookup_table; | ||
| 3144 | uint32_t i; | ||
| 3145 | |||
| 3146 | if (hwmgr->chip_id == CHIP_POLARIS10 && hwmgr->hw_revision == 0xC7) { | ||
| 3147 | if (lookup_table->entries[dep_mclk_table->entries[dep_mclk_table->count-1].vddInd].us_vdd >= 1000) | ||
| 3148 | return 0; | ||
| 3149 | |||
| 3150 | for (i = 0; i < lookup_table->count; i++) { | ||
| 3151 | if (lookup_table->entries[i].us_vdd < 0xff01 && lookup_table->entries[i].us_vdd >= 1000) { | ||
| 3152 | dep_mclk_table->entries[dep_mclk_table->count-1].vddInd = (uint8_t) i; | ||
| 3153 | return 0; | ||
| 3154 | } | ||
| 3155 | } | ||
| 3156 | } | ||
| 3157 | return 0; | ||
| 3158 | } | ||
| 3159 | |||
| 3160 | |||
| 3108 | int polaris10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | 3161 | int polaris10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) |
| 3109 | { | 3162 | { |
| 3110 | struct polaris10_hwmgr *data; | 3163 | struct polaris10_hwmgr *data; |
| @@ -3188,6 +3241,7 @@ int polaris10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
| 3188 | 3241 | ||
| 3189 | polaris10_set_features_platform_caps(hwmgr); | 3242 | polaris10_set_features_platform_caps(hwmgr); |
| 3190 | 3243 | ||
| 3244 | polaris10_patch_voltage_workaround(hwmgr); | ||
| 3191 | polaris10_init_dpm_defaults(hwmgr); | 3245 | polaris10_init_dpm_defaults(hwmgr); |
| 3192 | 3246 | ||
| 3193 | /* Get leakage voltage based on leakage ID. */ | 3247 | /* Get leakage voltage based on leakage ID. */ |
| @@ -4557,6 +4611,15 @@ static int polaris10_notify_link_speed_change_after_state_change( | |||
| 4557 | return 0; | 4611 | return 0; |
| 4558 | } | 4612 | } |
| 4559 | 4613 | ||
| 4614 | static int polaris10_notify_smc_display(struct pp_hwmgr *hwmgr) | ||
| 4615 | { | ||
| 4616 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | ||
| 4617 | |||
| 4618 | smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, | ||
| 4619 | (PPSMC_Msg)PPSMC_MSG_SetVBITimeout, data->frame_time_x2); | ||
| 4620 | return (smum_send_msg_to_smc(hwmgr->smumgr, (PPSMC_Msg)PPSMC_HasDisplay) == 0) ? 0 : -EINVAL; | ||
| 4621 | } | ||
| 4622 | |||
| 4560 | static int polaris10_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input) | 4623 | static int polaris10_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input) |
| 4561 | { | 4624 | { |
| 4562 | int tmp_result, result = 0; | 4625 | int tmp_result, result = 0; |
| @@ -4605,6 +4668,11 @@ static int polaris10_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *i | |||
| 4605 | "Failed to program memory timing parameters!", | 4668 | "Failed to program memory timing parameters!", |
| 4606 | result = tmp_result); | 4669 | result = tmp_result); |
| 4607 | 4670 | ||
| 4671 | tmp_result = polaris10_notify_smc_display(hwmgr); | ||
| 4672 | PP_ASSERT_WITH_CODE((0 == tmp_result), | ||
| 4673 | "Failed to notify smc display settings!", | ||
| 4674 | result = tmp_result); | ||
| 4675 | |||
| 4608 | tmp_result = polaris10_unfreeze_sclk_mclk_dpm(hwmgr); | 4676 | tmp_result = polaris10_unfreeze_sclk_mclk_dpm(hwmgr); |
| 4609 | PP_ASSERT_WITH_CODE((0 == tmp_result), | 4677 | PP_ASSERT_WITH_CODE((0 == tmp_result), |
| 4610 | "Failed to unfreeze SCLK MCLK DPM!", | 4678 | "Failed to unfreeze SCLK MCLK DPM!", |
| @@ -4639,6 +4707,7 @@ static int polaris10_set_max_fan_pwm_output(struct pp_hwmgr *hwmgr, uint16_t us_ | |||
| 4639 | PPSMC_MSG_SetFanPwmMax, us_max_fan_pwm); | 4707 | PPSMC_MSG_SetFanPwmMax, us_max_fan_pwm); |
| 4640 | } | 4708 | } |
| 4641 | 4709 | ||
| 4710 | |||
| 4642 | int polaris10_notify_smc_display_change(struct pp_hwmgr *hwmgr, bool has_display) | 4711 | int polaris10_notify_smc_display_change(struct pp_hwmgr *hwmgr, bool has_display) |
| 4643 | { | 4712 | { |
| 4644 | PPSMC_Msg msg = has_display ? (PPSMC_Msg)PPSMC_HasDisplay : (PPSMC_Msg)PPSMC_NoDisplay; | 4713 | PPSMC_Msg msg = has_display ? (PPSMC_Msg)PPSMC_HasDisplay : (PPSMC_Msg)PPSMC_NoDisplay; |
| @@ -4658,8 +4727,6 @@ int polaris10_notify_smc_display_config_after_ps_adjustment(struct pp_hwmgr *hwm | |||
| 4658 | 4727 | ||
| 4659 | if (num_active_displays > 1) /* to do && (pHwMgr->pPECI->displayConfiguration.bMultiMonitorInSync != TRUE)) */ | 4728 | if (num_active_displays > 1) /* to do && (pHwMgr->pPECI->displayConfiguration.bMultiMonitorInSync != TRUE)) */ |
| 4660 | polaris10_notify_smc_display_change(hwmgr, false); | 4729 | polaris10_notify_smc_display_change(hwmgr, false); |
| 4661 | else | ||
| 4662 | polaris10_notify_smc_display_change(hwmgr, true); | ||
| 4663 | 4730 | ||
| 4664 | return 0; | 4731 | return 0; |
| 4665 | } | 4732 | } |
| @@ -4700,6 +4767,8 @@ int polaris10_program_display_gap(struct pp_hwmgr *hwmgr) | |||
| 4700 | frame_time_in_us = 1000000 / refresh_rate; | 4767 | frame_time_in_us = 1000000 / refresh_rate; |
| 4701 | 4768 | ||
| 4702 | pre_vbi_time_in_us = frame_time_in_us - 200 - mode_info.vblank_time_us; | 4769 | pre_vbi_time_in_us = frame_time_in_us - 200 - mode_info.vblank_time_us; |
| 4770 | data->frame_time_x2 = frame_time_in_us * 2 / 100; | ||
| 4771 | |||
| 4703 | display_gap2 = pre_vbi_time_in_us * (ref_clock / 100); | 4772 | display_gap2 = pre_vbi_time_in_us * (ref_clock / 100); |
| 4704 | 4773 | ||
| 4705 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL2, display_gap2); | 4774 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL2, display_gap2); |
| @@ -4708,8 +4777,6 @@ int polaris10_program_display_gap(struct pp_hwmgr *hwmgr) | |||
| 4708 | 4777 | ||
| 4709 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, data->soft_regs_start + offsetof(SMU74_SoftRegisters, VBlankTimeout), (frame_time_in_us - pre_vbi_time_in_us)); | 4778 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, data->soft_regs_start + offsetof(SMU74_SoftRegisters, VBlankTimeout), (frame_time_in_us - pre_vbi_time_in_us)); |
| 4710 | 4779 | ||
| 4711 | polaris10_notify_smc_display_change(hwmgr, num_active_displays != 0); | ||
| 4712 | |||
| 4713 | return 0; | 4780 | return 0; |
| 4714 | } | 4781 | } |
| 4715 | 4782 | ||
| @@ -4821,7 +4888,7 @@ int polaris10_upload_mc_firmware(struct pp_hwmgr *hwmgr) | |||
| 4821 | return 0; | 4888 | return 0; |
| 4822 | } | 4889 | } |
| 4823 | 4890 | ||
| 4824 | data->need_long_memory_training = true; | 4891 | data->need_long_memory_training = false; |
| 4825 | 4892 | ||
| 4826 | /* | 4893 | /* |
| 4827 | * PPMCME_FirmwareDescriptorEntry *pfd = NULL; | 4894 | * PPMCME_FirmwareDescriptorEntry *pfd = NULL; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h index fd38b0d7a3c2..dbc6d9bfd5af 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h | |||
| @@ -311,6 +311,7 @@ struct polaris10_hwmgr { | |||
| 311 | bool apply_optimized_settings; | 311 | bool apply_optimized_settings; |
| 312 | uint32_t avfs_vdroop_override_setting; | 312 | uint32_t avfs_vdroop_override_setting; |
| 313 | bool apply_avfs_cks_off_voltage; | 313 | bool apply_avfs_cks_off_voltage; |
| 314 | uint32_t frame_time_x2; | ||
| 314 | }; | 315 | }; |
| 315 | 316 | ||
| 316 | /* To convert to Q8.8 format for firmware */ | 317 | /* To convert to Q8.8 format for firmware */ |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c index 5d70e2c47faf..a64db7ba4e0b 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c | |||
| @@ -1256,7 +1256,7 @@ int atomctrl_set_ac_timing_ai(struct pp_hwmgr *hwmgr, uint32_t memory_clock, | |||
| 1256 | } | 1256 | } |
| 1257 | 1257 | ||
| 1258 | int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_type, | 1258 | int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_type, |
| 1259 | uint32_t sclk, uint16_t virtual_voltage_Id, uint16_t *voltage) | 1259 | uint32_t sclk, uint16_t virtual_voltage_Id, uint32_t *voltage) |
| 1260 | { | 1260 | { |
| 1261 | 1261 | ||
| 1262 | int result; | 1262 | int result; |
| @@ -1274,7 +1274,7 @@ int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_ | |||
| 1274 | if (0 != result) | 1274 | if (0 != result) |
| 1275 | return result; | 1275 | return result; |
| 1276 | 1276 | ||
| 1277 | *voltage = get_voltage_info_param_space.usVoltageLevel; | 1277 | *voltage = ((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_3 *)(&get_voltage_info_param_space))->ulVoltageLevel; |
| 1278 | 1278 | ||
| 1279 | return result; | 1279 | return result; |
| 1280 | } | 1280 | } |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h index 248c5db5f380..1e35a9625baf 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h | |||
| @@ -305,7 +305,7 @@ extern int atomctrl_get_engine_pll_dividers_ai(struct pp_hwmgr *hwmgr, uint32_t | |||
| 305 | extern int atomctrl_set_ac_timing_ai(struct pp_hwmgr *hwmgr, uint32_t memory_clock, | 305 | extern int atomctrl_set_ac_timing_ai(struct pp_hwmgr *hwmgr, uint32_t memory_clock, |
| 306 | uint8_t level); | 306 | uint8_t level); |
| 307 | extern int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_type, | 307 | extern int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_type, |
| 308 | uint32_t sclk, uint16_t virtual_voltage_Id, uint16_t *voltage); | 308 | uint32_t sclk, uint16_t virtual_voltage_Id, uint32_t *voltage); |
| 309 | extern int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl_sclk_range_table *table); | 309 | extern int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl_sclk_range_table *table); |
| 310 | 310 | ||
| 311 | extern int atomctrl_get_avfs_information(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl__avfs_parameters *param); | 311 | extern int atomctrl_get_avfs_information(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl__avfs_parameters *param); |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index 6c4553cf8023..072b3b682637 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | |||
| @@ -1302,7 +1302,7 @@ static int tonga_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, | |||
| 1302 | table->Smio[count] |= | 1302 | table->Smio[count] |= |
| 1303 | data->mvdd_voltage_table.entries[count].smio_low; | 1303 | data->mvdd_voltage_table.entries[count].smio_low; |
| 1304 | } | 1304 | } |
| 1305 | table->SmioMask2 = data->vddci_voltage_table.mask_low; | 1305 | table->SmioMask2 = data->mvdd_voltage_table.mask_low; |
| 1306 | 1306 | ||
| 1307 | CONVERT_FROM_HOST_TO_SMC_UL(table->MvddLevelCount); | 1307 | CONVERT_FROM_HOST_TO_SMC_UL(table->MvddLevelCount); |
| 1308 | } | 1308 | } |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c index 94d6b472e1fe..4662d3d0b7b1 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | |||
| @@ -302,7 +302,7 @@ static int init_dpm_2_parameters( | |||
| 302 | (((unsigned long)powerplay_table) + le16_to_cpu(powerplay_table->usPPMTableOffset)); | 302 | (((unsigned long)powerplay_table) + le16_to_cpu(powerplay_table->usPPMTableOffset)); |
| 303 | 303 | ||
| 304 | if (0 != powerplay_table->usPPMTableOffset) { | 304 | if (0 != powerplay_table->usPPMTableOffset) { |
| 305 | if (1 == get_platform_power_management_table(hwmgr, atom_ppm_table)) { | 305 | if (get_platform_power_management_table(hwmgr, atom_ppm_table) == 0) { |
| 306 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 306 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
| 307 | PHM_PlatformCaps_EnablePlatformPowerManagement); | 307 | PHM_PlatformCaps_EnablePlatformPowerManagement); |
| 308 | } | 308 | } |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h index 0bbc42a224e5..bf0d2accf7bf 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | |||
| @@ -415,6 +415,8 @@ struct phm_cac_tdp_table { | |||
| 415 | uint8_t ucVr_I2C_Line; | 415 | uint8_t ucVr_I2C_Line; |
| 416 | uint8_t ucPlx_I2C_address; | 416 | uint8_t ucPlx_I2C_address; |
| 417 | uint8_t ucPlx_I2C_Line; | 417 | uint8_t ucPlx_I2C_Line; |
| 418 | uint32_t usBoostPowerLimit; | ||
| 419 | uint8_t ucCKS_LDO_REFSEL; | ||
| 418 | }; | 420 | }; |
| 419 | 421 | ||
| 420 | struct phm_ppm_table { | 422 | struct phm_ppm_table { |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h b/drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h index d41d37ab5b7c..b8f4b73c322e 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h +++ b/drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h | |||
| @@ -392,6 +392,8 @@ typedef uint16_t PPSMC_Result; | |||
| 392 | #define PPSMC_MSG_SetGpuPllDfsForSclk ((uint16_t) 0x300) | 392 | #define PPSMC_MSG_SetGpuPllDfsForSclk ((uint16_t) 0x300) |
| 393 | #define PPSMC_MSG_Didt_Block_Function ((uint16_t) 0x301) | 393 | #define PPSMC_MSG_Didt_Block_Function ((uint16_t) 0x301) |
| 394 | 394 | ||
| 395 | #define PPSMC_MSG_SetVBITimeout ((uint16_t) 0x306) | ||
| 396 | |||
| 395 | #define PPSMC_MSG_SecureSRBMWrite ((uint16_t) 0x600) | 397 | #define PPSMC_MSG_SecureSRBMWrite ((uint16_t) 0x600) |
| 396 | #define PPSMC_MSG_SecureSRBMRead ((uint16_t) 0x601) | 398 | #define PPSMC_MSG_SecureSRBMRead ((uint16_t) 0x601) |
| 397 | #define PPSMC_MSG_SetAddress ((uint16_t) 0x800) | 399 | #define PPSMC_MSG_SetAddress ((uint16_t) 0x800) |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h b/drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h index b85ff5400e57..899d6d8108c2 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h +++ b/drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h | |||
| @@ -270,7 +270,8 @@ struct SMU74_Discrete_DpmTable { | |||
| 270 | uint8_t BootPhases; | 270 | uint8_t BootPhases; |
| 271 | 271 | ||
| 272 | uint8_t VRHotLevel; | 272 | uint8_t VRHotLevel; |
| 273 | uint8_t Reserved1[3]; | 273 | uint8_t LdoRefSel; |
| 274 | uint8_t Reserved1[2]; | ||
| 274 | uint16_t FanStartTemperature; | 275 | uint16_t FanStartTemperature; |
| 275 | uint16_t FanStopTemperature; | 276 | uint16_t FanStopTemperature; |
| 276 | uint16_t MaxVoltage; | 277 | uint16_t MaxVoltage; |
diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c index 067632ad2f29..6f10b421487b 100644 --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c | |||
| @@ -40,7 +40,7 @@ static bool mutex_is_locked_by(struct mutex *mutex, struct task_struct *task) | |||
| 40 | if (!mutex_is_locked(mutex)) | 40 | if (!mutex_is_locked(mutex)) |
| 41 | return false; | 41 | return false; |
| 42 | 42 | ||
| 43 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES) | 43 | #if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER) |
| 44 | return mutex->owner == task; | 44 | return mutex->owner == task; |
| 45 | #else | 45 | #else |
| 46 | /* Since UP may be pre-empted, we cannot assume that we own the lock */ | 46 | /* Since UP may be pre-empted, we cannot assume that we own the lock */ |
diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c index c3b33a10c15c..3edb9580928e 100644 --- a/drivers/gpu/drm/i915/intel_csr.c +++ b/drivers/gpu/drm/i915/intel_csr.c | |||
| @@ -41,15 +41,15 @@ | |||
| 41 | * be moved to FW_FAILED. | 41 | * be moved to FW_FAILED. |
| 42 | */ | 42 | */ |
| 43 | 43 | ||
| 44 | #define I915_CSR_KBL "i915/kbl_dmc_ver1_01.bin" | 44 | #define I915_CSR_KBL "i915/kbl_dmc_ver1.bin" |
| 45 | MODULE_FIRMWARE(I915_CSR_KBL); | 45 | MODULE_FIRMWARE(I915_CSR_KBL); |
| 46 | #define KBL_CSR_VERSION_REQUIRED CSR_VERSION(1, 1) | 46 | #define KBL_CSR_VERSION_REQUIRED CSR_VERSION(1, 1) |
| 47 | 47 | ||
| 48 | #define I915_CSR_SKL "i915/skl_dmc_ver1_26.bin" | 48 | #define I915_CSR_SKL "i915/skl_dmc_ver1.bin" |
| 49 | MODULE_FIRMWARE(I915_CSR_SKL); | 49 | MODULE_FIRMWARE(I915_CSR_SKL); |
| 50 | #define SKL_CSR_VERSION_REQUIRED CSR_VERSION(1, 26) | 50 | #define SKL_CSR_VERSION_REQUIRED CSR_VERSION(1, 23) |
| 51 | 51 | ||
| 52 | #define I915_CSR_BXT "i915/bxt_dmc_ver1_07.bin" | 52 | #define I915_CSR_BXT "i915/bxt_dmc_ver1.bin" |
| 53 | MODULE_FIRMWARE(I915_CSR_BXT); | 53 | MODULE_FIRMWARE(I915_CSR_BXT); |
| 54 | #define BXT_CSR_VERSION_REQUIRED CSR_VERSION(1, 7) | 54 | #define BXT_CSR_VERSION_REQUIRED CSR_VERSION(1, 7) |
| 55 | 55 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index be3b2cab2640..70555c526f6c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -12016,6 +12016,12 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc, | |||
| 12016 | ret = intel_color_check(crtc, crtc_state); | 12016 | ret = intel_color_check(crtc, crtc_state); |
| 12017 | if (ret) | 12017 | if (ret) |
| 12018 | return ret; | 12018 | return ret; |
| 12019 | |||
| 12020 | /* | ||
| 12021 | * Changing color management on Intel hardware is | ||
| 12022 | * handled as part of planes update. | ||
| 12023 | */ | ||
| 12024 | crtc_state->planes_changed = true; | ||
| 12019 | } | 12025 | } |
| 12020 | 12026 | ||
| 12021 | ret = 0; | 12027 | ret = 0; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 0c5ba3410a1e..21b04c3eda41 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -4336,7 +4336,7 @@ intel_dp_detect(struct drm_connector *connector, bool force) | |||
| 4336 | 4336 | ||
| 4337 | intel_dp->detect_done = false; | 4337 | intel_dp->detect_done = false; |
| 4338 | 4338 | ||
| 4339 | if (intel_connector->detect_edid) | 4339 | if (is_edp(intel_dp) || intel_connector->detect_edid) |
| 4340 | return connector_status_connected; | 4340 | return connector_status_connected; |
| 4341 | else | 4341 | else |
| 4342 | return connector_status_disconnected; | 4342 | return connector_status_disconnected; |
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 70c699043d0e..414ddda43922 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c | |||
| @@ -1097,6 +1097,7 @@ static inline int gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *engine, | |||
| 1097 | uint32_t *const batch, | 1097 | uint32_t *const batch, |
| 1098 | uint32_t index) | 1098 | uint32_t index) |
| 1099 | { | 1099 | { |
| 1100 | struct drm_i915_private *dev_priv = engine->i915; | ||
| 1100 | uint32_t l3sqc4_flush = (0x40400000 | GEN8_LQSC_FLUSH_COHERENT_LINES); | 1101 | uint32_t l3sqc4_flush = (0x40400000 | GEN8_LQSC_FLUSH_COHERENT_LINES); |
| 1101 | 1102 | ||
| 1102 | /* | 1103 | /* |
| @@ -1105,8 +1106,8 @@ static inline int gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *engine, | |||
| 1105 | * this batch updates GEN8_L3SQCREG4 with default value we need to | 1106 | * this batch updates GEN8_L3SQCREG4 with default value we need to |
| 1106 | * set this bit here to retain the WA during flush. | 1107 | * set this bit here to retain the WA during flush. |
| 1107 | */ | 1108 | */ |
| 1108 | if (IS_SKL_REVID(engine->i915, 0, SKL_REVID_E0) || | 1109 | if (IS_SKL_REVID(dev_priv, 0, SKL_REVID_E0) || |
| 1109 | IS_KBL_REVID(engine->i915, 0, KBL_REVID_E0)) | 1110 | IS_KBL_REVID(dev_priv, 0, KBL_REVID_E0)) |
| 1110 | l3sqc4_flush |= GEN8_LQSC_RO_PERF_DIS; | 1111 | l3sqc4_flush |= GEN8_LQSC_RO_PERF_DIS; |
| 1111 | 1112 | ||
| 1112 | wa_ctx_emit(batch, index, (MI_STORE_REGISTER_MEM_GEN8 | | 1113 | wa_ctx_emit(batch, index, (MI_STORE_REGISTER_MEM_GEN8 | |
| @@ -1267,11 +1268,12 @@ static int gen9_init_indirectctx_bb(struct intel_engine_cs *engine, | |||
| 1267 | uint32_t *offset) | 1268 | uint32_t *offset) |
| 1268 | { | 1269 | { |
| 1269 | int ret; | 1270 | int ret; |
| 1271 | struct drm_i915_private *dev_priv = engine->i915; | ||
| 1270 | uint32_t index = wa_ctx_start(wa_ctx, *offset, CACHELINE_DWORDS); | 1272 | uint32_t index = wa_ctx_start(wa_ctx, *offset, CACHELINE_DWORDS); |
| 1271 | 1273 | ||
| 1272 | /* WaDisableCtxRestoreArbitration:skl,bxt */ | 1274 | /* WaDisableCtxRestoreArbitration:skl,bxt */ |
| 1273 | if (IS_SKL_REVID(engine->i915, 0, SKL_REVID_D0) || | 1275 | if (IS_SKL_REVID(dev_priv, 0, SKL_REVID_D0) || |
| 1274 | IS_BXT_REVID(engine->i915, 0, BXT_REVID_A1)) | 1276 | IS_BXT_REVID(dev_priv, 0, BXT_REVID_A1)) |
| 1275 | wa_ctx_emit(batch, index, MI_ARB_ON_OFF | MI_ARB_DISABLE); | 1277 | wa_ctx_emit(batch, index, MI_ARB_ON_OFF | MI_ARB_DISABLE); |
| 1276 | 1278 | ||
| 1277 | /* WaFlushCoherentL3CacheLinesAtContextSwitch:skl,bxt */ | 1279 | /* WaFlushCoherentL3CacheLinesAtContextSwitch:skl,bxt */ |
| @@ -1282,7 +1284,7 @@ static int gen9_init_indirectctx_bb(struct intel_engine_cs *engine, | |||
| 1282 | 1284 | ||
| 1283 | /* WaClearSlmSpaceAtContextSwitch:kbl */ | 1285 | /* WaClearSlmSpaceAtContextSwitch:kbl */ |
| 1284 | /* Actual scratch location is at 128 bytes offset */ | 1286 | /* Actual scratch location is at 128 bytes offset */ |
| 1285 | if (IS_KBL_REVID(engine->i915, 0, KBL_REVID_A0)) { | 1287 | if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_A0)) { |
| 1286 | uint32_t scratch_addr | 1288 | uint32_t scratch_addr |
| 1287 | = engine->scratch.gtt_offset + 2*CACHELINE_BYTES; | 1289 | = engine->scratch.gtt_offset + 2*CACHELINE_BYTES; |
| 1288 | 1290 | ||
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index c27d5eb063d0..adca262d591a 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c | |||
| @@ -1072,5 +1072,16 @@ intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) | |||
| 1072 | return -ENODEV; | 1072 | return -ENODEV; |
| 1073 | } | 1073 | } |
| 1074 | 1074 | ||
| 1075 | /* | ||
| 1076 | * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us | ||
| 1077 | * low vswing for eDP, whereas the VBT panel type (2) gives us normal | ||
| 1078 | * vswing instead. Low vswing results in some display flickers, so | ||
| 1079 | * let's simply ignore the OpRegion panel type on SKL for now. | ||
| 1080 | */ | ||
| 1081 | if (IS_SKYLAKE(dev_priv)) { | ||
| 1082 | DRM_DEBUG_KMS("Ignoring OpRegion panel type (%d)\n", ret - 1); | ||
| 1083 | return -ENODEV; | ||
| 1084 | } | ||
| 1085 | |||
| 1075 | return ret - 1; | 1086 | return ret - 1; |
| 1076 | } | 1087 | } |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 5a8ee0c76593..f4f3fcc8b3be 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
| @@ -57,7 +57,7 @@ | |||
| 57 | 57 | ||
| 58 | static void gen9_init_clock_gating(struct drm_device *dev) | 58 | static void gen9_init_clock_gating(struct drm_device *dev) |
| 59 | { | 59 | { |
| 60 | struct drm_i915_private *dev_priv = to_i915(dev); | 60 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 61 | 61 | ||
| 62 | /* See Bspec note for PSR2_CTL bit 31, Wa#828:skl,bxt,kbl */ | 62 | /* See Bspec note for PSR2_CTL bit 31, Wa#828:skl,bxt,kbl */ |
| 63 | I915_WRITE(CHICKEN_PAR1_1, | 63 | I915_WRITE(CHICKEN_PAR1_1, |
| @@ -7046,7 +7046,7 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv, | |||
| 7046 | 7046 | ||
| 7047 | static void kabylake_init_clock_gating(struct drm_device *dev) | 7047 | static void kabylake_init_clock_gating(struct drm_device *dev) |
| 7048 | { | 7048 | { |
| 7049 | struct drm_i915_private *dev_priv = to_i915(dev); | 7049 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 7050 | 7050 | ||
| 7051 | gen9_init_clock_gating(dev); | 7051 | gen9_init_clock_gating(dev); |
| 7052 | 7052 | ||
| @@ -7067,7 +7067,7 @@ static void kabylake_init_clock_gating(struct drm_device *dev) | |||
| 7067 | 7067 | ||
| 7068 | static void skylake_init_clock_gating(struct drm_device *dev) | 7068 | static void skylake_init_clock_gating(struct drm_device *dev) |
| 7069 | { | 7069 | { |
| 7070 | struct drm_i915_private *dev_priv = to_i915(dev); | 7070 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 7071 | 7071 | ||
| 7072 | gen9_init_clock_gating(dev); | 7072 | gen9_init_clock_gating(dev); |
| 7073 | 7073 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c index 22706c0a54b5..49bd5da194e1 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c | |||
| @@ -40,7 +40,8 @@ static int | |||
| 40 | gf119_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern) | 40 | gf119_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern) |
| 41 | { | 41 | { |
| 42 | struct nvkm_device *device = outp->base.disp->engine.subdev.device; | 42 | struct nvkm_device *device = outp->base.disp->engine.subdev.device; |
| 43 | nvkm_mask(device, 0x61c110, 0x0f0f0f0f, 0x01010101 * pattern); | 43 | const u32 soff = gf119_sor_soff(outp); |
| 44 | nvkm_mask(device, 0x61c110 + soff, 0x0f0f0f0f, 0x01010101 * pattern); | ||
| 44 | return 0; | 45 | return 0; |
| 45 | } | 46 | } |
| 46 | 47 | ||
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c index f628b6d8f23f..4a192210574f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c | |||
| @@ -77,6 +77,14 @@ static void sun4i_crtc_disable(struct drm_crtc *crtc) | |||
| 77 | DRM_DEBUG_DRIVER("Disabling the CRTC\n"); | 77 | DRM_DEBUG_DRIVER("Disabling the CRTC\n"); |
| 78 | 78 | ||
| 79 | sun4i_tcon_disable(drv->tcon); | 79 | sun4i_tcon_disable(drv->tcon); |
| 80 | |||
| 81 | if (crtc->state->event && !crtc->state->active) { | ||
| 82 | spin_lock_irq(&crtc->dev->event_lock); | ||
| 83 | drm_crtc_send_vblank_event(crtc, crtc->state->event); | ||
| 84 | spin_unlock_irq(&crtc->dev->event_lock); | ||
| 85 | |||
| 86 | crtc->state->event = NULL; | ||
| 87 | } | ||
| 80 | } | 88 | } |
| 81 | 89 | ||
| 82 | static void sun4i_crtc_enable(struct drm_crtc *crtc) | 90 | static void sun4i_crtc_enable(struct drm_crtc *crtc) |
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 5b89940edcb1..4dc543e1db10 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c | |||
| @@ -92,7 +92,7 @@ static struct drm_driver sun4i_drv_driver = { | |||
| 92 | /* Frame Buffer Operations */ | 92 | /* Frame Buffer Operations */ |
| 93 | 93 | ||
| 94 | /* VBlank Operations */ | 94 | /* VBlank Operations */ |
| 95 | .get_vblank_counter = drm_vblank_count, | 95 | .get_vblank_counter = drm_vblank_no_hw_counter, |
| 96 | .enable_vblank = sun4i_drv_enable_vblank, | 96 | .enable_vblank = sun4i_drv_enable_vblank, |
| 97 | .disable_vblank = sun4i_drv_disable_vblank, | 97 | .disable_vblank = sun4i_drv_disable_vblank, |
| 98 | }; | 98 | }; |
| @@ -300,6 +300,7 @@ static int sun4i_drv_probe(struct platform_device *pdev) | |||
| 300 | 300 | ||
| 301 | count += sun4i_drv_add_endpoints(&pdev->dev, &match, | 301 | count += sun4i_drv_add_endpoints(&pdev->dev, &match, |
| 302 | pipeline); | 302 | pipeline); |
| 303 | of_node_put(pipeline); | ||
| 303 | 304 | ||
| 304 | DRM_DEBUG_DRIVER("Queued %d outputs on pipeline %d\n", | 305 | DRM_DEBUG_DRIVER("Queued %d outputs on pipeline %d\n", |
| 305 | count, i); | 306 | count, i); |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index e340d0d66429..3452748dc43c 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
| @@ -1044,9 +1044,9 @@ out_unlock: | |||
| 1044 | return ret; | 1044 | return ret; |
| 1045 | } | 1045 | } |
| 1046 | 1046 | ||
| 1047 | static bool ttm_bo_mem_compat(struct ttm_placement *placement, | 1047 | bool ttm_bo_mem_compat(struct ttm_placement *placement, |
| 1048 | struct ttm_mem_reg *mem, | 1048 | struct ttm_mem_reg *mem, |
| 1049 | uint32_t *new_flags) | 1049 | uint32_t *new_flags) |
| 1050 | { | 1050 | { |
| 1051 | int i; | 1051 | int i; |
| 1052 | 1052 | ||
| @@ -1078,6 +1078,7 @@ static bool ttm_bo_mem_compat(struct ttm_placement *placement, | |||
| 1078 | 1078 | ||
| 1079 | return false; | 1079 | return false; |
| 1080 | } | 1080 | } |
| 1081 | EXPORT_SYMBOL(ttm_bo_mem_compat); | ||
| 1081 | 1082 | ||
| 1082 | int ttm_bo_validate(struct ttm_buffer_object *bo, | 1083 | int ttm_bo_validate(struct ttm_buffer_object *bo, |
| 1083 | struct ttm_placement *placement, | 1084 | struct ttm_placement *placement, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c index 9b078a493996..0cd889015dc5 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c | |||
| @@ -49,6 +49,7 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv, | |||
| 49 | { | 49 | { |
| 50 | struct ttm_buffer_object *bo = &buf->base; | 50 | struct ttm_buffer_object *bo = &buf->base; |
| 51 | int ret; | 51 | int ret; |
| 52 | uint32_t new_flags; | ||
| 52 | 53 | ||
| 53 | ret = ttm_write_lock(&dev_priv->reservation_sem, interruptible); | 54 | ret = ttm_write_lock(&dev_priv->reservation_sem, interruptible); |
| 54 | if (unlikely(ret != 0)) | 55 | if (unlikely(ret != 0)) |
| @@ -60,7 +61,12 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv, | |||
| 60 | if (unlikely(ret != 0)) | 61 | if (unlikely(ret != 0)) |
| 61 | goto err; | 62 | goto err; |
| 62 | 63 | ||
| 63 | ret = ttm_bo_validate(bo, placement, interruptible, false); | 64 | if (buf->pin_count > 0) |
| 65 | ret = ttm_bo_mem_compat(placement, &bo->mem, | ||
| 66 | &new_flags) == true ? 0 : -EINVAL; | ||
| 67 | else | ||
| 68 | ret = ttm_bo_validate(bo, placement, interruptible, false); | ||
| 69 | |||
| 64 | if (!ret) | 70 | if (!ret) |
| 65 | vmw_bo_pin_reserved(buf, true); | 71 | vmw_bo_pin_reserved(buf, true); |
| 66 | 72 | ||
| @@ -91,6 +97,7 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv, | |||
| 91 | { | 97 | { |
| 92 | struct ttm_buffer_object *bo = &buf->base; | 98 | struct ttm_buffer_object *bo = &buf->base; |
| 93 | int ret; | 99 | int ret; |
| 100 | uint32_t new_flags; | ||
| 94 | 101 | ||
| 95 | ret = ttm_write_lock(&dev_priv->reservation_sem, interruptible); | 102 | ret = ttm_write_lock(&dev_priv->reservation_sem, interruptible); |
| 96 | if (unlikely(ret != 0)) | 103 | if (unlikely(ret != 0)) |
| @@ -102,6 +109,12 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv, | |||
| 102 | if (unlikely(ret != 0)) | 109 | if (unlikely(ret != 0)) |
| 103 | goto err; | 110 | goto err; |
| 104 | 111 | ||
| 112 | if (buf->pin_count > 0) { | ||
| 113 | ret = ttm_bo_mem_compat(&vmw_vram_gmr_placement, &bo->mem, | ||
| 114 | &new_flags) == true ? 0 : -EINVAL; | ||
| 115 | goto out_unreserve; | ||
| 116 | } | ||
| 117 | |||
| 105 | ret = ttm_bo_validate(bo, &vmw_vram_gmr_placement, interruptible, | 118 | ret = ttm_bo_validate(bo, &vmw_vram_gmr_placement, interruptible, |
| 106 | false); | 119 | false); |
| 107 | if (likely(ret == 0) || ret == -ERESTARTSYS) | 120 | if (likely(ret == 0) || ret == -ERESTARTSYS) |
| @@ -161,6 +174,7 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *dev_priv, | |||
| 161 | struct ttm_placement placement; | 174 | struct ttm_placement placement; |
| 162 | struct ttm_place place; | 175 | struct ttm_place place; |
| 163 | int ret = 0; | 176 | int ret = 0; |
| 177 | uint32_t new_flags; | ||
| 164 | 178 | ||
| 165 | place = vmw_vram_placement.placement[0]; | 179 | place = vmw_vram_placement.placement[0]; |
| 166 | place.lpfn = bo->num_pages; | 180 | place.lpfn = bo->num_pages; |
| @@ -185,10 +199,15 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *dev_priv, | |||
| 185 | */ | 199 | */ |
| 186 | if (bo->mem.mem_type == TTM_PL_VRAM && | 200 | if (bo->mem.mem_type == TTM_PL_VRAM && |
| 187 | bo->mem.start < bo->num_pages && | 201 | bo->mem.start < bo->num_pages && |
| 188 | bo->mem.start > 0) | 202 | bo->mem.start > 0 && |
| 203 | buf->pin_count == 0) | ||
| 189 | (void) ttm_bo_validate(bo, &vmw_sys_placement, false, false); | 204 | (void) ttm_bo_validate(bo, &vmw_sys_placement, false, false); |
| 190 | 205 | ||
| 191 | ret = ttm_bo_validate(bo, &placement, interruptible, false); | 206 | if (buf->pin_count > 0) |
| 207 | ret = ttm_bo_mem_compat(&placement, &bo->mem, | ||
| 208 | &new_flags) == true ? 0 : -EINVAL; | ||
| 209 | else | ||
| 210 | ret = ttm_bo_validate(bo, &placement, interruptible, false); | ||
| 192 | 211 | ||
| 193 | /* For some reason we didn't end up at the start of vram */ | 212 | /* For some reason we didn't end up at the start of vram */ |
| 194 | WARN_ON(ret == 0 && bo->offset != 0); | 213 | WARN_ON(ret == 0 && bo->offset != 0); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 5d5c9515618d..e8ae3dc476d1 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
| @@ -233,6 +233,7 @@ static int vmw_force_iommu; | |||
| 233 | static int vmw_restrict_iommu; | 233 | static int vmw_restrict_iommu; |
| 234 | static int vmw_force_coherent; | 234 | static int vmw_force_coherent; |
| 235 | static int vmw_restrict_dma_mask; | 235 | static int vmw_restrict_dma_mask; |
| 236 | static int vmw_assume_16bpp; | ||
| 236 | 237 | ||
| 237 | static int vmw_probe(struct pci_dev *, const struct pci_device_id *); | 238 | static int vmw_probe(struct pci_dev *, const struct pci_device_id *); |
| 238 | static void vmw_master_init(struct vmw_master *); | 239 | static void vmw_master_init(struct vmw_master *); |
| @@ -249,6 +250,8 @@ MODULE_PARM_DESC(force_coherent, "Force coherent TTM pages"); | |||
| 249 | module_param_named(force_coherent, vmw_force_coherent, int, 0600); | 250 | module_param_named(force_coherent, vmw_force_coherent, int, 0600); |
| 250 | MODULE_PARM_DESC(restrict_dma_mask, "Restrict DMA mask to 44 bits with IOMMU"); | 251 | MODULE_PARM_DESC(restrict_dma_mask, "Restrict DMA mask to 44 bits with IOMMU"); |
| 251 | module_param_named(restrict_dma_mask, vmw_restrict_dma_mask, int, 0600); | 252 | module_param_named(restrict_dma_mask, vmw_restrict_dma_mask, int, 0600); |
| 253 | MODULE_PARM_DESC(assume_16bpp, "Assume 16-bpp when filtering modes"); | ||
| 254 | module_param_named(assume_16bpp, vmw_assume_16bpp, int, 0600); | ||
| 252 | 255 | ||
| 253 | 256 | ||
| 254 | static void vmw_print_capabilities(uint32_t capabilities) | 257 | static void vmw_print_capabilities(uint32_t capabilities) |
| @@ -660,6 +663,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
| 660 | dev_priv->vram_start = pci_resource_start(dev->pdev, 1); | 663 | dev_priv->vram_start = pci_resource_start(dev->pdev, 1); |
| 661 | dev_priv->mmio_start = pci_resource_start(dev->pdev, 2); | 664 | dev_priv->mmio_start = pci_resource_start(dev->pdev, 2); |
| 662 | 665 | ||
| 666 | dev_priv->assume_16bpp = !!vmw_assume_16bpp; | ||
| 667 | |||
| 663 | dev_priv->enable_fb = enable_fbdev; | 668 | dev_priv->enable_fb = enable_fbdev; |
| 664 | 669 | ||
| 665 | vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2); | 670 | vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2); |
| @@ -706,6 +711,13 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
| 706 | vmw_read(dev_priv, | 711 | vmw_read(dev_priv, |
| 707 | SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB); | 712 | SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB); |
| 708 | 713 | ||
| 714 | /* | ||
| 715 | * Workaround for low memory 2D VMs to compensate for the | ||
| 716 | * allocation taken by fbdev | ||
| 717 | */ | ||
| 718 | if (!(dev_priv->capabilities & SVGA_CAP_3D)) | ||
| 719 | mem_size *= 2; | ||
| 720 | |||
| 709 | dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE; | 721 | dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE; |
| 710 | dev_priv->prim_bb_mem = | 722 | dev_priv->prim_bb_mem = |
| 711 | vmw_read(dev_priv, | 723 | vmw_read(dev_priv, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 9a90f824814e..74304b03f9d4 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
| @@ -387,6 +387,7 @@ struct vmw_private { | |||
| 387 | spinlock_t hw_lock; | 387 | spinlock_t hw_lock; |
| 388 | spinlock_t cap_lock; | 388 | spinlock_t cap_lock; |
| 389 | bool has_dx; | 389 | bool has_dx; |
| 390 | bool assume_16bpp; | ||
| 390 | 391 | ||
| 391 | /* | 392 | /* |
| 392 | * VGA registers. | 393 | * VGA registers. |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c index 679a4cb98ee3..d2d93959b119 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | |||
| @@ -517,28 +517,6 @@ static int vmw_fb_kms_framebuffer(struct fb_info *info) | |||
| 517 | 517 | ||
| 518 | par->set_fb = &vfb->base; | 518 | par->set_fb = &vfb->base; |
| 519 | 519 | ||
| 520 | if (!par->bo_ptr) { | ||
| 521 | /* | ||
| 522 | * Pin before mapping. Since we don't know in what placement | ||
| 523 | * to pin, call into KMS to do it for us. | ||
| 524 | */ | ||
| 525 | ret = vfb->pin(vfb); | ||
| 526 | if (ret) { | ||
| 527 | DRM_ERROR("Could not pin the fbdev framebuffer.\n"); | ||
| 528 | return ret; | ||
| 529 | } | ||
| 530 | |||
| 531 | ret = ttm_bo_kmap(&par->vmw_bo->base, 0, | ||
| 532 | par->vmw_bo->base.num_pages, &par->map); | ||
| 533 | if (ret) { | ||
| 534 | vfb->unpin(vfb); | ||
| 535 | DRM_ERROR("Could not map the fbdev framebuffer.\n"); | ||
| 536 | return ret; | ||
| 537 | } | ||
| 538 | |||
| 539 | par->bo_ptr = ttm_kmap_obj_virtual(&par->map, &par->bo_iowrite); | ||
| 540 | } | ||
| 541 | |||
| 542 | return 0; | 520 | return 0; |
| 543 | } | 521 | } |
| 544 | 522 | ||
| @@ -601,6 +579,31 @@ static int vmw_fb_set_par(struct fb_info *info) | |||
| 601 | if (ret) | 579 | if (ret) |
| 602 | goto out_unlock; | 580 | goto out_unlock; |
| 603 | 581 | ||
| 582 | if (!par->bo_ptr) { | ||
| 583 | struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(set.fb); | ||
| 584 | |||
| 585 | /* | ||
| 586 | * Pin before mapping. Since we don't know in what placement | ||
| 587 | * to pin, call into KMS to do it for us. | ||
| 588 | */ | ||
| 589 | ret = vfb->pin(vfb); | ||
| 590 | if (ret) { | ||
| 591 | DRM_ERROR("Could not pin the fbdev framebuffer.\n"); | ||
| 592 | goto out_unlock; | ||
| 593 | } | ||
| 594 | |||
| 595 | ret = ttm_bo_kmap(&par->vmw_bo->base, 0, | ||
| 596 | par->vmw_bo->base.num_pages, &par->map); | ||
| 597 | if (ret) { | ||
| 598 | vfb->unpin(vfb); | ||
| 599 | DRM_ERROR("Could not map the fbdev framebuffer.\n"); | ||
| 600 | goto out_unlock; | ||
| 601 | } | ||
| 602 | |||
| 603 | par->bo_ptr = ttm_kmap_obj_virtual(&par->map, &par->bo_iowrite); | ||
| 604 | } | ||
| 605 | |||
| 606 | |||
| 604 | vmw_fb_dirty_mark(par, par->fb_x, par->fb_y, | 607 | vmw_fb_dirty_mark(par, par->fb_x, par->fb_y, |
| 605 | par->set_fb->width, par->set_fb->height); | 608 | par->set_fb->width, par->set_fb->height); |
| 606 | 609 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 8a69d4da40b5..bf28ccc150df 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
| @@ -1555,14 +1555,10 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, | |||
| 1555 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) | 1555 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) |
| 1556 | }; | 1556 | }; |
| 1557 | int i; | 1557 | int i; |
| 1558 | u32 assumed_bpp = 2; | 1558 | u32 assumed_bpp = 4; |
| 1559 | 1559 | ||
| 1560 | /* | 1560 | if (dev_priv->assume_16bpp) |
| 1561 | * If using screen objects, then assume 32-bpp because that's what the | 1561 | assumed_bpp = 2; |
| 1562 | * SVGA device is assuming | ||
| 1563 | */ | ||
| 1564 | if (dev_priv->active_display_unit == vmw_du_screen_object) | ||
| 1565 | assumed_bpp = 4; | ||
| 1566 | 1562 | ||
| 1567 | if (dev_priv->active_display_unit == vmw_du_screen_target) { | 1563 | if (dev_priv->active_display_unit == vmw_du_screen_target) { |
| 1568 | max_width = min(max_width, dev_priv->stdu_max_width); | 1564 | max_width = min(max_width, dev_priv->stdu_max_width); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c index f0374f9b56ca..e57a0bad7a62 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | |||
| @@ -300,6 +300,9 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg, | |||
| 300 | break; | 300 | break; |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | if (retries == RETRIES) | ||
| 304 | return -EINVAL; | ||
| 305 | |||
| 303 | *msg_len = reply_len; | 306 | *msg_len = reply_len; |
| 304 | *msg = reply; | 307 | *msg = reply; |
| 305 | 308 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index 9ca818fb034c..41932a7c4f79 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | |||
| @@ -399,8 +399,10 @@ static int vmw_stdu_bind_fb(struct vmw_private *dev_priv, | |||
| 399 | 399 | ||
| 400 | WARN_ON_ONCE(!stdu->defined); | 400 | WARN_ON_ONCE(!stdu->defined); |
| 401 | 401 | ||
| 402 | if (!vfb->dmabuf && new_fb->width == mode->hdisplay && | 402 | new_vfbs = (vfb->dmabuf) ? NULL : vmw_framebuffer_to_vfbs(new_fb); |
| 403 | new_fb->height == mode->vdisplay) | 403 | |
| 404 | if (new_vfbs && new_vfbs->surface->base_size.width == mode->hdisplay && | ||
| 405 | new_vfbs->surface->base_size.height == mode->vdisplay) | ||
| 404 | new_content_type = SAME_AS_DISPLAY; | 406 | new_content_type = SAME_AS_DISPLAY; |
| 405 | else if (vfb->dmabuf) | 407 | else if (vfb->dmabuf) |
| 406 | new_content_type = SEPARATE_DMA; | 408 | new_content_type = SEPARATE_DMA; |
| @@ -444,7 +446,6 @@ static int vmw_stdu_bind_fb(struct vmw_private *dev_priv, | |||
| 444 | content_srf.mip_levels[0] = 1; | 446 | content_srf.mip_levels[0] = 1; |
| 445 | content_srf.multisample_count = 0; | 447 | content_srf.multisample_count = 0; |
| 446 | } else { | 448 | } else { |
| 447 | new_vfbs = vmw_framebuffer_to_vfbs(new_fb); | ||
| 448 | content_srf = *new_vfbs->surface; | 449 | content_srf = *new_vfbs->surface; |
| 449 | } | 450 | } |
| 450 | 451 | ||
| @@ -464,7 +465,6 @@ static int vmw_stdu_bind_fb(struct vmw_private *dev_priv, | |||
| 464 | return ret; | 465 | return ret; |
| 465 | } | 466 | } |
| 466 | } else if (new_content_type == SAME_AS_DISPLAY) { | 467 | } else if (new_content_type == SAME_AS_DISPLAY) { |
| 467 | new_vfbs = vmw_framebuffer_to_vfbs(new_fb); | ||
| 468 | new_display_srf = vmw_surface_reference(new_vfbs->surface); | 468 | new_display_srf = vmw_surface_reference(new_vfbs->surface); |
| 469 | } | 469 | } |
| 470 | 470 | ||
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 95b7d61d9910..fb6f1f447279 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
| @@ -61,6 +61,7 @@ MODULE_LICENSE("GPL"); | |||
| 61 | #define MT_QUIRK_ALWAYS_VALID (1 << 4) | 61 | #define MT_QUIRK_ALWAYS_VALID (1 << 4) |
| 62 | #define MT_QUIRK_VALID_IS_INRANGE (1 << 5) | 62 | #define MT_QUIRK_VALID_IS_INRANGE (1 << 5) |
| 63 | #define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6) | 63 | #define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6) |
| 64 | #define MT_QUIRK_CONFIDENCE (1 << 7) | ||
| 64 | #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8) | 65 | #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8) |
| 65 | #define MT_QUIRK_NO_AREA (1 << 9) | 66 | #define MT_QUIRK_NO_AREA (1 << 9) |
| 66 | #define MT_QUIRK_IGNORE_DUPLICATES (1 << 10) | 67 | #define MT_QUIRK_IGNORE_DUPLICATES (1 << 10) |
| @@ -78,6 +79,7 @@ struct mt_slot { | |||
| 78 | __s32 contactid; /* the device ContactID assigned to this slot */ | 79 | __s32 contactid; /* the device ContactID assigned to this slot */ |
| 79 | bool touch_state; /* is the touch valid? */ | 80 | bool touch_state; /* is the touch valid? */ |
| 80 | bool inrange_state; /* is the finger in proximity of the sensor? */ | 81 | bool inrange_state; /* is the finger in proximity of the sensor? */ |
| 82 | bool confidence_state; /* is the touch made by a finger? */ | ||
| 81 | }; | 83 | }; |
| 82 | 84 | ||
| 83 | struct mt_class { | 85 | struct mt_class { |
| @@ -503,10 +505,8 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
| 503 | return 1; | 505 | return 1; |
| 504 | case HID_DG_CONFIDENCE: | 506 | case HID_DG_CONFIDENCE: |
| 505 | if (cls->name == MT_CLS_WIN_8 && | 507 | if (cls->name == MT_CLS_WIN_8 && |
| 506 | field->application == HID_DG_TOUCHPAD) { | 508 | field->application == HID_DG_TOUCHPAD) |
| 507 | cls->quirks &= ~MT_QUIRK_ALWAYS_VALID; | 509 | cls->quirks |= MT_QUIRK_CONFIDENCE; |
| 508 | cls->quirks |= MT_QUIRK_VALID_IS_CONFIDENCE; | ||
| 509 | } | ||
| 510 | mt_store_field(usage, td, hi); | 510 | mt_store_field(usage, td, hi); |
| 511 | return 1; | 511 | return 1; |
| 512 | case HID_DG_TIPSWITCH: | 512 | case HID_DG_TIPSWITCH: |
| @@ -619,6 +619,7 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input) | |||
| 619 | return; | 619 | return; |
| 620 | 620 | ||
| 621 | if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) { | 621 | if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) { |
| 622 | int active; | ||
| 622 | int slotnum = mt_compute_slot(td, input); | 623 | int slotnum = mt_compute_slot(td, input); |
| 623 | struct mt_slot *s = &td->curdata; | 624 | struct mt_slot *s = &td->curdata; |
| 624 | struct input_mt *mt = input->mt; | 625 | struct input_mt *mt = input->mt; |
| @@ -633,10 +634,14 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input) | |||
| 633 | return; | 634 | return; |
| 634 | } | 635 | } |
| 635 | 636 | ||
| 637 | if (!(td->mtclass.quirks & MT_QUIRK_CONFIDENCE)) | ||
| 638 | s->confidence_state = 1; | ||
| 639 | active = (s->touch_state || s->inrange_state) && | ||
| 640 | s->confidence_state; | ||
| 641 | |||
| 636 | input_mt_slot(input, slotnum); | 642 | input_mt_slot(input, slotnum); |
| 637 | input_mt_report_slot_state(input, MT_TOOL_FINGER, | 643 | input_mt_report_slot_state(input, MT_TOOL_FINGER, active); |
| 638 | s->touch_state || s->inrange_state); | 644 | if (active) { |
| 639 | if (s->touch_state || s->inrange_state) { | ||
| 640 | /* this finger is in proximity of the sensor */ | 645 | /* this finger is in proximity of the sensor */ |
| 641 | int wide = (s->w > s->h); | 646 | int wide = (s->w > s->h); |
| 642 | /* divided by two to match visual scale of touch */ | 647 | /* divided by two to match visual scale of touch */ |
| @@ -701,6 +706,8 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, | |||
| 701 | td->curdata.touch_state = value; | 706 | td->curdata.touch_state = value; |
| 702 | break; | 707 | break; |
| 703 | case HID_DG_CONFIDENCE: | 708 | case HID_DG_CONFIDENCE: |
| 709 | if (quirks & MT_QUIRK_CONFIDENCE) | ||
| 710 | td->curdata.confidence_state = value; | ||
| 704 | if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE) | 711 | if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE) |
| 705 | td->curvalid = value; | 712 | td->curvalid = value; |
| 706 | break; | 713 | break; |
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index cc6439ab3f71..041050edd809 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c | |||
| @@ -1268,6 +1268,8 @@ static int qup_i2c_xfer_v2(struct i2c_adapter *adap, | |||
| 1268 | } | 1268 | } |
| 1269 | } | 1269 | } |
| 1270 | 1270 | ||
| 1271 | idx = 0; | ||
| 1272 | |||
| 1271 | do { | 1273 | do { |
| 1272 | if (msgs[idx].len == 0) { | 1274 | if (msgs[idx].len == 0) { |
| 1273 | ret = -EINVAL; | 1275 | ret = -EINVAL; |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 445398c314a3..b126dbaa47e3 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
| @@ -912,7 +912,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
| 912 | ret = tegra_i2c_init(i2c_dev); | 912 | ret = tegra_i2c_init(i2c_dev); |
| 913 | if (ret) { | 913 | if (ret) { |
| 914 | dev_err(&pdev->dev, "Failed to initialize i2c controller"); | 914 | dev_err(&pdev->dev, "Failed to initialize i2c controller"); |
| 915 | goto unprepare_div_clk; | 915 | goto disable_div_clk; |
| 916 | } | 916 | } |
| 917 | 917 | ||
| 918 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, | 918 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, |
diff --git a/drivers/i2c/i2c-boardinfo.c b/drivers/i2c/i2c-boardinfo.c index e33022e2d459..6e5fac6a5262 100644 --- a/drivers/i2c/i2c-boardinfo.c +++ b/drivers/i2c/i2c-boardinfo.c | |||
| @@ -56,9 +56,7 @@ EXPORT_SYMBOL_GPL(__i2c_first_dynamic_bus_num); | |||
| 56 | * The board info passed can safely be __initdata, but be careful of embedded | 56 | * The board info passed can safely be __initdata, but be careful of embedded |
| 57 | * pointers (for platform_data, functions, etc) since that won't be copied. | 57 | * pointers (for platform_data, functions, etc) since that won't be copied. |
| 58 | */ | 58 | */ |
| 59 | int __init | 59 | int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned len) |
| 60 | i2c_register_board_info(int busnum, | ||
| 61 | struct i2c_board_info const *info, unsigned len) | ||
| 62 | { | 60 | { |
| 63 | int status; | 61 | int status; |
| 64 | 62 | ||
diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c index 26e7c5187a58..c6a90b4a9c62 100644 --- a/drivers/i2c/muxes/i2c-mux-reg.c +++ b/drivers/i2c/muxes/i2c-mux-reg.c | |||
| @@ -145,7 +145,7 @@ static int i2c_mux_reg_probe_dt(struct regmux *mux, | |||
| 145 | mux->data.idle_in_use = true; | 145 | mux->data.idle_in_use = true; |
| 146 | 146 | ||
| 147 | /* map address from "reg" if exists */ | 147 | /* map address from "reg" if exists */ |
| 148 | if (of_address_to_resource(np, 0, &res)) { | 148 | if (of_address_to_resource(np, 0, &res) == 0) { |
| 149 | mux->data.reg_size = resource_size(&res); | 149 | mux->data.reg_size = resource_size(&res); |
| 150 | mux->data.reg = devm_ioremap_resource(&pdev->dev, &res); | 150 | mux->data.reg = devm_ioremap_resource(&pdev->dev, &res); |
| 151 | if (IS_ERR(mux->data.reg)) | 151 | if (IS_ERR(mux->data.reg)) |
diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c index 923f56598d4b..3a9f106787d2 100644 --- a/drivers/iio/accel/kxsd9.c +++ b/drivers/iio/accel/kxsd9.c | |||
| @@ -81,7 +81,7 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro) | |||
| 81 | 81 | ||
| 82 | mutex_lock(&st->buf_lock); | 82 | mutex_lock(&st->buf_lock); |
| 83 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); | 83 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); |
| 84 | if (ret) | 84 | if (ret < 0) |
| 85 | goto error_ret; | 85 | goto error_ret; |
| 86 | st->tx[0] = KXSD9_WRITE(KXSD9_REG_CTRL_C); | 86 | st->tx[0] = KXSD9_WRITE(KXSD9_REG_CTRL_C); |
| 87 | st->tx[1] = (ret & ~KXSD9_FS_MASK) | i; | 87 | st->tx[1] = (ret & ~KXSD9_FS_MASK) | i; |
| @@ -163,7 +163,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, | |||
| 163 | break; | 163 | break; |
| 164 | case IIO_CHAN_INFO_SCALE: | 164 | case IIO_CHAN_INFO_SCALE: |
| 165 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); | 165 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); |
| 166 | if (ret) | 166 | if (ret < 0) |
| 167 | goto error_ret; | 167 | goto error_ret; |
| 168 | *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; | 168 | *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; |
| 169 | ret = IIO_VAL_INT_PLUS_MICRO; | 169 | ret = IIO_VAL_INT_PLUS_MICRO; |
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c index 21e19b60e2b9..2123f0ac2e2a 100644 --- a/drivers/iio/adc/ad7266.c +++ b/drivers/iio/adc/ad7266.c | |||
| @@ -396,8 +396,8 @@ static int ad7266_probe(struct spi_device *spi) | |||
| 396 | 396 | ||
| 397 | st = iio_priv(indio_dev); | 397 | st = iio_priv(indio_dev); |
| 398 | 398 | ||
| 399 | st->reg = devm_regulator_get(&spi->dev, "vref"); | 399 | st->reg = devm_regulator_get_optional(&spi->dev, "vref"); |
| 400 | if (!IS_ERR_OR_NULL(st->reg)) { | 400 | if (!IS_ERR(st->reg)) { |
| 401 | ret = regulator_enable(st->reg); | 401 | ret = regulator_enable(st->reg); |
| 402 | if (ret) | 402 | if (ret) |
| 403 | return ret; | 403 | return ret; |
| @@ -408,6 +408,9 @@ static int ad7266_probe(struct spi_device *spi) | |||
| 408 | 408 | ||
| 409 | st->vref_mv = ret / 1000; | 409 | st->vref_mv = ret / 1000; |
| 410 | } else { | 410 | } else { |
| 411 | /* Any other error indicates that the regulator does exist */ | ||
| 412 | if (PTR_ERR(st->reg) != -ENODEV) | ||
| 413 | return PTR_ERR(st->reg); | ||
| 411 | /* Use internal reference */ | 414 | /* Use internal reference */ |
| 412 | st->vref_mv = 2500; | 415 | st->vref_mv = 2500; |
| 413 | } | 416 | } |
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c index f62b8bd9ad7e..dd6fc6d21f9d 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | |||
| @@ -56,6 +56,7 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev, | |||
| 56 | int i; | 56 | int i; |
| 57 | acpi_status status; | 57 | acpi_status status; |
| 58 | union acpi_object *cpm; | 58 | union acpi_object *cpm; |
| 59 | int ret; | ||
| 59 | 60 | ||
| 60 | status = acpi_evaluate_object(adev->handle, "CNF0", NULL, &buffer); | 61 | status = acpi_evaluate_object(adev->handle, "CNF0", NULL, &buffer); |
| 61 | if (ACPI_FAILURE(status)) | 62 | if (ACPI_FAILURE(status)) |
| @@ -82,10 +83,10 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev, | |||
| 82 | } | 83 | } |
| 83 | } | 84 | } |
| 84 | } | 85 | } |
| 85 | 86 | ret = cpm->package.count; | |
| 86 | kfree(buffer.pointer); | 87 | kfree(buffer.pointer); |
| 87 | 88 | ||
| 88 | return cpm->package.count; | 89 | return ret; |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | static int acpi_i2c_check_resource(struct acpi_resource *ares, void *data) | 92 | static int acpi_i2c_check_resource(struct acpi_resource *ares, void *data) |
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index a5793c8f1590..60df4f8e81be 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
| @@ -530,6 +530,7 @@ static PORT_PMA_ATTR(port_xmit_data , 12, 32, 192); | |||
| 530 | static PORT_PMA_ATTR(port_rcv_data , 13, 32, 224); | 530 | static PORT_PMA_ATTR(port_rcv_data , 13, 32, 224); |
| 531 | static PORT_PMA_ATTR(port_xmit_packets , 14, 32, 256); | 531 | static PORT_PMA_ATTR(port_xmit_packets , 14, 32, 256); |
| 532 | static PORT_PMA_ATTR(port_rcv_packets , 15, 32, 288); | 532 | static PORT_PMA_ATTR(port_rcv_packets , 15, 32, 288); |
| 533 | static PORT_PMA_ATTR(port_xmit_wait , 0, 32, 320); | ||
| 533 | 534 | ||
| 534 | /* | 535 | /* |
| 535 | * Counters added by extended set | 536 | * Counters added by extended set |
| @@ -560,6 +561,7 @@ static struct attribute *pma_attrs[] = { | |||
| 560 | &port_pma_attr_port_rcv_data.attr.attr, | 561 | &port_pma_attr_port_rcv_data.attr.attr, |
| 561 | &port_pma_attr_port_xmit_packets.attr.attr, | 562 | &port_pma_attr_port_xmit_packets.attr.attr, |
| 562 | &port_pma_attr_port_rcv_packets.attr.attr, | 563 | &port_pma_attr_port_rcv_packets.attr.attr, |
| 564 | &port_pma_attr_port_xmit_wait.attr.attr, | ||
| 563 | NULL | 565 | NULL |
| 564 | }; | 566 | }; |
| 565 | 567 | ||
| @@ -579,6 +581,7 @@ static struct attribute *pma_attrs_ext[] = { | |||
| 579 | &port_pma_attr_ext_port_xmit_data.attr.attr, | 581 | &port_pma_attr_ext_port_xmit_data.attr.attr, |
| 580 | &port_pma_attr_ext_port_rcv_data.attr.attr, | 582 | &port_pma_attr_ext_port_rcv_data.attr.attr, |
| 581 | &port_pma_attr_ext_port_xmit_packets.attr.attr, | 583 | &port_pma_attr_ext_port_xmit_packets.attr.attr, |
| 584 | &port_pma_attr_port_xmit_wait.attr.attr, | ||
| 582 | &port_pma_attr_ext_port_rcv_packets.attr.attr, | 585 | &port_pma_attr_ext_port_rcv_packets.attr.attr, |
| 583 | &port_pma_attr_ext_unicast_rcv_packets.attr.attr, | 586 | &port_pma_attr_ext_unicast_rcv_packets.attr.attr, |
| 584 | &port_pma_attr_ext_unicast_xmit_packets.attr.attr, | 587 | &port_pma_attr_ext_unicast_xmit_packets.attr.attr, |
| @@ -604,6 +607,7 @@ static struct attribute *pma_attrs_noietf[] = { | |||
| 604 | &port_pma_attr_ext_port_rcv_data.attr.attr, | 607 | &port_pma_attr_ext_port_rcv_data.attr.attr, |
| 605 | &port_pma_attr_ext_port_xmit_packets.attr.attr, | 608 | &port_pma_attr_ext_port_xmit_packets.attr.attr, |
| 606 | &port_pma_attr_ext_port_rcv_packets.attr.attr, | 609 | &port_pma_attr_ext_port_rcv_packets.attr.attr, |
| 610 | &port_pma_attr_port_xmit_wait.attr.attr, | ||
| 607 | NULL | 611 | NULL |
| 608 | }; | 612 | }; |
| 609 | 613 | ||
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c index f5de85178055..dad4d0ebbdff 100644 --- a/drivers/infiniband/hw/hfi1/chip.c +++ b/drivers/infiniband/hw/hfi1/chip.c | |||
| @@ -14113,8 +14113,14 @@ static int init_asic_data(struct hfi1_devdata *dd) | |||
| 14113 | { | 14113 | { |
| 14114 | unsigned long flags; | 14114 | unsigned long flags; |
| 14115 | struct hfi1_devdata *tmp, *peer = NULL; | 14115 | struct hfi1_devdata *tmp, *peer = NULL; |
| 14116 | struct hfi1_asic_data *asic_data; | ||
| 14116 | int ret = 0; | 14117 | int ret = 0; |
| 14117 | 14118 | ||
| 14119 | /* pre-allocate the asic structure in case we are the first device */ | ||
| 14120 | asic_data = kzalloc(sizeof(*dd->asic_data), GFP_KERNEL); | ||
| 14121 | if (!asic_data) | ||
| 14122 | return -ENOMEM; | ||
| 14123 | |||
| 14118 | spin_lock_irqsave(&hfi1_devs_lock, flags); | 14124 | spin_lock_irqsave(&hfi1_devs_lock, flags); |
| 14119 | /* Find our peer device */ | 14125 | /* Find our peer device */ |
| 14120 | list_for_each_entry(tmp, &hfi1_dev_list, list) { | 14126 | list_for_each_entry(tmp, &hfi1_dev_list, list) { |
| @@ -14126,18 +14132,14 @@ static int init_asic_data(struct hfi1_devdata *dd) | |||
| 14126 | } | 14132 | } |
| 14127 | 14133 | ||
| 14128 | if (peer) { | 14134 | if (peer) { |
| 14135 | /* use already allocated structure */ | ||
| 14129 | dd->asic_data = peer->asic_data; | 14136 | dd->asic_data = peer->asic_data; |
| 14137 | kfree(asic_data); | ||
| 14130 | } else { | 14138 | } else { |
| 14131 | dd->asic_data = kzalloc(sizeof(*dd->asic_data), GFP_KERNEL); | 14139 | dd->asic_data = asic_data; |
| 14132 | if (!dd->asic_data) { | ||
| 14133 | ret = -ENOMEM; | ||
| 14134 | goto done; | ||
| 14135 | } | ||
| 14136 | mutex_init(&dd->asic_data->asic_resource_mutex); | 14140 | mutex_init(&dd->asic_data->asic_resource_mutex); |
| 14137 | } | 14141 | } |
| 14138 | dd->asic_data->dds[dd->hfi1_id] = dd; /* self back-pointer */ | 14142 | dd->asic_data->dds[dd->hfi1_id] = dd; /* self back-pointer */ |
| 14139 | |||
| 14140 | done: | ||
| 14141 | spin_unlock_irqrestore(&hfi1_devs_lock, flags); | 14143 | spin_unlock_irqrestore(&hfi1_devs_lock, flags); |
| 14142 | return ret; | 14144 | return ret; |
| 14143 | } | 14145 | } |
diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c index 1e503ad0bebb..be91f6fa1c87 100644 --- a/drivers/infiniband/hw/hfi1/ud.c +++ b/drivers/infiniband/hw/hfi1/ud.c | |||
| @@ -678,8 +678,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) | |||
| 678 | u32 tlen = packet->tlen; | 678 | u32 tlen = packet->tlen; |
| 679 | struct rvt_qp *qp = packet->qp; | 679 | struct rvt_qp *qp = packet->qp; |
| 680 | bool has_grh = rcv_flags & HFI1_HAS_GRH; | 680 | bool has_grh = rcv_flags & HFI1_HAS_GRH; |
| 681 | bool sc4_bit = has_sc4_bit(packet); | 681 | u8 sc5 = hdr2sc((struct hfi1_message_header *)hdr, packet->rhf); |
| 682 | u8 sc; | ||
| 683 | u32 bth1; | 682 | u32 bth1; |
| 684 | int is_mcast; | 683 | int is_mcast; |
| 685 | struct ib_grh *grh = NULL; | 684 | struct ib_grh *grh = NULL; |
| @@ -697,10 +696,8 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) | |||
| 697 | */ | 696 | */ |
| 698 | struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); | 697 | struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); |
| 699 | u32 lqpn = be32_to_cpu(ohdr->bth[1]) & RVT_QPN_MASK; | 698 | u32 lqpn = be32_to_cpu(ohdr->bth[1]) & RVT_QPN_MASK; |
| 700 | u8 sl, sc5; | 699 | u8 sl; |
| 701 | 700 | ||
| 702 | sc5 = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf; | ||
| 703 | sc5 |= sc4_bit; | ||
| 704 | sl = ibp->sc_to_sl[sc5]; | 701 | sl = ibp->sc_to_sl[sc5]; |
| 705 | 702 | ||
| 706 | process_becn(ppd, sl, 0, lqpn, 0, IB_CC_SVCTYPE_UD); | 703 | process_becn(ppd, sl, 0, lqpn, 0, IB_CC_SVCTYPE_UD); |
| @@ -717,10 +714,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) | |||
| 717 | 714 | ||
| 718 | if (!is_mcast && (opcode != IB_OPCODE_CNP) && bth1 & HFI1_FECN_SMASK) { | 715 | if (!is_mcast && (opcode != IB_OPCODE_CNP) && bth1 & HFI1_FECN_SMASK) { |
| 719 | u16 slid = be16_to_cpu(hdr->lrh[3]); | 716 | u16 slid = be16_to_cpu(hdr->lrh[3]); |
| 720 | u8 sc5; | ||
| 721 | |||
| 722 | sc5 = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf; | ||
| 723 | sc5 |= sc4_bit; | ||
| 724 | 717 | ||
| 725 | return_cnp(ibp, qp, src_qp, pkey, dlid, slid, sc5, grh); | 718 | return_cnp(ibp, qp, src_qp, pkey, dlid, slid, sc5, grh); |
| 726 | } | 719 | } |
| @@ -745,10 +738,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) | |||
| 745 | if (qp->ibqp.qp_num > 1) { | 738 | if (qp->ibqp.qp_num > 1) { |
| 746 | struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); | 739 | struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); |
| 747 | u16 slid; | 740 | u16 slid; |
| 748 | u8 sc5; | ||
| 749 | |||
| 750 | sc5 = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf; | ||
| 751 | sc5 |= sc4_bit; | ||
| 752 | 741 | ||
| 753 | slid = be16_to_cpu(hdr->lrh[3]); | 742 | slid = be16_to_cpu(hdr->lrh[3]); |
| 754 | if (unlikely(rcv_pkey_check(ppd, pkey, sc5, slid))) { | 743 | if (unlikely(rcv_pkey_check(ppd, pkey, sc5, slid))) { |
| @@ -790,10 +779,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) | |||
| 790 | /* Received on QP0, and so by definition, this is an SMP */ | 779 | /* Received on QP0, and so by definition, this is an SMP */ |
| 791 | struct opa_smp *smp = (struct opa_smp *)data; | 780 | struct opa_smp *smp = (struct opa_smp *)data; |
| 792 | u16 slid = be16_to_cpu(hdr->lrh[3]); | 781 | u16 slid = be16_to_cpu(hdr->lrh[3]); |
| 793 | u8 sc5; | ||
| 794 | |||
| 795 | sc5 = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf; | ||
| 796 | sc5 |= sc4_bit; | ||
| 797 | 782 | ||
| 798 | if (opa_smp_check(ibp, pkey, sc5, qp, slid, smp)) | 783 | if (opa_smp_check(ibp, pkey, sc5, qp, slid, smp)) |
| 799 | goto drop; | 784 | goto drop; |
| @@ -890,9 +875,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) | |||
| 890 | } | 875 | } |
| 891 | 876 | ||
| 892 | wc.slid = be16_to_cpu(hdr->lrh[3]); | 877 | wc.slid = be16_to_cpu(hdr->lrh[3]); |
| 893 | sc = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf; | 878 | wc.sl = ibp->sc_to_sl[sc5]; |
| 894 | sc |= sc4_bit; | ||
| 895 | wc.sl = ibp->sc_to_sl[sc]; | ||
| 896 | 879 | ||
| 897 | /* | 880 | /* |
| 898 | * Save the LMC lower bits if the destination LID is a unicast LID. | 881 | * Save the LMC lower bits if the destination LID is a unicast LID. |
diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c index c963cad92f5a..6e9081380a27 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_main.c +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c | |||
| @@ -600,8 +600,7 @@ static enum i40iw_status_code i40iw_create_cqp(struct i40iw_device *iwdev) | |||
| 600 | cqp_init_info.scratch_array = cqp->scratch_array; | 600 | cqp_init_info.scratch_array = cqp->scratch_array; |
| 601 | status = dev->cqp_ops->cqp_init(dev->cqp, &cqp_init_info); | 601 | status = dev->cqp_ops->cqp_init(dev->cqp, &cqp_init_info); |
| 602 | if (status) { | 602 | if (status) { |
| 603 | i40iw_pr_err("cqp init status %d maj_err %d min_err %d\n", | 603 | i40iw_pr_err("cqp init status %d\n", status); |
| 604 | status, maj_err, min_err); | ||
| 605 | goto exit; | 604 | goto exit; |
| 606 | } | 605 | } |
| 607 | status = dev->cqp_ops->cqp_create(dev->cqp, true, &maj_err, &min_err); | 606 | status = dev->cqp_ops->cqp_create(dev->cqp, true, &maj_err, &min_err); |
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c index 33959ed14563..283b64c942ee 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c | |||
| @@ -1474,6 +1474,7 @@ static int i40iw_hw_alloc_stag(struct i40iw_device *iwdev, struct i40iw_mr *iwmr | |||
| 1474 | info->stag_idx = iwmr->stag >> I40IW_CQPSQ_STAG_IDX_SHIFT; | 1474 | info->stag_idx = iwmr->stag >> I40IW_CQPSQ_STAG_IDX_SHIFT; |
| 1475 | info->pd_id = iwpd->sc_pd.pd_id; | 1475 | info->pd_id = iwpd->sc_pd.pd_id; |
| 1476 | info->total_len = iwmr->length; | 1476 | info->total_len = iwmr->length; |
| 1477 | info->remote_access = true; | ||
| 1477 | cqp_info->cqp_cmd = OP_ALLOC_STAG; | 1478 | cqp_info->cqp_cmd = OP_ALLOC_STAG; |
| 1478 | cqp_info->post_sq = 1; | 1479 | cqp_info->post_sq = 1; |
| 1479 | cqp_info->in.u.alloc_stag.dev = &iwdev->sc_dev; | 1480 | cqp_info->in.u.alloc_stag.dev = &iwdev->sc_dev; |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 804dbcc37d3f..a529a4535457 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
| @@ -1031,17 +1031,17 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect | |||
| 1031 | 1031 | ||
| 1032 | case XTYPE_XBOXONE: | 1032 | case XTYPE_XBOXONE: |
| 1033 | packet->data[0] = 0x09; /* activate rumble */ | 1033 | packet->data[0] = 0x09; /* activate rumble */ |
| 1034 | packet->data[1] = 0x08; | 1034 | packet->data[1] = 0x00; |
| 1035 | packet->data[2] = xpad->odata_serial++; | 1035 | packet->data[2] = xpad->odata_serial++; |
| 1036 | packet->data[3] = 0x08; /* continuous effect */ | 1036 | packet->data[3] = 0x09; |
| 1037 | packet->data[4] = 0x00; /* simple rumble mode */ | 1037 | packet->data[4] = 0x00; |
| 1038 | packet->data[5] = 0x03; /* L and R actuator only */ | 1038 | packet->data[5] = 0x0F; |
| 1039 | packet->data[6] = 0x00; /* TODO: LT actuator */ | 1039 | packet->data[6] = 0x00; |
| 1040 | packet->data[7] = 0x00; /* TODO: RT actuator */ | 1040 | packet->data[7] = 0x00; |
| 1041 | packet->data[8] = strong / 512; /* left actuator */ | 1041 | packet->data[8] = strong / 512; /* left actuator */ |
| 1042 | packet->data[9] = weak / 512; /* right actuator */ | 1042 | packet->data[9] = weak / 512; /* right actuator */ |
| 1043 | packet->data[10] = 0x80; /* length of pulse */ | 1043 | packet->data[10] = 0xFF; |
| 1044 | packet->data[11] = 0x00; /* stop period of pulse */ | 1044 | packet->data[11] = 0x00; |
| 1045 | packet->data[12] = 0x00; | 1045 | packet->data[12] = 0x00; |
| 1046 | packet->len = 13; | 1046 | packet->len = 13; |
| 1047 | packet->pending = true; | 1047 | packet->pending = true; |
| @@ -1431,22 +1431,15 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
| 1431 | int ep_irq_in_idx; | 1431 | int ep_irq_in_idx; |
| 1432 | int i, error; | 1432 | int i, error; |
| 1433 | 1433 | ||
| 1434 | if (intf->cur_altsetting->desc.bNumEndpoints != 2) | ||
| 1435 | return -ENODEV; | ||
| 1436 | |||
| 1434 | for (i = 0; xpad_device[i].idVendor; i++) { | 1437 | for (i = 0; xpad_device[i].idVendor; i++) { |
| 1435 | if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && | 1438 | if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && |
| 1436 | (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) | 1439 | (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) |
| 1437 | break; | 1440 | break; |
| 1438 | } | 1441 | } |
| 1439 | 1442 | ||
| 1440 | if (xpad_device[i].xtype == XTYPE_XBOXONE && | ||
| 1441 | intf->cur_altsetting->desc.bInterfaceNumber != 0) { | ||
| 1442 | /* | ||
| 1443 | * The Xbox One controller lists three interfaces all with the | ||
| 1444 | * same interface class, subclass and protocol. Differentiate by | ||
| 1445 | * interface number. | ||
| 1446 | */ | ||
| 1447 | return -ENODEV; | ||
| 1448 | } | ||
| 1449 | |||
| 1450 | xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL); | 1443 | xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL); |
| 1451 | if (!xpad) | 1444 | if (!xpad) |
| 1452 | return -ENOMEM; | 1445 | return -ENOMEM; |
| @@ -1478,6 +1471,8 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
| 1478 | if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { | 1471 | if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { |
| 1479 | if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) | 1472 | if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) |
| 1480 | xpad->xtype = XTYPE_XBOX360W; | 1473 | xpad->xtype = XTYPE_XBOX360W; |
| 1474 | else if (intf->cur_altsetting->desc.bInterfaceProtocol == 208) | ||
| 1475 | xpad->xtype = XTYPE_XBOXONE; | ||
| 1481 | else | 1476 | else |
| 1482 | xpad->xtype = XTYPE_XBOX360; | 1477 | xpad->xtype = XTYPE_XBOX360; |
| 1483 | } else { | 1478 | } else { |
| @@ -1492,6 +1487,17 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
| 1492 | xpad->mapping |= MAP_STICKS_TO_NULL; | 1487 | xpad->mapping |= MAP_STICKS_TO_NULL; |
| 1493 | } | 1488 | } |
| 1494 | 1489 | ||
| 1490 | if (xpad->xtype == XTYPE_XBOXONE && | ||
| 1491 | intf->cur_altsetting->desc.bInterfaceNumber != 0) { | ||
| 1492 | /* | ||
| 1493 | * The Xbox One controller lists three interfaces all with the | ||
| 1494 | * same interface class, subclass and protocol. Differentiate by | ||
| 1495 | * interface number. | ||
| 1496 | */ | ||
| 1497 | error = -ENODEV; | ||
| 1498 | goto err_free_in_urb; | ||
| 1499 | } | ||
| 1500 | |||
| 1495 | error = xpad_init_output(intf, xpad); | 1501 | error = xpad_init_output(intf, xpad); |
| 1496 | if (error) | 1502 | if (error) |
| 1497 | goto err_free_in_urb; | 1503 | goto err_free_in_urb; |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 78f93cf68840..be5b399da5d3 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
| @@ -1568,13 +1568,7 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
| 1568 | case 5: | 1568 | case 5: |
| 1569 | etd->hw_version = 3; | 1569 | etd->hw_version = 3; |
| 1570 | break; | 1570 | break; |
| 1571 | case 6: | 1571 | case 6 ... 14: |
| 1572 | case 7: | ||
| 1573 | case 8: | ||
| 1574 | case 9: | ||
| 1575 | case 10: | ||
| 1576 | case 13: | ||
| 1577 | case 14: | ||
| 1578 | etd->hw_version = 4; | 1572 | etd->hw_version = 4; |
| 1579 | break; | 1573 | break; |
| 1580 | default: | 1574 | default: |
diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c index a3f0f5a47490..0f586780ceb4 100644 --- a/drivers/input/mouse/vmmouse.c +++ b/drivers/input/mouse/vmmouse.c | |||
| @@ -355,18 +355,11 @@ int vmmouse_detect(struct psmouse *psmouse, bool set_properties) | |||
| 355 | return -ENXIO; | 355 | return -ENXIO; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | if (!request_region(VMMOUSE_PROTO_PORT, 4, "vmmouse")) { | ||
| 359 | psmouse_dbg(psmouse, "VMMouse port in use.\n"); | ||
| 360 | return -EBUSY; | ||
| 361 | } | ||
| 362 | |||
| 363 | /* Check if the device is present */ | 358 | /* Check if the device is present */ |
| 364 | response = ~VMMOUSE_PROTO_MAGIC; | 359 | response = ~VMMOUSE_PROTO_MAGIC; |
| 365 | VMMOUSE_CMD(GETVERSION, 0, version, response, dummy1, dummy2); | 360 | VMMOUSE_CMD(GETVERSION, 0, version, response, dummy1, dummy2); |
| 366 | if (response != VMMOUSE_PROTO_MAGIC || version == 0xffffffffU) { | 361 | if (response != VMMOUSE_PROTO_MAGIC || version == 0xffffffffU) |
| 367 | release_region(VMMOUSE_PROTO_PORT, 4); | ||
| 368 | return -ENXIO; | 362 | return -ENXIO; |
| 369 | } | ||
| 370 | 363 | ||
| 371 | if (set_properties) { | 364 | if (set_properties) { |
| 372 | psmouse->vendor = VMMOUSE_VENDOR; | 365 | psmouse->vendor = VMMOUSE_VENDOR; |
| @@ -374,8 +367,6 @@ int vmmouse_detect(struct psmouse *psmouse, bool set_properties) | |||
| 374 | psmouse->model = version; | 367 | psmouse->model = version; |
| 375 | } | 368 | } |
| 376 | 369 | ||
| 377 | release_region(VMMOUSE_PROTO_PORT, 4); | ||
| 378 | |||
| 379 | return 0; | 370 | return 0; |
| 380 | } | 371 | } |
| 381 | 372 | ||
| @@ -394,7 +385,6 @@ static void vmmouse_disconnect(struct psmouse *psmouse) | |||
| 394 | psmouse_reset(psmouse); | 385 | psmouse_reset(psmouse); |
| 395 | input_unregister_device(priv->abs_dev); | 386 | input_unregister_device(priv->abs_dev); |
| 396 | kfree(priv); | 387 | kfree(priv); |
| 397 | release_region(VMMOUSE_PROTO_PORT, 4); | ||
| 398 | } | 388 | } |
| 399 | 389 | ||
| 400 | /** | 390 | /** |
| @@ -438,15 +428,10 @@ int vmmouse_init(struct psmouse *psmouse) | |||
| 438 | struct input_dev *rel_dev = psmouse->dev, *abs_dev; | 428 | struct input_dev *rel_dev = psmouse->dev, *abs_dev; |
| 439 | int error; | 429 | int error; |
| 440 | 430 | ||
| 441 | if (!request_region(VMMOUSE_PROTO_PORT, 4, "vmmouse")) { | ||
| 442 | psmouse_dbg(psmouse, "VMMouse port in use.\n"); | ||
| 443 | return -EBUSY; | ||
| 444 | } | ||
| 445 | |||
| 446 | psmouse_reset(psmouse); | 431 | psmouse_reset(psmouse); |
| 447 | error = vmmouse_enable(psmouse); | 432 | error = vmmouse_enable(psmouse); |
| 448 | if (error) | 433 | if (error) |
| 449 | goto release_region; | 434 | return error; |
| 450 | 435 | ||
| 451 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 436 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 452 | abs_dev = input_allocate_device(); | 437 | abs_dev = input_allocate_device(); |
| @@ -502,8 +487,5 @@ init_fail: | |||
| 502 | kfree(priv); | 487 | kfree(priv); |
| 503 | psmouse->private = NULL; | 488 | psmouse->private = NULL; |
| 504 | 489 | ||
| 505 | release_region: | ||
| 506 | release_region(VMMOUSE_PROTO_PORT, 4); | ||
| 507 | |||
| 508 | return error; | 490 | return error; |
| 509 | } | 491 | } |
diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index b368b0515c5a..253df96be427 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c | |||
| @@ -157,11 +157,11 @@ static int rmi_function_match(struct device *dev, struct device_driver *drv) | |||
| 157 | static void rmi_function_of_probe(struct rmi_function *fn) | 157 | static void rmi_function_of_probe(struct rmi_function *fn) |
| 158 | { | 158 | { |
| 159 | char of_name[9]; | 159 | char of_name[9]; |
| 160 | struct device_node *node = fn->rmi_dev->xport->dev->of_node; | ||
| 160 | 161 | ||
| 161 | snprintf(of_name, sizeof(of_name), "rmi4-f%02x", | 162 | snprintf(of_name, sizeof(of_name), "rmi4-f%02x", |
| 162 | fn->fd.function_number); | 163 | fn->fd.function_number); |
| 163 | fn->dev.of_node = of_find_node_by_name( | 164 | fn->dev.of_node = of_get_child_by_name(node, of_name); |
| 164 | fn->rmi_dev->xport->dev->of_node, of_name); | ||
| 165 | } | 165 | } |
| 166 | #else | 166 | #else |
| 167 | static inline void rmi_function_of_probe(struct rmi_function *fn) | 167 | static inline void rmi_function_of_probe(struct rmi_function *fn) |
diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index 8dd3fb5e1f94..88e91559c84e 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c | |||
| @@ -66,7 +66,7 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12) | |||
| 66 | struct rmi_device *rmi_dev = fn->rmi_dev; | 66 | struct rmi_device *rmi_dev = fn->rmi_dev; |
| 67 | int ret; | 67 | int ret; |
| 68 | int offset; | 68 | int offset; |
| 69 | u8 buf[14]; | 69 | u8 buf[15]; |
| 70 | int pitch_x = 0; | 70 | int pitch_x = 0; |
| 71 | int pitch_y = 0; | 71 | int pitch_y = 0; |
| 72 | int clip_x_low = 0; | 72 | int clip_x_low = 0; |
| @@ -86,9 +86,10 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12) | |||
| 86 | 86 | ||
| 87 | offset = rmi_register_desc_calc_reg_offset(&f12->control_reg_desc, 8); | 87 | offset = rmi_register_desc_calc_reg_offset(&f12->control_reg_desc, 8); |
| 88 | 88 | ||
| 89 | if (item->reg_size > 14) { | 89 | if (item->reg_size > sizeof(buf)) { |
| 90 | dev_err(&fn->dev, "F12 control8 should be 14 bytes, not: %ld\n", | 90 | dev_err(&fn->dev, |
| 91 | item->reg_size); | 91 | "F12 control8 should be no bigger than %zd bytes, not: %ld\n", |
| 92 | sizeof(buf), item->reg_size); | ||
| 92 | return -ENODEV; | 93 | return -ENODEV; |
| 93 | } | 94 | } |
| 94 | 95 | ||
diff --git a/drivers/input/touchscreen/ts4800-ts.c b/drivers/input/touchscreen/ts4800-ts.c index 3c3dd78303be..fed73eeb47b3 100644 --- a/drivers/input/touchscreen/ts4800-ts.c +++ b/drivers/input/touchscreen/ts4800-ts.c | |||
| @@ -118,6 +118,13 @@ static int ts4800_parse_dt(struct platform_device *pdev, | |||
| 118 | return -ENODEV; | 118 | return -ENODEV; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | ts->regmap = syscon_node_to_regmap(syscon_np); | ||
| 122 | of_node_put(syscon_np); | ||
| 123 | if (IS_ERR(ts->regmap)) { | ||
| 124 | dev_err(dev, "cannot get parent's regmap\n"); | ||
| 125 | return PTR_ERR(ts->regmap); | ||
| 126 | } | ||
| 127 | |||
| 121 | error = of_property_read_u32_index(np, "syscon", 1, ®); | 128 | error = of_property_read_u32_index(np, "syscon", 1, ®); |
| 122 | if (error < 0) { | 129 | if (error < 0) { |
| 123 | dev_err(dev, "no offset in syscon\n"); | 130 | dev_err(dev, "no offset in syscon\n"); |
| @@ -134,12 +141,6 @@ static int ts4800_parse_dt(struct platform_device *pdev, | |||
| 134 | 141 | ||
| 135 | ts->bit = BIT(bit); | 142 | ts->bit = BIT(bit); |
| 136 | 143 | ||
| 137 | ts->regmap = syscon_node_to_regmap(syscon_np); | ||
| 138 | if (IS_ERR(ts->regmap)) { | ||
| 139 | dev_err(dev, "cannot get parent's regmap\n"); | ||
| 140 | return PTR_ERR(ts->regmap); | ||
| 141 | } | ||
| 142 | |||
| 143 | return 0; | 144 | return 0; |
| 144 | } | 145 | } |
| 145 | 146 | ||
diff --git a/drivers/input/touchscreen/tsc2004.c b/drivers/input/touchscreen/tsc2004.c index 7295c198aa08..6fe55d598fac 100644 --- a/drivers/input/touchscreen/tsc2004.c +++ b/drivers/input/touchscreen/tsc2004.c | |||
| @@ -22,6 +22,11 @@ | |||
| 22 | #include <linux/regmap.h> | 22 | #include <linux/regmap.h> |
| 23 | #include "tsc200x-core.h" | 23 | #include "tsc200x-core.h" |
| 24 | 24 | ||
| 25 | static const struct input_id tsc2004_input_id = { | ||
| 26 | .bustype = BUS_I2C, | ||
| 27 | .product = 2004, | ||
| 28 | }; | ||
| 29 | |||
| 25 | static int tsc2004_cmd(struct device *dev, u8 cmd) | 30 | static int tsc2004_cmd(struct device *dev, u8 cmd) |
| 26 | { | 31 | { |
| 27 | u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; | 32 | u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; |
| @@ -42,7 +47,7 @@ static int tsc2004_probe(struct i2c_client *i2c, | |||
| 42 | const struct i2c_device_id *id) | 47 | const struct i2c_device_id *id) |
| 43 | 48 | ||
| 44 | { | 49 | { |
| 45 | return tsc200x_probe(&i2c->dev, i2c->irq, BUS_I2C, | 50 | return tsc200x_probe(&i2c->dev, i2c->irq, &tsc2004_input_id, |
| 46 | devm_regmap_init_i2c(i2c, &tsc200x_regmap_config), | 51 | devm_regmap_init_i2c(i2c, &tsc200x_regmap_config), |
| 47 | tsc2004_cmd); | 52 | tsc2004_cmd); |
| 48 | } | 53 | } |
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index b9f593dfd2ef..f2c5f0e47f77 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c | |||
| @@ -24,6 +24,11 @@ | |||
| 24 | #include <linux/regmap.h> | 24 | #include <linux/regmap.h> |
| 25 | #include "tsc200x-core.h" | 25 | #include "tsc200x-core.h" |
| 26 | 26 | ||
| 27 | static const struct input_id tsc2005_input_id = { | ||
| 28 | .bustype = BUS_SPI, | ||
| 29 | .product = 2005, | ||
| 30 | }; | ||
| 31 | |||
| 27 | static int tsc2005_cmd(struct device *dev, u8 cmd) | 32 | static int tsc2005_cmd(struct device *dev, u8 cmd) |
| 28 | { | 33 | { |
| 29 | u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; | 34 | u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; |
| @@ -62,7 +67,7 @@ static int tsc2005_probe(struct spi_device *spi) | |||
| 62 | if (error) | 67 | if (error) |
| 63 | return error; | 68 | return error; |
| 64 | 69 | ||
| 65 | return tsc200x_probe(&spi->dev, spi->irq, BUS_SPI, | 70 | return tsc200x_probe(&spi->dev, spi->irq, &tsc2005_input_id, |
| 66 | devm_regmap_init_spi(spi, &tsc200x_regmap_config), | 71 | devm_regmap_init_spi(spi, &tsc200x_regmap_config), |
| 67 | tsc2005_cmd); | 72 | tsc2005_cmd); |
| 68 | } | 73 | } |
diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c index 15240c1ee850..dfa7f1c4f545 100644 --- a/drivers/input/touchscreen/tsc200x-core.c +++ b/drivers/input/touchscreen/tsc200x-core.c | |||
| @@ -450,7 +450,7 @@ static void tsc200x_close(struct input_dev *input) | |||
| 450 | mutex_unlock(&ts->mutex); | 450 | mutex_unlock(&ts->mutex); |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | int tsc200x_probe(struct device *dev, int irq, __u16 bustype, | 453 | int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, |
| 454 | struct regmap *regmap, | 454 | struct regmap *regmap, |
| 455 | int (*tsc200x_cmd)(struct device *dev, u8 cmd)) | 455 | int (*tsc200x_cmd)(struct device *dev, u8 cmd)) |
| 456 | { | 456 | { |
| @@ -547,9 +547,18 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype, | |||
| 547 | snprintf(ts->phys, sizeof(ts->phys), | 547 | snprintf(ts->phys, sizeof(ts->phys), |
| 548 | "%s/input-ts", dev_name(dev)); | 548 | "%s/input-ts", dev_name(dev)); |
| 549 | 549 | ||
| 550 | input_dev->name = "TSC200X touchscreen"; | 550 | if (tsc_id->product == 2004) { |
| 551 | input_dev->name = "TSC200X touchscreen"; | ||
| 552 | } else { | ||
| 553 | input_dev->name = devm_kasprintf(dev, GFP_KERNEL, | ||
| 554 | "TSC%04d touchscreen", | ||
| 555 | tsc_id->product); | ||
| 556 | if (!input_dev->name) | ||
| 557 | return -ENOMEM; | ||
| 558 | } | ||
| 559 | |||
| 551 | input_dev->phys = ts->phys; | 560 | input_dev->phys = ts->phys; |
| 552 | input_dev->id.bustype = bustype; | 561 | input_dev->id = *tsc_id; |
| 553 | input_dev->dev.parent = dev; | 562 | input_dev->dev.parent = dev; |
| 554 | input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); | 563 | input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); |
| 555 | input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | 564 | input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); |
diff --git a/drivers/input/touchscreen/tsc200x-core.h b/drivers/input/touchscreen/tsc200x-core.h index 7a482d102614..49a63a3c6840 100644 --- a/drivers/input/touchscreen/tsc200x-core.h +++ b/drivers/input/touchscreen/tsc200x-core.h | |||
| @@ -70,7 +70,7 @@ | |||
| 70 | extern const struct regmap_config tsc200x_regmap_config; | 70 | extern const struct regmap_config tsc200x_regmap_config; |
| 71 | extern const struct dev_pm_ops tsc200x_pm_ops; | 71 | extern const struct dev_pm_ops tsc200x_pm_ops; |
| 72 | 72 | ||
| 73 | int tsc200x_probe(struct device *dev, int irq, __u16 bustype, | 73 | int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, |
| 74 | struct regmap *regmap, | 74 | struct regmap *regmap, |
| 75 | int (*tsc200x_cmd)(struct device *dev, u8 cmd)); | 75 | int (*tsc200x_cmd)(struct device *dev, u8 cmd)); |
| 76 | int tsc200x_remove(struct device *dev); | 76 | int tsc200x_remove(struct device *dev); |
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index bab3c6acf6a2..b6fc4bde79de 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c | |||
| @@ -27,7 +27,7 @@ MODULE_AUTHOR("Jaya Kumar <jayakumar.lkml@gmail.com>"); | |||
| 27 | MODULE_DESCRIPTION(DRIVER_DESC); | 27 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 28 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
| 29 | 29 | ||
| 30 | #define W8001_MAX_LENGTH 11 | 30 | #define W8001_MAX_LENGTH 13 |
| 31 | #define W8001_LEAD_MASK 0x80 | 31 | #define W8001_LEAD_MASK 0x80 |
| 32 | #define W8001_LEAD_BYTE 0x80 | 32 | #define W8001_LEAD_BYTE 0x80 |
| 33 | #define W8001_TAB_MASK 0x40 | 33 | #define W8001_TAB_MASK 0x40 |
| @@ -155,6 +155,7 @@ static void parse_multi_touch(struct w8001 *w8001) | |||
| 155 | bool touch = data[0] & (1 << i); | 155 | bool touch = data[0] & (1 << i); |
| 156 | 156 | ||
| 157 | input_mt_slot(dev, i); | 157 | input_mt_slot(dev, i); |
| 158 | input_mt_report_slot_state(dev, MT_TOOL_FINGER, touch); | ||
| 158 | if (touch) { | 159 | if (touch) { |
| 159 | x = (data[6 * i + 1] << 7) | data[6 * i + 2]; | 160 | x = (data[6 * i + 1] << 7) | data[6 * i + 2]; |
| 160 | y = (data[6 * i + 3] << 7) | data[6 * i + 4]; | 161 | y = (data[6 * i + 3] << 7) | data[6 * i + 4]; |
| @@ -339,6 +340,15 @@ static irqreturn_t w8001_interrupt(struct serio *serio, | |||
| 339 | w8001->idx = 0; | 340 | w8001->idx = 0; |
| 340 | parse_multi_touch(w8001); | 341 | parse_multi_touch(w8001); |
| 341 | break; | 342 | break; |
| 343 | |||
| 344 | default: | ||
| 345 | /* | ||
| 346 | * ThinkPad X60 Tablet PC (pen only device) sometimes | ||
| 347 | * sends invalid data packets that are larger than | ||
| 348 | * W8001_PKTLEN_TPCPEN. Let's start over again. | ||
| 349 | */ | ||
| 350 | if (!w8001->touch_dev && w8001->idx > W8001_PKTLEN_TPCPEN - 1) | ||
| 351 | w8001->idx = 0; | ||
| 342 | } | 352 | } |
| 343 | 353 | ||
| 344 | return IRQ_HANDLED; | 354 | return IRQ_HANDLED; |
| @@ -513,6 +523,8 @@ static int w8001_setup_touch(struct w8001 *w8001, char *basename, | |||
| 513 | 0, touch.x, 0, 0); | 523 | 0, touch.x, 0, 0); |
| 514 | input_set_abs_params(dev, ABS_MT_POSITION_Y, | 524 | input_set_abs_params(dev, ABS_MT_POSITION_Y, |
| 515 | 0, touch.y, 0, 0); | 525 | 0, touch.y, 0, 0); |
| 526 | input_set_abs_params(dev, ABS_MT_TOOL_TYPE, | ||
| 527 | 0, MT_TOOL_MAX, 0, 0); | ||
| 516 | 528 | ||
| 517 | strlcat(basename, " 2FG", basename_sz); | 529 | strlcat(basename, " 2FG", basename_sz); |
| 518 | if (w8001->max_pen_x && w8001->max_pen_y) | 530 | if (w8001->max_pen_x && w8001->max_pen_y) |
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 9e0034196e10..59741ead7e15 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
| @@ -1107,13 +1107,13 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, | |||
| 1107 | break; | 1107 | break; |
| 1108 | } | 1108 | } |
| 1109 | 1109 | ||
| 1110 | devid = e->devid; | ||
| 1110 | DUMP_printk(" DEV_ACPI_HID(%s[%s])\t\tdevid: %02x:%02x.%x\n", | 1111 | DUMP_printk(" DEV_ACPI_HID(%s[%s])\t\tdevid: %02x:%02x.%x\n", |
| 1111 | hid, uid, | 1112 | hid, uid, |
| 1112 | PCI_BUS_NUM(devid), | 1113 | PCI_BUS_NUM(devid), |
| 1113 | PCI_SLOT(devid), | 1114 | PCI_SLOT(devid), |
| 1114 | PCI_FUNC(devid)); | 1115 | PCI_FUNC(devid)); |
| 1115 | 1116 | ||
| 1116 | devid = e->devid; | ||
| 1117 | flags = e->flags; | 1117 | flags = e->flags; |
| 1118 | 1118 | ||
| 1119 | ret = add_acpi_hid_device(hid, uid, &devid, false); | 1119 | ret = add_acpi_hid_device(hid, uid, &devid, false); |
| @@ -1568,13 +1568,23 @@ static int __init amd_iommu_init_pci(void) | |||
| 1568 | break; | 1568 | break; |
| 1569 | } | 1569 | } |
| 1570 | 1570 | ||
| 1571 | /* | ||
| 1572 | * Order is important here to make sure any unity map requirements are | ||
| 1573 | * fulfilled. The unity mappings are created and written to the device | ||
| 1574 | * table during the amd_iommu_init_api() call. | ||
| 1575 | * | ||
| 1576 | * After that we call init_device_table_dma() to make sure any | ||
| 1577 | * uninitialized DTE will block DMA, and in the end we flush the caches | ||
| 1578 | * of all IOMMUs to make sure the changes to the device table are | ||
| 1579 | * active. | ||
| 1580 | */ | ||
| 1581 | ret = amd_iommu_init_api(); | ||
| 1582 | |||
| 1571 | init_device_table_dma(); | 1583 | init_device_table_dma(); |
| 1572 | 1584 | ||
| 1573 | for_each_iommu(iommu) | 1585 | for_each_iommu(iommu) |
| 1574 | iommu_flush_all_caches(iommu); | 1586 | iommu_flush_all_caches(iommu); |
| 1575 | 1587 | ||
| 1576 | ret = amd_iommu_init_api(); | ||
| 1577 | |||
| 1578 | if (!ret) | 1588 | if (!ret) |
| 1579 | print_iommu_info(); | 1589 | print_iommu_info(); |
| 1580 | 1590 | ||
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 10700945994e..323dac9900ba 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -4602,13 +4602,13 @@ static void free_all_cpu_cached_iovas(unsigned int cpu) | |||
| 4602 | for (i = 0; i < g_num_of_iommus; i++) { | 4602 | for (i = 0; i < g_num_of_iommus; i++) { |
| 4603 | struct intel_iommu *iommu = g_iommus[i]; | 4603 | struct intel_iommu *iommu = g_iommus[i]; |
| 4604 | struct dmar_domain *domain; | 4604 | struct dmar_domain *domain; |
| 4605 | u16 did; | 4605 | int did; |
| 4606 | 4606 | ||
| 4607 | if (!iommu) | 4607 | if (!iommu) |
| 4608 | continue; | 4608 | continue; |
| 4609 | 4609 | ||
| 4610 | for (did = 0; did < 0xffff; did++) { | 4610 | for (did = 0; did < cap_ndoms(iommu->cap); did++) { |
| 4611 | domain = get_iommu_domain(iommu, did); | 4611 | domain = get_iommu_domain(iommu, (u16)did); |
| 4612 | 4612 | ||
| 4613 | if (!domain) | 4613 | if (!domain) |
| 4614 | continue; | 4614 | continue; |
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index ba764a0835d3..e23001bfcfee 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c | |||
| @@ -420,8 +420,10 @@ retry: | |||
| 420 | 420 | ||
| 421 | /* Try replenishing IOVAs by flushing rcache. */ | 421 | /* Try replenishing IOVAs by flushing rcache. */ |
| 422 | flushed_rcache = true; | 422 | flushed_rcache = true; |
| 423 | preempt_disable(); | ||
| 423 | for_each_online_cpu(cpu) | 424 | for_each_online_cpu(cpu) |
| 424 | free_cpu_cached_iovas(cpu, iovad); | 425 | free_cpu_cached_iovas(cpu, iovad); |
| 426 | preempt_enable(); | ||
| 425 | goto retry; | 427 | goto retry; |
| 426 | } | 428 | } |
| 427 | 429 | ||
| @@ -749,7 +751,7 @@ static bool __iova_rcache_insert(struct iova_domain *iovad, | |||
| 749 | bool can_insert = false; | 751 | bool can_insert = false; |
| 750 | unsigned long flags; | 752 | unsigned long flags; |
| 751 | 753 | ||
| 752 | cpu_rcache = this_cpu_ptr(rcache->cpu_rcaches); | 754 | cpu_rcache = get_cpu_ptr(rcache->cpu_rcaches); |
| 753 | spin_lock_irqsave(&cpu_rcache->lock, flags); | 755 | spin_lock_irqsave(&cpu_rcache->lock, flags); |
| 754 | 756 | ||
| 755 | if (!iova_magazine_full(cpu_rcache->loaded)) { | 757 | if (!iova_magazine_full(cpu_rcache->loaded)) { |
| @@ -779,6 +781,7 @@ static bool __iova_rcache_insert(struct iova_domain *iovad, | |||
| 779 | iova_magazine_push(cpu_rcache->loaded, iova_pfn); | 781 | iova_magazine_push(cpu_rcache->loaded, iova_pfn); |
| 780 | 782 | ||
| 781 | spin_unlock_irqrestore(&cpu_rcache->lock, flags); | 783 | spin_unlock_irqrestore(&cpu_rcache->lock, flags); |
| 784 | put_cpu_ptr(rcache->cpu_rcaches); | ||
| 782 | 785 | ||
| 783 | if (mag_to_free) { | 786 | if (mag_to_free) { |
| 784 | iova_magazine_free_pfns(mag_to_free, iovad); | 787 | iova_magazine_free_pfns(mag_to_free, iovad); |
| @@ -812,7 +815,7 @@ static unsigned long __iova_rcache_get(struct iova_rcache *rcache, | |||
| 812 | bool has_pfn = false; | 815 | bool has_pfn = false; |
| 813 | unsigned long flags; | 816 | unsigned long flags; |
| 814 | 817 | ||
| 815 | cpu_rcache = this_cpu_ptr(rcache->cpu_rcaches); | 818 | cpu_rcache = get_cpu_ptr(rcache->cpu_rcaches); |
| 816 | spin_lock_irqsave(&cpu_rcache->lock, flags); | 819 | spin_lock_irqsave(&cpu_rcache->lock, flags); |
| 817 | 820 | ||
| 818 | if (!iova_magazine_empty(cpu_rcache->loaded)) { | 821 | if (!iova_magazine_empty(cpu_rcache->loaded)) { |
| @@ -834,6 +837,7 @@ static unsigned long __iova_rcache_get(struct iova_rcache *rcache, | |||
| 834 | iova_pfn = iova_magazine_pop(cpu_rcache->loaded, limit_pfn); | 837 | iova_pfn = iova_magazine_pop(cpu_rcache->loaded, limit_pfn); |
| 835 | 838 | ||
| 836 | spin_unlock_irqrestore(&cpu_rcache->lock, flags); | 839 | spin_unlock_irqrestore(&cpu_rcache->lock, flags); |
| 840 | put_cpu_ptr(rcache->cpu_rcaches); | ||
| 837 | 841 | ||
| 838 | return iova_pfn; | 842 | return iova_pfn; |
| 839 | } | 843 | } |
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index 8a4adbeb2b8c..70ed1d0151b8 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c | |||
| @@ -718,7 +718,7 @@ static int gic_shared_irq_domain_map(struct irq_domain *d, unsigned int virq, | |||
| 718 | 718 | ||
| 719 | spin_lock_irqsave(&gic_lock, flags); | 719 | spin_lock_irqsave(&gic_lock, flags); |
| 720 | gic_map_to_pin(intr, gic_cpu_pin); | 720 | gic_map_to_pin(intr, gic_cpu_pin); |
| 721 | gic_map_to_vpe(intr, vpe); | 721 | gic_map_to_vpe(intr, mips_cm_vp_id(vpe)); |
| 722 | for (i = 0; i < min(gic_vpes, NR_CPUS); i++) | 722 | for (i = 0; i < min(gic_vpes, NR_CPUS); i++) |
| 723 | clear_bit(intr, pcpu_masks[i].pcpu_mask); | 723 | clear_bit(intr, pcpu_masks[i].pcpu_mask); |
| 724 | set_bit(intr, pcpu_masks[vpe].pcpu_mask); | 724 | set_bit(intr, pcpu_masks[vpe].pcpu_mask); |
| @@ -959,7 +959,7 @@ int gic_ipi_domain_match(struct irq_domain *d, struct device_node *node, | |||
| 959 | switch (bus_token) { | 959 | switch (bus_token) { |
| 960 | case DOMAIN_BUS_IPI: | 960 | case DOMAIN_BUS_IPI: |
| 961 | is_ipi = d->bus_token == bus_token; | 961 | is_ipi = d->bus_token == bus_token; |
| 962 | return to_of_node(d->fwnode) == node && is_ipi; | 962 | return (!node || to_of_node(d->fwnode) == node) && is_ipi; |
| 963 | break; | 963 | break; |
| 964 | default: | 964 | default: |
| 965 | return 0; | 965 | return 0; |
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index beb2841ceae5..3f1ab4986cfc 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
| @@ -779,11 +779,31 @@ static const struct v4l2_dv_timings_cap adv76xx_timings_cap_digital = { | |||
| 779 | V4L2_DV_BT_CAP_CUSTOM) | 779 | V4L2_DV_BT_CAP_CUSTOM) |
| 780 | }; | 780 | }; |
| 781 | 781 | ||
| 782 | static inline const struct v4l2_dv_timings_cap * | 782 | /* |
| 783 | adv76xx_get_dv_timings_cap(struct v4l2_subdev *sd) | 783 | * Return the DV timings capabilities for the requested sink pad. As a special |
| 784 | * case, pad value -1 returns the capabilities for the currently selected input. | ||
| 785 | */ | ||
| 786 | static const struct v4l2_dv_timings_cap * | ||
| 787 | adv76xx_get_dv_timings_cap(struct v4l2_subdev *sd, int pad) | ||
| 784 | { | 788 | { |
| 785 | return is_digital_input(sd) ? &adv76xx_timings_cap_digital : | 789 | if (pad == -1) { |
| 786 | &adv7604_timings_cap_analog; | 790 | struct adv76xx_state *state = to_state(sd); |
| 791 | |||
| 792 | pad = state->selected_input; | ||
| 793 | } | ||
| 794 | |||
| 795 | switch (pad) { | ||
| 796 | case ADV76XX_PAD_HDMI_PORT_A: | ||
| 797 | case ADV7604_PAD_HDMI_PORT_B: | ||
| 798 | case ADV7604_PAD_HDMI_PORT_C: | ||
| 799 | case ADV7604_PAD_HDMI_PORT_D: | ||
| 800 | return &adv76xx_timings_cap_digital; | ||
| 801 | |||
| 802 | case ADV7604_PAD_VGA_RGB: | ||
| 803 | case ADV7604_PAD_VGA_COMP: | ||
| 804 | default: | ||
| 805 | return &adv7604_timings_cap_analog; | ||
| 806 | } | ||
| 787 | } | 807 | } |
| 788 | 808 | ||
| 789 | 809 | ||
| @@ -1329,7 +1349,7 @@ static int stdi2dv_timings(struct v4l2_subdev *sd, | |||
| 1329 | const struct v4l2_bt_timings *bt = &v4l2_dv_timings_presets[i].bt; | 1349 | const struct v4l2_bt_timings *bt = &v4l2_dv_timings_presets[i].bt; |
| 1330 | 1350 | ||
| 1331 | if (!v4l2_valid_dv_timings(&v4l2_dv_timings_presets[i], | 1351 | if (!v4l2_valid_dv_timings(&v4l2_dv_timings_presets[i], |
| 1332 | adv76xx_get_dv_timings_cap(sd), | 1352 | adv76xx_get_dv_timings_cap(sd, -1), |
| 1333 | adv76xx_check_dv_timings, NULL)) | 1353 | adv76xx_check_dv_timings, NULL)) |
| 1334 | continue; | 1354 | continue; |
| 1335 | if (vtotal(bt) != stdi->lcf + 1) | 1355 | if (vtotal(bt) != stdi->lcf + 1) |
| @@ -1430,18 +1450,22 @@ static int adv76xx_enum_dv_timings(struct v4l2_subdev *sd, | |||
| 1430 | return -EINVAL; | 1450 | return -EINVAL; |
| 1431 | 1451 | ||
| 1432 | return v4l2_enum_dv_timings_cap(timings, | 1452 | return v4l2_enum_dv_timings_cap(timings, |
| 1433 | adv76xx_get_dv_timings_cap(sd), adv76xx_check_dv_timings, NULL); | 1453 | adv76xx_get_dv_timings_cap(sd, timings->pad), |
| 1454 | adv76xx_check_dv_timings, NULL); | ||
| 1434 | } | 1455 | } |
| 1435 | 1456 | ||
| 1436 | static int adv76xx_dv_timings_cap(struct v4l2_subdev *sd, | 1457 | static int adv76xx_dv_timings_cap(struct v4l2_subdev *sd, |
| 1437 | struct v4l2_dv_timings_cap *cap) | 1458 | struct v4l2_dv_timings_cap *cap) |
| 1438 | { | 1459 | { |
| 1439 | struct adv76xx_state *state = to_state(sd); | 1460 | struct adv76xx_state *state = to_state(sd); |
| 1461 | unsigned int pad = cap->pad; | ||
| 1440 | 1462 | ||
| 1441 | if (cap->pad >= state->source_pad) | 1463 | if (cap->pad >= state->source_pad) |
| 1442 | return -EINVAL; | 1464 | return -EINVAL; |
| 1443 | 1465 | ||
| 1444 | *cap = *adv76xx_get_dv_timings_cap(sd); | 1466 | *cap = *adv76xx_get_dv_timings_cap(sd, pad); |
| 1467 | cap->pad = pad; | ||
| 1468 | |||
| 1445 | return 0; | 1469 | return 0; |
| 1446 | } | 1470 | } |
| 1447 | 1471 | ||
| @@ -1450,9 +1474,9 @@ static int adv76xx_dv_timings_cap(struct v4l2_subdev *sd, | |||
| 1450 | static void adv76xx_fill_optional_dv_timings_fields(struct v4l2_subdev *sd, | 1474 | static void adv76xx_fill_optional_dv_timings_fields(struct v4l2_subdev *sd, |
| 1451 | struct v4l2_dv_timings *timings) | 1475 | struct v4l2_dv_timings *timings) |
| 1452 | { | 1476 | { |
| 1453 | v4l2_find_dv_timings_cap(timings, adv76xx_get_dv_timings_cap(sd), | 1477 | v4l2_find_dv_timings_cap(timings, adv76xx_get_dv_timings_cap(sd, -1), |
| 1454 | is_digital_input(sd) ? 250000 : 1000000, | 1478 | is_digital_input(sd) ? 250000 : 1000000, |
| 1455 | adv76xx_check_dv_timings, NULL); | 1479 | adv76xx_check_dv_timings, NULL); |
| 1456 | } | 1480 | } |
| 1457 | 1481 | ||
| 1458 | static unsigned int adv7604_read_hdmi_pixelclock(struct v4l2_subdev *sd) | 1482 | static unsigned int adv7604_read_hdmi_pixelclock(struct v4l2_subdev *sd) |
| @@ -1620,7 +1644,7 @@ static int adv76xx_s_dv_timings(struct v4l2_subdev *sd, | |||
| 1620 | 1644 | ||
| 1621 | bt = &timings->bt; | 1645 | bt = &timings->bt; |
| 1622 | 1646 | ||
| 1623 | if (!v4l2_valid_dv_timings(timings, adv76xx_get_dv_timings_cap(sd), | 1647 | if (!v4l2_valid_dv_timings(timings, adv76xx_get_dv_timings_cap(sd, -1), |
| 1624 | adv76xx_check_dv_timings, NULL)) | 1648 | adv76xx_check_dv_timings, NULL)) |
| 1625 | return -ERANGE; | 1649 | return -ERANGE; |
| 1626 | 1650 | ||
diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c index 87c12930416f..92d9d4214c3a 100644 --- a/drivers/media/usb/airspy/airspy.c +++ b/drivers/media/usb/airspy/airspy.c | |||
| @@ -1072,7 +1072,7 @@ static int airspy_probe(struct usb_interface *intf, | |||
| 1072 | if (ret) { | 1072 | if (ret) { |
| 1073 | dev_err(s->dev, "Failed to register as video device (%d)\n", | 1073 | dev_err(s->dev, "Failed to register as video device (%d)\n", |
| 1074 | ret); | 1074 | ret); |
| 1075 | goto err_unregister_v4l2_dev; | 1075 | goto err_free_controls; |
| 1076 | } | 1076 | } |
| 1077 | dev_info(s->dev, "Registered as %s\n", | 1077 | dev_info(s->dev, "Registered as %s\n", |
| 1078 | video_device_node_name(&s->vdev)); | 1078 | video_device_node_name(&s->vdev)); |
| @@ -1081,7 +1081,6 @@ static int airspy_probe(struct usb_interface *intf, | |||
| 1081 | 1081 | ||
| 1082 | err_free_controls: | 1082 | err_free_controls: |
| 1083 | v4l2_ctrl_handler_free(&s->hdl); | 1083 | v4l2_ctrl_handler_free(&s->hdl); |
| 1084 | err_unregister_v4l2_dev: | ||
| 1085 | v4l2_device_unregister(&s->v4l2_dev); | 1084 | v4l2_device_unregister(&s->v4l2_dev); |
| 1086 | err_free_mem: | 1085 | err_free_mem: |
| 1087 | kfree(s); | 1086 | kfree(s); |
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 28e5be2c2eef..528390f33b53 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | |||
| @@ -2171,7 +2171,7 @@ static int v4l_cropcap(const struct v4l2_ioctl_ops *ops, | |||
| 2171 | * The determine_valid_ioctls() call already should ensure | 2171 | * The determine_valid_ioctls() call already should ensure |
| 2172 | * that this can never happen, but just in case... | 2172 | * that this can never happen, but just in case... |
| 2173 | */ | 2173 | */ |
| 2174 | if (WARN_ON(!ops->vidioc_cropcap && !ops->vidioc_cropcap)) | 2174 | if (WARN_ON(!ops->vidioc_cropcap && !ops->vidioc_g_selection)) |
| 2175 | return -ENOTTY; | 2175 | return -ENOTTY; |
| 2176 | 2176 | ||
| 2177 | if (ops->vidioc_cropcap) | 2177 | if (ops->vidioc_cropcap) |
diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c index 199d261990be..f32fbb8e8129 100644 --- a/drivers/mfd/max77620.c +++ b/drivers/mfd/max77620.c | |||
| @@ -203,6 +203,7 @@ static int max77620_get_fps_period_reg_value(struct max77620_chip *chip, | |||
| 203 | break; | 203 | break; |
| 204 | case MAX77620: | 204 | case MAX77620: |
| 205 | fps_min_period = MAX77620_FPS_PERIOD_MIN_US; | 205 | fps_min_period = MAX77620_FPS_PERIOD_MIN_US; |
| 206 | break; | ||
| 206 | default: | 207 | default: |
| 207 | return -EINVAL; | 208 | return -EINVAL; |
| 208 | } | 209 | } |
| @@ -236,6 +237,7 @@ static int max77620_config_fps(struct max77620_chip *chip, | |||
| 236 | break; | 237 | break; |
| 237 | case MAX77620: | 238 | case MAX77620: |
| 238 | fps_max_period = MAX77620_FPS_PERIOD_MAX_US; | 239 | fps_max_period = MAX77620_FPS_PERIOD_MAX_US; |
| 240 | break; | ||
| 239 | default: | 241 | default: |
| 240 | return -EINVAL; | 242 | return -EINVAL; |
| 241 | } | 243 | } |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index e62fde3ac431..c5472e3c9231 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
| @@ -355,8 +355,10 @@ static struct mmc_blk_ioc_data *mmc_blk_ioctl_copy_from_user( | |||
| 355 | goto idata_err; | 355 | goto idata_err; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | if (!idata->buf_bytes) | 358 | if (!idata->buf_bytes) { |
| 359 | idata->buf = NULL; | ||
| 359 | return idata; | 360 | return idata; |
| 361 | } | ||
| 360 | 362 | ||
| 361 | idata->buf = kmalloc(idata->buf_bytes, GFP_KERNEL); | 363 | idata->buf = kmalloc(idata->buf_bytes, GFP_KERNEL); |
| 362 | if (!idata->buf) { | 364 | if (!idata->buf) { |
| @@ -1786,8 +1788,8 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, | |||
| 1786 | 1788 | ||
| 1787 | packed_cmd_hdr = packed->cmd_hdr; | 1789 | packed_cmd_hdr = packed->cmd_hdr; |
| 1788 | memset(packed_cmd_hdr, 0, sizeof(packed->cmd_hdr)); | 1790 | memset(packed_cmd_hdr, 0, sizeof(packed->cmd_hdr)); |
| 1789 | packed_cmd_hdr[0] = (packed->nr_entries << 16) | | 1791 | packed_cmd_hdr[0] = cpu_to_le32((packed->nr_entries << 16) | |
| 1790 | (PACKED_CMD_WR << 8) | PACKED_CMD_VER; | 1792 | (PACKED_CMD_WR << 8) | PACKED_CMD_VER); |
| 1791 | hdr_blocks = mmc_large_sector(card) ? 8 : 1; | 1793 | hdr_blocks = mmc_large_sector(card) ? 8 : 1; |
| 1792 | 1794 | ||
| 1793 | /* | 1795 | /* |
| @@ -1801,14 +1803,14 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, | |||
| 1801 | ((brq->data.blocks * brq->data.blksz) >= | 1803 | ((brq->data.blocks * brq->data.blksz) >= |
| 1802 | card->ext_csd.data_tag_unit_size); | 1804 | card->ext_csd.data_tag_unit_size); |
| 1803 | /* Argument of CMD23 */ | 1805 | /* Argument of CMD23 */ |
| 1804 | packed_cmd_hdr[(i * 2)] = | 1806 | packed_cmd_hdr[(i * 2)] = cpu_to_le32( |
| 1805 | (do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) | | 1807 | (do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) | |
| 1806 | (do_data_tag ? MMC_CMD23_ARG_TAG_REQ : 0) | | 1808 | (do_data_tag ? MMC_CMD23_ARG_TAG_REQ : 0) | |
| 1807 | blk_rq_sectors(prq); | 1809 | blk_rq_sectors(prq)); |
| 1808 | /* Argument of CMD18 or CMD25 */ | 1810 | /* Argument of CMD18 or CMD25 */ |
| 1809 | packed_cmd_hdr[((i * 2)) + 1] = | 1811 | packed_cmd_hdr[((i * 2)) + 1] = cpu_to_le32( |
| 1810 | mmc_card_blockaddr(card) ? | 1812 | mmc_card_blockaddr(card) ? |
| 1811 | blk_rq_pos(prq) : blk_rq_pos(prq) << 9; | 1813 | blk_rq_pos(prq) : blk_rq_pos(prq) << 9); |
| 1812 | packed->blocks += blk_rq_sectors(prq); | 1814 | packed->blocks += blk_rq_sectors(prq); |
| 1813 | i++; | 1815 | i++; |
| 1814 | } | 1816 | } |
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 86fac3e86833..c763b404510f 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
| @@ -789,14 +789,16 @@ static int pxamci_probe(struct platform_device *pdev) | |||
| 789 | gpio_direction_output(gpio_power, | 789 | gpio_direction_output(gpio_power, |
| 790 | host->pdata->gpio_power_invert); | 790 | host->pdata->gpio_power_invert); |
| 791 | } | 791 | } |
| 792 | if (gpio_is_valid(gpio_ro)) | 792 | if (gpio_is_valid(gpio_ro)) { |
| 793 | ret = mmc_gpio_request_ro(mmc, gpio_ro); | 793 | ret = mmc_gpio_request_ro(mmc, gpio_ro); |
| 794 | if (ret) { | 794 | if (ret) { |
| 795 | dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro); | 795 | dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", |
| 796 | goto out; | 796 | gpio_ro); |
| 797 | } else { | 797 | goto out; |
| 798 | mmc->caps2 |= host->pdata->gpio_card_ro_invert ? | 798 | } else { |
| 799 | 0 : MMC_CAP2_RO_ACTIVE_HIGH; | 799 | mmc->caps2 |= host->pdata->gpio_card_ro_invert ? |
| 800 | 0 : MMC_CAP2_RO_ACTIVE_HIGH; | ||
| 801 | } | ||
| 800 | } | 802 | } |
| 801 | 803 | ||
| 802 | if (gpio_is_valid(gpio_cd)) | 804 | if (gpio_is_valid(gpio_cd)) |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 08e158895635..a136da8df6fe 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
| @@ -1657,8 +1657,11 @@ static int omap_get_dt_info(struct device *dev, struct omap_nand_info *info) | |||
| 1657 | 1657 | ||
| 1658 | /* detect availability of ELM module. Won't be present pre-OMAP4 */ | 1658 | /* detect availability of ELM module. Won't be present pre-OMAP4 */ |
| 1659 | info->elm_of_node = of_parse_phandle(child, "ti,elm-id", 0); | 1659 | info->elm_of_node = of_parse_phandle(child, "ti,elm-id", 0); |
| 1660 | if (!info->elm_of_node) | 1660 | if (!info->elm_of_node) { |
| 1661 | dev_dbg(dev, "ti,elm-id not in DT\n"); | 1661 | info->elm_of_node = of_parse_phandle(child, "elm_id", 0); |
| 1662 | if (!info->elm_of_node) | ||
| 1663 | dev_dbg(dev, "ti,elm-id not in DT\n"); | ||
| 1664 | } | ||
| 1662 | 1665 | ||
| 1663 | /* select ecc-scheme for NAND */ | 1666 | /* select ecc-scheme for NAND */ |
| 1664 | if (of_property_read_string(child, "ti,nand-ecc-opt", &s)) { | 1667 | if (of_property_read_string(child, "ti,nand-ecc-opt", &s)) { |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index b9304a295f86..edc70ffad660 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
| @@ -101,11 +101,14 @@ enum ad_link_speed_type { | |||
| 101 | #define MAC_ADDRESS_EQUAL(A, B) \ | 101 | #define MAC_ADDRESS_EQUAL(A, B) \ |
| 102 | ether_addr_equal_64bits((const u8 *)A, (const u8 *)B) | 102 | ether_addr_equal_64bits((const u8 *)A, (const u8 *)B) |
| 103 | 103 | ||
| 104 | static struct mac_addr null_mac_addr = { { 0, 0, 0, 0, 0, 0 } }; | 104 | static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = { |
| 105 | 0, 0, 0, 0, 0, 0 | ||
| 106 | }; | ||
| 105 | static u16 ad_ticks_per_sec; | 107 | static u16 ad_ticks_per_sec; |
| 106 | static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; | 108 | static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; |
| 107 | 109 | ||
| 108 | static const u8 lacpdu_mcast_addr[ETH_ALEN] = MULTICAST_LACPDU_ADDR; | 110 | static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = |
| 111 | MULTICAST_LACPDU_ADDR; | ||
| 109 | 112 | ||
| 110 | /* ================= main 802.3ad protocol functions ================== */ | 113 | /* ================= main 802.3ad protocol functions ================== */ |
| 111 | static int ad_lacpdu_send(struct port *port); | 114 | static int ad_lacpdu_send(struct port *port); |
| @@ -657,6 +660,20 @@ static void __set_agg_ports_ready(struct aggregator *aggregator, int val) | |||
| 657 | } | 660 | } |
| 658 | } | 661 | } |
| 659 | 662 | ||
| 663 | static int __agg_active_ports(struct aggregator *agg) | ||
| 664 | { | ||
| 665 | struct port *port; | ||
| 666 | int active = 0; | ||
| 667 | |||
| 668 | for (port = agg->lag_ports; port; | ||
| 669 | port = port->next_port_in_aggregator) { | ||
| 670 | if (port->is_enabled) | ||
| 671 | active++; | ||
| 672 | } | ||
| 673 | |||
| 674 | return active; | ||
| 675 | } | ||
| 676 | |||
| 660 | /** | 677 | /** |
| 661 | * __get_agg_bandwidth - get the total bandwidth of an aggregator | 678 | * __get_agg_bandwidth - get the total bandwidth of an aggregator |
| 662 | * @aggregator: the aggregator we're looking at | 679 | * @aggregator: the aggregator we're looking at |
| @@ -664,39 +681,40 @@ static void __set_agg_ports_ready(struct aggregator *aggregator, int val) | |||
| 664 | */ | 681 | */ |
| 665 | static u32 __get_agg_bandwidth(struct aggregator *aggregator) | 682 | static u32 __get_agg_bandwidth(struct aggregator *aggregator) |
| 666 | { | 683 | { |
| 684 | int nports = __agg_active_ports(aggregator); | ||
| 667 | u32 bandwidth = 0; | 685 | u32 bandwidth = 0; |
| 668 | 686 | ||
| 669 | if (aggregator->num_of_ports) { | 687 | if (nports) { |
| 670 | switch (__get_link_speed(aggregator->lag_ports)) { | 688 | switch (__get_link_speed(aggregator->lag_ports)) { |
| 671 | case AD_LINK_SPEED_1MBPS: | 689 | case AD_LINK_SPEED_1MBPS: |
| 672 | bandwidth = aggregator->num_of_ports; | 690 | bandwidth = nports; |
| 673 | break; | 691 | break; |
| 674 | case AD_LINK_SPEED_10MBPS: | 692 | case AD_LINK_SPEED_10MBPS: |
| 675 | bandwidth = aggregator->num_of_ports * 10; | 693 | bandwidth = nports * 10; |
| 676 | break; | 694 | break; |
| 677 | case AD_LINK_SPEED_100MBPS: | 695 | case AD_LINK_SPEED_100MBPS: |
| 678 | bandwidth = aggregator->num_of_ports * 100; | 696 | bandwidth = nports * 100; |
| 679 | break; | 697 | break; |
| 680 | case AD_LINK_SPEED_1000MBPS: | 698 | case AD_LINK_SPEED_1000MBPS: |
| 681 | bandwidth = aggregator->num_of_ports * 1000; | 699 | bandwidth = nports * 1000; |
| 682 | break; | 700 | break; |
| 683 | case AD_LINK_SPEED_2500MBPS: | 701 | case AD_LINK_SPEED_2500MBPS: |
| 684 | bandwidth = aggregator->num_of_ports * 2500; | 702 | bandwidth = nports * 2500; |
| 685 | break; | 703 | break; |
| 686 | case AD_LINK_SPEED_10000MBPS: | 704 | case AD_LINK_SPEED_10000MBPS: |
| 687 | bandwidth = aggregator->num_of_ports * 10000; | 705 | bandwidth = nports * 10000; |
| 688 | break; | 706 | break; |
| 689 | case AD_LINK_SPEED_20000MBPS: | 707 | case AD_LINK_SPEED_20000MBPS: |
| 690 | bandwidth = aggregator->num_of_ports * 20000; | 708 | bandwidth = nports * 20000; |
| 691 | break; | 709 | break; |
| 692 | case AD_LINK_SPEED_40000MBPS: | 710 | case AD_LINK_SPEED_40000MBPS: |
| 693 | bandwidth = aggregator->num_of_ports * 40000; | 711 | bandwidth = nports * 40000; |
| 694 | break; | 712 | break; |
| 695 | case AD_LINK_SPEED_56000MBPS: | 713 | case AD_LINK_SPEED_56000MBPS: |
| 696 | bandwidth = aggregator->num_of_ports * 56000; | 714 | bandwidth = nports * 56000; |
| 697 | break; | 715 | break; |
| 698 | case AD_LINK_SPEED_100000MBPS: | 716 | case AD_LINK_SPEED_100000MBPS: |
| 699 | bandwidth = aggregator->num_of_ports * 100000; | 717 | bandwidth = nports * 100000; |
| 700 | break; | 718 | break; |
| 701 | default: | 719 | default: |
| 702 | bandwidth = 0; /* to silence the compiler */ | 720 | bandwidth = 0; /* to silence the compiler */ |
| @@ -1530,10 +1548,10 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best, | |||
| 1530 | 1548 | ||
| 1531 | switch (__get_agg_selection_mode(curr->lag_ports)) { | 1549 | switch (__get_agg_selection_mode(curr->lag_ports)) { |
| 1532 | case BOND_AD_COUNT: | 1550 | case BOND_AD_COUNT: |
| 1533 | if (curr->num_of_ports > best->num_of_ports) | 1551 | if (__agg_active_ports(curr) > __agg_active_ports(best)) |
| 1534 | return curr; | 1552 | return curr; |
| 1535 | 1553 | ||
| 1536 | if (curr->num_of_ports < best->num_of_ports) | 1554 | if (__agg_active_ports(curr) < __agg_active_ports(best)) |
| 1537 | return best; | 1555 | return best; |
| 1538 | 1556 | ||
| 1539 | /*FALLTHROUGH*/ | 1557 | /*FALLTHROUGH*/ |
| @@ -1561,8 +1579,14 @@ static int agg_device_up(const struct aggregator *agg) | |||
| 1561 | if (!port) | 1579 | if (!port) |
| 1562 | return 0; | 1580 | return 0; |
| 1563 | 1581 | ||
| 1564 | return netif_running(port->slave->dev) && | 1582 | for (port = agg->lag_ports; port; |
| 1565 | netif_carrier_ok(port->slave->dev); | 1583 | port = port->next_port_in_aggregator) { |
| 1584 | if (netif_running(port->slave->dev) && | ||
| 1585 | netif_carrier_ok(port->slave->dev)) | ||
| 1586 | return 1; | ||
| 1587 | } | ||
| 1588 | |||
| 1589 | return 0; | ||
| 1566 | } | 1590 | } |
| 1567 | 1591 | ||
| 1568 | /** | 1592 | /** |
| @@ -1610,7 +1634,7 @@ static void ad_agg_selection_logic(struct aggregator *agg, | |||
| 1610 | 1634 | ||
| 1611 | agg->is_active = 0; | 1635 | agg->is_active = 0; |
| 1612 | 1636 | ||
| 1613 | if (agg->num_of_ports && agg_device_up(agg)) | 1637 | if (__agg_active_ports(agg) && agg_device_up(agg)) |
| 1614 | best = ad_agg_selection_test(best, agg); | 1638 | best = ad_agg_selection_test(best, agg); |
| 1615 | } | 1639 | } |
| 1616 | 1640 | ||
| @@ -1622,7 +1646,7 @@ static void ad_agg_selection_logic(struct aggregator *agg, | |||
| 1622 | * answering partner. | 1646 | * answering partner. |
| 1623 | */ | 1647 | */ |
| 1624 | if (active && active->lag_ports && | 1648 | if (active && active->lag_ports && |
| 1625 | active->lag_ports->is_enabled && | 1649 | __agg_active_ports(active) && |
| 1626 | (__agg_has_partner(active) || | 1650 | (__agg_has_partner(active) || |
| 1627 | (!__agg_has_partner(active) && | 1651 | (!__agg_has_partner(active) && |
| 1628 | !__agg_has_partner(best)))) { | 1652 | !__agg_has_partner(best)))) { |
| @@ -1718,7 +1742,7 @@ static void ad_clear_agg(struct aggregator *aggregator) | |||
| 1718 | aggregator->is_individual = false; | 1742 | aggregator->is_individual = false; |
| 1719 | aggregator->actor_admin_aggregator_key = 0; | 1743 | aggregator->actor_admin_aggregator_key = 0; |
| 1720 | aggregator->actor_oper_aggregator_key = 0; | 1744 | aggregator->actor_oper_aggregator_key = 0; |
| 1721 | aggregator->partner_system = null_mac_addr; | 1745 | eth_zero_addr(aggregator->partner_system.mac_addr_value); |
| 1722 | aggregator->partner_system_priority = 0; | 1746 | aggregator->partner_system_priority = 0; |
| 1723 | aggregator->partner_oper_aggregator_key = 0; | 1747 | aggregator->partner_oper_aggregator_key = 0; |
| 1724 | aggregator->receive_state = 0; | 1748 | aggregator->receive_state = 0; |
| @@ -1740,7 +1764,7 @@ static void ad_initialize_agg(struct aggregator *aggregator) | |||
| 1740 | if (aggregator) { | 1764 | if (aggregator) { |
| 1741 | ad_clear_agg(aggregator); | 1765 | ad_clear_agg(aggregator); |
| 1742 | 1766 | ||
| 1743 | aggregator->aggregator_mac_address = null_mac_addr; | 1767 | eth_zero_addr(aggregator->aggregator_mac_address.mac_addr_value); |
| 1744 | aggregator->aggregator_identifier = 0; | 1768 | aggregator->aggregator_identifier = 0; |
| 1745 | aggregator->slave = NULL; | 1769 | aggregator->slave = NULL; |
| 1746 | } | 1770 | } |
| @@ -2133,7 +2157,7 @@ void bond_3ad_unbind_slave(struct slave *slave) | |||
| 2133 | else | 2157 | else |
| 2134 | temp_aggregator->lag_ports = temp_port->next_port_in_aggregator; | 2158 | temp_aggregator->lag_ports = temp_port->next_port_in_aggregator; |
| 2135 | temp_aggregator->num_of_ports--; | 2159 | temp_aggregator->num_of_ports--; |
| 2136 | if (temp_aggregator->num_of_ports == 0) { | 2160 | if (__agg_active_ports(temp_aggregator) == 0) { |
| 2137 | select_new_active_agg = temp_aggregator->is_active; | 2161 | select_new_active_agg = temp_aggregator->is_active; |
| 2138 | ad_clear_agg(temp_aggregator); | 2162 | ad_clear_agg(temp_aggregator); |
| 2139 | if (select_new_active_agg) { | 2163 | if (select_new_active_agg) { |
| @@ -2432,7 +2456,9 @@ void bond_3ad_adapter_speed_duplex_changed(struct slave *slave) | |||
| 2432 | */ | 2456 | */ |
| 2433 | void bond_3ad_handle_link_change(struct slave *slave, char link) | 2457 | void bond_3ad_handle_link_change(struct slave *slave, char link) |
| 2434 | { | 2458 | { |
| 2459 | struct aggregator *agg; | ||
| 2435 | struct port *port; | 2460 | struct port *port; |
| 2461 | bool dummy; | ||
| 2436 | 2462 | ||
| 2437 | port = &(SLAVE_AD_INFO(slave)->port); | 2463 | port = &(SLAVE_AD_INFO(slave)->port); |
| 2438 | 2464 | ||
| @@ -2459,6 +2485,9 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) | |||
| 2459 | port->is_enabled = false; | 2485 | port->is_enabled = false; |
| 2460 | ad_update_actor_keys(port, true); | 2486 | ad_update_actor_keys(port, true); |
| 2461 | } | 2487 | } |
| 2488 | agg = __get_first_agg(port); | ||
| 2489 | ad_agg_selection_logic(agg, &dummy); | ||
| 2490 | |||
| 2462 | netdev_dbg(slave->bond->dev, "Port %d changed link status to %s\n", | 2491 | netdev_dbg(slave->bond->dev, "Port %d changed link status to %s\n", |
| 2463 | port->actor_port_number, | 2492 | port->actor_port_number, |
| 2464 | link == BOND_LINK_UP ? "UP" : "DOWN"); | 2493 | link == BOND_LINK_UP ? "UP" : "DOWN"); |
| @@ -2499,7 +2528,7 @@ int bond_3ad_set_carrier(struct bonding *bond) | |||
| 2499 | active = __get_active_agg(&(SLAVE_AD_INFO(first_slave)->aggregator)); | 2528 | active = __get_active_agg(&(SLAVE_AD_INFO(first_slave)->aggregator)); |
| 2500 | if (active) { | 2529 | if (active) { |
| 2501 | /* are enough slaves available to consider link up? */ | 2530 | /* are enough slaves available to consider link up? */ |
| 2502 | if (active->num_of_ports < bond->params.min_links) { | 2531 | if (__agg_active_ports(active) < bond->params.min_links) { |
| 2503 | if (netif_carrier_ok(bond->dev)) { | 2532 | if (netif_carrier_ok(bond->dev)) { |
| 2504 | netif_carrier_off(bond->dev); | 2533 | netif_carrier_off(bond->dev); |
| 2505 | goto out; | 2534 | goto out; |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index c5ac160a8ae9..551f0f8dead3 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
| @@ -42,13 +42,10 @@ | |||
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | #ifndef __long_aligned | 45 | static const u8 mac_bcast[ETH_ALEN + 2] __long_aligned = { |
| 46 | #define __long_aligned __attribute__((aligned((sizeof(long))))) | ||
| 47 | #endif | ||
| 48 | static const u8 mac_bcast[ETH_ALEN] __long_aligned = { | ||
| 49 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff | 46 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff |
| 50 | }; | 47 | }; |
| 51 | static const u8 mac_v6_allmcast[ETH_ALEN] __long_aligned = { | 48 | static const u8 mac_v6_allmcast[ETH_ALEN + 2] __long_aligned = { |
| 52 | 0x33, 0x33, 0x00, 0x00, 0x00, 0x01 | 49 | 0x33, 0x33, 0x00, 0x00, 0x00, 0x01 |
| 53 | }; | 50 | }; |
| 54 | static const int alb_delta_in_ticks = HZ / ALB_TIMER_TICKS_PER_SEC; | 51 | static const int alb_delta_in_ticks = HZ / ALB_TIMER_TICKS_PER_SEC; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 941ec99cd3b6..a2afa3be17a4 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -1584,6 +1584,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
| 1584 | } | 1584 | } |
| 1585 | 1585 | ||
| 1586 | /* check for initial state */ | 1586 | /* check for initial state */ |
| 1587 | new_slave->link = BOND_LINK_NOCHANGE; | ||
| 1587 | if (bond->params.miimon) { | 1588 | if (bond->params.miimon) { |
| 1588 | if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) { | 1589 | if (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS) { |
| 1589 | if (bond->params.updelay) { | 1590 | if (bond->params.updelay) { |
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c index db760e84119f..b8df0f5e8c25 100644 --- a/drivers/net/bonding/bond_netlink.c +++ b/drivers/net/bonding/bond_netlink.c | |||
| @@ -446,7 +446,11 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev, | |||
| 446 | if (err < 0) | 446 | if (err < 0) |
| 447 | return err; | 447 | return err; |
| 448 | 448 | ||
| 449 | return register_netdevice(bond_dev); | 449 | err = register_netdevice(bond_dev); |
| 450 | |||
| 451 | netif_carrier_off(bond_dev); | ||
| 452 | |||
| 453 | return err; | ||
| 450 | } | 454 | } |
| 451 | 455 | ||
| 452 | static size_t bond_get_size(const struct net_device *bond_dev) | 456 | static size_t bond_get_size(const struct net_device *bond_dev) |
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 8b3275d7792a..8f5e93cb7975 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
| @@ -712,9 +712,10 @@ static int at91_poll_rx(struct net_device *dev, int quota) | |||
| 712 | 712 | ||
| 713 | /* upper group completed, look again in lower */ | 713 | /* upper group completed, look again in lower */ |
| 714 | if (priv->rx_next > get_mb_rx_low_last(priv) && | 714 | if (priv->rx_next > get_mb_rx_low_last(priv) && |
| 715 | quota > 0 && mb > get_mb_rx_last(priv)) { | 715 | mb > get_mb_rx_last(priv)) { |
| 716 | priv->rx_next = get_mb_rx_first(priv); | 716 | priv->rx_next = get_mb_rx_first(priv); |
| 717 | goto again; | 717 | if (quota > 0) |
| 718 | goto again; | ||
| 718 | } | 719 | } |
| 719 | 720 | ||
| 720 | return received; | 721 | return received; |
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index f91b094288da..e3dccd3200d5 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
| @@ -332,9 +332,23 @@ static void c_can_setup_tx_object(struct net_device *dev, int iface, | |||
| 332 | 332 | ||
| 333 | priv->write_reg(priv, C_CAN_IFACE(MSGCTRL_REG, iface), ctrl); | 333 | priv->write_reg(priv, C_CAN_IFACE(MSGCTRL_REG, iface), ctrl); |
| 334 | 334 | ||
| 335 | for (i = 0; i < frame->can_dlc; i += 2) { | 335 | if (priv->type == BOSCH_D_CAN) { |
| 336 | priv->write_reg(priv, C_CAN_IFACE(DATA1_REG, iface) + i / 2, | 336 | u32 data = 0, dreg = C_CAN_IFACE(DATA1_REG, iface); |
| 337 | frame->data[i] | (frame->data[i + 1] << 8)); | 337 | |
| 338 | for (i = 0; i < frame->can_dlc; i += 4, dreg += 2) { | ||
| 339 | data = (u32)frame->data[i]; | ||
| 340 | data |= (u32)frame->data[i + 1] << 8; | ||
| 341 | data |= (u32)frame->data[i + 2] << 16; | ||
| 342 | data |= (u32)frame->data[i + 3] << 24; | ||
| 343 | priv->write_reg32(priv, dreg, data); | ||
| 344 | } | ||
| 345 | } else { | ||
| 346 | for (i = 0; i < frame->can_dlc; i += 2) { | ||
| 347 | priv->write_reg(priv, | ||
| 348 | C_CAN_IFACE(DATA1_REG, iface) + i / 2, | ||
| 349 | frame->data[i] | | ||
| 350 | (frame->data[i + 1] << 8)); | ||
| 351 | } | ||
| 338 | } | 352 | } |
| 339 | } | 353 | } |
| 340 | 354 | ||
| @@ -402,10 +416,20 @@ static int c_can_read_msg_object(struct net_device *dev, int iface, u32 ctrl) | |||
| 402 | } else { | 416 | } else { |
| 403 | int i, dreg = C_CAN_IFACE(DATA1_REG, iface); | 417 | int i, dreg = C_CAN_IFACE(DATA1_REG, iface); |
| 404 | 418 | ||
| 405 | for (i = 0; i < frame->can_dlc; i += 2, dreg ++) { | 419 | if (priv->type == BOSCH_D_CAN) { |
| 406 | data = priv->read_reg(priv, dreg); | 420 | for (i = 0; i < frame->can_dlc; i += 4, dreg += 2) { |
| 407 | frame->data[i] = data; | 421 | data = priv->read_reg32(priv, dreg); |
| 408 | frame->data[i + 1] = data >> 8; | 422 | frame->data[i] = data; |
| 423 | frame->data[i + 1] = data >> 8; | ||
| 424 | frame->data[i + 2] = data >> 16; | ||
| 425 | frame->data[i + 3] = data >> 24; | ||
| 426 | } | ||
| 427 | } else { | ||
| 428 | for (i = 0; i < frame->can_dlc; i += 2, dreg++) { | ||
| 429 | data = priv->read_reg(priv, dreg); | ||
| 430 | frame->data[i] = data; | ||
| 431 | frame->data[i + 1] = data >> 8; | ||
| 432 | } | ||
| 409 | } | 433 | } |
| 410 | } | 434 | } |
| 411 | 435 | ||
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 910c12e2638e..ad535a854e5c 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
| @@ -798,6 +798,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[]) | |||
| 798 | * - control mode with CAN_CTRLMODE_FD set | 798 | * - control mode with CAN_CTRLMODE_FD set |
| 799 | */ | 799 | */ |
| 800 | 800 | ||
| 801 | if (!data) | ||
| 802 | return 0; | ||
| 803 | |||
| 801 | if (data[IFLA_CAN_CTRLMODE]) { | 804 | if (data[IFLA_CAN_CTRLMODE]) { |
| 802 | struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); | 805 | struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); |
| 803 | 806 | ||
| @@ -1008,6 +1011,11 @@ static int can_newlink(struct net *src_net, struct net_device *dev, | |||
| 1008 | return -EOPNOTSUPP; | 1011 | return -EOPNOTSUPP; |
| 1009 | } | 1012 | } |
| 1010 | 1013 | ||
| 1014 | static void can_dellink(struct net_device *dev, struct list_head *head) | ||
| 1015 | { | ||
| 1016 | return; | ||
| 1017 | } | ||
| 1018 | |||
| 1011 | static struct rtnl_link_ops can_link_ops __read_mostly = { | 1019 | static struct rtnl_link_ops can_link_ops __read_mostly = { |
| 1012 | .kind = "can", | 1020 | .kind = "can", |
| 1013 | .maxtype = IFLA_CAN_MAX, | 1021 | .maxtype = IFLA_CAN_MAX, |
| @@ -1016,6 +1024,7 @@ static struct rtnl_link_ops can_link_ops __read_mostly = { | |||
| 1016 | .validate = can_validate, | 1024 | .validate = can_validate, |
| 1017 | .newlink = can_newlink, | 1025 | .newlink = can_newlink, |
| 1018 | .changelink = can_changelink, | 1026 | .changelink = can_changelink, |
| 1027 | .dellink = can_dellink, | ||
| 1019 | .get_size = can_get_size, | 1028 | .get_size = can_get_size, |
| 1020 | .fill_info = can_fill_info, | 1029 | .fill_info = can_fill_info, |
| 1021 | .get_xstats_size = can_get_xstats_size, | 1030 | .get_xstats_size = can_get_xstats_size, |
diff --git a/drivers/net/can/usb/Kconfig b/drivers/net/can/usb/Kconfig index bcb272f6c68a..8483a40e7e9e 100644 --- a/drivers/net/can/usb/Kconfig +++ b/drivers/net/can/usb/Kconfig | |||
| @@ -16,7 +16,8 @@ config CAN_ESD_USB2 | |||
| 16 | config CAN_GS_USB | 16 | config CAN_GS_USB |
| 17 | tristate "Geschwister Schneider UG interfaces" | 17 | tristate "Geschwister Schneider UG interfaces" |
| 18 | ---help--- | 18 | ---help--- |
| 19 | This driver supports the Geschwister Schneider USB/CAN devices. | 19 | This driver supports the Geschwister Schneider and bytewerk.org |
| 20 | candleLight USB CAN interfaces USB/CAN devices | ||
| 20 | If unsure choose N, | 21 | If unsure choose N, |
| 21 | choose Y for built in support, | 22 | choose Y for built in support, |
| 22 | M to compile as module (module will be named: gs_usb). | 23 | M to compile as module (module will be named: gs_usb). |
| @@ -46,6 +47,8 @@ config CAN_KVASER_USB | |||
| 46 | - Kvaser USBcan R | 47 | - Kvaser USBcan R |
| 47 | - Kvaser Leaf Light v2 | 48 | - Kvaser Leaf Light v2 |
| 48 | - Kvaser Mini PCI Express HS | 49 | - Kvaser Mini PCI Express HS |
| 50 | - Kvaser Mini PCI Express 2xHS | ||
| 51 | - Kvaser USBcan Light 2xHS | ||
| 49 | - Kvaser USBcan II HS/HS | 52 | - Kvaser USBcan II HS/HS |
| 50 | - Kvaser USBcan II HS/LS | 53 | - Kvaser USBcan II HS/LS |
| 51 | - Kvaser USBcan Rugged ("USBcan Rev B") | 54 | - Kvaser USBcan Rugged ("USBcan Rev B") |
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index 1556d4286235..acb0c8490673 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | /* CAN driver for Geschwister Schneider USB/CAN devices. | 1 | /* CAN driver for Geschwister Schneider USB/CAN devices |
| 2 | * and bytewerk.org candleLight USB CAN interfaces. | ||
| 2 | * | 3 | * |
| 3 | * Copyright (C) 2013 Geschwister Schneider Technologie-, | 4 | * Copyright (C) 2013-2016 Geschwister Schneider Technologie-, |
| 4 | * Entwicklungs- und Vertriebs UG (Haftungsbeschränkt). | 5 | * Entwicklungs- und Vertriebs UG (Haftungsbeschränkt). |
| 6 | * Copyright (C) 2016 Hubert Denkmair | ||
| 5 | * | 7 | * |
| 6 | * Many thanks to all socketcan devs! | 8 | * Many thanks to all socketcan devs! |
| 7 | * | 9 | * |
| @@ -29,6 +31,9 @@ | |||
| 29 | #define USB_GSUSB_1_VENDOR_ID 0x1d50 | 31 | #define USB_GSUSB_1_VENDOR_ID 0x1d50 |
| 30 | #define USB_GSUSB_1_PRODUCT_ID 0x606f | 32 | #define USB_GSUSB_1_PRODUCT_ID 0x606f |
| 31 | 33 | ||
| 34 | #define USB_CANDLELIGHT_VENDOR_ID 0x1209 | ||
| 35 | #define USB_CANDLELIGHT_PRODUCT_ID 0x2323 | ||
| 36 | |||
| 32 | #define GSUSB_ENDPOINT_IN 1 | 37 | #define GSUSB_ENDPOINT_IN 1 |
| 33 | #define GSUSB_ENDPOINT_OUT 2 | 38 | #define GSUSB_ENDPOINT_OUT 2 |
| 34 | 39 | ||
| @@ -952,6 +957,8 @@ static void gs_usb_disconnect(struct usb_interface *intf) | |||
| 952 | static const struct usb_device_id gs_usb_table[] = { | 957 | static const struct usb_device_id gs_usb_table[] = { |
| 953 | { USB_DEVICE_INTERFACE_NUMBER(USB_GSUSB_1_VENDOR_ID, | 958 | { USB_DEVICE_INTERFACE_NUMBER(USB_GSUSB_1_VENDOR_ID, |
| 954 | USB_GSUSB_1_PRODUCT_ID, 0) }, | 959 | USB_GSUSB_1_PRODUCT_ID, 0) }, |
| 960 | { USB_DEVICE_INTERFACE_NUMBER(USB_CANDLELIGHT_VENDOR_ID, | ||
| 961 | USB_CANDLELIGHT_PRODUCT_ID, 0) }, | ||
| 955 | {} /* Terminating entry */ | 962 | {} /* Terminating entry */ |
| 956 | }; | 963 | }; |
| 957 | 964 | ||
| @@ -969,5 +976,6 @@ module_usb_driver(gs_usb_driver); | |||
| 969 | MODULE_AUTHOR("Maximilian Schneider <mws@schneidersoft.net>"); | 976 | MODULE_AUTHOR("Maximilian Schneider <mws@schneidersoft.net>"); |
| 970 | MODULE_DESCRIPTION( | 977 | MODULE_DESCRIPTION( |
| 971 | "Socket CAN device driver for Geschwister Schneider Technologie-, " | 978 | "Socket CAN device driver for Geschwister Schneider Technologie-, " |
| 972 | "Entwicklungs- und Vertriebs UG. USB2.0 to CAN interfaces."); | 979 | "Entwicklungs- und Vertriebs UG. USB2.0 to CAN interfaces\n" |
| 980 | "and bytewerk.org candleLight USB CAN interfaces."); | ||
| 973 | MODULE_LICENSE("GPL v2"); | 981 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 022bfa13ebfa..6f1f3b675ff5 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
| @@ -59,11 +59,14 @@ | |||
| 59 | #define USB_CAN_R_PRODUCT_ID 39 | 59 | #define USB_CAN_R_PRODUCT_ID 39 |
| 60 | #define USB_LEAF_LITE_V2_PRODUCT_ID 288 | 60 | #define USB_LEAF_LITE_V2_PRODUCT_ID 288 |
| 61 | #define USB_MINI_PCIE_HS_PRODUCT_ID 289 | 61 | #define USB_MINI_PCIE_HS_PRODUCT_ID 289 |
| 62 | #define USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID 290 | ||
| 63 | #define USB_USBCAN_LIGHT_2HS_PRODUCT_ID 291 | ||
| 64 | #define USB_MINI_PCIE_2HS_PRODUCT_ID 292 | ||
| 62 | 65 | ||
| 63 | static inline bool kvaser_is_leaf(const struct usb_device_id *id) | 66 | static inline bool kvaser_is_leaf(const struct usb_device_id *id) |
| 64 | { | 67 | { |
| 65 | return id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID && | 68 | return id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID && |
| 66 | id->idProduct <= USB_MINI_PCIE_HS_PRODUCT_ID; | 69 | id->idProduct <= USB_MINI_PCIE_2HS_PRODUCT_ID; |
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | /* Kvaser USBCan-II devices */ | 72 | /* Kvaser USBCan-II devices */ |
| @@ -537,6 +540,9 @@ static const struct usb_device_id kvaser_usb_table[] = { | |||
| 537 | .driver_info = KVASER_HAS_TXRX_ERRORS }, | 540 | .driver_info = KVASER_HAS_TXRX_ERRORS }, |
| 538 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID) }, | 541 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID) }, |
| 539 | { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID) }, | 542 | { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID) }, |
| 543 | { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID) }, | ||
| 544 | { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_2HS_PRODUCT_ID) }, | ||
| 545 | { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_2HS_PRODUCT_ID) }, | ||
| 540 | 546 | ||
| 541 | /* USBCANII family IDs */ | 547 | /* USBCANII family IDs */ |
| 542 | { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID), | 548 | { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID), |
diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c index 30defe6c81f2..821d86c38ab2 100644 --- a/drivers/net/ethernet/agere/et131x.c +++ b/drivers/net/ethernet/agere/et131x.c | |||
| @@ -3851,7 +3851,7 @@ static void et131x_tx_timeout(struct net_device *netdev) | |||
| 3851 | unsigned long flags; | 3851 | unsigned long flags; |
| 3852 | 3852 | ||
| 3853 | /* If the device is closed, ignore the timeout */ | 3853 | /* If the device is closed, ignore the timeout */ |
| 3854 | if (~(adapter->flags & FMP_ADAPTER_INTERRUPT_IN_USE)) | 3854 | if (!(adapter->flags & FMP_ADAPTER_INTERRUPT_IN_USE)) |
| 3855 | return; | 3855 | return; |
| 3856 | 3856 | ||
| 3857 | /* Any nonrecoverable hardware error? | 3857 | /* Any nonrecoverable hardware error? |
diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c index e0fb0f1122db..20760e10211a 100644 --- a/drivers/net/ethernet/amd/au1000_eth.c +++ b/drivers/net/ethernet/amd/au1000_eth.c | |||
| @@ -509,8 +509,8 @@ static int au1000_mii_probe(struct net_device *dev) | |||
| 509 | * on the current MAC's MII bus | 509 | * on the current MAC's MII bus |
| 510 | */ | 510 | */ |
| 511 | for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) | 511 | for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) |
| 512 | if (mdiobus_get_phy(aup->mii_bus, aup->phy_addr)) { | 512 | if (mdiobus_get_phy(aup->mii_bus, phy_addr)) { |
| 513 | phydev = mdiobus_get_phy(aup->mii_bus, aup->phy_addr); | 513 | phydev = mdiobus_get_phy(aup->mii_bus, phy_addr); |
| 514 | if (!aup->phy_search_highest_addr) | 514 | if (!aup->phy_search_highest_addr) |
| 515 | /* break out with first one found */ | 515 | /* break out with first one found */ |
| 516 | break; | 516 | break; |
diff --git a/drivers/net/ethernet/atheros/alx/alx.h b/drivers/net/ethernet/atheros/alx/alx.h index d02c4240b7df..8fc93c5f6abc 100644 --- a/drivers/net/ethernet/atheros/alx/alx.h +++ b/drivers/net/ethernet/atheros/alx/alx.h | |||
| @@ -96,10 +96,6 @@ struct alx_priv { | |||
| 96 | unsigned int rx_ringsz; | 96 | unsigned int rx_ringsz; |
| 97 | unsigned int rxbuf_size; | 97 | unsigned int rxbuf_size; |
| 98 | 98 | ||
| 99 | struct page *rx_page; | ||
| 100 | unsigned int rx_page_offset; | ||
| 101 | unsigned int rx_frag_size; | ||
| 102 | |||
| 103 | struct napi_struct napi; | 99 | struct napi_struct napi; |
| 104 | struct alx_tx_queue txq; | 100 | struct alx_tx_queue txq; |
| 105 | struct alx_rx_queue rxq; | 101 | struct alx_rx_queue rxq; |
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index c98acdc0d14f..e708e360a9e3 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c | |||
| @@ -70,35 +70,6 @@ static void alx_free_txbuf(struct alx_priv *alx, int entry) | |||
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | static struct sk_buff *alx_alloc_skb(struct alx_priv *alx, gfp_t gfp) | ||
| 74 | { | ||
| 75 | struct sk_buff *skb; | ||
| 76 | struct page *page; | ||
| 77 | |||
| 78 | if (alx->rx_frag_size > PAGE_SIZE) | ||
| 79 | return __netdev_alloc_skb(alx->dev, alx->rxbuf_size, gfp); | ||
| 80 | |||
| 81 | page = alx->rx_page; | ||
| 82 | if (!page) { | ||
| 83 | alx->rx_page = page = alloc_page(gfp); | ||
| 84 | if (unlikely(!page)) | ||
| 85 | return NULL; | ||
| 86 | alx->rx_page_offset = 0; | ||
| 87 | } | ||
| 88 | |||
| 89 | skb = build_skb(page_address(page) + alx->rx_page_offset, | ||
| 90 | alx->rx_frag_size); | ||
| 91 | if (likely(skb)) { | ||
| 92 | alx->rx_page_offset += alx->rx_frag_size; | ||
| 93 | if (alx->rx_page_offset >= PAGE_SIZE) | ||
| 94 | alx->rx_page = NULL; | ||
| 95 | else | ||
| 96 | get_page(page); | ||
| 97 | } | ||
| 98 | return skb; | ||
| 99 | } | ||
| 100 | |||
| 101 | |||
| 102 | static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp) | 73 | static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp) |
| 103 | { | 74 | { |
| 104 | struct alx_rx_queue *rxq = &alx->rxq; | 75 | struct alx_rx_queue *rxq = &alx->rxq; |
| @@ -115,9 +86,22 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp) | |||
| 115 | while (!cur_buf->skb && next != rxq->read_idx) { | 86 | while (!cur_buf->skb && next != rxq->read_idx) { |
| 116 | struct alx_rfd *rfd = &rxq->rfd[cur]; | 87 | struct alx_rfd *rfd = &rxq->rfd[cur]; |
| 117 | 88 | ||
| 118 | skb = alx_alloc_skb(alx, gfp); | 89 | /* |
| 90 | * When DMA RX address is set to something like | ||
| 91 | * 0x....fc0, it will be very likely to cause DMA | ||
| 92 | * RFD overflow issue. | ||
| 93 | * | ||
| 94 | * To work around it, we apply rx skb with 64 bytes | ||
| 95 | * longer space, and offset the address whenever | ||
| 96 | * 0x....fc0 is detected. | ||
| 97 | */ | ||
| 98 | skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size + 64, gfp); | ||
| 119 | if (!skb) | 99 | if (!skb) |
| 120 | break; | 100 | break; |
| 101 | |||
| 102 | if (((unsigned long)skb->data & 0xfff) == 0xfc0) | ||
| 103 | skb_reserve(skb, 64); | ||
| 104 | |||
| 121 | dma = dma_map_single(&alx->hw.pdev->dev, | 105 | dma = dma_map_single(&alx->hw.pdev->dev, |
| 122 | skb->data, alx->rxbuf_size, | 106 | skb->data, alx->rxbuf_size, |
| 123 | DMA_FROM_DEVICE); | 107 | DMA_FROM_DEVICE); |
| @@ -153,7 +137,6 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp) | |||
| 153 | alx_write_mem16(&alx->hw, ALX_RFD_PIDX, cur); | 137 | alx_write_mem16(&alx->hw, ALX_RFD_PIDX, cur); |
| 154 | } | 138 | } |
| 155 | 139 | ||
| 156 | |||
| 157 | return count; | 140 | return count; |
| 158 | } | 141 | } |
| 159 | 142 | ||
| @@ -622,11 +605,6 @@ static void alx_free_rings(struct alx_priv *alx) | |||
| 622 | kfree(alx->txq.bufs); | 605 | kfree(alx->txq.bufs); |
| 623 | kfree(alx->rxq.bufs); | 606 | kfree(alx->rxq.bufs); |
| 624 | 607 | ||
| 625 | if (alx->rx_page) { | ||
| 626 | put_page(alx->rx_page); | ||
| 627 | alx->rx_page = NULL; | ||
| 628 | } | ||
| 629 | |||
| 630 | dma_free_coherent(&alx->hw.pdev->dev, | 608 | dma_free_coherent(&alx->hw.pdev->dev, |
| 631 | alx->descmem.size, | 609 | alx->descmem.size, |
| 632 | alx->descmem.virt, | 610 | alx->descmem.virt, |
| @@ -681,7 +659,6 @@ static int alx_request_irq(struct alx_priv *alx) | |||
| 681 | alx->dev->name, alx); | 659 | alx->dev->name, alx); |
| 682 | if (!err) | 660 | if (!err) |
| 683 | goto out; | 661 | goto out; |
| 684 | |||
| 685 | /* fall back to legacy interrupt */ | 662 | /* fall back to legacy interrupt */ |
| 686 | pci_disable_msi(alx->hw.pdev); | 663 | pci_disable_msi(alx->hw.pdev); |
| 687 | } | 664 | } |
| @@ -725,7 +702,6 @@ static int alx_init_sw(struct alx_priv *alx) | |||
| 725 | struct pci_dev *pdev = alx->hw.pdev; | 702 | struct pci_dev *pdev = alx->hw.pdev; |
| 726 | struct alx_hw *hw = &alx->hw; | 703 | struct alx_hw *hw = &alx->hw; |
| 727 | int err; | 704 | int err; |
| 728 | unsigned int head_size; | ||
| 729 | 705 | ||
| 730 | err = alx_identify_hw(alx); | 706 | err = alx_identify_hw(alx); |
| 731 | if (err) { | 707 | if (err) { |
| @@ -741,12 +717,7 @@ static int alx_init_sw(struct alx_priv *alx) | |||
| 741 | 717 | ||
| 742 | hw->smb_timer = 400; | 718 | hw->smb_timer = 400; |
| 743 | hw->mtu = alx->dev->mtu; | 719 | hw->mtu = alx->dev->mtu; |
| 744 | |||
| 745 | alx->rxbuf_size = ALX_MAX_FRAME_LEN(hw->mtu); | 720 | alx->rxbuf_size = ALX_MAX_FRAME_LEN(hw->mtu); |
| 746 | head_size = SKB_DATA_ALIGN(alx->rxbuf_size + NET_SKB_PAD) + | ||
| 747 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | ||
| 748 | alx->rx_frag_size = roundup_pow_of_two(head_size); | ||
| 749 | |||
| 750 | alx->tx_ringsz = 256; | 721 | alx->tx_ringsz = 256; |
| 751 | alx->rx_ringsz = 512; | 722 | alx->rx_ringsz = 512; |
| 752 | hw->imt = 200; | 723 | hw->imt = 200; |
| @@ -848,7 +819,6 @@ static int alx_change_mtu(struct net_device *netdev, int mtu) | |||
| 848 | { | 819 | { |
| 849 | struct alx_priv *alx = netdev_priv(netdev); | 820 | struct alx_priv *alx = netdev_priv(netdev); |
| 850 | int max_frame = ALX_MAX_FRAME_LEN(mtu); | 821 | int max_frame = ALX_MAX_FRAME_LEN(mtu); |
| 851 | unsigned int head_size; | ||
| 852 | 822 | ||
| 853 | if ((max_frame < ALX_MIN_FRAME_SIZE) || | 823 | if ((max_frame < ALX_MIN_FRAME_SIZE) || |
| 854 | (max_frame > ALX_MAX_FRAME_SIZE)) | 824 | (max_frame > ALX_MAX_FRAME_SIZE)) |
| @@ -860,9 +830,6 @@ static int alx_change_mtu(struct net_device *netdev, int mtu) | |||
| 860 | netdev->mtu = mtu; | 830 | netdev->mtu = mtu; |
| 861 | alx->hw.mtu = mtu; | 831 | alx->hw.mtu = mtu; |
| 862 | alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE); | 832 | alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE); |
| 863 | head_size = SKB_DATA_ALIGN(alx->rxbuf_size + NET_SKB_PAD) + | ||
| 864 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | ||
| 865 | alx->rx_frag_size = roundup_pow_of_two(head_size); | ||
| 866 | netdev_update_features(netdev); | 833 | netdev_update_features(netdev); |
| 867 | if (netif_running(netdev)) | 834 | if (netif_running(netdev)) |
| 868 | alx_reinit(alx); | 835 | alx_reinit(alx); |
diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c index 08a23e6b60e9..1a3555d03a96 100644 --- a/drivers/net/ethernet/aurora/nb8800.c +++ b/drivers/net/ethernet/aurora/nb8800.c | |||
| @@ -259,6 +259,7 @@ static void nb8800_receive(struct net_device *dev, unsigned int i, | |||
| 259 | if (err) { | 259 | if (err) { |
| 260 | netdev_err(dev, "rx buffer allocation failed\n"); | 260 | netdev_err(dev, "rx buffer allocation failed\n"); |
| 261 | dev->stats.rx_dropped++; | 261 | dev->stats.rx_dropped++; |
| 262 | dev_kfree_skb(skb); | ||
| 262 | return; | 263 | return; |
| 263 | } | 264 | } |
| 264 | 265 | ||
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 543bf38105c9..bfa26a2590c9 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
| @@ -392,7 +392,7 @@ static void bcm_sysport_get_stats(struct net_device *dev, | |||
| 392 | else | 392 | else |
| 393 | p = (char *)priv; | 393 | p = (char *)priv; |
| 394 | p += s->stat_offset; | 394 | p += s->stat_offset; |
| 395 | data[i] = *(u32 *)p; | 395 | data[i] = *(unsigned long *)p; |
| 396 | } | 396 | } |
| 397 | } | 397 | } |
| 398 | 398 | ||
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index ee5f431ab32a..25bbae5928d4 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c | |||
| @@ -231,7 +231,7 @@ err_dma: | |||
| 231 | dma_unmap_single(dma_dev, slot->dma_addr, skb_headlen(skb), | 231 | dma_unmap_single(dma_dev, slot->dma_addr, skb_headlen(skb), |
| 232 | DMA_TO_DEVICE); | 232 | DMA_TO_DEVICE); |
| 233 | 233 | ||
| 234 | while (i > 0) { | 234 | while (i-- > 0) { |
| 235 | int index = (ring->end + i) % BGMAC_TX_RING_SLOTS; | 235 | int index = (ring->end + i) % BGMAC_TX_RING_SLOTS; |
| 236 | struct bgmac_slot_info *slot = &ring->slots[index]; | 236 | struct bgmac_slot_info *slot = &ring->slots[index]; |
| 237 | u32 ctl1 = le32_to_cpu(ring->cpu_base[index].ctl1); | 237 | u32 ctl1 = le32_to_cpu(ring->cpu_base[index].ctl1); |
| @@ -267,15 +267,16 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) | |||
| 267 | while (ring->start != ring->end) { | 267 | while (ring->start != ring->end) { |
| 268 | int slot_idx = ring->start % BGMAC_TX_RING_SLOTS; | 268 | int slot_idx = ring->start % BGMAC_TX_RING_SLOTS; |
| 269 | struct bgmac_slot_info *slot = &ring->slots[slot_idx]; | 269 | struct bgmac_slot_info *slot = &ring->slots[slot_idx]; |
| 270 | u32 ctl1; | 270 | u32 ctl0, ctl1; |
| 271 | int len; | 271 | int len; |
| 272 | 272 | ||
| 273 | if (slot_idx == empty_slot) | 273 | if (slot_idx == empty_slot) |
| 274 | break; | 274 | break; |
| 275 | 275 | ||
| 276 | ctl0 = le32_to_cpu(ring->cpu_base[slot_idx].ctl0); | ||
| 276 | ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1); | 277 | ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1); |
| 277 | len = ctl1 & BGMAC_DESC_CTL1_LEN; | 278 | len = ctl1 & BGMAC_DESC_CTL1_LEN; |
| 278 | if (ctl1 & BGMAC_DESC_CTL0_SOF) | 279 | if (ctl0 & BGMAC_DESC_CTL0_SOF) |
| 279 | /* Unmap no longer used buffer */ | 280 | /* Unmap no longer used buffer */ |
| 280 | dma_unmap_single(dma_dev, slot->dma_addr, len, | 281 | dma_unmap_single(dma_dev, slot->dma_addr, len, |
| 281 | DMA_TO_DEVICE); | 282 | DMA_TO_DEVICE); |
| @@ -1312,7 +1313,8 @@ static int bgmac_open(struct net_device *net_dev) | |||
| 1312 | 1313 | ||
| 1313 | phy_start(bgmac->phy_dev); | 1314 | phy_start(bgmac->phy_dev); |
| 1314 | 1315 | ||
| 1315 | netif_carrier_on(net_dev); | 1316 | netif_start_queue(net_dev); |
| 1317 | |||
| 1316 | return 0; | 1318 | return 0; |
| 1317 | } | 1319 | } |
| 1318 | 1320 | ||
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index a38cb047b540..1b0ae4a72e9e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | |||
| @@ -1591,7 +1591,7 @@ static int bnxt_get_module_eeprom(struct net_device *dev, | |||
| 1591 | { | 1591 | { |
| 1592 | struct bnxt *bp = netdev_priv(dev); | 1592 | struct bnxt *bp = netdev_priv(dev); |
| 1593 | u16 start = eeprom->offset, length = eeprom->len; | 1593 | u16 start = eeprom->offset, length = eeprom->len; |
| 1594 | int rc; | 1594 | int rc = 0; |
| 1595 | 1595 | ||
| 1596 | memset(data, 0, eeprom->len); | 1596 | memset(data, 0, eeprom->len); |
| 1597 | 1597 | ||
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index 8de79ae63231..0e7e7da8d201 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c | |||
| @@ -2821,7 +2821,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
| 2821 | if (!g) { | 2821 | if (!g) { |
| 2822 | netif_info(lio, tx_err, lio->netdev, | 2822 | netif_info(lio, tx_err, lio->netdev, |
| 2823 | "Transmit scatter gather: glist null!\n"); | 2823 | "Transmit scatter gather: glist null!\n"); |
| 2824 | goto lio_xmit_failed; | 2824 | goto lio_xmit_dma_failed; |
| 2825 | } | 2825 | } |
| 2826 | 2826 | ||
| 2827 | cmdsetup.s.gather = 1; | 2827 | cmdsetup.s.gather = 1; |
| @@ -2892,7 +2892,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
| 2892 | else | 2892 | else |
| 2893 | status = octnet_send_nic_data_pkt(oct, &ndata, xmit_more); | 2893 | status = octnet_send_nic_data_pkt(oct, &ndata, xmit_more); |
| 2894 | if (status == IQ_SEND_FAILED) | 2894 | if (status == IQ_SEND_FAILED) |
| 2895 | goto lio_xmit_failed; | 2895 | goto lio_xmit_dma_failed; |
| 2896 | 2896 | ||
| 2897 | netif_info(lio, tx_queued, lio->netdev, "Transmit queued successfully\n"); | 2897 | netif_info(lio, tx_queued, lio->netdev, "Transmit queued successfully\n"); |
| 2898 | 2898 | ||
| @@ -2906,12 +2906,13 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
| 2906 | 2906 | ||
| 2907 | return NETDEV_TX_OK; | 2907 | return NETDEV_TX_OK; |
| 2908 | 2908 | ||
| 2909 | lio_xmit_dma_failed: | ||
| 2910 | dma_unmap_single(&oct->pci_dev->dev, ndata.cmd.dptr, | ||
| 2911 | ndata.datasize, DMA_TO_DEVICE); | ||
| 2909 | lio_xmit_failed: | 2912 | lio_xmit_failed: |
| 2910 | stats->tx_dropped++; | 2913 | stats->tx_dropped++; |
| 2911 | netif_info(lio, tx_err, lio->netdev, "IQ%d Transmit dropped:%llu\n", | 2914 | netif_info(lio, tx_err, lio->netdev, "IQ%d Transmit dropped:%llu\n", |
| 2912 | iq_no, stats->tx_dropped); | 2915 | iq_no, stats->tx_dropped); |
| 2913 | dma_unmap_single(&oct->pci_dev->dev, ndata.cmd.dptr, | ||
| 2914 | ndata.datasize, DMA_TO_DEVICE); | ||
| 2915 | recv_buffer_free(skb); | 2916 | recv_buffer_free(skb); |
| 2916 | return NETDEV_TX_OK; | 2917 | return NETDEV_TX_OK; |
| 2917 | } | 2918 | } |
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 95f17f8cadac..16ed20357c5c 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c | |||
| @@ -499,6 +499,7 @@ static void nic_tx_channel_cfg(struct nicpf *nic, u8 vnic, | |||
| 499 | u32 rr_quantum; | 499 | u32 rr_quantum; |
| 500 | u8 sq_idx = sq->sq_num; | 500 | u8 sq_idx = sq->sq_num; |
| 501 | u8 pqs_vnic; | 501 | u8 pqs_vnic; |
| 502 | int svf; | ||
| 502 | 503 | ||
| 503 | if (sq->sqs_mode) | 504 | if (sq->sqs_mode) |
| 504 | pqs_vnic = nic->pqs_vf[vnic]; | 505 | pqs_vnic = nic->pqs_vf[vnic]; |
| @@ -511,10 +512,19 @@ static void nic_tx_channel_cfg(struct nicpf *nic, u8 vnic, | |||
| 511 | /* 24 bytes for FCS, IPG and preamble */ | 512 | /* 24 bytes for FCS, IPG and preamble */ |
| 512 | rr_quantum = ((NIC_HW_MAX_FRS + 24) / 4); | 513 | rr_quantum = ((NIC_HW_MAX_FRS + 24) / 4); |
| 513 | 514 | ||
| 514 | tl4 = (lmac * NIC_TL4_PER_LMAC) + (bgx * NIC_TL4_PER_BGX); | 515 | if (!sq->sqs_mode) { |
| 516 | tl4 = (lmac * NIC_TL4_PER_LMAC) + (bgx * NIC_TL4_PER_BGX); | ||
| 517 | } else { | ||
| 518 | for (svf = 0; svf < MAX_SQS_PER_VF; svf++) { | ||
| 519 | if (nic->vf_sqs[pqs_vnic][svf] == vnic) | ||
| 520 | break; | ||
| 521 | } | ||
| 522 | tl4 = (MAX_LMAC_PER_BGX * NIC_TL4_PER_LMAC); | ||
| 523 | tl4 += (lmac * NIC_TL4_PER_LMAC * MAX_SQS_PER_VF); | ||
| 524 | tl4 += (svf * NIC_TL4_PER_LMAC); | ||
| 525 | tl4 += (bgx * NIC_TL4_PER_BGX); | ||
| 526 | } | ||
| 515 | tl4 += sq_idx; | 527 | tl4 += sq_idx; |
| 516 | if (sq->sqs_mode) | ||
| 517 | tl4 += vnic * 8; | ||
| 518 | 528 | ||
| 519 | tl3 = tl4 / (NIC_MAX_TL4 / NIC_MAX_TL3); | 529 | tl3 = tl4 / (NIC_MAX_TL4 / NIC_MAX_TL3); |
| 520 | nic_reg_write(nic, NIC_PF_QSET_0_127_SQ_0_7_CFG2 | | 530 | nic_reg_write(nic, NIC_PF_QSET_0_127_SQ_0_7_CFG2 | |
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index 3ed21988626b..63a39ac97d53 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c | |||
| @@ -551,7 +551,9 @@ static int bgx_xaui_check_link(struct lmac *lmac) | |||
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | /* Clear rcvflt bit (latching high) and read it back */ | 553 | /* Clear rcvflt bit (latching high) and read it back */ |
| 554 | bgx_reg_modify(bgx, lmacid, BGX_SPUX_STATUS2, SPU_STATUS2_RCVFLT); | 554 | if (bgx_reg_read(bgx, lmacid, BGX_SPUX_STATUS2) & SPU_STATUS2_RCVFLT) |
| 555 | bgx_reg_modify(bgx, lmacid, | ||
| 556 | BGX_SPUX_STATUS2, SPU_STATUS2_RCVFLT); | ||
| 555 | if (bgx_reg_read(bgx, lmacid, BGX_SPUX_STATUS2) & SPU_STATUS2_RCVFLT) { | 557 | if (bgx_reg_read(bgx, lmacid, BGX_SPUX_STATUS2) & SPU_STATUS2_RCVFLT) { |
| 556 | dev_err(&bgx->pdev->dev, "Receive fault, retry training\n"); | 558 | dev_err(&bgx->pdev->dev, "Receive fault, retry training\n"); |
| 557 | if (bgx->use_training) { | 559 | if (bgx->use_training) { |
| @@ -570,13 +572,6 @@ static int bgx_xaui_check_link(struct lmac *lmac) | |||
| 570 | return -1; | 572 | return -1; |
| 571 | } | 573 | } |
| 572 | 574 | ||
| 573 | /* Wait for MAC RX to be ready */ | ||
| 574 | if (bgx_poll_reg(bgx, lmacid, BGX_SMUX_RX_CTL, | ||
| 575 | SMU_RX_CTL_STATUS, true)) { | ||
| 576 | dev_err(&bgx->pdev->dev, "SMU RX link not okay\n"); | ||
| 577 | return -1; | ||
| 578 | } | ||
| 579 | |||
| 580 | /* Wait for BGX RX to be idle */ | 575 | /* Wait for BGX RX to be idle */ |
| 581 | if (bgx_poll_reg(bgx, lmacid, BGX_SMUX_CTL, SMU_CTL_RX_IDLE, false)) { | 576 | if (bgx_poll_reg(bgx, lmacid, BGX_SMUX_CTL, SMU_CTL_RX_IDLE, false)) { |
| 582 | dev_err(&bgx->pdev->dev, "SMU RX not idle\n"); | 577 | dev_err(&bgx->pdev->dev, "SMU RX not idle\n"); |
| @@ -589,29 +584,30 @@ static int bgx_xaui_check_link(struct lmac *lmac) | |||
| 589 | return -1; | 584 | return -1; |
| 590 | } | 585 | } |
| 591 | 586 | ||
| 592 | if (bgx_reg_read(bgx, lmacid, BGX_SPUX_STATUS2) & SPU_STATUS2_RCVFLT) { | 587 | /* Clear receive packet disable */ |
| 593 | dev_err(&bgx->pdev->dev, "Receive fault\n"); | ||
| 594 | return -1; | ||
| 595 | } | ||
| 596 | |||
| 597 | /* Receive link is latching low. Force it high and verify it */ | ||
| 598 | bgx_reg_modify(bgx, lmacid, BGX_SPUX_STATUS1, SPU_STATUS1_RCV_LNK); | ||
| 599 | if (bgx_poll_reg(bgx, lmacid, BGX_SPUX_STATUS1, | ||
| 600 | SPU_STATUS1_RCV_LNK, false)) { | ||
| 601 | dev_err(&bgx->pdev->dev, "SPU receive link down\n"); | ||
| 602 | return -1; | ||
| 603 | } | ||
| 604 | |||
| 605 | cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_MISC_CONTROL); | 588 | cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_MISC_CONTROL); |
| 606 | cfg &= ~SPU_MISC_CTL_RX_DIS; | 589 | cfg &= ~SPU_MISC_CTL_RX_DIS; |
| 607 | bgx_reg_write(bgx, lmacid, BGX_SPUX_MISC_CONTROL, cfg); | 590 | bgx_reg_write(bgx, lmacid, BGX_SPUX_MISC_CONTROL, cfg); |
| 608 | return 0; | 591 | |
| 592 | /* Check for MAC RX faults */ | ||
| 593 | cfg = bgx_reg_read(bgx, lmacid, BGX_SMUX_RX_CTL); | ||
| 594 | /* 0 - Link is okay, 1 - Local fault, 2 - Remote fault */ | ||
| 595 | cfg &= SMU_RX_CTL_STATUS; | ||
| 596 | if (!cfg) | ||
| 597 | return 0; | ||
| 598 | |||
| 599 | /* Rx local/remote fault seen. | ||
| 600 | * Do lmac reinit to see if condition recovers | ||
| 601 | */ | ||
| 602 | bgx_lmac_xaui_init(bgx, lmacid, bgx->lmac_type); | ||
| 603 | |||
| 604 | return -1; | ||
| 609 | } | 605 | } |
| 610 | 606 | ||
| 611 | static void bgx_poll_for_link(struct work_struct *work) | 607 | static void bgx_poll_for_link(struct work_struct *work) |
| 612 | { | 608 | { |
| 613 | struct lmac *lmac; | 609 | struct lmac *lmac; |
| 614 | u64 link; | 610 | u64 spu_link, smu_link; |
| 615 | 611 | ||
| 616 | lmac = container_of(work, struct lmac, dwork.work); | 612 | lmac = container_of(work, struct lmac, dwork.work); |
| 617 | 613 | ||
| @@ -621,8 +617,11 @@ static void bgx_poll_for_link(struct work_struct *work) | |||
| 621 | bgx_poll_reg(lmac->bgx, lmac->lmacid, BGX_SPUX_STATUS1, | 617 | bgx_poll_reg(lmac->bgx, lmac->lmacid, BGX_SPUX_STATUS1, |
| 622 | SPU_STATUS1_RCV_LNK, false); | 618 | SPU_STATUS1_RCV_LNK, false); |
| 623 | 619 | ||
| 624 | link = bgx_reg_read(lmac->bgx, lmac->lmacid, BGX_SPUX_STATUS1); | 620 | spu_link = bgx_reg_read(lmac->bgx, lmac->lmacid, BGX_SPUX_STATUS1); |
| 625 | if (link & SPU_STATUS1_RCV_LNK) { | 621 | smu_link = bgx_reg_read(lmac->bgx, lmac->lmacid, BGX_SMUX_RX_CTL); |
| 622 | |||
| 623 | if ((spu_link & SPU_STATUS1_RCV_LNK) && | ||
| 624 | !(smu_link & SMU_RX_CTL_STATUS)) { | ||
| 626 | lmac->link_up = 1; | 625 | lmac->link_up = 1; |
| 627 | if (lmac->bgx->lmac_type == BGX_MODE_XLAUI) | 626 | if (lmac->bgx->lmac_type == BGX_MODE_XLAUI) |
| 628 | lmac->last_speed = 40000; | 627 | lmac->last_speed = 40000; |
| @@ -636,9 +635,15 @@ static void bgx_poll_for_link(struct work_struct *work) | |||
| 636 | } | 635 | } |
| 637 | 636 | ||
| 638 | if (lmac->last_link != lmac->link_up) { | 637 | if (lmac->last_link != lmac->link_up) { |
| 638 | if (lmac->link_up) { | ||
| 639 | if (bgx_xaui_check_link(lmac)) { | ||
| 640 | /* Errors, clear link_up state */ | ||
| 641 | lmac->link_up = 0; | ||
| 642 | lmac->last_speed = SPEED_UNKNOWN; | ||
| 643 | lmac->last_duplex = DUPLEX_UNKNOWN; | ||
| 644 | } | ||
| 645 | } | ||
| 639 | lmac->last_link = lmac->link_up; | 646 | lmac->last_link = lmac->link_up; |
| 640 | if (lmac->link_up) | ||
| 641 | bgx_xaui_check_link(lmac); | ||
| 642 | } | 647 | } |
| 643 | 648 | ||
| 644 | queue_delayed_work(lmac->check_link, &lmac->dwork, HZ * 2); | 649 | queue_delayed_work(lmac->check_link, &lmac->dwork, HZ * 2); |
| @@ -710,7 +715,7 @@ static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid) | |||
| 710 | static void bgx_lmac_disable(struct bgx *bgx, u8 lmacid) | 715 | static void bgx_lmac_disable(struct bgx *bgx, u8 lmacid) |
| 711 | { | 716 | { |
| 712 | struct lmac *lmac; | 717 | struct lmac *lmac; |
| 713 | u64 cmrx_cfg; | 718 | u64 cfg; |
| 714 | 719 | ||
| 715 | lmac = &bgx->lmac[lmacid]; | 720 | lmac = &bgx->lmac[lmacid]; |
| 716 | if (lmac->check_link) { | 721 | if (lmac->check_link) { |
| @@ -719,9 +724,33 @@ static void bgx_lmac_disable(struct bgx *bgx, u8 lmacid) | |||
| 719 | destroy_workqueue(lmac->check_link); | 724 | destroy_workqueue(lmac->check_link); |
| 720 | } | 725 | } |
| 721 | 726 | ||
| 722 | cmrx_cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG); | 727 | /* Disable packet reception */ |
| 723 | cmrx_cfg &= ~(1 << 15); | 728 | cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG); |
| 724 | bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cmrx_cfg); | 729 | cfg &= ~CMR_PKT_RX_EN; |
| 730 | bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg); | ||
| 731 | |||
| 732 | /* Give chance for Rx/Tx FIFO to get drained */ | ||
| 733 | bgx_poll_reg(bgx, lmacid, BGX_CMRX_RX_FIFO_LEN, (u64)0x1FFF, true); | ||
| 734 | bgx_poll_reg(bgx, lmacid, BGX_CMRX_TX_FIFO_LEN, (u64)0x3FFF, true); | ||
| 735 | |||
| 736 | /* Disable packet transmission */ | ||
| 737 | cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG); | ||
| 738 | cfg &= ~CMR_PKT_TX_EN; | ||
| 739 | bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg); | ||
| 740 | |||
| 741 | /* Disable serdes lanes */ | ||
| 742 | if (!lmac->is_sgmii) | ||
| 743 | bgx_reg_modify(bgx, lmacid, | ||
| 744 | BGX_SPUX_CONTROL1, SPU_CTL_LOW_POWER); | ||
| 745 | else | ||
| 746 | bgx_reg_modify(bgx, lmacid, | ||
| 747 | BGX_GMP_PCS_MRX_CTL, PCS_MRX_CTL_PWR_DN); | ||
| 748 | |||
| 749 | /* Disable LMAC */ | ||
| 750 | cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG); | ||
| 751 | cfg &= ~CMR_EN; | ||
| 752 | bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg); | ||
| 753 | |||
| 725 | bgx_flush_dmac_addrs(bgx, lmacid); | 754 | bgx_flush_dmac_addrs(bgx, lmacid); |
| 726 | 755 | ||
| 727 | if ((bgx->lmac_type != BGX_MODE_XFI) && | 756 | if ((bgx->lmac_type != BGX_MODE_XFI) && |
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h index 149e179363a1..42010d2e5ddf 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #define BGX_CMRX_RX_STAT10 0xC0 | 41 | #define BGX_CMRX_RX_STAT10 0xC0 |
| 42 | #define BGX_CMRX_RX_BP_DROP 0xC8 | 42 | #define BGX_CMRX_RX_BP_DROP 0xC8 |
| 43 | #define BGX_CMRX_RX_DMAC_CTL 0x0E8 | 43 | #define BGX_CMRX_RX_DMAC_CTL 0x0E8 |
| 44 | #define BGX_CMRX_RX_FIFO_LEN 0x108 | ||
| 44 | #define BGX_CMR_RX_DMACX_CAM 0x200 | 45 | #define BGX_CMR_RX_DMACX_CAM 0x200 |
| 45 | #define RX_DMACX_CAM_EN BIT_ULL(48) | 46 | #define RX_DMACX_CAM_EN BIT_ULL(48) |
| 46 | #define RX_DMACX_CAM_LMACID(x) (x << 49) | 47 | #define RX_DMACX_CAM_LMACID(x) (x << 49) |
| @@ -50,6 +51,7 @@ | |||
| 50 | #define BGX_CMR_CHAN_MSK_AND 0x450 | 51 | #define BGX_CMR_CHAN_MSK_AND 0x450 |
| 51 | #define BGX_CMR_BIST_STATUS 0x460 | 52 | #define BGX_CMR_BIST_STATUS 0x460 |
| 52 | #define BGX_CMR_RX_LMACS 0x468 | 53 | #define BGX_CMR_RX_LMACS 0x468 |
| 54 | #define BGX_CMRX_TX_FIFO_LEN 0x518 | ||
| 53 | #define BGX_CMRX_TX_STAT0 0x600 | 55 | #define BGX_CMRX_TX_STAT0 0x600 |
| 54 | #define BGX_CMRX_TX_STAT1 0x608 | 56 | #define BGX_CMRX_TX_STAT1 0x608 |
| 55 | #define BGX_CMRX_TX_STAT2 0x610 | 57 | #define BGX_CMRX_TX_STAT2 0x610 |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h index c4b262ca7d43..2accab386323 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h | |||
| @@ -36,8 +36,8 @@ | |||
| 36 | #define __T4FW_VERSION_H__ | 36 | #define __T4FW_VERSION_H__ |
| 37 | 37 | ||
| 38 | #define T4FW_VERSION_MAJOR 0x01 | 38 | #define T4FW_VERSION_MAJOR 0x01 |
| 39 | #define T4FW_VERSION_MINOR 0x0E | 39 | #define T4FW_VERSION_MINOR 0x0F |
| 40 | #define T4FW_VERSION_MICRO 0x04 | 40 | #define T4FW_VERSION_MICRO 0x25 |
| 41 | #define T4FW_VERSION_BUILD 0x00 | 41 | #define T4FW_VERSION_BUILD 0x00 |
| 42 | 42 | ||
| 43 | #define T4FW_MIN_VERSION_MAJOR 0x01 | 43 | #define T4FW_MIN_VERSION_MAJOR 0x01 |
| @@ -45,8 +45,8 @@ | |||
| 45 | #define T4FW_MIN_VERSION_MICRO 0x00 | 45 | #define T4FW_MIN_VERSION_MICRO 0x00 |
| 46 | 46 | ||
| 47 | #define T5FW_VERSION_MAJOR 0x01 | 47 | #define T5FW_VERSION_MAJOR 0x01 |
| 48 | #define T5FW_VERSION_MINOR 0x0E | 48 | #define T5FW_VERSION_MINOR 0x0F |
| 49 | #define T5FW_VERSION_MICRO 0x04 | 49 | #define T5FW_VERSION_MICRO 0x25 |
| 50 | #define T5FW_VERSION_BUILD 0x00 | 50 | #define T5FW_VERSION_BUILD 0x00 |
| 51 | 51 | ||
| 52 | #define T5FW_MIN_VERSION_MAJOR 0x00 | 52 | #define T5FW_MIN_VERSION_MAJOR 0x00 |
| @@ -54,8 +54,8 @@ | |||
| 54 | #define T5FW_MIN_VERSION_MICRO 0x00 | 54 | #define T5FW_MIN_VERSION_MICRO 0x00 |
| 55 | 55 | ||
| 56 | #define T6FW_VERSION_MAJOR 0x01 | 56 | #define T6FW_VERSION_MAJOR 0x01 |
| 57 | #define T6FW_VERSION_MINOR 0x0E | 57 | #define T6FW_VERSION_MINOR 0x0F |
| 58 | #define T6FW_VERSION_MICRO 0x04 | 58 | #define T6FW_VERSION_MICRO 0x25 |
| 59 | #define T6FW_VERSION_BUILD 0x00 | 59 | #define T6FW_VERSION_BUILD 0x00 |
| 60 | 60 | ||
| 61 | #define T6FW_MIN_VERSION_MAJOR 0x00 | 61 | #define T6FW_MIN_VERSION_MAJOR 0x00 |
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c index 4edb98c3c6c7..4466a1187110 100644 --- a/drivers/net/ethernet/ethoc.c +++ b/drivers/net/ethernet/ethoc.c | |||
| @@ -860,6 +860,11 @@ static netdev_tx_t ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 860 | unsigned int entry; | 860 | unsigned int entry; |
| 861 | void *dest; | 861 | void *dest; |
| 862 | 862 | ||
| 863 | if (skb_put_padto(skb, ETHOC_ZLEN)) { | ||
| 864 | dev->stats.tx_errors++; | ||
| 865 | goto out_no_free; | ||
| 866 | } | ||
| 867 | |||
| 863 | if (unlikely(skb->len > ETHOC_BUFSIZ)) { | 868 | if (unlikely(skb->len > ETHOC_BUFSIZ)) { |
| 864 | dev->stats.tx_errors++; | 869 | dev->stats.tx_errors++; |
| 865 | goto out; | 870 | goto out; |
| @@ -894,6 +899,7 @@ static netdev_tx_t ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 894 | skb_tx_timestamp(skb); | 899 | skb_tx_timestamp(skb); |
| 895 | out: | 900 | out: |
| 896 | dev_kfree_skb(skb); | 901 | dev_kfree_skb(skb); |
| 902 | out_no_free: | ||
| 897 | return NETDEV_TX_OK; | 903 | return NETDEV_TX_OK; |
| 898 | } | 904 | } |
| 899 | 905 | ||
| @@ -1086,7 +1092,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
| 1086 | if (!priv->iobase) { | 1092 | if (!priv->iobase) { |
| 1087 | dev_err(&pdev->dev, "cannot remap I/O memory space\n"); | 1093 | dev_err(&pdev->dev, "cannot remap I/O memory space\n"); |
| 1088 | ret = -ENXIO; | 1094 | ret = -ENXIO; |
| 1089 | goto error; | 1095 | goto free; |
| 1090 | } | 1096 | } |
| 1091 | 1097 | ||
| 1092 | if (netdev->mem_end) { | 1098 | if (netdev->mem_end) { |
| @@ -1095,7 +1101,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
| 1095 | if (!priv->membase) { | 1101 | if (!priv->membase) { |
| 1096 | dev_err(&pdev->dev, "cannot remap memory space\n"); | 1102 | dev_err(&pdev->dev, "cannot remap memory space\n"); |
| 1097 | ret = -ENXIO; | 1103 | ret = -ENXIO; |
| 1098 | goto error; | 1104 | goto free; |
| 1099 | } | 1105 | } |
| 1100 | } else { | 1106 | } else { |
| 1101 | /* Allocate buffer memory */ | 1107 | /* Allocate buffer memory */ |
| @@ -1106,7 +1112,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
| 1106 | dev_err(&pdev->dev, "cannot allocate %dB buffer\n", | 1112 | dev_err(&pdev->dev, "cannot allocate %dB buffer\n", |
| 1107 | buffer_size); | 1113 | buffer_size); |
| 1108 | ret = -ENOMEM; | 1114 | ret = -ENOMEM; |
| 1109 | goto error; | 1115 | goto free; |
| 1110 | } | 1116 | } |
| 1111 | netdev->mem_end = netdev->mem_start + buffer_size; | 1117 | netdev->mem_end = netdev->mem_start + buffer_size; |
| 1112 | priv->dma_alloc = buffer_size; | 1118 | priv->dma_alloc = buffer_size; |
| @@ -1120,7 +1126,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
| 1120 | 128, (netdev->mem_end - netdev->mem_start + 1) / ETHOC_BUFSIZ); | 1126 | 128, (netdev->mem_end - netdev->mem_start + 1) / ETHOC_BUFSIZ); |
| 1121 | if (num_bd < 4) { | 1127 | if (num_bd < 4) { |
| 1122 | ret = -ENODEV; | 1128 | ret = -ENODEV; |
| 1123 | goto error; | 1129 | goto free; |
| 1124 | } | 1130 | } |
| 1125 | priv->num_bd = num_bd; | 1131 | priv->num_bd = num_bd; |
| 1126 | /* num_tx must be a power of two */ | 1132 | /* num_tx must be a power of two */ |
| @@ -1133,7 +1139,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
| 1133 | priv->vma = devm_kzalloc(&pdev->dev, num_bd*sizeof(void *), GFP_KERNEL); | 1139 | priv->vma = devm_kzalloc(&pdev->dev, num_bd*sizeof(void *), GFP_KERNEL); |
| 1134 | if (!priv->vma) { | 1140 | if (!priv->vma) { |
| 1135 | ret = -ENOMEM; | 1141 | ret = -ENOMEM; |
| 1136 | goto error; | 1142 | goto free; |
| 1137 | } | 1143 | } |
| 1138 | 1144 | ||
| 1139 | /* Allow the platform setup code to pass in a MAC address. */ | 1145 | /* Allow the platform setup code to pass in a MAC address. */ |
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c index 06f031715b57..9b7a3f5a2818 100644 --- a/drivers/net/ethernet/ezchip/nps_enet.c +++ b/drivers/net/ethernet/ezchip/nps_enet.c | |||
| @@ -285,6 +285,7 @@ static void nps_enet_hw_reset(struct net_device *ndev) | |||
| 285 | ge_rst_value |= NPS_ENET_ENABLE << RST_GMAC_0_SHIFT; | 285 | ge_rst_value |= NPS_ENET_ENABLE << RST_GMAC_0_SHIFT; |
| 286 | nps_enet_reg_set(priv, NPS_ENET_REG_GE_RST, ge_rst_value); | 286 | nps_enet_reg_set(priv, NPS_ENET_REG_GE_RST, ge_rst_value); |
| 287 | usleep_range(10, 20); | 287 | usleep_range(10, 20); |
| 288 | ge_rst_value = 0; | ||
| 288 | nps_enet_reg_set(priv, NPS_ENET_REG_GE_RST, ge_rst_value); | 289 | nps_enet_reg_set(priv, NPS_ENET_REG_GE_RST, ge_rst_value); |
| 289 | 290 | ||
| 290 | /* Tx fifo reset sequence */ | 291 | /* Tx fifo reset sequence */ |
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 864cb21351a4..88f3c85fb04a 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c | |||
| @@ -75,6 +75,7 @@ | |||
| 75 | #include <linux/uaccess.h> | 75 | #include <linux/uaccess.h> |
| 76 | #include <asm/firmware.h> | 76 | #include <asm/firmware.h> |
| 77 | #include <linux/seq_file.h> | 77 | #include <linux/seq_file.h> |
| 78 | #include <linux/workqueue.h> | ||
| 78 | 79 | ||
| 79 | #include "ibmvnic.h" | 80 | #include "ibmvnic.h" |
| 80 | 81 | ||
| @@ -89,6 +90,7 @@ MODULE_VERSION(IBMVNIC_DRIVER_VERSION); | |||
| 89 | static int ibmvnic_version = IBMVNIC_INITIAL_VERSION; | 90 | static int ibmvnic_version = IBMVNIC_INITIAL_VERSION; |
| 90 | static int ibmvnic_remove(struct vio_dev *); | 91 | static int ibmvnic_remove(struct vio_dev *); |
| 91 | static void release_sub_crqs(struct ibmvnic_adapter *); | 92 | static void release_sub_crqs(struct ibmvnic_adapter *); |
| 93 | static void release_sub_crqs_no_irqs(struct ibmvnic_adapter *); | ||
| 92 | static int ibmvnic_reset_crq(struct ibmvnic_adapter *); | 94 | static int ibmvnic_reset_crq(struct ibmvnic_adapter *); |
| 93 | static int ibmvnic_send_crq_init(struct ibmvnic_adapter *); | 95 | static int ibmvnic_send_crq_init(struct ibmvnic_adapter *); |
| 94 | static int ibmvnic_reenable_crq_queue(struct ibmvnic_adapter *); | 96 | static int ibmvnic_reenable_crq_queue(struct ibmvnic_adapter *); |
| @@ -469,7 +471,8 @@ static int ibmvnic_open(struct net_device *netdev) | |||
| 469 | crq.logical_link_state.link_state = IBMVNIC_LOGICAL_LNK_UP; | 471 | crq.logical_link_state.link_state = IBMVNIC_LOGICAL_LNK_UP; |
| 470 | ibmvnic_send_crq(adapter, &crq); | 472 | ibmvnic_send_crq(adapter, &crq); |
| 471 | 473 | ||
| 472 | netif_start_queue(netdev); | 474 | netif_tx_start_all_queues(netdev); |
| 475 | |||
| 473 | return 0; | 476 | return 0; |
| 474 | 477 | ||
| 475 | bounce_map_failed: | 478 | bounce_map_failed: |
| @@ -519,7 +522,7 @@ static int ibmvnic_close(struct net_device *netdev) | |||
| 519 | for (i = 0; i < adapter->req_rx_queues; i++) | 522 | for (i = 0; i < adapter->req_rx_queues; i++) |
| 520 | napi_disable(&adapter->napi[i]); | 523 | napi_disable(&adapter->napi[i]); |
| 521 | 524 | ||
| 522 | netif_stop_queue(netdev); | 525 | netif_tx_stop_all_queues(netdev); |
| 523 | 526 | ||
| 524 | if (adapter->bounce_buffer) { | 527 | if (adapter->bounce_buffer) { |
| 525 | if (!dma_mapping_error(dev, adapter->bounce_buffer_dma)) { | 528 | if (!dma_mapping_error(dev, adapter->bounce_buffer_dma)) { |
| @@ -1212,12 +1215,6 @@ static struct ibmvnic_sub_crq_queue *init_sub_crq_queue(struct ibmvnic_adapter | |||
| 1212 | goto reg_failed; | 1215 | goto reg_failed; |
| 1213 | } | 1216 | } |
| 1214 | 1217 | ||
| 1215 | scrq->irq = irq_create_mapping(NULL, scrq->hw_irq); | ||
| 1216 | if (scrq->irq == NO_IRQ) { | ||
| 1217 | dev_err(dev, "Error mapping irq\n"); | ||
| 1218 | goto map_irq_failed; | ||
| 1219 | } | ||
| 1220 | |||
| 1221 | scrq->adapter = adapter; | 1218 | scrq->adapter = adapter; |
| 1222 | scrq->size = 4 * PAGE_SIZE / sizeof(*scrq->msgs); | 1219 | scrq->size = 4 * PAGE_SIZE / sizeof(*scrq->msgs); |
| 1223 | scrq->cur = 0; | 1220 | scrq->cur = 0; |
| @@ -1230,12 +1227,6 @@ static struct ibmvnic_sub_crq_queue *init_sub_crq_queue(struct ibmvnic_adapter | |||
| 1230 | 1227 | ||
| 1231 | return scrq; | 1228 | return scrq; |
| 1232 | 1229 | ||
| 1233 | map_irq_failed: | ||
| 1234 | do { | ||
| 1235 | rc = plpar_hcall_norets(H_FREE_SUB_CRQ, | ||
| 1236 | adapter->vdev->unit_address, | ||
| 1237 | scrq->crq_num); | ||
| 1238 | } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); | ||
| 1239 | reg_failed: | 1230 | reg_failed: |
| 1240 | dma_unmap_single(dev, scrq->msg_token, 4 * PAGE_SIZE, | 1231 | dma_unmap_single(dev, scrq->msg_token, 4 * PAGE_SIZE, |
| 1241 | DMA_BIDIRECTIONAL); | 1232 | DMA_BIDIRECTIONAL); |
| @@ -1256,6 +1247,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter) | |||
| 1256 | if (adapter->tx_scrq[i]) { | 1247 | if (adapter->tx_scrq[i]) { |
| 1257 | free_irq(adapter->tx_scrq[i]->irq, | 1248 | free_irq(adapter->tx_scrq[i]->irq, |
| 1258 | adapter->tx_scrq[i]); | 1249 | adapter->tx_scrq[i]); |
| 1250 | irq_dispose_mapping(adapter->tx_scrq[i]->irq); | ||
| 1259 | release_sub_crq_queue(adapter, | 1251 | release_sub_crq_queue(adapter, |
| 1260 | adapter->tx_scrq[i]); | 1252 | adapter->tx_scrq[i]); |
| 1261 | } | 1253 | } |
| @@ -1267,6 +1259,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter) | |||
| 1267 | if (adapter->rx_scrq[i]) { | 1259 | if (adapter->rx_scrq[i]) { |
| 1268 | free_irq(adapter->rx_scrq[i]->irq, | 1260 | free_irq(adapter->rx_scrq[i]->irq, |
| 1269 | adapter->rx_scrq[i]); | 1261 | adapter->rx_scrq[i]); |
| 1262 | irq_dispose_mapping(adapter->rx_scrq[i]->irq); | ||
| 1270 | release_sub_crq_queue(adapter, | 1263 | release_sub_crq_queue(adapter, |
| 1271 | adapter->rx_scrq[i]); | 1264 | adapter->rx_scrq[i]); |
| 1272 | } | 1265 | } |
| @@ -1276,6 +1269,29 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter) | |||
| 1276 | adapter->requested_caps = 0; | 1269 | adapter->requested_caps = 0; |
| 1277 | } | 1270 | } |
| 1278 | 1271 | ||
| 1272 | static void release_sub_crqs_no_irqs(struct ibmvnic_adapter *adapter) | ||
| 1273 | { | ||
| 1274 | int i; | ||
| 1275 | |||
| 1276 | if (adapter->tx_scrq) { | ||
| 1277 | for (i = 0; i < adapter->req_tx_queues; i++) | ||
| 1278 | if (adapter->tx_scrq[i]) | ||
| 1279 | release_sub_crq_queue(adapter, | ||
| 1280 | adapter->tx_scrq[i]); | ||
| 1281 | adapter->tx_scrq = NULL; | ||
| 1282 | } | ||
| 1283 | |||
| 1284 | if (adapter->rx_scrq) { | ||
| 1285 | for (i = 0; i < adapter->req_rx_queues; i++) | ||
| 1286 | if (adapter->rx_scrq[i]) | ||
| 1287 | release_sub_crq_queue(adapter, | ||
| 1288 | adapter->rx_scrq[i]); | ||
| 1289 | adapter->rx_scrq = NULL; | ||
| 1290 | } | ||
| 1291 | |||
| 1292 | adapter->requested_caps = 0; | ||
| 1293 | } | ||
| 1294 | |||
| 1279 | static int disable_scrq_irq(struct ibmvnic_adapter *adapter, | 1295 | static int disable_scrq_irq(struct ibmvnic_adapter *adapter, |
| 1280 | struct ibmvnic_sub_crq_queue *scrq) | 1296 | struct ibmvnic_sub_crq_queue *scrq) |
| 1281 | { | 1297 | { |
| @@ -1395,6 +1411,66 @@ static irqreturn_t ibmvnic_interrupt_rx(int irq, void *instance) | |||
| 1395 | return IRQ_HANDLED; | 1411 | return IRQ_HANDLED; |
| 1396 | } | 1412 | } |
| 1397 | 1413 | ||
| 1414 | static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter) | ||
| 1415 | { | ||
| 1416 | struct device *dev = &adapter->vdev->dev; | ||
| 1417 | struct ibmvnic_sub_crq_queue *scrq; | ||
| 1418 | int i = 0, j = 0; | ||
| 1419 | int rc = 0; | ||
| 1420 | |||
| 1421 | for (i = 0; i < adapter->req_tx_queues; i++) { | ||
| 1422 | scrq = adapter->tx_scrq[i]; | ||
| 1423 | scrq->irq = irq_create_mapping(NULL, scrq->hw_irq); | ||
| 1424 | |||
| 1425 | if (scrq->irq == NO_IRQ) { | ||
| 1426 | rc = -EINVAL; | ||
| 1427 | dev_err(dev, "Error mapping irq\n"); | ||
| 1428 | goto req_tx_irq_failed; | ||
| 1429 | } | ||
| 1430 | |||
| 1431 | rc = request_irq(scrq->irq, ibmvnic_interrupt_tx, | ||
| 1432 | 0, "ibmvnic_tx", scrq); | ||
| 1433 | |||
| 1434 | if (rc) { | ||
| 1435 | dev_err(dev, "Couldn't register tx irq 0x%x. rc=%d\n", | ||
| 1436 | scrq->irq, rc); | ||
| 1437 | irq_dispose_mapping(scrq->irq); | ||
| 1438 | goto req_rx_irq_failed; | ||
| 1439 | } | ||
| 1440 | } | ||
| 1441 | |||
| 1442 | for (i = 0; i < adapter->req_rx_queues; i++) { | ||
| 1443 | scrq = adapter->rx_scrq[i]; | ||
| 1444 | scrq->irq = irq_create_mapping(NULL, scrq->hw_irq); | ||
| 1445 | if (scrq->irq == NO_IRQ) { | ||
| 1446 | rc = -EINVAL; | ||
| 1447 | dev_err(dev, "Error mapping irq\n"); | ||
| 1448 | goto req_rx_irq_failed; | ||
| 1449 | } | ||
| 1450 | rc = request_irq(scrq->irq, ibmvnic_interrupt_rx, | ||
| 1451 | 0, "ibmvnic_rx", scrq); | ||
| 1452 | if (rc) { | ||
| 1453 | dev_err(dev, "Couldn't register rx irq 0x%x. rc=%d\n", | ||
| 1454 | scrq->irq, rc); | ||
| 1455 | irq_dispose_mapping(scrq->irq); | ||
| 1456 | goto req_rx_irq_failed; | ||
| 1457 | } | ||
| 1458 | } | ||
| 1459 | return rc; | ||
| 1460 | |||
| 1461 | req_rx_irq_failed: | ||
| 1462 | for (j = 0; j < i; j++) | ||
| 1463 | free_irq(adapter->rx_scrq[j]->irq, adapter->rx_scrq[j]); | ||
| 1464 | irq_dispose_mapping(adapter->rx_scrq[j]->irq); | ||
| 1465 | i = adapter->req_tx_queues; | ||
| 1466 | req_tx_irq_failed: | ||
| 1467 | for (j = 0; j < i; j++) | ||
| 1468 | free_irq(adapter->tx_scrq[j]->irq, adapter->tx_scrq[j]); | ||
| 1469 | irq_dispose_mapping(adapter->rx_scrq[j]->irq); | ||
| 1470 | release_sub_crqs_no_irqs(adapter); | ||
| 1471 | return rc; | ||
| 1472 | } | ||
| 1473 | |||
| 1398 | static void init_sub_crqs(struct ibmvnic_adapter *adapter, int retry) | 1474 | static void init_sub_crqs(struct ibmvnic_adapter *adapter, int retry) |
| 1399 | { | 1475 | { |
| 1400 | struct device *dev = &adapter->vdev->dev; | 1476 | struct device *dev = &adapter->vdev->dev; |
| @@ -1403,8 +1479,7 @@ static void init_sub_crqs(struct ibmvnic_adapter *adapter, int retry) | |||
| 1403 | union ibmvnic_crq crq; | 1479 | union ibmvnic_crq crq; |
| 1404 | int total_queues; | 1480 | int total_queues; |
| 1405 | int more = 0; | 1481 | int more = 0; |
| 1406 | int i, j; | 1482 | int i; |
| 1407 | int rc; | ||
| 1408 | 1483 | ||
| 1409 | if (!retry) { | 1484 | if (!retry) { |
| 1410 | /* Sub-CRQ entries are 32 byte long */ | 1485 | /* Sub-CRQ entries are 32 byte long */ |
| @@ -1483,13 +1558,6 @@ static void init_sub_crqs(struct ibmvnic_adapter *adapter, int retry) | |||
| 1483 | for (i = 0; i < adapter->req_tx_queues; i++) { | 1558 | for (i = 0; i < adapter->req_tx_queues; i++) { |
| 1484 | adapter->tx_scrq[i] = allqueues[i]; | 1559 | adapter->tx_scrq[i] = allqueues[i]; |
| 1485 | adapter->tx_scrq[i]->pool_index = i; | 1560 | adapter->tx_scrq[i]->pool_index = i; |
| 1486 | rc = request_irq(adapter->tx_scrq[i]->irq, ibmvnic_interrupt_tx, | ||
| 1487 | 0, "ibmvnic_tx", adapter->tx_scrq[i]); | ||
| 1488 | if (rc) { | ||
| 1489 | dev_err(dev, "Couldn't register tx irq 0x%x. rc=%d\n", | ||
| 1490 | adapter->tx_scrq[i]->irq, rc); | ||
| 1491 | goto req_tx_irq_failed; | ||
| 1492 | } | ||
| 1493 | } | 1561 | } |
| 1494 | 1562 | ||
| 1495 | adapter->rx_scrq = kcalloc(adapter->req_rx_queues, | 1563 | adapter->rx_scrq = kcalloc(adapter->req_rx_queues, |
| @@ -1500,13 +1568,6 @@ static void init_sub_crqs(struct ibmvnic_adapter *adapter, int retry) | |||
| 1500 | for (i = 0; i < adapter->req_rx_queues; i++) { | 1568 | for (i = 0; i < adapter->req_rx_queues; i++) { |
| 1501 | adapter->rx_scrq[i] = allqueues[i + adapter->req_tx_queues]; | 1569 | adapter->rx_scrq[i] = allqueues[i + adapter->req_tx_queues]; |
| 1502 | adapter->rx_scrq[i]->scrq_num = i; | 1570 | adapter->rx_scrq[i]->scrq_num = i; |
| 1503 | rc = request_irq(adapter->rx_scrq[i]->irq, ibmvnic_interrupt_rx, | ||
| 1504 | 0, "ibmvnic_rx", adapter->rx_scrq[i]); | ||
| 1505 | if (rc) { | ||
| 1506 | dev_err(dev, "Couldn't register rx irq 0x%x. rc=%d\n", | ||
| 1507 | adapter->rx_scrq[i]->irq, rc); | ||
| 1508 | goto req_rx_irq_failed; | ||
| 1509 | } | ||
| 1510 | } | 1571 | } |
| 1511 | 1572 | ||
| 1512 | memset(&crq, 0, sizeof(crq)); | 1573 | memset(&crq, 0, sizeof(crq)); |
| @@ -1559,15 +1620,6 @@ static void init_sub_crqs(struct ibmvnic_adapter *adapter, int retry) | |||
| 1559 | 1620 | ||
| 1560 | return; | 1621 | return; |
| 1561 | 1622 | ||
| 1562 | req_rx_irq_failed: | ||
| 1563 | for (j = 0; j < i; j++) | ||
| 1564 | free_irq(adapter->rx_scrq[j]->irq, adapter->rx_scrq[j]); | ||
| 1565 | i = adapter->req_tx_queues; | ||
| 1566 | req_tx_irq_failed: | ||
| 1567 | for (j = 0; j < i; j++) | ||
| 1568 | free_irq(adapter->tx_scrq[j]->irq, adapter->tx_scrq[j]); | ||
| 1569 | kfree(adapter->rx_scrq); | ||
| 1570 | adapter->rx_scrq = NULL; | ||
| 1571 | rx_failed: | 1623 | rx_failed: |
| 1572 | kfree(adapter->tx_scrq); | 1624 | kfree(adapter->tx_scrq); |
| 1573 | adapter->tx_scrq = NULL; | 1625 | adapter->tx_scrq = NULL; |
| @@ -2121,7 +2173,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, | |||
| 2121 | struct ibmvnic_adapter *adapter) | 2173 | struct ibmvnic_adapter *adapter) |
| 2122 | { | 2174 | { |
| 2123 | struct device *dev = &adapter->vdev->dev; | 2175 | struct device *dev = &adapter->vdev->dev; |
| 2124 | struct ibmvnic_error_buff *error_buff; | 2176 | struct ibmvnic_error_buff *error_buff, *tmp; |
| 2125 | unsigned long flags; | 2177 | unsigned long flags; |
| 2126 | bool found = false; | 2178 | bool found = false; |
| 2127 | int i; | 2179 | int i; |
| @@ -2133,7 +2185,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, | |||
| 2133 | } | 2185 | } |
| 2134 | 2186 | ||
| 2135 | spin_lock_irqsave(&adapter->error_list_lock, flags); | 2187 | spin_lock_irqsave(&adapter->error_list_lock, flags); |
| 2136 | list_for_each_entry(error_buff, &adapter->errors, list) | 2188 | list_for_each_entry_safe(error_buff, tmp, &adapter->errors, list) |
| 2137 | if (error_buff->error_id == crq->request_error_rsp.error_id) { | 2189 | if (error_buff->error_id == crq->request_error_rsp.error_id) { |
| 2138 | found = true; | 2190 | found = true; |
| 2139 | list_del(&error_buff->list); | 2191 | list_del(&error_buff->list); |
| @@ -2348,9 +2400,9 @@ static void handle_request_cap_rsp(union ibmvnic_crq *crq, | |||
| 2348 | *req_value, | 2400 | *req_value, |
| 2349 | (long int)be32_to_cpu(crq->request_capability_rsp. | 2401 | (long int)be32_to_cpu(crq->request_capability_rsp. |
| 2350 | number), name); | 2402 | number), name); |
| 2351 | release_sub_crqs(adapter); | 2403 | release_sub_crqs_no_irqs(adapter); |
| 2352 | *req_value = be32_to_cpu(crq->request_capability_rsp.number); | 2404 | *req_value = be32_to_cpu(crq->request_capability_rsp.number); |
| 2353 | complete(&adapter->init_done); | 2405 | init_sub_crqs(adapter, 1); |
| 2354 | return; | 2406 | return; |
| 2355 | default: | 2407 | default: |
| 2356 | dev_err(dev, "Error %d in request cap rsp\n", | 2408 | dev_err(dev, "Error %d in request cap rsp\n", |
| @@ -2659,7 +2711,7 @@ static void handle_query_cap_rsp(union ibmvnic_crq *crq, | |||
| 2659 | 2711 | ||
| 2660 | out: | 2712 | out: |
| 2661 | if (atomic_read(&adapter->running_cap_queries) == 0) | 2713 | if (atomic_read(&adapter->running_cap_queries) == 0) |
| 2662 | complete(&adapter->init_done); | 2714 | init_sub_crqs(adapter, 0); |
| 2663 | /* We're done querying the capabilities, initialize sub-crqs */ | 2715 | /* We're done querying the capabilities, initialize sub-crqs */ |
| 2664 | } | 2716 | } |
| 2665 | 2717 | ||
| @@ -3141,14 +3193,14 @@ static void handle_request_ras_comp_num_rsp(union ibmvnic_crq *crq, | |||
| 3141 | 3193 | ||
| 3142 | static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) | 3194 | static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) |
| 3143 | { | 3195 | { |
| 3144 | struct ibmvnic_inflight_cmd *inflight_cmd; | 3196 | struct ibmvnic_inflight_cmd *inflight_cmd, *tmp1; |
| 3145 | struct device *dev = &adapter->vdev->dev; | 3197 | struct device *dev = &adapter->vdev->dev; |
| 3146 | struct ibmvnic_error_buff *error_buff; | 3198 | struct ibmvnic_error_buff *error_buff, *tmp2; |
| 3147 | unsigned long flags; | 3199 | unsigned long flags; |
| 3148 | unsigned long flags2; | 3200 | unsigned long flags2; |
| 3149 | 3201 | ||
| 3150 | spin_lock_irqsave(&adapter->inflight_lock, flags); | 3202 | spin_lock_irqsave(&adapter->inflight_lock, flags); |
| 3151 | list_for_each_entry(inflight_cmd, &adapter->inflight, list) { | 3203 | list_for_each_entry_safe(inflight_cmd, tmp1, &adapter->inflight, list) { |
| 3152 | switch (inflight_cmd->crq.generic.cmd) { | 3204 | switch (inflight_cmd->crq.generic.cmd) { |
| 3153 | case LOGIN: | 3205 | case LOGIN: |
| 3154 | dma_unmap_single(dev, adapter->login_buf_token, | 3206 | dma_unmap_single(dev, adapter->login_buf_token, |
| @@ -3165,8 +3217,8 @@ static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) | |||
| 3165 | break; | 3217 | break; |
| 3166 | case REQUEST_ERROR_INFO: | 3218 | case REQUEST_ERROR_INFO: |
| 3167 | spin_lock_irqsave(&adapter->error_list_lock, flags2); | 3219 | spin_lock_irqsave(&adapter->error_list_lock, flags2); |
| 3168 | list_for_each_entry(error_buff, &adapter->errors, | 3220 | list_for_each_entry_safe(error_buff, tmp2, |
| 3169 | list) { | 3221 | &adapter->errors, list) { |
| 3170 | dma_unmap_single(dev, error_buff->dma, | 3222 | dma_unmap_single(dev, error_buff->dma, |
| 3171 | error_buff->len, | 3223 | error_buff->len, |
| 3172 | DMA_FROM_DEVICE); | 3224 | DMA_FROM_DEVICE); |
| @@ -3202,8 +3254,8 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, | |||
| 3202 | dev_info(dev, "Partner initialized\n"); | 3254 | dev_info(dev, "Partner initialized\n"); |
| 3203 | /* Send back a response */ | 3255 | /* Send back a response */ |
| 3204 | rc = ibmvnic_send_crq_init_complete(adapter); | 3256 | rc = ibmvnic_send_crq_init_complete(adapter); |
| 3205 | if (rc == 0) | 3257 | if (!rc) |
| 3206 | send_version_xchg(adapter); | 3258 | schedule_work(&adapter->vnic_crq_init); |
| 3207 | else | 3259 | else |
| 3208 | dev_err(dev, "Can't send initrsp rc=%ld\n", rc); | 3260 | dev_err(dev, "Can't send initrsp rc=%ld\n", rc); |
| 3209 | break; | 3261 | break; |
| @@ -3555,8 +3607,63 @@ static const struct file_operations ibmvnic_dump_ops = { | |||
| 3555 | .release = single_release, | 3607 | .release = single_release, |
| 3556 | }; | 3608 | }; |
| 3557 | 3609 | ||
| 3610 | static void handle_crq_init_rsp(struct work_struct *work) | ||
| 3611 | { | ||
| 3612 | struct ibmvnic_adapter *adapter = container_of(work, | ||
| 3613 | struct ibmvnic_adapter, | ||
| 3614 | vnic_crq_init); | ||
| 3615 | struct device *dev = &adapter->vdev->dev; | ||
| 3616 | struct net_device *netdev = adapter->netdev; | ||
| 3617 | unsigned long timeout = msecs_to_jiffies(30000); | ||
| 3618 | int rc; | ||
| 3619 | |||
| 3620 | send_version_xchg(adapter); | ||
| 3621 | reinit_completion(&adapter->init_done); | ||
| 3622 | if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { | ||
| 3623 | dev_err(dev, "Passive init timeout\n"); | ||
| 3624 | goto task_failed; | ||
| 3625 | } | ||
| 3626 | |||
| 3627 | do { | ||
| 3628 | if (adapter->renegotiate) { | ||
| 3629 | adapter->renegotiate = false; | ||
| 3630 | release_sub_crqs_no_irqs(adapter); | ||
| 3631 | send_cap_queries(adapter); | ||
| 3632 | |||
| 3633 | reinit_completion(&adapter->init_done); | ||
| 3634 | if (!wait_for_completion_timeout(&adapter->init_done, | ||
| 3635 | timeout)) { | ||
| 3636 | dev_err(dev, "Passive init timeout\n"); | ||
| 3637 | goto task_failed; | ||
| 3638 | } | ||
| 3639 | } | ||
| 3640 | } while (adapter->renegotiate); | ||
| 3641 | rc = init_sub_crq_irqs(adapter); | ||
| 3642 | |||
| 3643 | if (rc) | ||
| 3644 | goto task_failed; | ||
| 3645 | |||
| 3646 | netdev->real_num_tx_queues = adapter->req_tx_queues; | ||
| 3647 | |||
| 3648 | rc = register_netdev(netdev); | ||
| 3649 | if (rc) { | ||
| 3650 | dev_err(dev, | ||
| 3651 | "failed to register netdev rc=%d\n", rc); | ||
| 3652 | goto register_failed; | ||
| 3653 | } | ||
| 3654 | dev_info(dev, "ibmvnic registered\n"); | ||
| 3655 | |||
| 3656 | return; | ||
| 3657 | |||
| 3658 | register_failed: | ||
| 3659 | release_sub_crqs(adapter); | ||
| 3660 | task_failed: | ||
| 3661 | dev_err(dev, "Passive initialization was not successful\n"); | ||
| 3662 | } | ||
| 3663 | |||
| 3558 | static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) | 3664 | static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) |
| 3559 | { | 3665 | { |
| 3666 | unsigned long timeout = msecs_to_jiffies(30000); | ||
| 3560 | struct ibmvnic_adapter *adapter; | 3667 | struct ibmvnic_adapter *adapter; |
| 3561 | struct net_device *netdev; | 3668 | struct net_device *netdev; |
| 3562 | unsigned char *mac_addr_p; | 3669 | unsigned char *mac_addr_p; |
| @@ -3593,6 +3700,8 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) | |||
| 3593 | netdev->ethtool_ops = &ibmvnic_ethtool_ops; | 3700 | netdev->ethtool_ops = &ibmvnic_ethtool_ops; |
| 3594 | SET_NETDEV_DEV(netdev, &dev->dev); | 3701 | SET_NETDEV_DEV(netdev, &dev->dev); |
| 3595 | 3702 | ||
| 3703 | INIT_WORK(&adapter->vnic_crq_init, handle_crq_init_rsp); | ||
| 3704 | |||
| 3596 | spin_lock_init(&adapter->stats_lock); | 3705 | spin_lock_init(&adapter->stats_lock); |
| 3597 | 3706 | ||
| 3598 | rc = ibmvnic_init_crq_queue(adapter); | 3707 | rc = ibmvnic_init_crq_queue(adapter); |
| @@ -3635,30 +3744,26 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) | |||
| 3635 | ibmvnic_send_crq_init(adapter); | 3744 | ibmvnic_send_crq_init(adapter); |
| 3636 | 3745 | ||
| 3637 | init_completion(&adapter->init_done); | 3746 | init_completion(&adapter->init_done); |
| 3638 | wait_for_completion(&adapter->init_done); | 3747 | if (!wait_for_completion_timeout(&adapter->init_done, timeout)) |
| 3748 | return 0; | ||
| 3639 | 3749 | ||
| 3640 | do { | 3750 | do { |
| 3641 | adapter->renegotiate = false; | ||
| 3642 | |||
| 3643 | init_sub_crqs(adapter, 0); | ||
| 3644 | reinit_completion(&adapter->init_done); | ||
| 3645 | wait_for_completion(&adapter->init_done); | ||
| 3646 | |||
| 3647 | if (adapter->renegotiate) { | 3751 | if (adapter->renegotiate) { |
| 3648 | release_sub_crqs(adapter); | 3752 | adapter->renegotiate = false; |
| 3753 | release_sub_crqs_no_irqs(adapter); | ||
| 3649 | send_cap_queries(adapter); | 3754 | send_cap_queries(adapter); |
| 3650 | 3755 | ||
| 3651 | reinit_completion(&adapter->init_done); | 3756 | reinit_completion(&adapter->init_done); |
| 3652 | wait_for_completion(&adapter->init_done); | 3757 | if (!wait_for_completion_timeout(&adapter->init_done, |
| 3758 | timeout)) | ||
| 3759 | return 0; | ||
| 3653 | } | 3760 | } |
| 3654 | } while (adapter->renegotiate); | 3761 | } while (adapter->renegotiate); |
| 3655 | 3762 | ||
| 3656 | /* if init_sub_crqs is partially successful, retry */ | 3763 | rc = init_sub_crq_irqs(adapter); |
| 3657 | while (!adapter->tx_scrq || !adapter->rx_scrq) { | 3764 | if (rc) { |
| 3658 | init_sub_crqs(adapter, 1); | 3765 | dev_err(&dev->dev, "failed to initialize sub crq irqs\n"); |
| 3659 | 3766 | goto free_debugfs; | |
| 3660 | reinit_completion(&adapter->init_done); | ||
| 3661 | wait_for_completion(&adapter->init_done); | ||
| 3662 | } | 3767 | } |
| 3663 | 3768 | ||
| 3664 | netdev->real_num_tx_queues = adapter->req_tx_queues; | 3769 | netdev->real_num_tx_queues = adapter->req_tx_queues; |
| @@ -3666,12 +3771,14 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) | |||
| 3666 | rc = register_netdev(netdev); | 3771 | rc = register_netdev(netdev); |
| 3667 | if (rc) { | 3772 | if (rc) { |
| 3668 | dev_err(&dev->dev, "failed to register netdev rc=%d\n", rc); | 3773 | dev_err(&dev->dev, "failed to register netdev rc=%d\n", rc); |
| 3669 | goto free_debugfs; | 3774 | goto free_sub_crqs; |
| 3670 | } | 3775 | } |
| 3671 | dev_info(&dev->dev, "ibmvnic registered\n"); | 3776 | dev_info(&dev->dev, "ibmvnic registered\n"); |
| 3672 | 3777 | ||
| 3673 | return 0; | 3778 | return 0; |
| 3674 | 3779 | ||
| 3780 | free_sub_crqs: | ||
| 3781 | release_sub_crqs(adapter); | ||
| 3675 | free_debugfs: | 3782 | free_debugfs: |
| 3676 | if (adapter->debugfs_dir && !IS_ERR(adapter->debugfs_dir)) | 3783 | if (adapter->debugfs_dir && !IS_ERR(adapter->debugfs_dir)) |
| 3677 | debugfs_remove_recursive(adapter->debugfs_dir); | 3784 | debugfs_remove_recursive(adapter->debugfs_dir); |
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h index 0b66a506a4e4..e82898fd518e 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.h +++ b/drivers/net/ethernet/ibm/ibmvnic.h | |||
| @@ -1045,4 +1045,6 @@ struct ibmvnic_adapter { | |||
| 1045 | u64 opt_rxba_entries_per_subcrq; | 1045 | u64 opt_rxba_entries_per_subcrq; |
| 1046 | __be64 tx_rx_desc_req; | 1046 | __be64 tx_rx_desc_req; |
| 1047 | u8 map_id; | 1047 | u8 map_id; |
| 1048 | |||
| 1049 | struct work_struct vnic_crq_init; | ||
| 1048 | }; | 1050 | }; |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 75e60897b7e7..2b2e2f8c6369 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
| @@ -2789,7 +2789,7 @@ static void e1000e_vlan_filter_enable(struct e1000_adapter *adapter) | |||
| 2789 | } | 2789 | } |
| 2790 | 2790 | ||
| 2791 | /** | 2791 | /** |
| 2792 | * e1000e_vlan_strip_enable - helper to disable HW VLAN stripping | 2792 | * e1000e_vlan_strip_disable - helper to disable HW VLAN stripping |
| 2793 | * @adapter: board private structure to initialize | 2793 | * @adapter: board private structure to initialize |
| 2794 | **/ | 2794 | **/ |
| 2795 | static void e1000e_vlan_strip_disable(struct e1000_adapter *adapter) | 2795 | static void e1000e_vlan_strip_disable(struct e1000_adapter *adapter) |
| @@ -6915,6 +6915,14 @@ static netdev_features_t e1000_fix_features(struct net_device *netdev, | |||
| 6915 | if ((hw->mac.type >= e1000_pch2lan) && (netdev->mtu > ETH_DATA_LEN)) | 6915 | if ((hw->mac.type >= e1000_pch2lan) && (netdev->mtu > ETH_DATA_LEN)) |
| 6916 | features &= ~NETIF_F_RXFCS; | 6916 | features &= ~NETIF_F_RXFCS; |
| 6917 | 6917 | ||
| 6918 | /* Since there is no support for separate Rx/Tx vlan accel | ||
| 6919 | * enable/disable make sure Tx flag is always in same state as Rx. | ||
| 6920 | */ | ||
| 6921 | if (features & NETIF_F_HW_VLAN_CTAG_RX) | ||
| 6922 | features |= NETIF_F_HW_VLAN_CTAG_TX; | ||
| 6923 | else | ||
| 6924 | features &= ~NETIF_F_HW_VLAN_CTAG_TX; | ||
| 6925 | |||
| 6918 | return features; | 6926 | return features; |
| 6919 | } | 6927 | } |
| 6920 | 6928 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 5ea22008d721..501f15d9f4d6 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
| @@ -1344,6 +1344,13 @@ struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi, | |||
| 1344 | if (!vsi || !macaddr) | 1344 | if (!vsi || !macaddr) |
| 1345 | return NULL; | 1345 | return NULL; |
| 1346 | 1346 | ||
| 1347 | /* Do not allow broadcast filter to be added since broadcast filter | ||
| 1348 | * is added as part of add VSI for any newly created VSI except | ||
| 1349 | * FDIR VSI | ||
| 1350 | */ | ||
| 1351 | if (is_broadcast_ether_addr(macaddr)) | ||
| 1352 | return NULL; | ||
| 1353 | |||
| 1347 | f = i40e_find_filter(vsi, macaddr, vlan, is_vf, is_netdev); | 1354 | f = i40e_find_filter(vsi, macaddr, vlan, is_vf, is_netdev); |
| 1348 | if (!f) { | 1355 | if (!f) { |
| 1349 | f = kzalloc(sizeof(*f), GFP_ATOMIC); | 1356 | f = kzalloc(sizeof(*f), GFP_ATOMIC); |
| @@ -2151,18 +2158,6 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) | |||
| 2151 | aq_ret, pf->hw.aq.asq_last_status); | 2158 | aq_ret, pf->hw.aq.asq_last_status); |
| 2152 | } | 2159 | } |
| 2153 | } | 2160 | } |
| 2154 | aq_ret = i40e_aq_set_vsi_broadcast(&vsi->back->hw, | ||
| 2155 | vsi->seid, | ||
| 2156 | cur_promisc, NULL); | ||
| 2157 | if (aq_ret) { | ||
| 2158 | retval = i40e_aq_rc_to_posix(aq_ret, | ||
| 2159 | pf->hw.aq.asq_last_status); | ||
| 2160 | dev_info(&pf->pdev->dev, | ||
| 2161 | "set brdcast promisc failed, err %s, aq_err %s\n", | ||
| 2162 | i40e_stat_str(&pf->hw, aq_ret), | ||
| 2163 | i40e_aq_str(&pf->hw, | ||
| 2164 | pf->hw.aq.asq_last_status)); | ||
| 2165 | } | ||
| 2166 | } | 2161 | } |
| 2167 | out: | 2162 | out: |
| 2168 | /* if something went wrong then set the changed flag so we try again */ | 2163 | /* if something went wrong then set the changed flag so we try again */ |
| @@ -7726,10 +7721,11 @@ static int i40e_init_msix(struct i40e_pf *pf) | |||
| 7726 | * i40e_vsi_alloc_q_vector - Allocate memory for a single interrupt vector | 7721 | * i40e_vsi_alloc_q_vector - Allocate memory for a single interrupt vector |
| 7727 | * @vsi: the VSI being configured | 7722 | * @vsi: the VSI being configured |
| 7728 | * @v_idx: index of the vector in the vsi struct | 7723 | * @v_idx: index of the vector in the vsi struct |
| 7724 | * @cpu: cpu to be used on affinity_mask | ||
| 7729 | * | 7725 | * |
| 7730 | * We allocate one q_vector. If allocation fails we return -ENOMEM. | 7726 | * We allocate one q_vector. If allocation fails we return -ENOMEM. |
| 7731 | **/ | 7727 | **/ |
| 7732 | static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx) | 7728 | static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx, int cpu) |
| 7733 | { | 7729 | { |
| 7734 | struct i40e_q_vector *q_vector; | 7730 | struct i40e_q_vector *q_vector; |
| 7735 | 7731 | ||
| @@ -7740,7 +7736,8 @@ static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx) | |||
| 7740 | 7736 | ||
| 7741 | q_vector->vsi = vsi; | 7737 | q_vector->vsi = vsi; |
| 7742 | q_vector->v_idx = v_idx; | 7738 | q_vector->v_idx = v_idx; |
| 7743 | cpumask_set_cpu(v_idx, &q_vector->affinity_mask); | 7739 | cpumask_set_cpu(cpu, &q_vector->affinity_mask); |
| 7740 | |||
| 7744 | if (vsi->netdev) | 7741 | if (vsi->netdev) |
| 7745 | netif_napi_add(vsi->netdev, &q_vector->napi, | 7742 | netif_napi_add(vsi->netdev, &q_vector->napi, |
| 7746 | i40e_napi_poll, NAPI_POLL_WEIGHT); | 7743 | i40e_napi_poll, NAPI_POLL_WEIGHT); |
| @@ -7764,8 +7761,7 @@ static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx) | |||
| 7764 | static int i40e_vsi_alloc_q_vectors(struct i40e_vsi *vsi) | 7761 | static int i40e_vsi_alloc_q_vectors(struct i40e_vsi *vsi) |
| 7765 | { | 7762 | { |
| 7766 | struct i40e_pf *pf = vsi->back; | 7763 | struct i40e_pf *pf = vsi->back; |
| 7767 | int v_idx, num_q_vectors; | 7764 | int err, v_idx, num_q_vectors, current_cpu; |
| 7768 | int err; | ||
| 7769 | 7765 | ||
| 7770 | /* if not MSIX, give the one vector only to the LAN VSI */ | 7766 | /* if not MSIX, give the one vector only to the LAN VSI */ |
| 7771 | if (pf->flags & I40E_FLAG_MSIX_ENABLED) | 7767 | if (pf->flags & I40E_FLAG_MSIX_ENABLED) |
| @@ -7775,10 +7771,15 @@ static int i40e_vsi_alloc_q_vectors(struct i40e_vsi *vsi) | |||
| 7775 | else | 7771 | else |
| 7776 | return -EINVAL; | 7772 | return -EINVAL; |
| 7777 | 7773 | ||
| 7774 | current_cpu = cpumask_first(cpu_online_mask); | ||
| 7775 | |||
| 7778 | for (v_idx = 0; v_idx < num_q_vectors; v_idx++) { | 7776 | for (v_idx = 0; v_idx < num_q_vectors; v_idx++) { |
| 7779 | err = i40e_vsi_alloc_q_vector(vsi, v_idx); | 7777 | err = i40e_vsi_alloc_q_vector(vsi, v_idx, current_cpu); |
| 7780 | if (err) | 7778 | if (err) |
| 7781 | goto err_out; | 7779 | goto err_out; |
| 7780 | current_cpu = cpumask_next(current_cpu, cpu_online_mask); | ||
| 7781 | if (unlikely(current_cpu >= nr_cpu_ids)) | ||
| 7782 | current_cpu = cpumask_first(cpu_online_mask); | ||
| 7782 | } | 7783 | } |
| 7783 | 7784 | ||
| 7784 | return 0; | 7785 | return 0; |
| @@ -9224,6 +9225,7 @@ int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi) | |||
| 9224 | static int i40e_add_vsi(struct i40e_vsi *vsi) | 9225 | static int i40e_add_vsi(struct i40e_vsi *vsi) |
| 9225 | { | 9226 | { |
| 9226 | int ret = -ENODEV; | 9227 | int ret = -ENODEV; |
| 9228 | i40e_status aq_ret = 0; | ||
| 9227 | u8 laa_macaddr[ETH_ALEN]; | 9229 | u8 laa_macaddr[ETH_ALEN]; |
| 9228 | bool found_laa_mac_filter = false; | 9230 | bool found_laa_mac_filter = false; |
| 9229 | struct i40e_pf *pf = vsi->back; | 9231 | struct i40e_pf *pf = vsi->back; |
| @@ -9413,6 +9415,18 @@ static int i40e_add_vsi(struct i40e_vsi *vsi) | |||
| 9413 | vsi->seid = ctxt.seid; | 9415 | vsi->seid = ctxt.seid; |
| 9414 | vsi->id = ctxt.vsi_number; | 9416 | vsi->id = ctxt.vsi_number; |
| 9415 | } | 9417 | } |
| 9418 | /* Except FDIR VSI, for all othet VSI set the broadcast filter */ | ||
| 9419 | if (vsi->type != I40E_VSI_FDIR) { | ||
| 9420 | aq_ret = i40e_aq_set_vsi_broadcast(hw, vsi->seid, true, NULL); | ||
| 9421 | if (aq_ret) { | ||
| 9422 | ret = i40e_aq_rc_to_posix(aq_ret, | ||
| 9423 | hw->aq.asq_last_status); | ||
| 9424 | dev_info(&pf->pdev->dev, | ||
| 9425 | "set brdcast promisc failed, err %s, aq_err %s\n", | ||
| 9426 | i40e_stat_str(hw, aq_ret), | ||
| 9427 | i40e_aq_str(hw, hw->aq.asq_last_status)); | ||
| 9428 | } | ||
| 9429 | } | ||
| 9416 | 9430 | ||
| 9417 | spin_lock_bh(&vsi->mac_filter_list_lock); | 9431 | spin_lock_bh(&vsi->mac_filter_list_lock); |
| 9418 | /* If macvlan filters already exist, force them to get loaded */ | 9432 | /* If macvlan filters already exist, force them to get loaded */ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 55f151fca1dc..a8868e1bf832 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
| @@ -1280,8 +1280,8 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi, | |||
| 1280 | union i40e_rx_desc *rx_desc) | 1280 | union i40e_rx_desc *rx_desc) |
| 1281 | { | 1281 | { |
| 1282 | struct i40e_rx_ptype_decoded decoded; | 1282 | struct i40e_rx_ptype_decoded decoded; |
| 1283 | bool ipv4, ipv6, tunnel = false; | ||
| 1284 | u32 rx_error, rx_status; | 1283 | u32 rx_error, rx_status; |
| 1284 | bool ipv4, ipv6; | ||
| 1285 | u8 ptype; | 1285 | u8 ptype; |
| 1286 | u64 qword; | 1286 | u64 qword; |
| 1287 | 1287 | ||
| @@ -1336,19 +1336,23 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi, | |||
| 1336 | if (rx_error & BIT(I40E_RX_DESC_ERROR_PPRS_SHIFT)) | 1336 | if (rx_error & BIT(I40E_RX_DESC_ERROR_PPRS_SHIFT)) |
| 1337 | return; | 1337 | return; |
| 1338 | 1338 | ||
| 1339 | /* The hardware supported by this driver does not validate outer | 1339 | /* If there is an outer header present that might contain a checksum |
| 1340 | * checksums for tunneled VXLAN or GENEVE frames. I don't agree | 1340 | * we need to bump the checksum level by 1 to reflect the fact that |
| 1341 | * with it but the specification states that you "MAY validate", it | 1341 | * we are indicating we validated the inner checksum. |
| 1342 | * doesn't make it a hard requirement so if we have validated the | ||
| 1343 | * inner checksum report CHECKSUM_UNNECESSARY. | ||
| 1344 | */ | 1342 | */ |
| 1345 | if (decoded.inner_prot & (I40E_RX_PTYPE_INNER_PROT_TCP | | 1343 | if (decoded.tunnel_type >= I40E_RX_PTYPE_TUNNEL_IP_GRENAT) |
| 1346 | I40E_RX_PTYPE_INNER_PROT_UDP | | 1344 | skb->csum_level = 1; |
| 1347 | I40E_RX_PTYPE_INNER_PROT_SCTP)) | 1345 | |
| 1348 | tunnel = true; | 1346 | /* Only report checksum unnecessary for TCP, UDP, or SCTP */ |
| 1349 | 1347 | switch (decoded.inner_prot) { | |
| 1350 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1348 | case I40E_RX_PTYPE_INNER_PROT_TCP: |
| 1351 | skb->csum_level = tunnel ? 1 : 0; | 1349 | case I40E_RX_PTYPE_INNER_PROT_UDP: |
| 1350 | case I40E_RX_PTYPE_INNER_PROT_SCTP: | ||
| 1351 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 1352 | /* fall though */ | ||
| 1353 | default: | ||
| 1354 | break; | ||
| 1355 | } | ||
| 1352 | 1356 | ||
| 1353 | return; | 1357 | return; |
| 1354 | 1358 | ||
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c index be99189da925..79d99cd91b24 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c | |||
| @@ -752,8 +752,8 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi, | |||
| 752 | union i40e_rx_desc *rx_desc) | 752 | union i40e_rx_desc *rx_desc) |
| 753 | { | 753 | { |
| 754 | struct i40e_rx_ptype_decoded decoded; | 754 | struct i40e_rx_ptype_decoded decoded; |
| 755 | bool ipv4, ipv6, tunnel = false; | ||
| 756 | u32 rx_error, rx_status; | 755 | u32 rx_error, rx_status; |
| 756 | bool ipv4, ipv6; | ||
| 757 | u8 ptype; | 757 | u8 ptype; |
| 758 | u64 qword; | 758 | u64 qword; |
| 759 | 759 | ||
| @@ -808,19 +808,23 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi, | |||
| 808 | if (rx_error & BIT(I40E_RX_DESC_ERROR_PPRS_SHIFT)) | 808 | if (rx_error & BIT(I40E_RX_DESC_ERROR_PPRS_SHIFT)) |
| 809 | return; | 809 | return; |
| 810 | 810 | ||
| 811 | /* The hardware supported by this driver does not validate outer | 811 | /* If there is an outer header present that might contain a checksum |
| 812 | * checksums for tunneled VXLAN or GENEVE frames. I don't agree | 812 | * we need to bump the checksum level by 1 to reflect the fact that |
| 813 | * with it but the specification states that you "MAY validate", it | 813 | * we are indicating we validated the inner checksum. |
| 814 | * doesn't make it a hard requirement so if we have validated the | ||
| 815 | * inner checksum report CHECKSUM_UNNECESSARY. | ||
| 816 | */ | 814 | */ |
| 817 | if (decoded.inner_prot & (I40E_RX_PTYPE_INNER_PROT_TCP | | 815 | if (decoded.tunnel_type >= I40E_RX_PTYPE_TUNNEL_IP_GRENAT) |
| 818 | I40E_RX_PTYPE_INNER_PROT_UDP | | 816 | skb->csum_level = 1; |
| 819 | I40E_RX_PTYPE_INNER_PROT_SCTP)) | 817 | |
| 820 | tunnel = true; | 818 | /* Only report checksum unnecessary for TCP, UDP, or SCTP */ |
| 821 | 819 | switch (decoded.inner_prot) { | |
| 822 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 820 | case I40E_RX_PTYPE_INNER_PROT_TCP: |
| 823 | skb->csum_level = tunnel ? 1 : 0; | 821 | case I40E_RX_PTYPE_INNER_PROT_UDP: |
| 822 | case I40E_RX_PTYPE_INNER_PROT_SCTP: | ||
| 823 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 824 | /* fall though */ | ||
| 825 | default: | ||
| 826 | break; | ||
| 827 | } | ||
| 824 | 828 | ||
| 825 | return; | 829 | return; |
| 826 | 830 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 088c47cf27d9..8bebd862a54c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
| @@ -2887,7 +2887,7 @@ int ixgbe_poll(struct napi_struct *napi, int budget) | |||
| 2887 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) | 2887 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) |
| 2888 | ixgbe_irq_enable_queues(adapter, BIT_ULL(q_vector->v_idx)); | 2888 | ixgbe_irq_enable_queues(adapter, BIT_ULL(q_vector->v_idx)); |
| 2889 | 2889 | ||
| 2890 | return 0; | 2890 | return min(work_done, budget - 1); |
| 2891 | } | 2891 | } |
| 2892 | 2892 | ||
| 2893 | /** | 2893 | /** |
diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.c b/drivers/net/ethernet/intel/ixgbevf/mbx.c index 61a80da8b6f0..2819abc454c7 100644 --- a/drivers/net/ethernet/intel/ixgbevf/mbx.c +++ b/drivers/net/ethernet/intel/ixgbevf/mbx.c | |||
| @@ -85,7 +85,7 @@ static s32 ixgbevf_poll_for_ack(struct ixgbe_hw *hw) | |||
| 85 | static s32 ixgbevf_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size) | 85 | static s32 ixgbevf_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size) |
| 86 | { | 86 | { |
| 87 | struct ixgbe_mbx_info *mbx = &hw->mbx; | 87 | struct ixgbe_mbx_info *mbx = &hw->mbx; |
| 88 | s32 ret_val = -IXGBE_ERR_MBX; | 88 | s32 ret_val = IXGBE_ERR_MBX; |
| 89 | 89 | ||
| 90 | if (!mbx->ops.read) | 90 | if (!mbx->ops.read) |
| 91 | goto out; | 91 | goto out; |
| @@ -111,7 +111,7 @@ out: | |||
| 111 | static s32 ixgbevf_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size) | 111 | static s32 ixgbevf_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size) |
| 112 | { | 112 | { |
| 113 | struct ixgbe_mbx_info *mbx = &hw->mbx; | 113 | struct ixgbe_mbx_info *mbx = &hw->mbx; |
| 114 | s32 ret_val = -IXGBE_ERR_MBX; | 114 | s32 ret_val = IXGBE_ERR_MBX; |
| 115 | 115 | ||
| 116 | /* exit if either we can't write or there isn't a defined timeout */ | 116 | /* exit if either we can't write or there isn't a defined timeout */ |
| 117 | if (!mbx->ops.write || !mbx->timeout) | 117 | if (!mbx->ops.write || !mbx->timeout) |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index a6d26d351dfc..f92018b13d28 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
| @@ -244,7 +244,7 @@ | |||
| 244 | /* Various constants */ | 244 | /* Various constants */ |
| 245 | 245 | ||
| 246 | /* Coalescing */ | 246 | /* Coalescing */ |
| 247 | #define MVNETA_TXDONE_COAL_PKTS 1 | 247 | #define MVNETA_TXDONE_COAL_PKTS 0 /* interrupt per packet */ |
| 248 | #define MVNETA_RX_COAL_PKTS 32 | 248 | #define MVNETA_RX_COAL_PKTS 32 |
| 249 | #define MVNETA_RX_COAL_USEC 100 | 249 | #define MVNETA_RX_COAL_USEC 100 |
| 250 | 250 | ||
| @@ -3458,6 +3458,8 @@ static int mvneta_open(struct net_device *dev) | |||
| 3458 | return 0; | 3458 | return 0; |
| 3459 | 3459 | ||
| 3460 | err_free_irq: | 3460 | err_free_irq: |
| 3461 | unregister_cpu_notifier(&pp->cpu_notifier); | ||
| 3462 | on_each_cpu(mvneta_percpu_disable, pp, true); | ||
| 3461 | free_percpu_irq(pp->dev->irq, pp->ports); | 3463 | free_percpu_irq(pp->dev->irq, pp->ports); |
| 3462 | err_cleanup_txqs: | 3464 | err_cleanup_txqs: |
| 3463 | mvneta_cleanup_txqs(pp); | 3465 | mvneta_cleanup_txqs(pp); |
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 4763252bbf85..d1cdc2d76151 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | |||
| @@ -481,20 +481,23 @@ static inline void mtk_rx_get_desc(struct mtk_rx_dma *rxd, | |||
| 481 | /* the qdma core needs scratch memory to be setup */ | 481 | /* the qdma core needs scratch memory to be setup */ |
| 482 | static int mtk_init_fq_dma(struct mtk_eth *eth) | 482 | static int mtk_init_fq_dma(struct mtk_eth *eth) |
| 483 | { | 483 | { |
| 484 | dma_addr_t phy_ring_head, phy_ring_tail; | 484 | dma_addr_t phy_ring_tail; |
| 485 | int cnt = MTK_DMA_SIZE; | 485 | int cnt = MTK_DMA_SIZE; |
| 486 | dma_addr_t dma_addr; | 486 | dma_addr_t dma_addr; |
| 487 | int i; | 487 | int i; |
| 488 | 488 | ||
| 489 | eth->scratch_ring = dma_alloc_coherent(eth->dev, | 489 | eth->scratch_ring = dma_alloc_coherent(eth->dev, |
| 490 | cnt * sizeof(struct mtk_tx_dma), | 490 | cnt * sizeof(struct mtk_tx_dma), |
| 491 | &phy_ring_head, | 491 | ð->phy_scratch_ring, |
| 492 | GFP_ATOMIC | __GFP_ZERO); | 492 | GFP_ATOMIC | __GFP_ZERO); |
| 493 | if (unlikely(!eth->scratch_ring)) | 493 | if (unlikely(!eth->scratch_ring)) |
| 494 | return -ENOMEM; | 494 | return -ENOMEM; |
| 495 | 495 | ||
| 496 | eth->scratch_head = kcalloc(cnt, MTK_QDMA_PAGE_SIZE, | 496 | eth->scratch_head = kcalloc(cnt, MTK_QDMA_PAGE_SIZE, |
| 497 | GFP_KERNEL); | 497 | GFP_KERNEL); |
| 498 | if (unlikely(!eth->scratch_head)) | ||
| 499 | return -ENOMEM; | ||
| 500 | |||
| 498 | dma_addr = dma_map_single(eth->dev, | 501 | dma_addr = dma_map_single(eth->dev, |
| 499 | eth->scratch_head, cnt * MTK_QDMA_PAGE_SIZE, | 502 | eth->scratch_head, cnt * MTK_QDMA_PAGE_SIZE, |
| 500 | DMA_FROM_DEVICE); | 503 | DMA_FROM_DEVICE); |
| @@ -502,19 +505,19 @@ static int mtk_init_fq_dma(struct mtk_eth *eth) | |||
| 502 | return -ENOMEM; | 505 | return -ENOMEM; |
| 503 | 506 | ||
| 504 | memset(eth->scratch_ring, 0x0, sizeof(struct mtk_tx_dma) * cnt); | 507 | memset(eth->scratch_ring, 0x0, sizeof(struct mtk_tx_dma) * cnt); |
| 505 | phy_ring_tail = phy_ring_head + | 508 | phy_ring_tail = eth->phy_scratch_ring + |
| 506 | (sizeof(struct mtk_tx_dma) * (cnt - 1)); | 509 | (sizeof(struct mtk_tx_dma) * (cnt - 1)); |
| 507 | 510 | ||
| 508 | for (i = 0; i < cnt; i++) { | 511 | for (i = 0; i < cnt; i++) { |
| 509 | eth->scratch_ring[i].txd1 = | 512 | eth->scratch_ring[i].txd1 = |
| 510 | (dma_addr + (i * MTK_QDMA_PAGE_SIZE)); | 513 | (dma_addr + (i * MTK_QDMA_PAGE_SIZE)); |
| 511 | if (i < cnt - 1) | 514 | if (i < cnt - 1) |
| 512 | eth->scratch_ring[i].txd2 = (phy_ring_head + | 515 | eth->scratch_ring[i].txd2 = (eth->phy_scratch_ring + |
| 513 | ((i + 1) * sizeof(struct mtk_tx_dma))); | 516 | ((i + 1) * sizeof(struct mtk_tx_dma))); |
| 514 | eth->scratch_ring[i].txd3 = TX_DMA_SDL(MTK_QDMA_PAGE_SIZE); | 517 | eth->scratch_ring[i].txd3 = TX_DMA_SDL(MTK_QDMA_PAGE_SIZE); |
| 515 | } | 518 | } |
| 516 | 519 | ||
| 517 | mtk_w32(eth, phy_ring_head, MTK_QDMA_FQ_HEAD); | 520 | mtk_w32(eth, eth->phy_scratch_ring, MTK_QDMA_FQ_HEAD); |
| 518 | mtk_w32(eth, phy_ring_tail, MTK_QDMA_FQ_TAIL); | 521 | mtk_w32(eth, phy_ring_tail, MTK_QDMA_FQ_TAIL); |
| 519 | mtk_w32(eth, (cnt << 16) | cnt, MTK_QDMA_FQ_CNT); | 522 | mtk_w32(eth, (cnt << 16) | cnt, MTK_QDMA_FQ_CNT); |
| 520 | mtk_w32(eth, MTK_QDMA_PAGE_SIZE << 16, MTK_QDMA_FQ_BLEN); | 523 | mtk_w32(eth, MTK_QDMA_PAGE_SIZE << 16, MTK_QDMA_FQ_BLEN); |
| @@ -671,7 +674,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
| 671 | 674 | ||
| 672 | err_dma: | 675 | err_dma: |
| 673 | do { | 676 | do { |
| 674 | tx_buf = mtk_desc_to_tx_buf(ring, txd); | 677 | tx_buf = mtk_desc_to_tx_buf(ring, itxd); |
| 675 | 678 | ||
| 676 | /* unmap dma */ | 679 | /* unmap dma */ |
| 677 | mtk_tx_unmap(&dev->dev, tx_buf); | 680 | mtk_tx_unmap(&dev->dev, tx_buf); |
| @@ -701,6 +704,20 @@ static inline int mtk_cal_txd_req(struct sk_buff *skb) | |||
| 701 | return nfrags; | 704 | return nfrags; |
| 702 | } | 705 | } |
| 703 | 706 | ||
| 707 | static int mtk_queue_stopped(struct mtk_eth *eth) | ||
| 708 | { | ||
| 709 | int i; | ||
| 710 | |||
| 711 | for (i = 0; i < MTK_MAC_COUNT; i++) { | ||
| 712 | if (!eth->netdev[i]) | ||
| 713 | continue; | ||
| 714 | if (netif_queue_stopped(eth->netdev[i])) | ||
| 715 | return 1; | ||
| 716 | } | ||
| 717 | |||
| 718 | return 0; | ||
| 719 | } | ||
| 720 | |||
| 704 | static void mtk_wake_queue(struct mtk_eth *eth) | 721 | static void mtk_wake_queue(struct mtk_eth *eth) |
| 705 | { | 722 | { |
| 706 | int i; | 723 | int i; |
| @@ -766,12 +783,9 @@ static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 766 | if (mtk_tx_map(skb, dev, tx_num, ring, gso) < 0) | 783 | if (mtk_tx_map(skb, dev, tx_num, ring, gso) < 0) |
| 767 | goto drop; | 784 | goto drop; |
| 768 | 785 | ||
| 769 | if (unlikely(atomic_read(&ring->free_count) <= ring->thresh)) { | 786 | if (unlikely(atomic_read(&ring->free_count) <= ring->thresh)) |
| 770 | mtk_stop_queue(eth); | 787 | mtk_stop_queue(eth); |
| 771 | if (unlikely(atomic_read(&ring->free_count) > | 788 | |
| 772 | ring->thresh)) | ||
| 773 | mtk_wake_queue(eth); | ||
| 774 | } | ||
| 775 | spin_unlock_irqrestore(ð->page_lock, flags); | 789 | spin_unlock_irqrestore(ð->page_lock, flags); |
| 776 | 790 | ||
| 777 | return NETDEV_TX_OK; | 791 | return NETDEV_TX_OK; |
| @@ -826,6 +840,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, | |||
| 826 | DMA_FROM_DEVICE); | 840 | DMA_FROM_DEVICE); |
| 827 | if (unlikely(dma_mapping_error(&netdev->dev, dma_addr))) { | 841 | if (unlikely(dma_mapping_error(&netdev->dev, dma_addr))) { |
| 828 | skb_free_frag(new_data); | 842 | skb_free_frag(new_data); |
| 843 | netdev->stats.rx_dropped++; | ||
| 829 | goto release_desc; | 844 | goto release_desc; |
| 830 | } | 845 | } |
| 831 | 846 | ||
| @@ -833,6 +848,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, | |||
| 833 | skb = build_skb(data, ring->frag_size); | 848 | skb = build_skb(data, ring->frag_size); |
| 834 | if (unlikely(!skb)) { | 849 | if (unlikely(!skb)) { |
| 835 | put_page(virt_to_head_page(new_data)); | 850 | put_page(virt_to_head_page(new_data)); |
| 851 | netdev->stats.rx_dropped++; | ||
| 836 | goto release_desc; | 852 | goto release_desc; |
| 837 | } | 853 | } |
| 838 | skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN); | 854 | skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN); |
| @@ -921,7 +937,6 @@ static int mtk_poll_tx(struct mtk_eth *eth, int budget, bool *tx_again) | |||
| 921 | } | 937 | } |
| 922 | mtk_tx_unmap(eth->dev, tx_buf); | 938 | mtk_tx_unmap(eth->dev, tx_buf); |
| 923 | 939 | ||
| 924 | ring->last_free->txd2 = next_cpu; | ||
| 925 | ring->last_free = desc; | 940 | ring->last_free = desc; |
| 926 | atomic_inc(&ring->free_count); | 941 | atomic_inc(&ring->free_count); |
| 927 | 942 | ||
| @@ -946,7 +961,8 @@ static int mtk_poll_tx(struct mtk_eth *eth, int budget, bool *tx_again) | |||
| 946 | if (!total) | 961 | if (!total) |
| 947 | return 0; | 962 | return 0; |
| 948 | 963 | ||
| 949 | if (atomic_read(&ring->free_count) > ring->thresh) | 964 | if (mtk_queue_stopped(eth) && |
| 965 | (atomic_read(&ring->free_count) > ring->thresh)) | ||
| 950 | mtk_wake_queue(eth); | 966 | mtk_wake_queue(eth); |
| 951 | 967 | ||
| 952 | return total; | 968 | return total; |
| @@ -1027,9 +1043,8 @@ static int mtk_tx_alloc(struct mtk_eth *eth) | |||
| 1027 | 1043 | ||
| 1028 | atomic_set(&ring->free_count, MTK_DMA_SIZE - 2); | 1044 | atomic_set(&ring->free_count, MTK_DMA_SIZE - 2); |
| 1029 | ring->next_free = &ring->dma[0]; | 1045 | ring->next_free = &ring->dma[0]; |
| 1030 | ring->last_free = &ring->dma[MTK_DMA_SIZE - 2]; | 1046 | ring->last_free = &ring->dma[MTK_DMA_SIZE - 1]; |
| 1031 | ring->thresh = max((unsigned long)MTK_DMA_SIZE >> 2, | 1047 | ring->thresh = MAX_SKB_FRAGS; |
| 1032 | MAX_SKB_FRAGS); | ||
| 1033 | 1048 | ||
| 1034 | /* make sure that all changes to the dma ring are flushed before we | 1049 | /* make sure that all changes to the dma ring are flushed before we |
| 1035 | * continue | 1050 | * continue |
| @@ -1207,6 +1222,14 @@ static void mtk_dma_free(struct mtk_eth *eth) | |||
| 1207 | for (i = 0; i < MTK_MAC_COUNT; i++) | 1222 | for (i = 0; i < MTK_MAC_COUNT; i++) |
| 1208 | if (eth->netdev[i]) | 1223 | if (eth->netdev[i]) |
| 1209 | netdev_reset_queue(eth->netdev[i]); | 1224 | netdev_reset_queue(eth->netdev[i]); |
| 1225 | if (eth->scratch_ring) { | ||
| 1226 | dma_free_coherent(eth->dev, | ||
| 1227 | MTK_DMA_SIZE * sizeof(struct mtk_tx_dma), | ||
| 1228 | eth->scratch_ring, | ||
| 1229 | eth->phy_scratch_ring); | ||
| 1230 | eth->scratch_ring = NULL; | ||
| 1231 | eth->phy_scratch_ring = 0; | ||
| 1232 | } | ||
| 1210 | mtk_tx_clean(eth); | 1233 | mtk_tx_clean(eth); |
| 1211 | mtk_rx_clean(eth); | 1234 | mtk_rx_clean(eth); |
| 1212 | kfree(eth->scratch_head); | 1235 | kfree(eth->scratch_head); |
| @@ -1269,7 +1292,7 @@ static int mtk_start_dma(struct mtk_eth *eth) | |||
| 1269 | mtk_w32(eth, | 1292 | mtk_w32(eth, |
| 1270 | MTK_TX_WB_DDONE | MTK_RX_DMA_EN | MTK_TX_DMA_EN | | 1293 | MTK_TX_WB_DDONE | MTK_RX_DMA_EN | MTK_TX_DMA_EN | |
| 1271 | MTK_RX_2B_OFFSET | MTK_DMA_SIZE_16DWORDS | | 1294 | MTK_RX_2B_OFFSET | MTK_DMA_SIZE_16DWORDS | |
| 1272 | MTK_RX_BT_32DWORDS, | 1295 | MTK_RX_BT_32DWORDS | MTK_NDP_CO_PRO, |
| 1273 | MTK_QDMA_GLO_CFG); | 1296 | MTK_QDMA_GLO_CFG); |
| 1274 | 1297 | ||
| 1275 | return 0; | 1298 | return 0; |
| @@ -1383,7 +1406,7 @@ static int __init mtk_hw_init(struct mtk_eth *eth) | |||
| 1383 | 1406 | ||
| 1384 | /* disable delay and normal interrupt */ | 1407 | /* disable delay and normal interrupt */ |
| 1385 | mtk_w32(eth, 0, MTK_QDMA_DELAY_INT); | 1408 | mtk_w32(eth, 0, MTK_QDMA_DELAY_INT); |
| 1386 | mtk_irq_disable(eth, MTK_TX_DONE_INT | MTK_RX_DONE_INT); | 1409 | mtk_irq_disable(eth, ~0); |
| 1387 | mtk_w32(eth, RST_GL_PSE, MTK_RST_GL); | 1410 | mtk_w32(eth, RST_GL_PSE, MTK_RST_GL); |
| 1388 | mtk_w32(eth, 0, MTK_RST_GL); | 1411 | mtk_w32(eth, 0, MTK_RST_GL); |
| 1389 | 1412 | ||
| @@ -1697,7 +1720,7 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) | |||
| 1697 | mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET; | 1720 | mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET; |
| 1698 | 1721 | ||
| 1699 | SET_NETDEV_DEV(eth->netdev[id], eth->dev); | 1722 | SET_NETDEV_DEV(eth->netdev[id], eth->dev); |
| 1700 | eth->netdev[id]->watchdog_timeo = HZ; | 1723 | eth->netdev[id]->watchdog_timeo = 5 * HZ; |
| 1701 | eth->netdev[id]->netdev_ops = &mtk_netdev_ops; | 1724 | eth->netdev[id]->netdev_ops = &mtk_netdev_ops; |
| 1702 | eth->netdev[id]->base_addr = (unsigned long)eth->base; | 1725 | eth->netdev[id]->base_addr = (unsigned long)eth->base; |
| 1703 | eth->netdev[id]->vlan_features = MTK_HW_FEATURES & | 1726 | eth->netdev[id]->vlan_features = MTK_HW_FEATURES & |
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index eed626d56ea4..a5eb7c62306b 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h | |||
| @@ -91,6 +91,7 @@ | |||
| 91 | #define MTK_QDMA_GLO_CFG 0x1A04 | 91 | #define MTK_QDMA_GLO_CFG 0x1A04 |
| 92 | #define MTK_RX_2B_OFFSET BIT(31) | 92 | #define MTK_RX_2B_OFFSET BIT(31) |
| 93 | #define MTK_RX_BT_32DWORDS (3 << 11) | 93 | #define MTK_RX_BT_32DWORDS (3 << 11) |
| 94 | #define MTK_NDP_CO_PRO BIT(10) | ||
| 94 | #define MTK_TX_WB_DDONE BIT(6) | 95 | #define MTK_TX_WB_DDONE BIT(6) |
| 95 | #define MTK_DMA_SIZE_16DWORDS (2 << 4) | 96 | #define MTK_DMA_SIZE_16DWORDS (2 << 4) |
| 96 | #define MTK_RX_DMA_BUSY BIT(3) | 97 | #define MTK_RX_DMA_BUSY BIT(3) |
| @@ -357,6 +358,7 @@ struct mtk_rx_ring { | |||
| 357 | * @rx_ring: Pointer to the memore holding info about the RX ring | 358 | * @rx_ring: Pointer to the memore holding info about the RX ring |
| 358 | * @rx_napi: The NAPI struct | 359 | * @rx_napi: The NAPI struct |
| 359 | * @scratch_ring: Newer SoCs need memory for a second HW managed TX ring | 360 | * @scratch_ring: Newer SoCs need memory for a second HW managed TX ring |
| 361 | * @phy_scratch_ring: physical address of scratch_ring | ||
| 360 | * @scratch_head: The scratch memory that scratch_ring points to. | 362 | * @scratch_head: The scratch memory that scratch_ring points to. |
| 361 | * @clk_ethif: The ethif clock | 363 | * @clk_ethif: The ethif clock |
| 362 | * @clk_esw: The switch clock | 364 | * @clk_esw: The switch clock |
| @@ -384,6 +386,7 @@ struct mtk_eth { | |||
| 384 | struct mtk_rx_ring rx_ring; | 386 | struct mtk_rx_ring rx_ring; |
| 385 | struct napi_struct rx_napi; | 387 | struct napi_struct rx_napi; |
| 386 | struct mtk_tx_dma *scratch_ring; | 388 | struct mtk_tx_dma *scratch_ring; |
| 389 | dma_addr_t phy_scratch_ring; | ||
| 387 | void *scratch_head; | 390 | void *scratch_head; |
| 388 | struct clk *clk_ethif; | 391 | struct clk *clk_ethif; |
| 389 | struct clk *clk_esw; | 392 | struct clk *clk_esw; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index e94ca1c3fc7c..f04a423ff79d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
| @@ -2597,7 +2597,6 @@ int mlx4_cmd_use_events(struct mlx4_dev *dev) | |||
| 2597 | priv->cmd.free_head = 0; | 2597 | priv->cmd.free_head = 0; |
| 2598 | 2598 | ||
| 2599 | sema_init(&priv->cmd.event_sem, priv->cmd.max_cmds); | 2599 | sema_init(&priv->cmd.event_sem, priv->cmd.max_cmds); |
| 2600 | spin_lock_init(&priv->cmd.context_lock); | ||
| 2601 | 2600 | ||
| 2602 | for (priv->cmd.token_mask = 1; | 2601 | for (priv->cmd.token_mask = 1; |
| 2603 | priv->cmd.token_mask < priv->cmd.max_cmds; | 2602 | priv->cmd.token_mask < priv->cmd.max_cmds; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index fc95affaf76b..44cf16d01f42 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
| @@ -1042,6 +1042,8 @@ static int mlx4_en_set_ringparam(struct net_device *dev, | |||
| 1042 | { | 1042 | { |
| 1043 | struct mlx4_en_priv *priv = netdev_priv(dev); | 1043 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 1044 | struct mlx4_en_dev *mdev = priv->mdev; | 1044 | struct mlx4_en_dev *mdev = priv->mdev; |
| 1045 | struct mlx4_en_port_profile new_prof; | ||
| 1046 | struct mlx4_en_priv *tmp; | ||
| 1045 | u32 rx_size, tx_size; | 1047 | u32 rx_size, tx_size; |
| 1046 | int port_up = 0; | 1048 | int port_up = 0; |
| 1047 | int err = 0; | 1049 | int err = 0; |
| @@ -1061,22 +1063,25 @@ static int mlx4_en_set_ringparam(struct net_device *dev, | |||
| 1061 | tx_size == priv->tx_ring[0]->size) | 1063 | tx_size == priv->tx_ring[0]->size) |
| 1062 | return 0; | 1064 | return 0; |
| 1063 | 1065 | ||
| 1066 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); | ||
| 1067 | if (!tmp) | ||
| 1068 | return -ENOMEM; | ||
| 1069 | |||
| 1064 | mutex_lock(&mdev->state_lock); | 1070 | mutex_lock(&mdev->state_lock); |
| 1071 | memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); | ||
| 1072 | new_prof.tx_ring_size = tx_size; | ||
| 1073 | new_prof.rx_ring_size = rx_size; | ||
| 1074 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof); | ||
| 1075 | if (err) | ||
| 1076 | goto out; | ||
| 1077 | |||
| 1065 | if (priv->port_up) { | 1078 | if (priv->port_up) { |
| 1066 | port_up = 1; | 1079 | port_up = 1; |
| 1067 | mlx4_en_stop_port(dev, 1); | 1080 | mlx4_en_stop_port(dev, 1); |
| 1068 | } | 1081 | } |
| 1069 | 1082 | ||
| 1070 | mlx4_en_free_resources(priv); | 1083 | mlx4_en_safe_replace_resources(priv, tmp); |
| 1071 | |||
| 1072 | priv->prof->tx_ring_size = tx_size; | ||
| 1073 | priv->prof->rx_ring_size = rx_size; | ||
| 1074 | 1084 | ||
| 1075 | err = mlx4_en_alloc_resources(priv); | ||
| 1076 | if (err) { | ||
| 1077 | en_err(priv, "Failed reallocating port resources\n"); | ||
| 1078 | goto out; | ||
| 1079 | } | ||
| 1080 | if (port_up) { | 1085 | if (port_up) { |
| 1081 | err = mlx4_en_start_port(dev); | 1086 | err = mlx4_en_start_port(dev); |
| 1082 | if (err) | 1087 | if (err) |
| @@ -1084,8 +1089,8 @@ static int mlx4_en_set_ringparam(struct net_device *dev, | |||
| 1084 | } | 1089 | } |
| 1085 | 1090 | ||
| 1086 | err = mlx4_en_moderation_update(priv); | 1091 | err = mlx4_en_moderation_update(priv); |
| 1087 | |||
| 1088 | out: | 1092 | out: |
| 1093 | kfree(tmp); | ||
| 1089 | mutex_unlock(&mdev->state_lock); | 1094 | mutex_unlock(&mdev->state_lock); |
| 1090 | return err; | 1095 | return err; |
| 1091 | } | 1096 | } |
| @@ -1714,6 +1719,8 @@ static int mlx4_en_set_channels(struct net_device *dev, | |||
| 1714 | { | 1719 | { |
| 1715 | struct mlx4_en_priv *priv = netdev_priv(dev); | 1720 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 1716 | struct mlx4_en_dev *mdev = priv->mdev; | 1721 | struct mlx4_en_dev *mdev = priv->mdev; |
| 1722 | struct mlx4_en_port_profile new_prof; | ||
| 1723 | struct mlx4_en_priv *tmp; | ||
| 1717 | int port_up = 0; | 1724 | int port_up = 0; |
| 1718 | int err = 0; | 1725 | int err = 0; |
| 1719 | 1726 | ||
| @@ -1723,23 +1730,26 @@ static int mlx4_en_set_channels(struct net_device *dev, | |||
| 1723 | !channel->tx_count || !channel->rx_count) | 1730 | !channel->tx_count || !channel->rx_count) |
| 1724 | return -EINVAL; | 1731 | return -EINVAL; |
| 1725 | 1732 | ||
| 1733 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); | ||
| 1734 | if (!tmp) | ||
| 1735 | return -ENOMEM; | ||
| 1736 | |||
| 1726 | mutex_lock(&mdev->state_lock); | 1737 | mutex_lock(&mdev->state_lock); |
| 1738 | memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); | ||
| 1739 | new_prof.num_tx_rings_p_up = channel->tx_count; | ||
| 1740 | new_prof.tx_ring_num = channel->tx_count * MLX4_EN_NUM_UP; | ||
| 1741 | new_prof.rx_ring_num = channel->rx_count; | ||
| 1742 | |||
| 1743 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof); | ||
| 1744 | if (err) | ||
| 1745 | goto out; | ||
| 1746 | |||
| 1727 | if (priv->port_up) { | 1747 | if (priv->port_up) { |
| 1728 | port_up = 1; | 1748 | port_up = 1; |
| 1729 | mlx4_en_stop_port(dev, 1); | 1749 | mlx4_en_stop_port(dev, 1); |
| 1730 | } | 1750 | } |
| 1731 | 1751 | ||
| 1732 | mlx4_en_free_resources(priv); | 1752 | mlx4_en_safe_replace_resources(priv, tmp); |
| 1733 | |||
| 1734 | priv->num_tx_rings_p_up = channel->tx_count; | ||
| 1735 | priv->tx_ring_num = channel->tx_count * MLX4_EN_NUM_UP; | ||
| 1736 | priv->rx_ring_num = channel->rx_count; | ||
| 1737 | |||
| 1738 | err = mlx4_en_alloc_resources(priv); | ||
| 1739 | if (err) { | ||
| 1740 | en_err(priv, "Failed reallocating port resources\n"); | ||
| 1741 | goto out; | ||
| 1742 | } | ||
| 1743 | 1753 | ||
| 1744 | netif_set_real_num_tx_queues(dev, priv->tx_ring_num); | 1754 | netif_set_real_num_tx_queues(dev, priv->tx_ring_num); |
| 1745 | netif_set_real_num_rx_queues(dev, priv->rx_ring_num); | 1755 | netif_set_real_num_rx_queues(dev, priv->rx_ring_num); |
| @@ -1757,8 +1767,8 @@ static int mlx4_en_set_channels(struct net_device *dev, | |||
| 1757 | } | 1767 | } |
| 1758 | 1768 | ||
| 1759 | err = mlx4_en_moderation_update(priv); | 1769 | err = mlx4_en_moderation_update(priv); |
| 1760 | |||
| 1761 | out: | 1770 | out: |
| 1771 | kfree(tmp); | ||
| 1762 | mutex_unlock(&mdev->state_lock); | 1772 | mutex_unlock(&mdev->state_lock); |
| 1763 | return err; | 1773 | return err; |
| 1764 | } | 1774 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 19ceced6736c..8359e9e51b3b 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
| @@ -406,14 +406,18 @@ static int mlx4_en_vlan_rx_add_vid(struct net_device *dev, | |||
| 406 | mutex_lock(&mdev->state_lock); | 406 | mutex_lock(&mdev->state_lock); |
| 407 | if (mdev->device_up && priv->port_up) { | 407 | if (mdev->device_up && priv->port_up) { |
| 408 | err = mlx4_SET_VLAN_FLTR(mdev->dev, priv); | 408 | err = mlx4_SET_VLAN_FLTR(mdev->dev, priv); |
| 409 | if (err) | 409 | if (err) { |
| 410 | en_err(priv, "Failed configuring VLAN filter\n"); | 410 | en_err(priv, "Failed configuring VLAN filter\n"); |
| 411 | goto out; | ||
| 412 | } | ||
| 411 | } | 413 | } |
| 412 | if (mlx4_register_vlan(mdev->dev, priv->port, vid, &idx)) | 414 | err = mlx4_register_vlan(mdev->dev, priv->port, vid, &idx); |
| 413 | en_dbg(HW, priv, "failed adding vlan %d\n", vid); | 415 | if (err) |
| 414 | mutex_unlock(&mdev->state_lock); | 416 | en_dbg(HW, priv, "Failed adding vlan %d\n", vid); |
| 415 | 417 | ||
| 416 | return 0; | 418 | out: |
| 419 | mutex_unlock(&mdev->state_lock); | ||
| 420 | return err; | ||
| 417 | } | 421 | } |
| 418 | 422 | ||
| 419 | static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, | 423 | static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, |
| @@ -421,7 +425,7 @@ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, | |||
| 421 | { | 425 | { |
| 422 | struct mlx4_en_priv *priv = netdev_priv(dev); | 426 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 423 | struct mlx4_en_dev *mdev = priv->mdev; | 427 | struct mlx4_en_dev *mdev = priv->mdev; |
| 424 | int err; | 428 | int err = 0; |
| 425 | 429 | ||
| 426 | en_dbg(HW, priv, "Killing VID:%d\n", vid); | 430 | en_dbg(HW, priv, "Killing VID:%d\n", vid); |
| 427 | 431 | ||
| @@ -438,7 +442,7 @@ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, | |||
| 438 | } | 442 | } |
| 439 | mutex_unlock(&mdev->state_lock); | 443 | mutex_unlock(&mdev->state_lock); |
| 440 | 444 | ||
| 441 | return 0; | 445 | return err; |
| 442 | } | 446 | } |
| 443 | 447 | ||
| 444 | static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) | 448 | static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) |
| @@ -1950,7 +1954,7 @@ static int mlx4_en_close(struct net_device *dev) | |||
| 1950 | return 0; | 1954 | return 0; |
| 1951 | } | 1955 | } |
| 1952 | 1956 | ||
| 1953 | void mlx4_en_free_resources(struct mlx4_en_priv *priv) | 1957 | static void mlx4_en_free_resources(struct mlx4_en_priv *priv) |
| 1954 | { | 1958 | { |
| 1955 | int i; | 1959 | int i; |
| 1956 | 1960 | ||
| @@ -1975,7 +1979,7 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) | |||
| 1975 | 1979 | ||
| 1976 | } | 1980 | } |
| 1977 | 1981 | ||
| 1978 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | 1982 | static int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) |
| 1979 | { | 1983 | { |
| 1980 | struct mlx4_en_port_profile *prof = priv->prof; | 1984 | struct mlx4_en_port_profile *prof = priv->prof; |
| 1981 | int i; | 1985 | int i; |
| @@ -2032,11 +2036,91 @@ err: | |||
| 2032 | return -ENOMEM; | 2036 | return -ENOMEM; |
| 2033 | } | 2037 | } |
| 2034 | 2038 | ||
| 2039 | static void mlx4_en_shutdown(struct net_device *dev) | ||
| 2040 | { | ||
| 2041 | rtnl_lock(); | ||
| 2042 | netif_device_detach(dev); | ||
| 2043 | mlx4_en_close(dev); | ||
| 2044 | rtnl_unlock(); | ||
| 2045 | } | ||
| 2046 | |||
| 2047 | static int mlx4_en_copy_priv(struct mlx4_en_priv *dst, | ||
| 2048 | struct mlx4_en_priv *src, | ||
| 2049 | struct mlx4_en_port_profile *prof) | ||
| 2050 | { | ||
| 2051 | memcpy(&dst->hwtstamp_config, &prof->hwtstamp_config, | ||
| 2052 | sizeof(dst->hwtstamp_config)); | ||
| 2053 | dst->num_tx_rings_p_up = src->mdev->profile.num_tx_rings_p_up; | ||
| 2054 | dst->tx_ring_num = prof->tx_ring_num; | ||
| 2055 | dst->rx_ring_num = prof->rx_ring_num; | ||
| 2056 | dst->flags = prof->flags; | ||
| 2057 | dst->mdev = src->mdev; | ||
| 2058 | dst->port = src->port; | ||
| 2059 | dst->dev = src->dev; | ||
| 2060 | dst->prof = prof; | ||
| 2061 | dst->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + | ||
| 2062 | DS_SIZE * MLX4_EN_MAX_RX_FRAGS); | ||
| 2063 | |||
| 2064 | dst->tx_ring = kzalloc(sizeof(struct mlx4_en_tx_ring *) * MAX_TX_RINGS, | ||
| 2065 | GFP_KERNEL); | ||
| 2066 | if (!dst->tx_ring) | ||
| 2067 | return -ENOMEM; | ||
| 2068 | |||
| 2069 | dst->tx_cq = kzalloc(sizeof(struct mlx4_en_cq *) * MAX_TX_RINGS, | ||
| 2070 | GFP_KERNEL); | ||
| 2071 | if (!dst->tx_cq) { | ||
| 2072 | kfree(dst->tx_ring); | ||
| 2073 | return -ENOMEM; | ||
| 2074 | } | ||
| 2075 | return 0; | ||
| 2076 | } | ||
| 2077 | |||
| 2078 | static void mlx4_en_update_priv(struct mlx4_en_priv *dst, | ||
| 2079 | struct mlx4_en_priv *src) | ||
| 2080 | { | ||
| 2081 | memcpy(dst->rx_ring, src->rx_ring, | ||
| 2082 | sizeof(struct mlx4_en_rx_ring *) * src->rx_ring_num); | ||
| 2083 | memcpy(dst->rx_cq, src->rx_cq, | ||
| 2084 | sizeof(struct mlx4_en_cq *) * src->rx_ring_num); | ||
| 2085 | memcpy(&dst->hwtstamp_config, &src->hwtstamp_config, | ||
| 2086 | sizeof(dst->hwtstamp_config)); | ||
| 2087 | dst->tx_ring_num = src->tx_ring_num; | ||
| 2088 | dst->rx_ring_num = src->rx_ring_num; | ||
| 2089 | dst->tx_ring = src->tx_ring; | ||
| 2090 | dst->tx_cq = src->tx_cq; | ||
| 2091 | memcpy(dst->prof, src->prof, sizeof(struct mlx4_en_port_profile)); | ||
| 2092 | } | ||
| 2093 | |||
| 2094 | int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv, | ||
| 2095 | struct mlx4_en_priv *tmp, | ||
| 2096 | struct mlx4_en_port_profile *prof) | ||
| 2097 | { | ||
| 2098 | mlx4_en_copy_priv(tmp, priv, prof); | ||
| 2099 | |||
| 2100 | if (mlx4_en_alloc_resources(tmp)) { | ||
| 2101 | en_warn(priv, | ||
| 2102 | "%s: Resource allocation failed, using previous configuration\n", | ||
| 2103 | __func__); | ||
| 2104 | kfree(tmp->tx_ring); | ||
| 2105 | kfree(tmp->tx_cq); | ||
| 2106 | return -ENOMEM; | ||
| 2107 | } | ||
| 2108 | return 0; | ||
| 2109 | } | ||
| 2110 | |||
| 2111 | void mlx4_en_safe_replace_resources(struct mlx4_en_priv *priv, | ||
| 2112 | struct mlx4_en_priv *tmp) | ||
| 2113 | { | ||
| 2114 | mlx4_en_free_resources(priv); | ||
| 2115 | mlx4_en_update_priv(priv, tmp); | ||
| 2116 | } | ||
| 2035 | 2117 | ||
| 2036 | void mlx4_en_destroy_netdev(struct net_device *dev) | 2118 | void mlx4_en_destroy_netdev(struct net_device *dev) |
| 2037 | { | 2119 | { |
| 2038 | struct mlx4_en_priv *priv = netdev_priv(dev); | 2120 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 2039 | struct mlx4_en_dev *mdev = priv->mdev; | 2121 | struct mlx4_en_dev *mdev = priv->mdev; |
| 2122 | bool shutdown = mdev->dev->persist->interface_state & | ||
| 2123 | MLX4_INTERFACE_STATE_SHUTDOWN; | ||
| 2040 | 2124 | ||
| 2041 | en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port); | 2125 | en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port); |
| 2042 | 2126 | ||
| @@ -2044,7 +2128,10 @@ void mlx4_en_destroy_netdev(struct net_device *dev) | |||
| 2044 | if (priv->registered) { | 2128 | if (priv->registered) { |
| 2045 | devlink_port_type_clear(mlx4_get_devlink_port(mdev->dev, | 2129 | devlink_port_type_clear(mlx4_get_devlink_port(mdev->dev, |
| 2046 | priv->port)); | 2130 | priv->port)); |
| 2047 | unregister_netdev(dev); | 2131 | if (shutdown) |
| 2132 | mlx4_en_shutdown(dev); | ||
| 2133 | else | ||
| 2134 | unregister_netdev(dev); | ||
| 2048 | } | 2135 | } |
| 2049 | 2136 | ||
| 2050 | if (priv->allocated) | 2137 | if (priv->allocated) |
| @@ -2064,12 +2151,17 @@ void mlx4_en_destroy_netdev(struct net_device *dev) | |||
| 2064 | mdev->upper[priv->port] = NULL; | 2151 | mdev->upper[priv->port] = NULL; |
| 2065 | mutex_unlock(&mdev->state_lock); | 2152 | mutex_unlock(&mdev->state_lock); |
| 2066 | 2153 | ||
| 2154 | #ifdef CONFIG_RFS_ACCEL | ||
| 2155 | mlx4_en_cleanup_filters(priv); | ||
| 2156 | #endif | ||
| 2157 | |||
| 2067 | mlx4_en_free_resources(priv); | 2158 | mlx4_en_free_resources(priv); |
| 2068 | 2159 | ||
| 2069 | kfree(priv->tx_ring); | 2160 | kfree(priv->tx_ring); |
| 2070 | kfree(priv->tx_cq); | 2161 | kfree(priv->tx_cq); |
| 2071 | 2162 | ||
| 2072 | free_netdev(dev); | 2163 | if (!shutdown) |
| 2164 | free_netdev(dev); | ||
| 2073 | } | 2165 | } |
| 2074 | 2166 | ||
| 2075 | static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu) | 2167 | static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu) |
| @@ -2447,9 +2539,14 @@ static netdev_features_t mlx4_en_features_check(struct sk_buff *skb, | |||
| 2447 | * strip that feature if this is an IPv6 encapsulated frame. | 2539 | * strip that feature if this is an IPv6 encapsulated frame. |
| 2448 | */ | 2540 | */ |
| 2449 | if (skb->encapsulation && | 2541 | if (skb->encapsulation && |
| 2450 | (skb->ip_summed == CHECKSUM_PARTIAL) && | 2542 | (skb->ip_summed == CHECKSUM_PARTIAL)) { |
| 2451 | (ip_hdr(skb)->version != 4)) | 2543 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 2452 | features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); | 2544 | |
| 2545 | if (!priv->vxlan_port || | ||
| 2546 | (ip_hdr(skb)->version != 4) || | ||
| 2547 | (udp_hdr(skb)->dest != priv->vxlan_port)) | ||
| 2548 | features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); | ||
| 2549 | } | ||
| 2453 | 2550 | ||
| 2454 | return features; | 2551 | return features; |
| 2455 | } | 2552 | } |
| @@ -3102,6 +3199,8 @@ int mlx4_en_reset_config(struct net_device *dev, | |||
| 3102 | { | 3199 | { |
| 3103 | struct mlx4_en_priv *priv = netdev_priv(dev); | 3200 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 3104 | struct mlx4_en_dev *mdev = priv->mdev; | 3201 | struct mlx4_en_dev *mdev = priv->mdev; |
| 3202 | struct mlx4_en_port_profile new_prof; | ||
| 3203 | struct mlx4_en_priv *tmp; | ||
| 3105 | int port_up = 0; | 3204 | int port_up = 0; |
| 3106 | int err = 0; | 3205 | int err = 0; |
| 3107 | 3206 | ||
| @@ -3118,19 +3217,29 @@ int mlx4_en_reset_config(struct net_device *dev, | |||
| 3118 | return -EINVAL; | 3217 | return -EINVAL; |
| 3119 | } | 3218 | } |
| 3120 | 3219 | ||
| 3220 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); | ||
| 3221 | if (!tmp) | ||
| 3222 | return -ENOMEM; | ||
| 3223 | |||
| 3121 | mutex_lock(&mdev->state_lock); | 3224 | mutex_lock(&mdev->state_lock); |
| 3225 | |||
| 3226 | memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); | ||
| 3227 | memcpy(&new_prof.hwtstamp_config, &ts_config, sizeof(ts_config)); | ||
| 3228 | |||
| 3229 | err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof); | ||
| 3230 | if (err) | ||
| 3231 | goto out; | ||
| 3232 | |||
| 3122 | if (priv->port_up) { | 3233 | if (priv->port_up) { |
| 3123 | port_up = 1; | 3234 | port_up = 1; |
| 3124 | mlx4_en_stop_port(dev, 1); | 3235 | mlx4_en_stop_port(dev, 1); |
| 3125 | } | 3236 | } |
| 3126 | 3237 | ||
| 3127 | mlx4_en_free_resources(priv); | ||
| 3128 | |||
| 3129 | en_warn(priv, "Changing device configuration rx filter(%x) rx vlan(%x)\n", | 3238 | en_warn(priv, "Changing device configuration rx filter(%x) rx vlan(%x)\n", |
| 3130 | ts_config.rx_filter, !!(features & NETIF_F_HW_VLAN_CTAG_RX)); | 3239 | ts_config.rx_filter, |
| 3240 | !!(features & NETIF_F_HW_VLAN_CTAG_RX)); | ||
| 3131 | 3241 | ||
| 3132 | priv->hwtstamp_config.tx_type = ts_config.tx_type; | 3242 | mlx4_en_safe_replace_resources(priv, tmp); |
| 3133 | priv->hwtstamp_config.rx_filter = ts_config.rx_filter; | ||
| 3134 | 3243 | ||
| 3135 | if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX)) { | 3244 | if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX)) { |
| 3136 | if (features & NETIF_F_HW_VLAN_CTAG_RX) | 3245 | if (features & NETIF_F_HW_VLAN_CTAG_RX) |
| @@ -3164,11 +3273,6 @@ int mlx4_en_reset_config(struct net_device *dev, | |||
| 3164 | dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; | 3273 | dev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; |
| 3165 | } | 3274 | } |
| 3166 | 3275 | ||
| 3167 | err = mlx4_en_alloc_resources(priv); | ||
| 3168 | if (err) { | ||
| 3169 | en_err(priv, "Failed reallocating port resources\n"); | ||
| 3170 | goto out; | ||
| 3171 | } | ||
| 3172 | if (port_up) { | 3276 | if (port_up) { |
| 3173 | err = mlx4_en_start_port(dev); | 3277 | err = mlx4_en_start_port(dev); |
| 3174 | if (err) | 3278 | if (err) |
| @@ -3177,6 +3281,8 @@ int mlx4_en_reset_config(struct net_device *dev, | |||
| 3177 | 3281 | ||
| 3178 | out: | 3282 | out: |
| 3179 | mutex_unlock(&mdev->state_lock); | 3283 | mutex_unlock(&mdev->state_lock); |
| 3180 | netdev_features_change(dev); | 3284 | kfree(tmp); |
| 3285 | if (!err) | ||
| 3286 | netdev_features_change(dev); | ||
| 3181 | return err; | 3287 | return err; |
| 3182 | } | 3288 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index c1b3a9c8cf3b..99b5407f2278 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
| @@ -514,9 +514,6 @@ void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, | |||
| 514 | ring->rx_info = NULL; | 514 | ring->rx_info = NULL; |
| 515 | kfree(ring); | 515 | kfree(ring); |
| 516 | *pring = NULL; | 516 | *pring = NULL; |
| 517 | #ifdef CONFIG_RFS_ACCEL | ||
| 518 | mlx4_en_cleanup_filters(priv); | ||
| 519 | #endif | ||
| 520 | } | 517 | } |
| 521 | 518 | ||
| 522 | void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, | 519 | void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 12c77a70abdb..546fab0ecc3b 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
| @@ -3222,6 +3222,7 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data, | |||
| 3222 | 3222 | ||
| 3223 | INIT_LIST_HEAD(&priv->pgdir_list); | 3223 | INIT_LIST_HEAD(&priv->pgdir_list); |
| 3224 | mutex_init(&priv->pgdir_mutex); | 3224 | mutex_init(&priv->pgdir_mutex); |
| 3225 | spin_lock_init(&priv->cmd.context_lock); | ||
| 3225 | 3226 | ||
| 3226 | INIT_LIST_HEAD(&priv->bf_list); | 3227 | INIT_LIST_HEAD(&priv->bf_list); |
| 3227 | mutex_init(&priv->bf_mutex); | 3228 | mutex_init(&priv->bf_mutex); |
| @@ -4134,8 +4135,11 @@ static void mlx4_shutdown(struct pci_dev *pdev) | |||
| 4134 | 4135 | ||
| 4135 | mlx4_info(persist->dev, "mlx4_shutdown was called\n"); | 4136 | mlx4_info(persist->dev, "mlx4_shutdown was called\n"); |
| 4136 | mutex_lock(&persist->interface_state_mutex); | 4137 | mutex_lock(&persist->interface_state_mutex); |
| 4137 | if (persist->interface_state & MLX4_INTERFACE_STATE_UP) | 4138 | if (persist->interface_state & MLX4_INTERFACE_STATE_UP) { |
| 4139 | /* Notify mlx4 clients that the kernel is being shut down */ | ||
| 4140 | persist->interface_state |= MLX4_INTERFACE_STATE_SHUTDOWN; | ||
| 4138 | mlx4_unload_one(pdev); | 4141 | mlx4_unload_one(pdev); |
| 4142 | } | ||
| 4139 | mutex_unlock(&persist->interface_state_mutex); | 4143 | mutex_unlock(&persist->interface_state_mutex); |
| 4140 | } | 4144 | } |
| 4141 | 4145 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 467d47ed2c39..13d297ee34bb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
| @@ -353,12 +353,14 @@ struct mlx4_en_port_profile { | |||
| 353 | u32 rx_ring_num; | 353 | u32 rx_ring_num; |
| 354 | u32 tx_ring_size; | 354 | u32 tx_ring_size; |
| 355 | u32 rx_ring_size; | 355 | u32 rx_ring_size; |
| 356 | u8 num_tx_rings_p_up; | ||
| 356 | u8 rx_pause; | 357 | u8 rx_pause; |
| 357 | u8 rx_ppp; | 358 | u8 rx_ppp; |
| 358 | u8 tx_pause; | 359 | u8 tx_pause; |
| 359 | u8 tx_ppp; | 360 | u8 tx_ppp; |
| 360 | int rss_rings; | 361 | int rss_rings; |
| 361 | int inline_thold; | 362 | int inline_thold; |
| 363 | struct hwtstamp_config hwtstamp_config; | ||
| 362 | }; | 364 | }; |
| 363 | 365 | ||
| 364 | struct mlx4_en_profile { | 366 | struct mlx4_en_profile { |
| @@ -623,8 +625,11 @@ void mlx4_en_set_stats_bitmap(struct mlx4_dev *dev, | |||
| 623 | u8 rx_ppp, u8 rx_pause, | 625 | u8 rx_ppp, u8 rx_pause, |
| 624 | u8 tx_ppp, u8 tx_pause); | 626 | u8 tx_ppp, u8 tx_pause); |
| 625 | 627 | ||
| 626 | void mlx4_en_free_resources(struct mlx4_en_priv *priv); | 628 | int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv, |
| 627 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv); | 629 | struct mlx4_en_priv *tmp, |
| 630 | struct mlx4_en_port_profile *prof); | ||
| 631 | void mlx4_en_safe_replace_resources(struct mlx4_en_priv *priv, | ||
| 632 | struct mlx4_en_priv *tmp); | ||
| 628 | 633 | ||
| 629 | int mlx4_en_create_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq, | 634 | int mlx4_en_create_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq, |
| 630 | int entries, int ring, enum cq_type mode, int node); | 635 | int entries, int ring, enum cq_type mode, int node); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index dcd2df6518de..d6e2a1cae19a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | |||
| @@ -295,6 +295,12 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op, | |||
| 295 | case MLX5_CMD_OP_DESTROY_FLOW_GROUP: | 295 | case MLX5_CMD_OP_DESTROY_FLOW_GROUP: |
| 296 | case MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY: | 296 | case MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY: |
| 297 | case MLX5_CMD_OP_DEALLOC_FLOW_COUNTER: | 297 | case MLX5_CMD_OP_DEALLOC_FLOW_COUNTER: |
| 298 | case MLX5_CMD_OP_2ERR_QP: | ||
| 299 | case MLX5_CMD_OP_2RST_QP: | ||
| 300 | case MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT: | ||
| 301 | case MLX5_CMD_OP_MODIFY_FLOW_TABLE: | ||
| 302 | case MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY: | ||
| 303 | case MLX5_CMD_OP_SET_FLOW_TABLE_ROOT: | ||
| 298 | return MLX5_CMD_STAT_OK; | 304 | return MLX5_CMD_STAT_OK; |
| 299 | 305 | ||
| 300 | case MLX5_CMD_OP_QUERY_HCA_CAP: | 306 | case MLX5_CMD_OP_QUERY_HCA_CAP: |
| @@ -321,8 +327,6 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op, | |||
| 321 | case MLX5_CMD_OP_RTR2RTS_QP: | 327 | case MLX5_CMD_OP_RTR2RTS_QP: |
| 322 | case MLX5_CMD_OP_RTS2RTS_QP: | 328 | case MLX5_CMD_OP_RTS2RTS_QP: |
| 323 | case MLX5_CMD_OP_SQERR2RTS_QP: | 329 | case MLX5_CMD_OP_SQERR2RTS_QP: |
| 324 | case MLX5_CMD_OP_2ERR_QP: | ||
| 325 | case MLX5_CMD_OP_2RST_QP: | ||
| 326 | case MLX5_CMD_OP_QUERY_QP: | 330 | case MLX5_CMD_OP_QUERY_QP: |
| 327 | case MLX5_CMD_OP_SQD_RTS_QP: | 331 | case MLX5_CMD_OP_SQD_RTS_QP: |
| 328 | case MLX5_CMD_OP_INIT2INIT_QP: | 332 | case MLX5_CMD_OP_INIT2INIT_QP: |
| @@ -342,7 +346,6 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op, | |||
| 342 | case MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT: | 346 | case MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT: |
| 343 | case MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT: | 347 | case MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT: |
| 344 | case MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT: | 348 | case MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT: |
| 345 | case MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT: | ||
| 346 | case MLX5_CMD_OP_QUERY_ROCE_ADDRESS: | 349 | case MLX5_CMD_OP_QUERY_ROCE_ADDRESS: |
| 347 | case MLX5_CMD_OP_SET_ROCE_ADDRESS: | 350 | case MLX5_CMD_OP_SET_ROCE_ADDRESS: |
| 348 | case MLX5_CMD_OP_QUERY_HCA_VPORT_CONTEXT: | 351 | case MLX5_CMD_OP_QUERY_HCA_VPORT_CONTEXT: |
| @@ -390,11 +393,12 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op, | |||
| 390 | case MLX5_CMD_OP_CREATE_RQT: | 393 | case MLX5_CMD_OP_CREATE_RQT: |
| 391 | case MLX5_CMD_OP_MODIFY_RQT: | 394 | case MLX5_CMD_OP_MODIFY_RQT: |
| 392 | case MLX5_CMD_OP_QUERY_RQT: | 395 | case MLX5_CMD_OP_QUERY_RQT: |
| 396 | |||
| 393 | case MLX5_CMD_OP_CREATE_FLOW_TABLE: | 397 | case MLX5_CMD_OP_CREATE_FLOW_TABLE: |
| 394 | case MLX5_CMD_OP_QUERY_FLOW_TABLE: | 398 | case MLX5_CMD_OP_QUERY_FLOW_TABLE: |
| 395 | case MLX5_CMD_OP_CREATE_FLOW_GROUP: | 399 | case MLX5_CMD_OP_CREATE_FLOW_GROUP: |
| 396 | case MLX5_CMD_OP_QUERY_FLOW_GROUP: | 400 | case MLX5_CMD_OP_QUERY_FLOW_GROUP: |
| 397 | case MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY: | 401 | |
| 398 | case MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY: | 402 | case MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY: |
| 399 | case MLX5_CMD_OP_ALLOC_FLOW_COUNTER: | 403 | case MLX5_CMD_OP_ALLOC_FLOW_COUNTER: |
| 400 | case MLX5_CMD_OP_QUERY_FLOW_COUNTER: | 404 | case MLX5_CMD_OP_QUERY_FLOW_COUNTER: |
| @@ -545,6 +549,7 @@ const char *mlx5_command_str(int command) | |||
| 545 | MLX5_COMMAND_STR_CASE(ALLOC_FLOW_COUNTER); | 549 | MLX5_COMMAND_STR_CASE(ALLOC_FLOW_COUNTER); |
| 546 | MLX5_COMMAND_STR_CASE(DEALLOC_FLOW_COUNTER); | 550 | MLX5_COMMAND_STR_CASE(DEALLOC_FLOW_COUNTER); |
| 547 | MLX5_COMMAND_STR_CASE(QUERY_FLOW_COUNTER); | 551 | MLX5_COMMAND_STR_CASE(QUERY_FLOW_COUNTER); |
| 552 | MLX5_COMMAND_STR_CASE(MODIFY_FLOW_TABLE); | ||
| 548 | default: return "unknown command opcode"; | 553 | default: return "unknown command opcode"; |
| 549 | } | 554 | } |
| 550 | } | 555 | } |
| @@ -601,11 +606,36 @@ static void dump_command(struct mlx5_core_dev *dev, | |||
| 601 | pr_debug("\n"); | 606 | pr_debug("\n"); |
| 602 | } | 607 | } |
| 603 | 608 | ||
| 609 | static u16 msg_to_opcode(struct mlx5_cmd_msg *in) | ||
| 610 | { | ||
| 611 | struct mlx5_inbox_hdr *hdr = (struct mlx5_inbox_hdr *)(in->first.data); | ||
| 612 | |||
| 613 | return be16_to_cpu(hdr->opcode); | ||
| 614 | } | ||
| 615 | |||
| 616 | static void cb_timeout_handler(struct work_struct *work) | ||
| 617 | { | ||
| 618 | struct delayed_work *dwork = container_of(work, struct delayed_work, | ||
| 619 | work); | ||
| 620 | struct mlx5_cmd_work_ent *ent = container_of(dwork, | ||
| 621 | struct mlx5_cmd_work_ent, | ||
| 622 | cb_timeout_work); | ||
| 623 | struct mlx5_core_dev *dev = container_of(ent->cmd, struct mlx5_core_dev, | ||
| 624 | cmd); | ||
| 625 | |||
| 626 | ent->ret = -ETIMEDOUT; | ||
| 627 | mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", | ||
| 628 | mlx5_command_str(msg_to_opcode(ent->in)), | ||
| 629 | msg_to_opcode(ent->in)); | ||
| 630 | mlx5_cmd_comp_handler(dev, 1UL << ent->idx); | ||
| 631 | } | ||
| 632 | |||
| 604 | static void cmd_work_handler(struct work_struct *work) | 633 | static void cmd_work_handler(struct work_struct *work) |
| 605 | { | 634 | { |
| 606 | struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work); | 635 | struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work); |
| 607 | struct mlx5_cmd *cmd = ent->cmd; | 636 | struct mlx5_cmd *cmd = ent->cmd; |
| 608 | struct mlx5_core_dev *dev = container_of(cmd, struct mlx5_core_dev, cmd); | 637 | struct mlx5_core_dev *dev = container_of(cmd, struct mlx5_core_dev, cmd); |
| 638 | unsigned long cb_timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC); | ||
| 609 | struct mlx5_cmd_layout *lay; | 639 | struct mlx5_cmd_layout *lay; |
| 610 | struct semaphore *sem; | 640 | struct semaphore *sem; |
| 611 | unsigned long flags; | 641 | unsigned long flags; |
| @@ -646,6 +676,9 @@ static void cmd_work_handler(struct work_struct *work) | |||
| 646 | dump_command(dev, ent, 1); | 676 | dump_command(dev, ent, 1); |
| 647 | ent->ts1 = ktime_get_ns(); | 677 | ent->ts1 = ktime_get_ns(); |
| 648 | 678 | ||
| 679 | if (ent->callback) | ||
| 680 | schedule_delayed_work(&ent->cb_timeout_work, cb_timeout); | ||
| 681 | |||
| 649 | /* ring doorbell after the descriptor is valid */ | 682 | /* ring doorbell after the descriptor is valid */ |
| 650 | mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); | 683 | mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); |
| 651 | wmb(); | 684 | wmb(); |
| @@ -690,13 +723,6 @@ static const char *deliv_status_to_str(u8 status) | |||
| 690 | } | 723 | } |
| 691 | } | 724 | } |
| 692 | 725 | ||
| 693 | static u16 msg_to_opcode(struct mlx5_cmd_msg *in) | ||
| 694 | { | ||
| 695 | struct mlx5_inbox_hdr *hdr = (struct mlx5_inbox_hdr *)(in->first.data); | ||
| 696 | |||
| 697 | return be16_to_cpu(hdr->opcode); | ||
| 698 | } | ||
| 699 | |||
| 700 | static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) | 726 | static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) |
| 701 | { | 727 | { |
| 702 | unsigned long timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC); | 728 | unsigned long timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC); |
| @@ -705,13 +731,13 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) | |||
| 705 | 731 | ||
| 706 | if (cmd->mode == CMD_MODE_POLLING) { | 732 | if (cmd->mode == CMD_MODE_POLLING) { |
| 707 | wait_for_completion(&ent->done); | 733 | wait_for_completion(&ent->done); |
| 708 | err = ent->ret; | 734 | } else if (!wait_for_completion_timeout(&ent->done, timeout)) { |
| 709 | } else { | 735 | ent->ret = -ETIMEDOUT; |
| 710 | if (!wait_for_completion_timeout(&ent->done, timeout)) | 736 | mlx5_cmd_comp_handler(dev, 1UL << ent->idx); |
| 711 | err = -ETIMEDOUT; | ||
| 712 | else | ||
| 713 | err = 0; | ||
| 714 | } | 737 | } |
| 738 | |||
| 739 | err = ent->ret; | ||
| 740 | |||
| 715 | if (err == -ETIMEDOUT) { | 741 | if (err == -ETIMEDOUT) { |
| 716 | mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", | 742 | mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", |
| 717 | mlx5_command_str(msg_to_opcode(ent->in)), | 743 | mlx5_command_str(msg_to_opcode(ent->in)), |
| @@ -760,6 +786,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, | |||
| 760 | if (!callback) | 786 | if (!callback) |
| 761 | init_completion(&ent->done); | 787 | init_completion(&ent->done); |
| 762 | 788 | ||
| 789 | INIT_DELAYED_WORK(&ent->cb_timeout_work, cb_timeout_handler); | ||
| 763 | INIT_WORK(&ent->work, cmd_work_handler); | 790 | INIT_WORK(&ent->work, cmd_work_handler); |
| 764 | if (page_queue) { | 791 | if (page_queue) { |
| 765 | cmd_work_handler(&ent->work); | 792 | cmd_work_handler(&ent->work); |
| @@ -769,28 +796,26 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, | |||
| 769 | goto out_free; | 796 | goto out_free; |
| 770 | } | 797 | } |
| 771 | 798 | ||
| 772 | if (!callback) { | 799 | if (callback) |
| 773 | err = wait_func(dev, ent); | 800 | goto out; |
| 774 | if (err == -ETIMEDOUT) | ||
| 775 | goto out; | ||
| 776 | |||
| 777 | ds = ent->ts2 - ent->ts1; | ||
| 778 | op = be16_to_cpu(((struct mlx5_inbox_hdr *)in->first.data)->opcode); | ||
| 779 | if (op < ARRAY_SIZE(cmd->stats)) { | ||
| 780 | stats = &cmd->stats[op]; | ||
| 781 | spin_lock_irq(&stats->lock); | ||
| 782 | stats->sum += ds; | ||
| 783 | ++stats->n; | ||
| 784 | spin_unlock_irq(&stats->lock); | ||
| 785 | } | ||
| 786 | mlx5_core_dbg_mask(dev, 1 << MLX5_CMD_TIME, | ||
| 787 | "fw exec time for %s is %lld nsec\n", | ||
| 788 | mlx5_command_str(op), ds); | ||
| 789 | *status = ent->status; | ||
| 790 | free_cmd(ent); | ||
| 791 | } | ||
| 792 | 801 | ||
| 793 | return err; | 802 | err = wait_func(dev, ent); |
| 803 | if (err == -ETIMEDOUT) | ||
| 804 | goto out_free; | ||
| 805 | |||
| 806 | ds = ent->ts2 - ent->ts1; | ||
| 807 | op = be16_to_cpu(((struct mlx5_inbox_hdr *)in->first.data)->opcode); | ||
| 808 | if (op < ARRAY_SIZE(cmd->stats)) { | ||
| 809 | stats = &cmd->stats[op]; | ||
| 810 | spin_lock_irq(&stats->lock); | ||
| 811 | stats->sum += ds; | ||
| 812 | ++stats->n; | ||
| 813 | spin_unlock_irq(&stats->lock); | ||
| 814 | } | ||
| 815 | mlx5_core_dbg_mask(dev, 1 << MLX5_CMD_TIME, | ||
| 816 | "fw exec time for %s is %lld nsec\n", | ||
| 817 | mlx5_command_str(op), ds); | ||
| 818 | *status = ent->status; | ||
| 794 | 819 | ||
| 795 | out_free: | 820 | out_free: |
| 796 | free_cmd(ent); | 821 | free_cmd(ent); |
| @@ -1180,41 +1205,30 @@ err_dbg: | |||
| 1180 | return err; | 1205 | return err; |
| 1181 | } | 1206 | } |
| 1182 | 1207 | ||
| 1183 | void mlx5_cmd_use_events(struct mlx5_core_dev *dev) | 1208 | static void mlx5_cmd_change_mod(struct mlx5_core_dev *dev, int mode) |
| 1184 | { | 1209 | { |
| 1185 | struct mlx5_cmd *cmd = &dev->cmd; | 1210 | struct mlx5_cmd *cmd = &dev->cmd; |
| 1186 | int i; | 1211 | int i; |
| 1187 | 1212 | ||
| 1188 | for (i = 0; i < cmd->max_reg_cmds; i++) | 1213 | for (i = 0; i < cmd->max_reg_cmds; i++) |
| 1189 | down(&cmd->sem); | 1214 | down(&cmd->sem); |
| 1190 | |||
| 1191 | down(&cmd->pages_sem); | 1215 | down(&cmd->pages_sem); |
| 1192 | 1216 | ||
| 1193 | flush_workqueue(cmd->wq); | 1217 | cmd->mode = mode; |
| 1194 | |||
| 1195 | cmd->mode = CMD_MODE_EVENTS; | ||
| 1196 | 1218 | ||
| 1197 | up(&cmd->pages_sem); | 1219 | up(&cmd->pages_sem); |
| 1198 | for (i = 0; i < cmd->max_reg_cmds; i++) | 1220 | for (i = 0; i < cmd->max_reg_cmds; i++) |
| 1199 | up(&cmd->sem); | 1221 | up(&cmd->sem); |
| 1200 | } | 1222 | } |
| 1201 | 1223 | ||
| 1202 | void mlx5_cmd_use_polling(struct mlx5_core_dev *dev) | 1224 | void mlx5_cmd_use_events(struct mlx5_core_dev *dev) |
| 1203 | { | 1225 | { |
| 1204 | struct mlx5_cmd *cmd = &dev->cmd; | 1226 | mlx5_cmd_change_mod(dev, CMD_MODE_EVENTS); |
| 1205 | int i; | 1227 | } |
| 1206 | |||
| 1207 | for (i = 0; i < cmd->max_reg_cmds; i++) | ||
| 1208 | down(&cmd->sem); | ||
| 1209 | |||
| 1210 | down(&cmd->pages_sem); | ||
| 1211 | |||
| 1212 | flush_workqueue(cmd->wq); | ||
| 1213 | cmd->mode = CMD_MODE_POLLING; | ||
| 1214 | 1228 | ||
| 1215 | up(&cmd->pages_sem); | 1229 | void mlx5_cmd_use_polling(struct mlx5_core_dev *dev) |
| 1216 | for (i = 0; i < cmd->max_reg_cmds; i++) | 1230 | { |
| 1217 | up(&cmd->sem); | 1231 | mlx5_cmd_change_mod(dev, CMD_MODE_POLLING); |
| 1218 | } | 1232 | } |
| 1219 | 1233 | ||
| 1220 | static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg) | 1234 | static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg) |
| @@ -1250,6 +1264,8 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec) | |||
| 1250 | struct semaphore *sem; | 1264 | struct semaphore *sem; |
| 1251 | 1265 | ||
| 1252 | ent = cmd->ent_arr[i]; | 1266 | ent = cmd->ent_arr[i]; |
| 1267 | if (ent->callback) | ||
| 1268 | cancel_delayed_work(&ent->cb_timeout_work); | ||
| 1253 | if (ent->page_queue) | 1269 | if (ent->page_queue) |
| 1254 | sem = &cmd->pages_sem; | 1270 | sem = &cmd->pages_sem; |
| 1255 | else | 1271 | else |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index e8a6c3325b39..943b1bd434bf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h | |||
| @@ -145,7 +145,6 @@ struct mlx5e_umr_wqe { | |||
| 145 | 145 | ||
| 146 | #ifdef CONFIG_MLX5_CORE_EN_DCB | 146 | #ifdef CONFIG_MLX5_CORE_EN_DCB |
| 147 | #define MLX5E_MAX_BW_ALLOC 100 /* Max percentage of BW allocation */ | 147 | #define MLX5E_MAX_BW_ALLOC 100 /* Max percentage of BW allocation */ |
| 148 | #define MLX5E_MIN_BW_ALLOC 1 /* Min percentage of BW allocation */ | ||
| 149 | #endif | 148 | #endif |
| 150 | 149 | ||
| 151 | struct mlx5e_params { | 150 | struct mlx5e_params { |
| @@ -191,6 +190,7 @@ struct mlx5e_tstamp { | |||
| 191 | enum { | 190 | enum { |
| 192 | MLX5E_RQ_STATE_POST_WQES_ENABLE, | 191 | MLX5E_RQ_STATE_POST_WQES_ENABLE, |
| 193 | MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, | 192 | MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, |
| 193 | MLX5E_RQ_STATE_FLUSH_TIMEOUT, | ||
| 194 | }; | 194 | }; |
| 195 | 195 | ||
| 196 | struct mlx5e_cq { | 196 | struct mlx5e_cq { |
| @@ -220,6 +220,8 @@ typedef void (*mlx5e_fp_handle_rx_cqe)(struct mlx5e_rq *rq, | |||
| 220 | typedef int (*mlx5e_fp_alloc_wqe)(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, | 220 | typedef int (*mlx5e_fp_alloc_wqe)(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, |
| 221 | u16 ix); | 221 | u16 ix); |
| 222 | 222 | ||
| 223 | typedef void (*mlx5e_fp_dealloc_wqe)(struct mlx5e_rq *rq, u16 ix); | ||
| 224 | |||
| 223 | struct mlx5e_dma_info { | 225 | struct mlx5e_dma_info { |
| 224 | struct page *page; | 226 | struct page *page; |
| 225 | dma_addr_t addr; | 227 | dma_addr_t addr; |
| @@ -241,6 +243,7 @@ struct mlx5e_rq { | |||
| 241 | struct mlx5e_cq cq; | 243 | struct mlx5e_cq cq; |
| 242 | mlx5e_fp_handle_rx_cqe handle_rx_cqe; | 244 | mlx5e_fp_handle_rx_cqe handle_rx_cqe; |
| 243 | mlx5e_fp_alloc_wqe alloc_wqe; | 245 | mlx5e_fp_alloc_wqe alloc_wqe; |
| 246 | mlx5e_fp_dealloc_wqe dealloc_wqe; | ||
| 244 | 247 | ||
| 245 | unsigned long state; | 248 | unsigned long state; |
| 246 | int ix; | 249 | int ix; |
| @@ -305,6 +308,7 @@ struct mlx5e_sq_dma { | |||
| 305 | enum { | 308 | enum { |
| 306 | MLX5E_SQ_STATE_WAKE_TXQ_ENABLE, | 309 | MLX5E_SQ_STATE_WAKE_TXQ_ENABLE, |
| 307 | MLX5E_SQ_STATE_BF_ENABLE, | 310 | MLX5E_SQ_STATE_BF_ENABLE, |
| 311 | MLX5E_SQ_STATE_TX_TIMEOUT, | ||
| 308 | }; | 312 | }; |
| 309 | 313 | ||
| 310 | struct mlx5e_ico_wqe_info { | 314 | struct mlx5e_ico_wqe_info { |
| @@ -401,7 +405,7 @@ enum mlx5e_traffic_types { | |||
| 401 | }; | 405 | }; |
| 402 | 406 | ||
| 403 | enum { | 407 | enum { |
| 404 | MLX5E_STATE_ASYNC_EVENTS_ENABLE, | 408 | MLX5E_STATE_ASYNC_EVENTS_ENABLED, |
| 405 | MLX5E_STATE_OPENED, | 409 | MLX5E_STATE_OPENED, |
| 406 | MLX5E_STATE_DESTROYING, | 410 | MLX5E_STATE_DESTROYING, |
| 407 | }; | 411 | }; |
| @@ -538,6 +542,7 @@ struct mlx5e_priv { | |||
| 538 | struct workqueue_struct *wq; | 542 | struct workqueue_struct *wq; |
| 539 | struct work_struct update_carrier_work; | 543 | struct work_struct update_carrier_work; |
| 540 | struct work_struct set_rx_mode_work; | 544 | struct work_struct set_rx_mode_work; |
| 545 | struct work_struct tx_timeout_work; | ||
| 541 | struct delayed_work update_stats_work; | 546 | struct delayed_work update_stats_work; |
| 542 | 547 | ||
| 543 | struct mlx5_core_dev *mdev; | 548 | struct mlx5_core_dev *mdev; |
| @@ -589,12 +594,16 @@ void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event); | |||
| 589 | int mlx5e_napi_poll(struct napi_struct *napi, int budget); | 594 | int mlx5e_napi_poll(struct napi_struct *napi, int budget); |
| 590 | bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget); | 595 | bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget); |
| 591 | int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget); | 596 | int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget); |
| 597 | void mlx5e_free_tx_descs(struct mlx5e_sq *sq); | ||
| 598 | void mlx5e_free_rx_descs(struct mlx5e_rq *rq); | ||
| 592 | 599 | ||
| 593 | void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); | 600 | void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); |
| 594 | void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); | 601 | void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); |
| 595 | bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq); | 602 | bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq); |
| 596 | int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix); | 603 | int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix); |
| 597 | int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix); | 604 | int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix); |
| 605 | void mlx5e_dealloc_rx_wqe(struct mlx5e_rq *rq, u16 ix); | ||
| 606 | void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix); | ||
| 598 | void mlx5e_post_rx_fragmented_mpwqe(struct mlx5e_rq *rq); | 607 | void mlx5e_post_rx_fragmented_mpwqe(struct mlx5e_rq *rq); |
| 599 | void mlx5e_complete_rx_linear_mpwqe(struct mlx5e_rq *rq, | 608 | void mlx5e_complete_rx_linear_mpwqe(struct mlx5e_rq *rq, |
| 600 | struct mlx5_cqe64 *cqe, | 609 | struct mlx5_cqe64 *cqe, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c index b2db180ae2a5..c585349e05c3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | |||
| @@ -96,7 +96,7 @@ static void mlx5e_build_tc_tx_bw(struct ieee_ets *ets, u8 *tc_tx_bw, | |||
| 96 | tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC; | 96 | tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC; |
| 97 | break; | 97 | break; |
| 98 | case IEEE_8021QAZ_TSA_ETS: | 98 | case IEEE_8021QAZ_TSA_ETS: |
| 99 | tc_tx_bw[i] = ets->tc_tx_bw[i] ?: MLX5E_MIN_BW_ALLOC; | 99 | tc_tx_bw[i] = ets->tc_tx_bw[i]; |
| 100 | break; | 100 | break; |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| @@ -140,8 +140,12 @@ static int mlx5e_dbcnl_validate_ets(struct ieee_ets *ets) | |||
| 140 | 140 | ||
| 141 | /* Validate Bandwidth Sum */ | 141 | /* Validate Bandwidth Sum */ |
| 142 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { | 142 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { |
| 143 | if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) | 143 | if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) { |
| 144 | if (!ets->tc_tx_bw[i]) | ||
| 145 | return -EINVAL; | ||
| 146 | |||
| 144 | bw_sum += ets->tc_tx_bw[i]; | 147 | bw_sum += ets->tc_tx_bw[i]; |
| 148 | } | ||
| 145 | } | 149 | } |
| 146 | 150 | ||
| 147 | if (bw_sum != 0 && bw_sum != 100) | 151 | if (bw_sum != 0 && bw_sum != 100) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index fc7dcc03b1de..e667a870e0c2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
| @@ -184,7 +184,9 @@ static unsigned long mlx5e_query_pfc_combined(struct mlx5e_priv *priv) | |||
| 184 | #define MLX5E_NUM_SQ_STATS(priv) \ | 184 | #define MLX5E_NUM_SQ_STATS(priv) \ |
| 185 | (NUM_SQ_STATS * priv->params.num_channels * priv->params.num_tc * \ | 185 | (NUM_SQ_STATS * priv->params.num_channels * priv->params.num_tc * \ |
| 186 | test_bit(MLX5E_STATE_OPENED, &priv->state)) | 186 | test_bit(MLX5E_STATE_OPENED, &priv->state)) |
| 187 | #define MLX5E_NUM_PFC_COUNTERS(priv) hweight8(mlx5e_query_pfc_combined(priv)) | 187 | #define MLX5E_NUM_PFC_COUNTERS(priv) \ |
| 188 | (hweight8(mlx5e_query_pfc_combined(priv)) * \ | ||
| 189 | NUM_PPORT_PER_PRIO_PFC_COUNTERS) | ||
| 188 | 190 | ||
| 189 | static int mlx5e_get_sset_count(struct net_device *dev, int sset) | 191 | static int mlx5e_get_sset_count(struct net_device *dev, int sset) |
| 190 | { | 192 | { |
| @@ -211,42 +213,41 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data) | |||
| 211 | 213 | ||
| 212 | /* SW counters */ | 214 | /* SW counters */ |
| 213 | for (i = 0; i < NUM_SW_COUNTERS; i++) | 215 | for (i = 0; i < NUM_SW_COUNTERS; i++) |
| 214 | strcpy(data + (idx++) * ETH_GSTRING_LEN, sw_stats_desc[i].name); | 216 | strcpy(data + (idx++) * ETH_GSTRING_LEN, sw_stats_desc[i].format); |
| 215 | 217 | ||
| 216 | /* Q counters */ | 218 | /* Q counters */ |
| 217 | for (i = 0; i < MLX5E_NUM_Q_CNTRS(priv); i++) | 219 | for (i = 0; i < MLX5E_NUM_Q_CNTRS(priv); i++) |
| 218 | strcpy(data + (idx++) * ETH_GSTRING_LEN, q_stats_desc[i].name); | 220 | strcpy(data + (idx++) * ETH_GSTRING_LEN, q_stats_desc[i].format); |
| 219 | 221 | ||
| 220 | /* VPORT counters */ | 222 | /* VPORT counters */ |
| 221 | for (i = 0; i < NUM_VPORT_COUNTERS; i++) | 223 | for (i = 0; i < NUM_VPORT_COUNTERS; i++) |
| 222 | strcpy(data + (idx++) * ETH_GSTRING_LEN, | 224 | strcpy(data + (idx++) * ETH_GSTRING_LEN, |
| 223 | vport_stats_desc[i].name); | 225 | vport_stats_desc[i].format); |
| 224 | 226 | ||
| 225 | /* PPORT counters */ | 227 | /* PPORT counters */ |
| 226 | for (i = 0; i < NUM_PPORT_802_3_COUNTERS; i++) | 228 | for (i = 0; i < NUM_PPORT_802_3_COUNTERS; i++) |
| 227 | strcpy(data + (idx++) * ETH_GSTRING_LEN, | 229 | strcpy(data + (idx++) * ETH_GSTRING_LEN, |
| 228 | pport_802_3_stats_desc[i].name); | 230 | pport_802_3_stats_desc[i].format); |
| 229 | 231 | ||
| 230 | for (i = 0; i < NUM_PPORT_2863_COUNTERS; i++) | 232 | for (i = 0; i < NUM_PPORT_2863_COUNTERS; i++) |
| 231 | strcpy(data + (idx++) * ETH_GSTRING_LEN, | 233 | strcpy(data + (idx++) * ETH_GSTRING_LEN, |
| 232 | pport_2863_stats_desc[i].name); | 234 | pport_2863_stats_desc[i].format); |
| 233 | 235 | ||
| 234 | for (i = 0; i < NUM_PPORT_2819_COUNTERS; i++) | 236 | for (i = 0; i < NUM_PPORT_2819_COUNTERS; i++) |
| 235 | strcpy(data + (idx++) * ETH_GSTRING_LEN, | 237 | strcpy(data + (idx++) * ETH_GSTRING_LEN, |
| 236 | pport_2819_stats_desc[i].name); | 238 | pport_2819_stats_desc[i].format); |
| 237 | 239 | ||
| 238 | for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { | 240 | for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { |
| 239 | for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) | 241 | for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) |
| 240 | sprintf(data + (idx++) * ETH_GSTRING_LEN, "prio%d_%s", | 242 | sprintf(data + (idx++) * ETH_GSTRING_LEN, |
| 241 | prio, | 243 | pport_per_prio_traffic_stats_desc[i].format, prio); |
| 242 | pport_per_prio_traffic_stats_desc[i].name); | ||
| 243 | } | 244 | } |
| 244 | 245 | ||
| 245 | pfc_combined = mlx5e_query_pfc_combined(priv); | 246 | pfc_combined = mlx5e_query_pfc_combined(priv); |
| 246 | for_each_set_bit(prio, &pfc_combined, NUM_PPORT_PRIO) { | 247 | for_each_set_bit(prio, &pfc_combined, NUM_PPORT_PRIO) { |
| 247 | for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) { | 248 | for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) { |
| 248 | sprintf(data + (idx++) * ETH_GSTRING_LEN, "prio%d_%s", | 249 | sprintf(data + (idx++) * ETH_GSTRING_LEN, |
| 249 | prio, pport_per_prio_pfc_stats_desc[i].name); | 250 | pport_per_prio_pfc_stats_desc[i].format, prio); |
| 250 | } | 251 | } |
| 251 | } | 252 | } |
| 252 | 253 | ||
| @@ -256,16 +257,15 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data) | |||
| 256 | /* per channel counters */ | 257 | /* per channel counters */ |
| 257 | for (i = 0; i < priv->params.num_channels; i++) | 258 | for (i = 0; i < priv->params.num_channels; i++) |
| 258 | for (j = 0; j < NUM_RQ_STATS; j++) | 259 | for (j = 0; j < NUM_RQ_STATS; j++) |
| 259 | sprintf(data + (idx++) * ETH_GSTRING_LEN, "rx%d_%s", i, | 260 | sprintf(data + (idx++) * ETH_GSTRING_LEN, |
| 260 | rq_stats_desc[j].name); | 261 | rq_stats_desc[j].format, i); |
| 261 | 262 | ||
| 262 | for (tc = 0; tc < priv->params.num_tc; tc++) | 263 | for (tc = 0; tc < priv->params.num_tc; tc++) |
| 263 | for (i = 0; i < priv->params.num_channels; i++) | 264 | for (i = 0; i < priv->params.num_channels; i++) |
| 264 | for (j = 0; j < NUM_SQ_STATS; j++) | 265 | for (j = 0; j < NUM_SQ_STATS; j++) |
| 265 | sprintf(data + (idx++) * ETH_GSTRING_LEN, | 266 | sprintf(data + (idx++) * ETH_GSTRING_LEN, |
| 266 | "tx%d_%s", | 267 | sq_stats_desc[j].format, |
| 267 | priv->channeltc_to_txq_map[i][tc], | 268 | priv->channeltc_to_txq_map[i][tc]); |
| 268 | sq_stats_desc[j].name); | ||
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | static void mlx5e_get_strings(struct net_device *dev, | 271 | static void mlx5e_get_strings(struct net_device *dev, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index f5c8d5db25a8..5a4d88c2cdb2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
| @@ -39,6 +39,13 @@ | |||
| 39 | #include "eswitch.h" | 39 | #include "eswitch.h" |
| 40 | #include "vxlan.h" | 40 | #include "vxlan.h" |
| 41 | 41 | ||
| 42 | enum { | ||
| 43 | MLX5_EN_QP_FLUSH_TIMEOUT_MS = 5000, | ||
| 44 | MLX5_EN_QP_FLUSH_MSLEEP_QUANT = 20, | ||
| 45 | MLX5_EN_QP_FLUSH_MAX_ITER = MLX5_EN_QP_FLUSH_TIMEOUT_MS / | ||
| 46 | MLX5_EN_QP_FLUSH_MSLEEP_QUANT, | ||
| 47 | }; | ||
| 48 | |||
| 42 | struct mlx5e_rq_param { | 49 | struct mlx5e_rq_param { |
| 43 | u32 rqc[MLX5_ST_SZ_DW(rqc)]; | 50 | u32 rqc[MLX5_ST_SZ_DW(rqc)]; |
| 44 | struct mlx5_wq_param wq; | 51 | struct mlx5_wq_param wq; |
| @@ -74,10 +81,13 @@ static void mlx5e_update_carrier(struct mlx5e_priv *priv) | |||
| 74 | port_state = mlx5_query_vport_state(mdev, | 81 | port_state = mlx5_query_vport_state(mdev, |
| 75 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT, 0); | 82 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT, 0); |
| 76 | 83 | ||
| 77 | if (port_state == VPORT_STATE_UP) | 84 | if (port_state == VPORT_STATE_UP) { |
| 85 | netdev_info(priv->netdev, "Link up\n"); | ||
| 78 | netif_carrier_on(priv->netdev); | 86 | netif_carrier_on(priv->netdev); |
| 79 | else | 87 | } else { |
| 88 | netdev_info(priv->netdev, "Link down\n"); | ||
| 80 | netif_carrier_off(priv->netdev); | 89 | netif_carrier_off(priv->netdev); |
| 90 | } | ||
| 81 | } | 91 | } |
| 82 | 92 | ||
| 83 | static void mlx5e_update_carrier_work(struct work_struct *work) | 93 | static void mlx5e_update_carrier_work(struct work_struct *work) |
| @@ -91,6 +101,26 @@ static void mlx5e_update_carrier_work(struct work_struct *work) | |||
| 91 | mutex_unlock(&priv->state_lock); | 101 | mutex_unlock(&priv->state_lock); |
| 92 | } | 102 | } |
| 93 | 103 | ||
| 104 | static void mlx5e_tx_timeout_work(struct work_struct *work) | ||
| 105 | { | ||
| 106 | struct mlx5e_priv *priv = container_of(work, struct mlx5e_priv, | ||
| 107 | tx_timeout_work); | ||
| 108 | int err; | ||
| 109 | |||
| 110 | rtnl_lock(); | ||
| 111 | mutex_lock(&priv->state_lock); | ||
| 112 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) | ||
| 113 | goto unlock; | ||
| 114 | mlx5e_close_locked(priv->netdev); | ||
| 115 | err = mlx5e_open_locked(priv->netdev); | ||
| 116 | if (err) | ||
| 117 | netdev_err(priv->netdev, "mlx5e_open_locked failed recovering from a tx_timeout, err(%d).\n", | ||
| 118 | err); | ||
| 119 | unlock: | ||
| 120 | mutex_unlock(&priv->state_lock); | ||
| 121 | rtnl_unlock(); | ||
| 122 | } | ||
| 123 | |||
| 94 | static void mlx5e_update_sw_counters(struct mlx5e_priv *priv) | 124 | static void mlx5e_update_sw_counters(struct mlx5e_priv *priv) |
| 95 | { | 125 | { |
| 96 | struct mlx5e_sw_stats *s = &priv->stats.sw; | 126 | struct mlx5e_sw_stats *s = &priv->stats.sw; |
| @@ -105,11 +135,11 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv) | |||
| 105 | 135 | ||
| 106 | s->rx_packets += rq_stats->packets; | 136 | s->rx_packets += rq_stats->packets; |
| 107 | s->rx_bytes += rq_stats->bytes; | 137 | s->rx_bytes += rq_stats->bytes; |
| 108 | s->lro_packets += rq_stats->lro_packets; | 138 | s->rx_lro_packets += rq_stats->lro_packets; |
| 109 | s->lro_bytes += rq_stats->lro_bytes; | 139 | s->rx_lro_bytes += rq_stats->lro_bytes; |
| 110 | s->rx_csum_none += rq_stats->csum_none; | 140 | s->rx_csum_none += rq_stats->csum_none; |
| 111 | s->rx_csum_sw += rq_stats->csum_sw; | 141 | s->rx_csum_complete += rq_stats->csum_complete; |
| 112 | s->rx_csum_inner += rq_stats->csum_inner; | 142 | s->rx_csum_unnecessary_inner += rq_stats->csum_unnecessary_inner; |
| 113 | s->rx_wqe_err += rq_stats->wqe_err; | 143 | s->rx_wqe_err += rq_stats->wqe_err; |
| 114 | s->rx_mpwqe_filler += rq_stats->mpwqe_filler; | 144 | s->rx_mpwqe_filler += rq_stats->mpwqe_filler; |
| 115 | s->rx_mpwqe_frag += rq_stats->mpwqe_frag; | 145 | s->rx_mpwqe_frag += rq_stats->mpwqe_frag; |
| @@ -122,24 +152,23 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv) | |||
| 122 | 152 | ||
| 123 | s->tx_packets += sq_stats->packets; | 153 | s->tx_packets += sq_stats->packets; |
| 124 | s->tx_bytes += sq_stats->bytes; | 154 | s->tx_bytes += sq_stats->bytes; |
| 125 | s->tso_packets += sq_stats->tso_packets; | 155 | s->tx_tso_packets += sq_stats->tso_packets; |
| 126 | s->tso_bytes += sq_stats->tso_bytes; | 156 | s->tx_tso_bytes += sq_stats->tso_bytes; |
| 127 | s->tso_inner_packets += sq_stats->tso_inner_packets; | 157 | s->tx_tso_inner_packets += sq_stats->tso_inner_packets; |
| 128 | s->tso_inner_bytes += sq_stats->tso_inner_bytes; | 158 | s->tx_tso_inner_bytes += sq_stats->tso_inner_bytes; |
| 129 | s->tx_queue_stopped += sq_stats->stopped; | 159 | s->tx_queue_stopped += sq_stats->stopped; |
| 130 | s->tx_queue_wake += sq_stats->wake; | 160 | s->tx_queue_wake += sq_stats->wake; |
| 131 | s->tx_queue_dropped += sq_stats->dropped; | 161 | s->tx_queue_dropped += sq_stats->dropped; |
| 132 | s->tx_csum_inner += sq_stats->csum_offload_inner; | 162 | s->tx_csum_partial_inner += sq_stats->csum_partial_inner; |
| 133 | tx_offload_none += sq_stats->csum_offload_none; | 163 | tx_offload_none += sq_stats->csum_none; |
| 134 | } | 164 | } |
| 135 | } | 165 | } |
| 136 | 166 | ||
| 137 | /* Update calculated offload counters */ | 167 | /* Update calculated offload counters */ |
| 138 | s->tx_csum_offload = s->tx_packets - tx_offload_none - s->tx_csum_inner; | 168 | s->tx_csum_partial = s->tx_packets - tx_offload_none - s->tx_csum_partial_inner; |
| 139 | s->rx_csum_good = s->rx_packets - s->rx_csum_none - | 169 | s->rx_csum_unnecessary = s->rx_packets - s->rx_csum_none - s->rx_csum_complete; |
| 140 | s->rx_csum_sw; | ||
| 141 | 170 | ||
| 142 | s->link_down_events = MLX5_GET(ppcnt_reg, | 171 | s->link_down_events_phy = MLX5_GET(ppcnt_reg, |
| 143 | priv->stats.pport.phy_counters, | 172 | priv->stats.pport.phy_counters, |
| 144 | counter_set.phys_layer_cntrs.link_down_events); | 173 | counter_set.phys_layer_cntrs.link_down_events); |
| 145 | } | 174 | } |
| @@ -244,7 +273,7 @@ static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv, | |||
| 244 | { | 273 | { |
| 245 | struct mlx5e_priv *priv = vpriv; | 274 | struct mlx5e_priv *priv = vpriv; |
| 246 | 275 | ||
| 247 | if (!test_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLE, &priv->state)) | 276 | if (!test_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLED, &priv->state)) |
| 248 | return; | 277 | return; |
| 249 | 278 | ||
| 250 | switch (event) { | 279 | switch (event) { |
| @@ -260,12 +289,12 @@ static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv, | |||
| 260 | 289 | ||
| 261 | static void mlx5e_enable_async_events(struct mlx5e_priv *priv) | 290 | static void mlx5e_enable_async_events(struct mlx5e_priv *priv) |
| 262 | { | 291 | { |
| 263 | set_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLE, &priv->state); | 292 | set_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLED, &priv->state); |
| 264 | } | 293 | } |
| 265 | 294 | ||
| 266 | static void mlx5e_disable_async_events(struct mlx5e_priv *priv) | 295 | static void mlx5e_disable_async_events(struct mlx5e_priv *priv) |
| 267 | { | 296 | { |
| 268 | clear_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLE, &priv->state); | 297 | clear_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLED, &priv->state); |
| 269 | synchronize_irq(mlx5_get_msix_vec(priv->mdev, MLX5_EQ_VEC_ASYNC)); | 298 | synchronize_irq(mlx5_get_msix_vec(priv->mdev, MLX5_EQ_VEC_ASYNC)); |
| 270 | } | 299 | } |
| 271 | 300 | ||
| @@ -306,6 +335,7 @@ static int mlx5e_create_rq(struct mlx5e_channel *c, | |||
| 306 | } | 335 | } |
| 307 | rq->handle_rx_cqe = mlx5e_handle_rx_cqe_mpwrq; | 336 | rq->handle_rx_cqe = mlx5e_handle_rx_cqe_mpwrq; |
| 308 | rq->alloc_wqe = mlx5e_alloc_rx_mpwqe; | 337 | rq->alloc_wqe = mlx5e_alloc_rx_mpwqe; |
| 338 | rq->dealloc_wqe = mlx5e_dealloc_rx_mpwqe; | ||
| 309 | 339 | ||
| 310 | rq->mpwqe_stride_sz = BIT(priv->params.mpwqe_log_stride_sz); | 340 | rq->mpwqe_stride_sz = BIT(priv->params.mpwqe_log_stride_sz); |
| 311 | rq->mpwqe_num_strides = BIT(priv->params.mpwqe_log_num_strides); | 341 | rq->mpwqe_num_strides = BIT(priv->params.mpwqe_log_num_strides); |
| @@ -321,6 +351,7 @@ static int mlx5e_create_rq(struct mlx5e_channel *c, | |||
| 321 | } | 351 | } |
| 322 | rq->handle_rx_cqe = mlx5e_handle_rx_cqe; | 352 | rq->handle_rx_cqe = mlx5e_handle_rx_cqe; |
| 323 | rq->alloc_wqe = mlx5e_alloc_rx_wqe; | 353 | rq->alloc_wqe = mlx5e_alloc_rx_wqe; |
| 354 | rq->dealloc_wqe = mlx5e_dealloc_rx_wqe; | ||
| 324 | 355 | ||
| 325 | rq->wqe_sz = (priv->params.lro_en) ? | 356 | rq->wqe_sz = (priv->params.lro_en) ? |
| 326 | priv->params.lro_wqe_sz : | 357 | priv->params.lro_wqe_sz : |
| @@ -526,17 +557,25 @@ err_destroy_rq: | |||
| 526 | 557 | ||
| 527 | static void mlx5e_close_rq(struct mlx5e_rq *rq) | 558 | static void mlx5e_close_rq(struct mlx5e_rq *rq) |
| 528 | { | 559 | { |
| 560 | int tout = 0; | ||
| 561 | int err; | ||
| 562 | |||
| 529 | clear_bit(MLX5E_RQ_STATE_POST_WQES_ENABLE, &rq->state); | 563 | clear_bit(MLX5E_RQ_STATE_POST_WQES_ENABLE, &rq->state); |
| 530 | napi_synchronize(&rq->channel->napi); /* prevent mlx5e_post_rx_wqes */ | 564 | napi_synchronize(&rq->channel->napi); /* prevent mlx5e_post_rx_wqes */ |
| 531 | 565 | ||
| 532 | mlx5e_modify_rq_state(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR); | 566 | err = mlx5e_modify_rq_state(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR); |
| 533 | while (!mlx5_wq_ll_is_empty(&rq->wq)) | 567 | while (!mlx5_wq_ll_is_empty(&rq->wq) && !err && |
| 534 | msleep(20); | 568 | tout++ < MLX5_EN_QP_FLUSH_MAX_ITER) |
| 569 | msleep(MLX5_EN_QP_FLUSH_MSLEEP_QUANT); | ||
| 570 | |||
| 571 | if (err || tout == MLX5_EN_QP_FLUSH_MAX_ITER) | ||
| 572 | set_bit(MLX5E_RQ_STATE_FLUSH_TIMEOUT, &rq->state); | ||
| 535 | 573 | ||
| 536 | /* avoid destroying rq before mlx5e_poll_rx_cq() is done with it */ | 574 | /* avoid destroying rq before mlx5e_poll_rx_cq() is done with it */ |
| 537 | napi_synchronize(&rq->channel->napi); | 575 | napi_synchronize(&rq->channel->napi); |
| 538 | 576 | ||
| 539 | mlx5e_disable_rq(rq); | 577 | mlx5e_disable_rq(rq); |
| 578 | mlx5e_free_rx_descs(rq); | ||
| 540 | mlx5e_destroy_rq(rq); | 579 | mlx5e_destroy_rq(rq); |
| 541 | } | 580 | } |
| 542 | 581 | ||
| @@ -580,7 +619,7 @@ static int mlx5e_create_sq(struct mlx5e_channel *c, | |||
| 580 | void *sqc_wq = MLX5_ADDR_OF(sqc, sqc, wq); | 619 | void *sqc_wq = MLX5_ADDR_OF(sqc, sqc, wq); |
| 581 | int err; | 620 | int err; |
| 582 | 621 | ||
| 583 | err = mlx5_alloc_map_uar(mdev, &sq->uar, true); | 622 | err = mlx5_alloc_map_uar(mdev, &sq->uar, !!MLX5_CAP_GEN(mdev, bf)); |
| 584 | if (err) | 623 | if (err) |
| 585 | return err; | 624 | return err; |
| 586 | 625 | ||
| @@ -783,6 +822,9 @@ static inline void netif_tx_disable_queue(struct netdev_queue *txq) | |||
| 783 | 822 | ||
| 784 | static void mlx5e_close_sq(struct mlx5e_sq *sq) | 823 | static void mlx5e_close_sq(struct mlx5e_sq *sq) |
| 785 | { | 824 | { |
| 825 | int tout = 0; | ||
| 826 | int err; | ||
| 827 | |||
| 786 | if (sq->txq) { | 828 | if (sq->txq) { |
| 787 | clear_bit(MLX5E_SQ_STATE_WAKE_TXQ_ENABLE, &sq->state); | 829 | clear_bit(MLX5E_SQ_STATE_WAKE_TXQ_ENABLE, &sq->state); |
| 788 | /* prevent netif_tx_wake_queue */ | 830 | /* prevent netif_tx_wake_queue */ |
| @@ -793,15 +835,24 @@ static void mlx5e_close_sq(struct mlx5e_sq *sq) | |||
| 793 | if (mlx5e_sq_has_room_for(sq, 1)) | 835 | if (mlx5e_sq_has_room_for(sq, 1)) |
| 794 | mlx5e_send_nop(sq, true); | 836 | mlx5e_send_nop(sq, true); |
| 795 | 837 | ||
| 796 | mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR); | 838 | err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, |
| 839 | MLX5_SQC_STATE_ERR); | ||
| 840 | if (err) | ||
| 841 | set_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state); | ||
| 797 | } | 842 | } |
| 798 | 843 | ||
| 799 | while (sq->cc != sq->pc) /* wait till sq is empty */ | 844 | /* wait till sq is empty, unless a TX timeout occurred on this SQ */ |
| 800 | msleep(20); | 845 | while (sq->cc != sq->pc && |
| 846 | !test_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state)) { | ||
| 847 | msleep(MLX5_EN_QP_FLUSH_MSLEEP_QUANT); | ||
| 848 | if (tout++ > MLX5_EN_QP_FLUSH_MAX_ITER) | ||
| 849 | set_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state); | ||
| 850 | } | ||
| 801 | 851 | ||
| 802 | /* avoid destroying sq before mlx5e_poll_tx_cq() is done with it */ | 852 | /* avoid destroying sq before mlx5e_poll_tx_cq() is done with it */ |
| 803 | napi_synchronize(&sq->channel->napi); | 853 | napi_synchronize(&sq->channel->napi); |
| 804 | 854 | ||
| 855 | mlx5e_free_tx_descs(sq); | ||
| 805 | mlx5e_disable_sq(sq); | 856 | mlx5e_disable_sq(sq); |
| 806 | mlx5e_destroy_sq(sq); | 857 | mlx5e_destroy_sq(sq); |
| 807 | } | 858 | } |
| @@ -1297,6 +1348,11 @@ static int mlx5e_open_channels(struct mlx5e_priv *priv) | |||
| 1297 | goto err_close_channels; | 1348 | goto err_close_channels; |
| 1298 | } | 1349 | } |
| 1299 | 1350 | ||
| 1351 | /* FIXME: This is a W/A for tx timeout watch dog false alarm when | ||
| 1352 | * polling for inactive tx queues. | ||
| 1353 | */ | ||
| 1354 | netif_tx_start_all_queues(priv->netdev); | ||
| 1355 | |||
| 1300 | kfree(cparam); | 1356 | kfree(cparam); |
| 1301 | return 0; | 1357 | return 0; |
| 1302 | 1358 | ||
| @@ -1316,6 +1372,12 @@ static void mlx5e_close_channels(struct mlx5e_priv *priv) | |||
| 1316 | { | 1372 | { |
| 1317 | int i; | 1373 | int i; |
| 1318 | 1374 | ||
| 1375 | /* FIXME: This is a W/A only for tx timeout watch dog false alarm when | ||
| 1376 | * polling for inactive tx queues. | ||
| 1377 | */ | ||
| 1378 | netif_tx_stop_all_queues(priv->netdev); | ||
| 1379 | netif_tx_disable(priv->netdev); | ||
| 1380 | |||
| 1319 | for (i = 0; i < priv->params.num_channels; i++) | 1381 | for (i = 0; i < priv->params.num_channels; i++) |
| 1320 | mlx5e_close_channel(priv->channel[i]); | 1382 | mlx5e_close_channel(priv->channel[i]); |
| 1321 | 1383 | ||
| @@ -1659,8 +1721,11 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev) | |||
| 1659 | 1721 | ||
| 1660 | netdev_set_num_tc(netdev, ntc); | 1722 | netdev_set_num_tc(netdev, ntc); |
| 1661 | 1723 | ||
| 1724 | /* Map netdev TCs to offset 0 | ||
| 1725 | * We have our own UP to TXQ mapping for QoS | ||
| 1726 | */ | ||
| 1662 | for (tc = 0; tc < ntc; tc++) | 1727 | for (tc = 0; tc < ntc; tc++) |
| 1663 | netdev_set_tc_queue(netdev, tc, nch, tc * nch); | 1728 | netdev_set_tc_queue(netdev, tc, nch, 0); |
| 1664 | } | 1729 | } |
| 1665 | 1730 | ||
| 1666 | int mlx5e_open_locked(struct net_device *netdev) | 1731 | int mlx5e_open_locked(struct net_device *netdev) |
| @@ -2591,6 +2656,29 @@ static netdev_features_t mlx5e_features_check(struct sk_buff *skb, | |||
| 2591 | return features; | 2656 | return features; |
| 2592 | } | 2657 | } |
| 2593 | 2658 | ||
| 2659 | static void mlx5e_tx_timeout(struct net_device *dev) | ||
| 2660 | { | ||
| 2661 | struct mlx5e_priv *priv = netdev_priv(dev); | ||
| 2662 | bool sched_work = false; | ||
| 2663 | int i; | ||
| 2664 | |||
| 2665 | netdev_err(dev, "TX timeout detected\n"); | ||
| 2666 | |||
| 2667 | for (i = 0; i < priv->params.num_channels * priv->params.num_tc; i++) { | ||
| 2668 | struct mlx5e_sq *sq = priv->txq_to_sq_map[i]; | ||
| 2669 | |||
| 2670 | if (!netif_xmit_stopped(netdev_get_tx_queue(dev, i))) | ||
| 2671 | continue; | ||
| 2672 | sched_work = true; | ||
| 2673 | set_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state); | ||
| 2674 | netdev_err(dev, "TX timeout on queue: %d, SQ: 0x%x, CQ: 0x%x, SQ Cons: 0x%x SQ Prod: 0x%x\n", | ||
| 2675 | i, sq->sqn, sq->cq.mcq.cqn, sq->cc, sq->pc); | ||
| 2676 | } | ||
| 2677 | |||
| 2678 | if (sched_work && test_bit(MLX5E_STATE_OPENED, &priv->state)) | ||
| 2679 | schedule_work(&priv->tx_timeout_work); | ||
| 2680 | } | ||
| 2681 | |||
| 2594 | static const struct net_device_ops mlx5e_netdev_ops_basic = { | 2682 | static const struct net_device_ops mlx5e_netdev_ops_basic = { |
| 2595 | .ndo_open = mlx5e_open, | 2683 | .ndo_open = mlx5e_open, |
| 2596 | .ndo_stop = mlx5e_close, | 2684 | .ndo_stop = mlx5e_close, |
| @@ -2608,6 +2696,7 @@ static const struct net_device_ops mlx5e_netdev_ops_basic = { | |||
| 2608 | #ifdef CONFIG_RFS_ACCEL | 2696 | #ifdef CONFIG_RFS_ACCEL |
| 2609 | .ndo_rx_flow_steer = mlx5e_rx_flow_steer, | 2697 | .ndo_rx_flow_steer = mlx5e_rx_flow_steer, |
| 2610 | #endif | 2698 | #endif |
| 2699 | .ndo_tx_timeout = mlx5e_tx_timeout, | ||
| 2611 | }; | 2700 | }; |
| 2612 | 2701 | ||
| 2613 | static const struct net_device_ops mlx5e_netdev_ops_sriov = { | 2702 | static const struct net_device_ops mlx5e_netdev_ops_sriov = { |
| @@ -2637,6 +2726,7 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = { | |||
| 2637 | .ndo_get_vf_config = mlx5e_get_vf_config, | 2726 | .ndo_get_vf_config = mlx5e_get_vf_config, |
| 2638 | .ndo_set_vf_link_state = mlx5e_set_vf_link_state, | 2727 | .ndo_set_vf_link_state = mlx5e_set_vf_link_state, |
| 2639 | .ndo_get_vf_stats = mlx5e_get_vf_stats, | 2728 | .ndo_get_vf_stats = mlx5e_get_vf_stats, |
| 2729 | .ndo_tx_timeout = mlx5e_tx_timeout, | ||
| 2640 | }; | 2730 | }; |
| 2641 | 2731 | ||
| 2642 | static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev) | 2732 | static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev) |
| @@ -2839,6 +2929,7 @@ static void mlx5e_build_netdev_priv(struct mlx5_core_dev *mdev, | |||
| 2839 | 2929 | ||
| 2840 | INIT_WORK(&priv->update_carrier_work, mlx5e_update_carrier_work); | 2930 | INIT_WORK(&priv->update_carrier_work, mlx5e_update_carrier_work); |
| 2841 | INIT_WORK(&priv->set_rx_mode_work, mlx5e_set_rx_mode_work); | 2931 | INIT_WORK(&priv->set_rx_mode_work, mlx5e_set_rx_mode_work); |
| 2932 | INIT_WORK(&priv->tx_timeout_work, mlx5e_tx_timeout_work); | ||
| 2842 | INIT_DELAYED_WORK(&priv->update_stats_work, mlx5e_update_stats_work); | 2933 | INIT_DELAYED_WORK(&priv->update_stats_work, mlx5e_update_stats_work); |
| 2843 | } | 2934 | } |
| 2844 | 2935 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index bd947704b59c..9f2a16a507e0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | |||
| @@ -212,6 +212,20 @@ err_free_skb: | |||
| 212 | return -ENOMEM; | 212 | return -ENOMEM; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | void mlx5e_dealloc_rx_wqe(struct mlx5e_rq *rq, u16 ix) | ||
| 216 | { | ||
| 217 | struct sk_buff *skb = rq->skb[ix]; | ||
| 218 | |||
| 219 | if (skb) { | ||
| 220 | rq->skb[ix] = NULL; | ||
| 221 | dma_unmap_single(rq->pdev, | ||
| 222 | *((dma_addr_t *)skb->cb), | ||
| 223 | rq->wqe_sz, | ||
| 224 | DMA_FROM_DEVICE); | ||
| 225 | dev_kfree_skb(skb); | ||
| 226 | } | ||
| 227 | } | ||
| 228 | |||
| 215 | static inline int mlx5e_mpwqe_strides_per_page(struct mlx5e_rq *rq) | 229 | static inline int mlx5e_mpwqe_strides_per_page(struct mlx5e_rq *rq) |
| 216 | { | 230 | { |
| 217 | return rq->mpwqe_num_strides >> MLX5_MPWRQ_WQE_PAGE_ORDER; | 231 | return rq->mpwqe_num_strides >> MLX5_MPWRQ_WQE_PAGE_ORDER; |
| @@ -574,6 +588,30 @@ int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe *wqe, u16 ix) | |||
| 574 | return 0; | 588 | return 0; |
| 575 | } | 589 | } |
| 576 | 590 | ||
| 591 | void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix) | ||
| 592 | { | ||
| 593 | struct mlx5e_mpw_info *wi = &rq->wqe_info[ix]; | ||
| 594 | |||
| 595 | wi->free_wqe(rq, wi); | ||
| 596 | } | ||
| 597 | |||
| 598 | void mlx5e_free_rx_descs(struct mlx5e_rq *rq) | ||
| 599 | { | ||
| 600 | struct mlx5_wq_ll *wq = &rq->wq; | ||
| 601 | struct mlx5e_rx_wqe *wqe; | ||
| 602 | __be16 wqe_ix_be; | ||
| 603 | u16 wqe_ix; | ||
| 604 | |||
| 605 | while (!mlx5_wq_ll_is_empty(wq)) { | ||
| 606 | wqe_ix_be = *wq->tail_next; | ||
| 607 | wqe_ix = be16_to_cpu(wqe_ix_be); | ||
| 608 | wqe = mlx5_wq_ll_get_wqe(&rq->wq, wqe_ix); | ||
| 609 | rq->dealloc_wqe(rq, wqe_ix); | ||
| 610 | mlx5_wq_ll_pop(&rq->wq, wqe_ix_be, | ||
| 611 | &wqe->next.next_wqe_index); | ||
| 612 | } | ||
| 613 | } | ||
| 614 | |||
| 577 | #define RQ_CANNOT_POST(rq) \ | 615 | #define RQ_CANNOT_POST(rq) \ |
| 578 | (!test_bit(MLX5E_RQ_STATE_POST_WQES_ENABLE, &rq->state) || \ | 616 | (!test_bit(MLX5E_RQ_STATE_POST_WQES_ENABLE, &rq->state) || \ |
| 579 | test_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state)) | 617 | test_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state)) |
| @@ -689,7 +727,7 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, | |||
| 689 | if (is_first_ethertype_ip(skb)) { | 727 | if (is_first_ethertype_ip(skb)) { |
| 690 | skb->ip_summed = CHECKSUM_COMPLETE; | 728 | skb->ip_summed = CHECKSUM_COMPLETE; |
| 691 | skb->csum = csum_unfold((__force __sum16)cqe->check_sum); | 729 | skb->csum = csum_unfold((__force __sum16)cqe->check_sum); |
| 692 | rq->stats.csum_sw++; | 730 | rq->stats.csum_complete++; |
| 693 | return; | 731 | return; |
| 694 | } | 732 | } |
| 695 | 733 | ||
| @@ -699,7 +737,7 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, | |||
| 699 | if (cqe_is_tunneled(cqe)) { | 737 | if (cqe_is_tunneled(cqe)) { |
| 700 | skb->csum_level = 1; | 738 | skb->csum_level = 1; |
| 701 | skb->encapsulation = 1; | 739 | skb->encapsulation = 1; |
| 702 | rq->stats.csum_inner++; | 740 | rq->stats.csum_unnecessary_inner++; |
| 703 | } | 741 | } |
| 704 | return; | 742 | return; |
| 705 | } | 743 | } |
| @@ -878,6 +916,9 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) | |||
| 878 | struct mlx5e_rq *rq = container_of(cq, struct mlx5e_rq, cq); | 916 | struct mlx5e_rq *rq = container_of(cq, struct mlx5e_rq, cq); |
| 879 | int work_done = 0; | 917 | int work_done = 0; |
| 880 | 918 | ||
| 919 | if (unlikely(test_bit(MLX5E_RQ_STATE_FLUSH_TIMEOUT, &rq->state))) | ||
| 920 | return 0; | ||
| 921 | |||
| 881 | if (cq->decmprs_left) | 922 | if (cq->decmprs_left) |
| 882 | work_done += mlx5e_decompress_cqes_cont(rq, cq, 0, budget); | 923 | work_done += mlx5e_decompress_cqes_cont(rq, cq, 0, budget); |
| 883 | 924 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h index 83bc32b25849..fcd490cc5610 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | |||
| @@ -42,9 +42,11 @@ | |||
| 42 | be64_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset)) | 42 | be64_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset)) |
| 43 | 43 | ||
| 44 | #define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld) | 44 | #define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld) |
| 45 | #define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld) | ||
| 46 | #define MLX5E_DECLARE_TX_STAT(type, fld) "tx%d_"#fld, offsetof(type, fld) | ||
| 45 | 47 | ||
| 46 | struct counter_desc { | 48 | struct counter_desc { |
| 47 | char name[ETH_GSTRING_LEN]; | 49 | char format[ETH_GSTRING_LEN]; |
| 48 | int offset; /* Byte offset */ | 50 | int offset; /* Byte offset */ |
| 49 | }; | 51 | }; |
| 50 | 52 | ||
| @@ -53,18 +55,18 @@ struct mlx5e_sw_stats { | |||
| 53 | u64 rx_bytes; | 55 | u64 rx_bytes; |
| 54 | u64 tx_packets; | 56 | u64 tx_packets; |
| 55 | u64 tx_bytes; | 57 | u64 tx_bytes; |
| 56 | u64 tso_packets; | 58 | u64 tx_tso_packets; |
| 57 | u64 tso_bytes; | 59 | u64 tx_tso_bytes; |
| 58 | u64 tso_inner_packets; | 60 | u64 tx_tso_inner_packets; |
| 59 | u64 tso_inner_bytes; | 61 | u64 tx_tso_inner_bytes; |
| 60 | u64 lro_packets; | 62 | u64 rx_lro_packets; |
| 61 | u64 lro_bytes; | 63 | u64 rx_lro_bytes; |
| 62 | u64 rx_csum_good; | 64 | u64 rx_csum_unnecessary; |
| 63 | u64 rx_csum_none; | 65 | u64 rx_csum_none; |
| 64 | u64 rx_csum_sw; | 66 | u64 rx_csum_complete; |
| 65 | u64 rx_csum_inner; | 67 | u64 rx_csum_unnecessary_inner; |
| 66 | u64 tx_csum_offload; | 68 | u64 tx_csum_partial; |
| 67 | u64 tx_csum_inner; | 69 | u64 tx_csum_partial_inner; |
| 68 | u64 tx_queue_stopped; | 70 | u64 tx_queue_stopped; |
| 69 | u64 tx_queue_wake; | 71 | u64 tx_queue_wake; |
| 70 | u64 tx_queue_dropped; | 72 | u64 tx_queue_dropped; |
| @@ -76,7 +78,7 @@ struct mlx5e_sw_stats { | |||
| 76 | u64 rx_cqe_compress_pkts; | 78 | u64 rx_cqe_compress_pkts; |
| 77 | 79 | ||
| 78 | /* Special handling counters */ | 80 | /* Special handling counters */ |
| 79 | u64 link_down_events; | 81 | u64 link_down_events_phy; |
| 80 | }; | 82 | }; |
| 81 | 83 | ||
| 82 | static const struct counter_desc sw_stats_desc[] = { | 84 | static const struct counter_desc sw_stats_desc[] = { |
| @@ -84,18 +86,18 @@ static const struct counter_desc sw_stats_desc[] = { | |||
| 84 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_bytes) }, | 86 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_bytes) }, |
| 85 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_packets) }, | 87 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_packets) }, |
| 86 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_bytes) }, | 88 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_bytes) }, |
| 87 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tso_packets) }, | 89 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_packets) }, |
| 88 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tso_bytes) }, | 90 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_bytes) }, |
| 89 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tso_inner_packets) }, | 91 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_packets) }, |
| 90 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tso_inner_bytes) }, | 92 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_bytes) }, |
| 91 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, lro_packets) }, | 93 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) }, |
| 92 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, lro_bytes) }, | 94 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_bytes) }, |
| 93 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_good) }, | 95 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) }, |
| 94 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) }, | 96 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) }, |
| 95 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_sw) }, | 97 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) }, |
| 96 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_inner) }, | 98 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) }, |
| 97 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_offload) }, | 99 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial) }, |
| 98 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_inner) }, | 100 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial_inner) }, |
| 99 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) }, | 101 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) }, |
| 100 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) }, | 102 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) }, |
| 101 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) }, | 103 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) }, |
| @@ -105,7 +107,7 @@ static const struct counter_desc sw_stats_desc[] = { | |||
| 105 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) }, | 107 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) }, |
| 106 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) }, | 108 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) }, |
| 107 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) }, | 109 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) }, |
| 108 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, link_down_events) }, | 110 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, link_down_events_phy) }, |
| 109 | }; | 111 | }; |
| 110 | 112 | ||
| 111 | struct mlx5e_qcounter_stats { | 113 | struct mlx5e_qcounter_stats { |
| @@ -125,12 +127,6 @@ struct mlx5e_vport_stats { | |||
| 125 | }; | 127 | }; |
| 126 | 128 | ||
| 127 | static const struct counter_desc vport_stats_desc[] = { | 129 | static const struct counter_desc vport_stats_desc[] = { |
| 128 | { "rx_vport_error_packets", | ||
| 129 | VPORT_COUNTER_OFF(received_errors.packets) }, | ||
| 130 | { "rx_vport_error_bytes", VPORT_COUNTER_OFF(received_errors.octets) }, | ||
| 131 | { "tx_vport_error_packets", | ||
| 132 | VPORT_COUNTER_OFF(transmit_errors.packets) }, | ||
| 133 | { "tx_vport_error_bytes", VPORT_COUNTER_OFF(transmit_errors.octets) }, | ||
| 134 | { "rx_vport_unicast_packets", | 130 | { "rx_vport_unicast_packets", |
| 135 | VPORT_COUNTER_OFF(received_eth_unicast.packets) }, | 131 | VPORT_COUNTER_OFF(received_eth_unicast.packets) }, |
| 136 | { "rx_vport_unicast_bytes", | 132 | { "rx_vport_unicast_bytes", |
| @@ -192,94 +188,68 @@ struct mlx5e_pport_stats { | |||
| 192 | }; | 188 | }; |
| 193 | 189 | ||
| 194 | static const struct counter_desc pport_802_3_stats_desc[] = { | 190 | static const struct counter_desc pport_802_3_stats_desc[] = { |
| 195 | { "frames_tx", PPORT_802_3_OFF(a_frames_transmitted_ok) }, | 191 | { "tx_packets_phy", PPORT_802_3_OFF(a_frames_transmitted_ok) }, |
| 196 | { "frames_rx", PPORT_802_3_OFF(a_frames_received_ok) }, | 192 | { "rx_packets_phy", PPORT_802_3_OFF(a_frames_received_ok) }, |
| 197 | { "check_seq_err", PPORT_802_3_OFF(a_frame_check_sequence_errors) }, | 193 | { "rx_crc_errors_phy", PPORT_802_3_OFF(a_frame_check_sequence_errors) }, |
| 198 | { "alignment_err", PPORT_802_3_OFF(a_alignment_errors) }, | 194 | { "tx_bytes_phy", PPORT_802_3_OFF(a_octets_transmitted_ok) }, |
| 199 | { "octets_tx", PPORT_802_3_OFF(a_octets_transmitted_ok) }, | 195 | { "rx_bytes_phy", PPORT_802_3_OFF(a_octets_received_ok) }, |
| 200 | { "octets_received", PPORT_802_3_OFF(a_octets_received_ok) }, | 196 | { "tx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_xmitted_ok) }, |
| 201 | { "multicast_xmitted", PPORT_802_3_OFF(a_multicast_frames_xmitted_ok) }, | 197 | { "tx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_xmitted_ok) }, |
| 202 | { "broadcast_xmitted", PPORT_802_3_OFF(a_broadcast_frames_xmitted_ok) }, | 198 | { "rx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_received_ok) }, |
| 203 | { "multicast_rx", PPORT_802_3_OFF(a_multicast_frames_received_ok) }, | 199 | { "rx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_received_ok) }, |
| 204 | { "broadcast_rx", PPORT_802_3_OFF(a_broadcast_frames_received_ok) }, | 200 | { "rx_in_range_len_errors_phy", PPORT_802_3_OFF(a_in_range_length_errors) }, |
| 205 | { "in_range_len_errors", PPORT_802_3_OFF(a_in_range_length_errors) }, | 201 | { "rx_out_of_range_len_phy", PPORT_802_3_OFF(a_out_of_range_length_field) }, |
| 206 | { "out_of_range_len", PPORT_802_3_OFF(a_out_of_range_length_field) }, | 202 | { "rx_oversize_pkts_phy", PPORT_802_3_OFF(a_frame_too_long_errors) }, |
| 207 | { "too_long_errors", PPORT_802_3_OFF(a_frame_too_long_errors) }, | 203 | { "rx_symbol_err_phy", PPORT_802_3_OFF(a_symbol_error_during_carrier) }, |
| 208 | { "symbol_err", PPORT_802_3_OFF(a_symbol_error_during_carrier) }, | 204 | { "tx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_transmitted) }, |
| 209 | { "mac_control_tx", PPORT_802_3_OFF(a_mac_control_frames_transmitted) }, | 205 | { "rx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_received) }, |
| 210 | { "mac_control_rx", PPORT_802_3_OFF(a_mac_control_frames_received) }, | 206 | { "rx_unsupported_op_phy", PPORT_802_3_OFF(a_unsupported_opcodes_received) }, |
| 211 | { "unsupported_op_rx", | 207 | { "rx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_received) }, |
| 212 | PPORT_802_3_OFF(a_unsupported_opcodes_received) }, | 208 | { "tx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_transmitted) }, |
| 213 | { "pause_ctrl_rx", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_received) }, | ||
| 214 | { "pause_ctrl_tx", | ||
| 215 | PPORT_802_3_OFF(a_pause_mac_ctrl_frames_transmitted) }, | ||
| 216 | }; | 209 | }; |
| 217 | 210 | ||
| 218 | static const struct counter_desc pport_2863_stats_desc[] = { | 211 | static const struct counter_desc pport_2863_stats_desc[] = { |
| 219 | { "in_octets", PPORT_2863_OFF(if_in_octets) }, | 212 | { "rx_discards_phy", PPORT_2863_OFF(if_in_discards) }, |
| 220 | { "in_ucast_pkts", PPORT_2863_OFF(if_in_ucast_pkts) }, | 213 | { "tx_discards_phy", PPORT_2863_OFF(if_out_discards) }, |
| 221 | { "in_discards", PPORT_2863_OFF(if_in_discards) }, | 214 | { "tx_errors_phy", PPORT_2863_OFF(if_out_errors) }, |
| 222 | { "in_errors", PPORT_2863_OFF(if_in_errors) }, | ||
| 223 | { "in_unknown_protos", PPORT_2863_OFF(if_in_unknown_protos) }, | ||
| 224 | { "out_octets", PPORT_2863_OFF(if_out_octets) }, | ||
| 225 | { "out_ucast_pkts", PPORT_2863_OFF(if_out_ucast_pkts) }, | ||
| 226 | { "out_discards", PPORT_2863_OFF(if_out_discards) }, | ||
| 227 | { "out_errors", PPORT_2863_OFF(if_out_errors) }, | ||
| 228 | { "in_multicast_pkts", PPORT_2863_OFF(if_in_multicast_pkts) }, | ||
| 229 | { "in_broadcast_pkts", PPORT_2863_OFF(if_in_broadcast_pkts) }, | ||
| 230 | { "out_multicast_pkts", PPORT_2863_OFF(if_out_multicast_pkts) }, | ||
| 231 | { "out_broadcast_pkts", PPORT_2863_OFF(if_out_broadcast_pkts) }, | ||
| 232 | }; | 215 | }; |
| 233 | 216 | ||
| 234 | static const struct counter_desc pport_2819_stats_desc[] = { | 217 | static const struct counter_desc pport_2819_stats_desc[] = { |
| 235 | { "drop_events", PPORT_2819_OFF(ether_stats_drop_events) }, | 218 | { "rx_undersize_pkts_phy", PPORT_2819_OFF(ether_stats_undersize_pkts) }, |
| 236 | { "octets", PPORT_2819_OFF(ether_stats_octets) }, | 219 | { "rx_fragments_phy", PPORT_2819_OFF(ether_stats_fragments) }, |
| 237 | { "pkts", PPORT_2819_OFF(ether_stats_pkts) }, | 220 | { "rx_jabbers_phy", PPORT_2819_OFF(ether_stats_jabbers) }, |
| 238 | { "broadcast_pkts", PPORT_2819_OFF(ether_stats_broadcast_pkts) }, | 221 | { "rx_64_bytes_phy", PPORT_2819_OFF(ether_stats_pkts64octets) }, |
| 239 | { "multicast_pkts", PPORT_2819_OFF(ether_stats_multicast_pkts) }, | 222 | { "rx_65_to_127_bytes_phy", PPORT_2819_OFF(ether_stats_pkts65to127octets) }, |
| 240 | { "crc_align_errors", PPORT_2819_OFF(ether_stats_crc_align_errors) }, | 223 | { "rx_128_to_255_bytes_phy", PPORT_2819_OFF(ether_stats_pkts128to255octets) }, |
| 241 | { "undersize_pkts", PPORT_2819_OFF(ether_stats_undersize_pkts) }, | 224 | { "rx_256_to_511_bytes_phy", PPORT_2819_OFF(ether_stats_pkts256to511octets) }, |
| 242 | { "oversize_pkts", PPORT_2819_OFF(ether_stats_oversize_pkts) }, | 225 | { "rx_512_to_1023_bytes_phy", PPORT_2819_OFF(ether_stats_pkts512to1023octets) }, |
| 243 | { "fragments", PPORT_2819_OFF(ether_stats_fragments) }, | 226 | { "rx_1024_to_1518_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1024to1518octets) }, |
| 244 | { "jabbers", PPORT_2819_OFF(ether_stats_jabbers) }, | 227 | { "rx_1519_to_2047_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1519to2047octets) }, |
| 245 | { "collisions", PPORT_2819_OFF(ether_stats_collisions) }, | 228 | { "rx_2048_to_4095_bytes_phy", PPORT_2819_OFF(ether_stats_pkts2048to4095octets) }, |
| 246 | { "p64octets", PPORT_2819_OFF(ether_stats_pkts64octets) }, | 229 | { "rx_4096_to_8191_bytes_phy", PPORT_2819_OFF(ether_stats_pkts4096to8191octets) }, |
| 247 | { "p65to127octets", PPORT_2819_OFF(ether_stats_pkts65to127octets) }, | 230 | { "rx_8192_to_10239_bytes_phy", PPORT_2819_OFF(ether_stats_pkts8192to10239octets) }, |
| 248 | { "p128to255octets", PPORT_2819_OFF(ether_stats_pkts128to255octets) }, | ||
| 249 | { "p256to511octets", PPORT_2819_OFF(ether_stats_pkts256to511octets) }, | ||
| 250 | { "p512to1023octets", PPORT_2819_OFF(ether_stats_pkts512to1023octets) }, | ||
| 251 | { "p1024to1518octets", | ||
| 252 | PPORT_2819_OFF(ether_stats_pkts1024to1518octets) }, | ||
| 253 | { "p1519to2047octets", | ||
| 254 | PPORT_2819_OFF(ether_stats_pkts1519to2047octets) }, | ||
| 255 | { "p2048to4095octets", | ||
| 256 | PPORT_2819_OFF(ether_stats_pkts2048to4095octets) }, | ||
| 257 | { "p4096to8191octets", | ||
| 258 | PPORT_2819_OFF(ether_stats_pkts4096to8191octets) }, | ||
| 259 | { "p8192to10239octets", | ||
| 260 | PPORT_2819_OFF(ether_stats_pkts8192to10239octets) }, | ||
| 261 | }; | 231 | }; |
| 262 | 232 | ||
| 263 | static const struct counter_desc pport_per_prio_traffic_stats_desc[] = { | 233 | static const struct counter_desc pport_per_prio_traffic_stats_desc[] = { |
| 264 | { "rx_octets", PPORT_PER_PRIO_OFF(rx_octets) }, | 234 | { "rx_prio%d_bytes", PPORT_PER_PRIO_OFF(rx_octets) }, |
| 265 | { "rx_frames", PPORT_PER_PRIO_OFF(rx_frames) }, | 235 | { "rx_prio%d_packets", PPORT_PER_PRIO_OFF(rx_frames) }, |
| 266 | { "tx_octets", PPORT_PER_PRIO_OFF(tx_octets) }, | 236 | { "tx_prio%d_bytes", PPORT_PER_PRIO_OFF(tx_octets) }, |
| 267 | { "tx_frames", PPORT_PER_PRIO_OFF(tx_frames) }, | 237 | { "tx_prio%d_packets", PPORT_PER_PRIO_OFF(tx_frames) }, |
| 268 | }; | 238 | }; |
| 269 | 239 | ||
| 270 | static const struct counter_desc pport_per_prio_pfc_stats_desc[] = { | 240 | static const struct counter_desc pport_per_prio_pfc_stats_desc[] = { |
| 271 | { "rx_pause", PPORT_PER_PRIO_OFF(rx_pause) }, | 241 | { "rx_prio%d_pause", PPORT_PER_PRIO_OFF(rx_pause) }, |
| 272 | { "rx_pause_duration", PPORT_PER_PRIO_OFF(rx_pause_duration) }, | 242 | { "rx_prio%d_pause_duration", PPORT_PER_PRIO_OFF(rx_pause_duration) }, |
| 273 | { "tx_pause", PPORT_PER_PRIO_OFF(tx_pause) }, | 243 | { "tx_prio%d_pause", PPORT_PER_PRIO_OFF(tx_pause) }, |
| 274 | { "tx_pause_duration", PPORT_PER_PRIO_OFF(tx_pause_duration) }, | 244 | { "tx_prio%d_pause_duration", PPORT_PER_PRIO_OFF(tx_pause_duration) }, |
| 275 | { "rx_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) }, | 245 | { "rx_prio%d_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) }, |
| 276 | }; | 246 | }; |
| 277 | 247 | ||
| 278 | struct mlx5e_rq_stats { | 248 | struct mlx5e_rq_stats { |
| 279 | u64 packets; | 249 | u64 packets; |
| 280 | u64 bytes; | 250 | u64 bytes; |
| 281 | u64 csum_sw; | 251 | u64 csum_complete; |
| 282 | u64 csum_inner; | 252 | u64 csum_unnecessary_inner; |
| 283 | u64 csum_none; | 253 | u64 csum_none; |
| 284 | u64 lro_packets; | 254 | u64 lro_packets; |
| 285 | u64 lro_bytes; | 255 | u64 lro_bytes; |
| @@ -292,19 +262,19 @@ struct mlx5e_rq_stats { | |||
| 292 | }; | 262 | }; |
| 293 | 263 | ||
| 294 | static const struct counter_desc rq_stats_desc[] = { | 264 | static const struct counter_desc rq_stats_desc[] = { |
| 295 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, packets) }, | 265 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) }, |
| 296 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, bytes) }, | 266 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) }, |
| 297 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, csum_sw) }, | 267 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) }, |
| 298 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, csum_inner) }, | 268 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) }, |
| 299 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, csum_none) }, | 269 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) }, |
| 300 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, lro_packets) }, | 270 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_packets) }, |
| 301 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, lro_bytes) }, | 271 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_bytes) }, |
| 302 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, wqe_err) }, | 272 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) }, |
| 303 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, mpwqe_filler) }, | 273 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler) }, |
| 304 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, mpwqe_frag) }, | 274 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_frag) }, |
| 305 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, buff_alloc_err) }, | 275 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, buff_alloc_err) }, |
| 306 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, cqe_compress_blks) }, | 276 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_blks) }, |
| 307 | { MLX5E_DECLARE_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) }, | 277 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) }, |
| 308 | }; | 278 | }; |
| 309 | 279 | ||
| 310 | struct mlx5e_sq_stats { | 280 | struct mlx5e_sq_stats { |
| @@ -315,28 +285,28 @@ struct mlx5e_sq_stats { | |||
| 315 | u64 tso_bytes; | 285 | u64 tso_bytes; |
| 316 | u64 tso_inner_packets; | 286 | u64 tso_inner_packets; |
| 317 | u64 tso_inner_bytes; | 287 | u64 tso_inner_bytes; |
| 318 | u64 csum_offload_inner; | 288 | u64 csum_partial_inner; |
| 319 | u64 nop; | 289 | u64 nop; |
| 320 | /* less likely accessed in data path */ | 290 | /* less likely accessed in data path */ |
| 321 | u64 csum_offload_none; | 291 | u64 csum_none; |
| 322 | u64 stopped; | 292 | u64 stopped; |
| 323 | u64 wake; | 293 | u64 wake; |
| 324 | u64 dropped; | 294 | u64 dropped; |
| 325 | }; | 295 | }; |
| 326 | 296 | ||
| 327 | static const struct counter_desc sq_stats_desc[] = { | 297 | static const struct counter_desc sq_stats_desc[] = { |
| 328 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, packets) }, | 298 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, packets) }, |
| 329 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, bytes) }, | 299 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, bytes) }, |
| 330 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, tso_packets) }, | 300 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_packets) }, |
| 331 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, tso_bytes) }, | 301 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_bytes) }, |
| 332 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, tso_inner_packets) }, | 302 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_packets) }, |
| 333 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, tso_inner_bytes) }, | 303 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_bytes) }, |
| 334 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, csum_offload_inner) }, | 304 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) }, |
| 335 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, nop) }, | 305 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) }, |
| 336 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, csum_offload_none) }, | 306 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) }, |
| 337 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, stopped) }, | 307 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) }, |
| 338 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, wake) }, | 308 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, wake) }, |
| 339 | { MLX5E_DECLARE_STAT(struct mlx5e_sq_stats, dropped) }, | 309 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, dropped) }, |
| 340 | }; | 310 | }; |
| 341 | 311 | ||
| 342 | #define NUM_SW_COUNTERS ARRAY_SIZE(sw_stats_desc) | 312 | #define NUM_SW_COUNTERS ARRAY_SIZE(sw_stats_desc) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index b000ddc29553..5740b465ef84 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | |||
| @@ -110,8 +110,20 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, | |||
| 110 | { | 110 | { |
| 111 | struct mlx5e_priv *priv = netdev_priv(dev); | 111 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 112 | int channel_ix = fallback(dev, skb); | 112 | int channel_ix = fallback(dev, skb); |
| 113 | int up = (netdev_get_num_tc(dev) && skb_vlan_tag_present(skb)) ? | 113 | int up = 0; |
| 114 | skb->vlan_tci >> VLAN_PRIO_SHIFT : 0; | 114 | |
| 115 | if (!netdev_get_num_tc(dev)) | ||
| 116 | return channel_ix; | ||
| 117 | |||
| 118 | if (skb_vlan_tag_present(skb)) | ||
| 119 | up = skb->vlan_tci >> VLAN_PRIO_SHIFT; | ||
| 120 | |||
| 121 | /* channel_ix can be larger than num_channels since | ||
| 122 | * dev->num_real_tx_queues = num_channels * num_tc | ||
| 123 | */ | ||
| 124 | if (channel_ix >= priv->params.num_channels) | ||
| 125 | channel_ix = reciprocal_scale(channel_ix, | ||
| 126 | priv->params.num_channels); | ||
| 115 | 127 | ||
| 116 | return priv->channeltc_to_txq_map[channel_ix][up]; | 128 | return priv->channeltc_to_txq_map[channel_ix][up]; |
| 117 | } | 129 | } |
| @@ -123,7 +135,7 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq, | |||
| 123 | * headers and occur before the data gather. | 135 | * headers and occur before the data gather. |
| 124 | * Therefore these headers must be copied into the WQE | 136 | * Therefore these headers must be copied into the WQE |
| 125 | */ | 137 | */ |
| 126 | #define MLX5E_MIN_INLINE ETH_HLEN | 138 | #define MLX5E_MIN_INLINE (ETH_HLEN + VLAN_HLEN) |
| 127 | 139 | ||
| 128 | if (bf) { | 140 | if (bf) { |
| 129 | u16 ihs = skb_headlen(skb); | 141 | u16 ihs = skb_headlen(skb); |
| @@ -135,7 +147,7 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq, | |||
| 135 | return skb_headlen(skb); | 147 | return skb_headlen(skb); |
| 136 | } | 148 | } |
| 137 | 149 | ||
| 138 | return MLX5E_MIN_INLINE; | 150 | return max(skb_network_offset(skb), MLX5E_MIN_INLINE); |
| 139 | } | 151 | } |
| 140 | 152 | ||
| 141 | static inline void mlx5e_tx_skb_pull_inline(unsigned char **skb_data, | 153 | static inline void mlx5e_tx_skb_pull_inline(unsigned char **skb_data, |
| @@ -192,12 +204,12 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) | |||
| 192 | if (skb->encapsulation) { | 204 | if (skb->encapsulation) { |
| 193 | eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM | | 205 | eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM | |
| 194 | MLX5_ETH_WQE_L4_INNER_CSUM; | 206 | MLX5_ETH_WQE_L4_INNER_CSUM; |
| 195 | sq->stats.csum_offload_inner++; | 207 | sq->stats.csum_partial_inner++; |
| 196 | } else { | 208 | } else { |
| 197 | eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM; | 209 | eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM; |
| 198 | } | 210 | } |
| 199 | } else | 211 | } else |
| 200 | sq->stats.csum_offload_none++; | 212 | sq->stats.csum_none++; |
| 201 | 213 | ||
| 202 | if (sq->cc != sq->prev_cc) { | 214 | if (sq->cc != sq->prev_cc) { |
| 203 | sq->prev_cc = sq->cc; | 215 | sq->prev_cc = sq->cc; |
| @@ -341,6 +353,35 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 341 | return mlx5e_sq_xmit(sq, skb); | 353 | return mlx5e_sq_xmit(sq, skb); |
| 342 | } | 354 | } |
| 343 | 355 | ||
| 356 | void mlx5e_free_tx_descs(struct mlx5e_sq *sq) | ||
| 357 | { | ||
| 358 | struct mlx5e_tx_wqe_info *wi; | ||
| 359 | struct sk_buff *skb; | ||
| 360 | u16 ci; | ||
| 361 | int i; | ||
| 362 | |||
| 363 | while (sq->cc != sq->pc) { | ||
| 364 | ci = sq->cc & sq->wq.sz_m1; | ||
| 365 | skb = sq->skb[ci]; | ||
| 366 | wi = &sq->wqe_info[ci]; | ||
| 367 | |||
| 368 | if (!skb) { /* nop */ | ||
| 369 | sq->cc++; | ||
| 370 | continue; | ||
| 371 | } | ||
| 372 | |||
| 373 | for (i = 0; i < wi->num_dma; i++) { | ||
| 374 | struct mlx5e_sq_dma *dma = | ||
| 375 | mlx5e_dma_get(sq, sq->dma_fifo_cc++); | ||
| 376 | |||
| 377 | mlx5e_tx_dma_unmap(sq->pdev, dma); | ||
| 378 | } | ||
| 379 | |||
| 380 | dev_kfree_skb_any(skb); | ||
| 381 | sq->cc += wi->num_wqebbs; | ||
| 382 | } | ||
| 383 | } | ||
| 384 | |||
| 344 | bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) | 385 | bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) |
| 345 | { | 386 | { |
| 346 | struct mlx5e_sq *sq; | 387 | struct mlx5e_sq *sq; |
| @@ -352,6 +393,9 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) | |||
| 352 | 393 | ||
| 353 | sq = container_of(cq, struct mlx5e_sq, cq); | 394 | sq = container_of(cq, struct mlx5e_sq, cq); |
| 354 | 395 | ||
| 396 | if (unlikely(test_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state))) | ||
| 397 | return false; | ||
| 398 | |||
| 355 | npkts = 0; | 399 | npkts = 0; |
| 356 | nbytes = 0; | 400 | nbytes = 0; |
| 357 | 401 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index 42d16b9458e4..96a59463ae65 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c | |||
| @@ -108,15 +108,21 @@ static int in_fatal(struct mlx5_core_dev *dev) | |||
| 108 | 108 | ||
| 109 | void mlx5_enter_error_state(struct mlx5_core_dev *dev) | 109 | void mlx5_enter_error_state(struct mlx5_core_dev *dev) |
| 110 | { | 110 | { |
| 111 | mutex_lock(&dev->intf_state_mutex); | ||
| 111 | if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) | 112 | if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) |
| 112 | return; | 113 | goto unlock; |
| 113 | 114 | ||
| 114 | mlx5_core_err(dev, "start\n"); | 115 | mlx5_core_err(dev, "start\n"); |
| 115 | if (pci_channel_offline(dev->pdev) || in_fatal(dev)) | 116 | if (pci_channel_offline(dev->pdev) || in_fatal(dev)) { |
| 116 | dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; | 117 | dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; |
| 118 | trigger_cmd_completions(dev); | ||
| 119 | } | ||
| 117 | 120 | ||
| 118 | mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); | 121 | mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); |
| 119 | mlx5_core_err(dev, "end\n"); | 122 | mlx5_core_err(dev, "end\n"); |
| 123 | |||
| 124 | unlock: | ||
| 125 | mutex_unlock(&dev->intf_state_mutex); | ||
| 120 | } | 126 | } |
| 121 | 127 | ||
| 122 | static void mlx5_handle_bad_state(struct mlx5_core_dev *dev) | 128 | static void mlx5_handle_bad_state(struct mlx5_core_dev *dev) |
| @@ -245,7 +251,6 @@ static void poll_health(unsigned long data) | |||
| 245 | u32 count; | 251 | u32 count; |
| 246 | 252 | ||
| 247 | if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { | 253 | if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { |
| 248 | trigger_cmd_completions(dev); | ||
| 249 | mod_timer(&health->timer, get_next_poll_jiffies()); | 254 | mod_timer(&health->timer, get_next_poll_jiffies()); |
| 250 | return; | 255 | return; |
| 251 | } | 256 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index a19b59348dd6..6695893ddd2d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
| @@ -1422,46 +1422,31 @@ void mlx5_disable_device(struct mlx5_core_dev *dev) | |||
| 1422 | mlx5_pci_err_detected(dev->pdev, 0); | 1422 | mlx5_pci_err_detected(dev->pdev, 0); |
| 1423 | } | 1423 | } |
| 1424 | 1424 | ||
| 1425 | /* wait for the device to show vital signs. For now we check | 1425 | /* wait for the device to show vital signs by waiting |
| 1426 | * that we can read the device ID and that the health buffer | 1426 | * for the health counter to start counting. |
| 1427 | * shows a non zero value which is different than 0xffffffff | ||
| 1428 | */ | 1427 | */ |
| 1429 | static void wait_vital(struct pci_dev *pdev) | 1428 | static int wait_vital(struct pci_dev *pdev) |
| 1430 | { | 1429 | { |
| 1431 | struct mlx5_core_dev *dev = pci_get_drvdata(pdev); | 1430 | struct mlx5_core_dev *dev = pci_get_drvdata(pdev); |
| 1432 | struct mlx5_core_health *health = &dev->priv.health; | 1431 | struct mlx5_core_health *health = &dev->priv.health; |
| 1433 | const int niter = 100; | 1432 | const int niter = 100; |
| 1433 | u32 last_count = 0; | ||
| 1434 | u32 count; | 1434 | u32 count; |
| 1435 | u16 did; | ||
| 1436 | int i; | 1435 | int i; |
| 1437 | 1436 | ||
| 1438 | /* Wait for firmware to be ready after reset */ | ||
| 1439 | msleep(1000); | ||
| 1440 | for (i = 0; i < niter; i++) { | ||
| 1441 | if (pci_read_config_word(pdev, 2, &did)) { | ||
| 1442 | dev_warn(&pdev->dev, "failed reading config word\n"); | ||
| 1443 | break; | ||
| 1444 | } | ||
| 1445 | if (did == pdev->device) { | ||
| 1446 | dev_info(&pdev->dev, "device ID correctly read after %d iterations\n", i); | ||
| 1447 | break; | ||
| 1448 | } | ||
| 1449 | msleep(50); | ||
| 1450 | } | ||
| 1451 | if (i == niter) | ||
| 1452 | dev_warn(&pdev->dev, "%s-%d: could not read device ID\n", __func__, __LINE__); | ||
| 1453 | |||
| 1454 | for (i = 0; i < niter; i++) { | 1437 | for (i = 0; i < niter; i++) { |
| 1455 | count = ioread32be(health->health_counter); | 1438 | count = ioread32be(health->health_counter); |
| 1456 | if (count && count != 0xffffffff) { | 1439 | if (count && count != 0xffffffff) { |
| 1457 | dev_info(&pdev->dev, "Counter value 0x%x after %d iterations\n", count, i); | 1440 | if (last_count && last_count != count) { |
| 1458 | break; | 1441 | dev_info(&pdev->dev, "Counter value 0x%x after %d iterations\n", count, i); |
| 1442 | return 0; | ||
| 1443 | } | ||
| 1444 | last_count = count; | ||
| 1459 | } | 1445 | } |
| 1460 | msleep(50); | 1446 | msleep(50); |
| 1461 | } | 1447 | } |
| 1462 | 1448 | ||
| 1463 | if (i == niter) | 1449 | return -ETIMEDOUT; |
| 1464 | dev_warn(&pdev->dev, "%s-%d: could not read device ID\n", __func__, __LINE__); | ||
| 1465 | } | 1450 | } |
| 1466 | 1451 | ||
| 1467 | static void mlx5_pci_resume(struct pci_dev *pdev) | 1452 | static void mlx5_pci_resume(struct pci_dev *pdev) |
| @@ -1473,7 +1458,11 @@ static void mlx5_pci_resume(struct pci_dev *pdev) | |||
| 1473 | dev_info(&pdev->dev, "%s was called\n", __func__); | 1458 | dev_info(&pdev->dev, "%s was called\n", __func__); |
| 1474 | 1459 | ||
| 1475 | pci_save_state(pdev); | 1460 | pci_save_state(pdev); |
| 1476 | wait_vital(pdev); | 1461 | err = wait_vital(pdev); |
| 1462 | if (err) { | ||
| 1463 | dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__); | ||
| 1464 | return; | ||
| 1465 | } | ||
| 1477 | 1466 | ||
| 1478 | err = mlx5_load_one(dev, priv); | 1467 | err = mlx5_load_one(dev, priv); |
| 1479 | if (err) | 1468 | if (err) |
| @@ -1508,8 +1497,9 @@ static const struct pci_device_id mlx5_core_pci_table[] = { | |||
| 1508 | { PCI_VDEVICE(MELLANOX, 0x1014), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4 VF */ | 1497 | { PCI_VDEVICE(MELLANOX, 0x1014), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4 VF */ |
| 1509 | { PCI_VDEVICE(MELLANOX, 0x1015) }, /* ConnectX-4LX */ | 1498 | { PCI_VDEVICE(MELLANOX, 0x1015) }, /* ConnectX-4LX */ |
| 1510 | { PCI_VDEVICE(MELLANOX, 0x1016), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4LX VF */ | 1499 | { PCI_VDEVICE(MELLANOX, 0x1016), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4LX VF */ |
| 1511 | { PCI_VDEVICE(MELLANOX, 0x1017) }, /* ConnectX-5 */ | 1500 | { PCI_VDEVICE(MELLANOX, 0x1017) }, /* ConnectX-5, PCIe 3.0 */ |
| 1512 | { PCI_VDEVICE(MELLANOX, 0x1018), MLX5_PCI_DEV_IS_VF}, /* ConnectX-5 VF */ | 1501 | { PCI_VDEVICE(MELLANOX, 0x1018), MLX5_PCI_DEV_IS_VF}, /* ConnectX-5 VF */ |
| 1502 | { PCI_VDEVICE(MELLANOX, 0x1019) }, /* ConnectX-5, PCIe 4.0 */ | ||
| 1513 | { 0, } | 1503 | { 0, } |
| 1514 | }; | 1504 | }; |
| 1515 | 1505 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c index 9eeee0545f1c..32dea3524cee 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | |||
| @@ -345,7 +345,6 @@ retry: | |||
| 345 | func_id, npages, err); | 345 | func_id, npages, err); |
| 346 | goto out_4k; | 346 | goto out_4k; |
| 347 | } | 347 | } |
| 348 | dev->priv.fw_pages += npages; | ||
| 349 | 348 | ||
| 350 | err = mlx5_cmd_status_to_err(&out.hdr); | 349 | err = mlx5_cmd_status_to_err(&out.hdr); |
| 351 | if (err) { | 350 | if (err) { |
| @@ -373,6 +372,33 @@ out_free: | |||
| 373 | return err; | 372 | return err; |
| 374 | } | 373 | } |
| 375 | 374 | ||
| 375 | static int reclaim_pages_cmd(struct mlx5_core_dev *dev, | ||
| 376 | struct mlx5_manage_pages_inbox *in, int in_size, | ||
| 377 | struct mlx5_manage_pages_outbox *out, int out_size) | ||
| 378 | { | ||
| 379 | struct fw_page *fwp; | ||
| 380 | struct rb_node *p; | ||
| 381 | u32 npages; | ||
| 382 | u32 i = 0; | ||
| 383 | |||
| 384 | if (dev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) | ||
| 385 | return mlx5_cmd_exec_check_status(dev, (u32 *)in, in_size, | ||
| 386 | (u32 *)out, out_size); | ||
| 387 | |||
| 388 | npages = be32_to_cpu(in->num_entries); | ||
| 389 | |||
| 390 | p = rb_first(&dev->priv.page_root); | ||
| 391 | while (p && i < npages) { | ||
| 392 | fwp = rb_entry(p, struct fw_page, rb_node); | ||
| 393 | out->pas[i] = cpu_to_be64(fwp->addr); | ||
| 394 | p = rb_next(p); | ||
| 395 | i++; | ||
| 396 | } | ||
| 397 | |||
| 398 | out->num_entries = cpu_to_be32(i); | ||
| 399 | return 0; | ||
| 400 | } | ||
| 401 | |||
| 376 | static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, | 402 | static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, |
| 377 | int *nclaimed) | 403 | int *nclaimed) |
| 378 | { | 404 | { |
| @@ -398,15 +424,9 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, | |||
| 398 | in.func_id = cpu_to_be16(func_id); | 424 | in.func_id = cpu_to_be16(func_id); |
| 399 | in.num_entries = cpu_to_be32(npages); | 425 | in.num_entries = cpu_to_be32(npages); |
| 400 | mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); | 426 | mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); |
| 401 | err = mlx5_cmd_exec(dev, &in, sizeof(in), out, outlen); | 427 | err = reclaim_pages_cmd(dev, &in, sizeof(in), out, outlen); |
| 402 | if (err) { | 428 | if (err) { |
| 403 | mlx5_core_err(dev, "failed reclaiming pages\n"); | 429 | mlx5_core_err(dev, "failed reclaiming pages: err %d\n", err); |
| 404 | goto out_free; | ||
| 405 | } | ||
| 406 | dev->priv.fw_pages -= npages; | ||
| 407 | |||
| 408 | if (out->hdr.status) { | ||
| 409 | err = mlx5_cmd_status_to_err(&out->hdr); | ||
| 410 | goto out_free; | 430 | goto out_free; |
| 411 | } | 431 | } |
| 412 | 432 | ||
| @@ -417,13 +437,15 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, | |||
| 417 | err = -EINVAL; | 437 | err = -EINVAL; |
| 418 | goto out_free; | 438 | goto out_free; |
| 419 | } | 439 | } |
| 420 | if (nclaimed) | ||
| 421 | *nclaimed = num_claimed; | ||
| 422 | 440 | ||
| 423 | for (i = 0; i < num_claimed; i++) { | 441 | for (i = 0; i < num_claimed; i++) { |
| 424 | addr = be64_to_cpu(out->pas[i]); | 442 | addr = be64_to_cpu(out->pas[i]); |
| 425 | free_4k(dev, addr); | 443 | free_4k(dev, addr); |
| 426 | } | 444 | } |
| 445 | |||
| 446 | if (nclaimed) | ||
| 447 | *nclaimed = num_claimed; | ||
| 448 | |||
| 427 | dev->priv.fw_pages -= num_claimed; | 449 | dev->priv.fw_pages -= num_claimed; |
| 428 | if (func_id) | 450 | if (func_id) |
| 429 | dev->priv.vfs_pages -= num_claimed; | 451 | dev->priv.vfs_pages -= num_claimed; |
| @@ -514,14 +536,10 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev) | |||
| 514 | p = rb_first(&dev->priv.page_root); | 536 | p = rb_first(&dev->priv.page_root); |
| 515 | if (p) { | 537 | if (p) { |
| 516 | fwp = rb_entry(p, struct fw_page, rb_node); | 538 | fwp = rb_entry(p, struct fw_page, rb_node); |
| 517 | if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { | 539 | err = reclaim_pages(dev, fwp->func_id, |
| 518 | free_4k(dev, fwp->addr); | 540 | optimal_reclaimed_pages(), |
| 519 | nclaimed = 1; | 541 | &nclaimed); |
| 520 | } else { | 542 | |
| 521 | err = reclaim_pages(dev, fwp->func_id, | ||
| 522 | optimal_reclaimed_pages(), | ||
| 523 | &nclaimed); | ||
| 524 | } | ||
| 525 | if (err) { | 543 | if (err) { |
| 526 | mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", | 544 | mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", |
| 527 | err); | 545 | err); |
| @@ -536,6 +554,13 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev) | |||
| 536 | } | 554 | } |
| 537 | } while (p); | 555 | } while (p); |
| 538 | 556 | ||
| 557 | WARN(dev->priv.fw_pages, | ||
| 558 | "FW pages counter is %d after reclaiming all pages\n", | ||
| 559 | dev->priv.fw_pages); | ||
| 560 | WARN(dev->priv.vfs_pages, | ||
| 561 | "VFs FW pages counter is %d after reclaiming all pages\n", | ||
| 562 | dev->priv.vfs_pages); | ||
| 563 | |||
| 539 | return 0; | 564 | return 0; |
| 540 | } | 565 | } |
| 541 | 566 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c index daf44cd4c566..91846dfcbe9c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c | |||
| @@ -513,7 +513,6 @@ int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, | |||
| 513 | { | 513 | { |
| 514 | int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in); | 514 | int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in); |
| 515 | void *nic_vport_context; | 515 | void *nic_vport_context; |
| 516 | u8 *guid; | ||
| 517 | void *in; | 516 | void *in; |
| 518 | int err; | 517 | int err; |
| 519 | 518 | ||
| @@ -535,8 +534,6 @@ int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, | |||
| 535 | 534 | ||
| 536 | nic_vport_context = MLX5_ADDR_OF(modify_nic_vport_context_in, | 535 | nic_vport_context = MLX5_ADDR_OF(modify_nic_vport_context_in, |
| 537 | in, nic_vport_context); | 536 | in, nic_vport_context); |
| 538 | guid = MLX5_ADDR_OF(nic_vport_context, nic_vport_context, | ||
| 539 | node_guid); | ||
| 540 | MLX5_SET64(nic_vport_context, nic_vport_context, node_guid, node_guid); | 537 | MLX5_SET64(nic_vport_context, nic_vport_context, node_guid, node_guid); |
| 541 | 538 | ||
| 542 | err = mlx5_modify_nic_vport_context(mdev, in, inlen); | 539 | err = mlx5_modify_nic_vport_context(mdev, in, inlen); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c index f2fd1ef16da7..e25a73ed2981 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c | |||
| @@ -72,8 +72,8 @@ static int mlx5e_vxlan_core_del_port_cmd(struct mlx5_core_dev *mdev, u16 port) | |||
| 72 | u32 in[MLX5_ST_SZ_DW(delete_vxlan_udp_dport_in)]; | 72 | u32 in[MLX5_ST_SZ_DW(delete_vxlan_udp_dport_in)]; |
| 73 | u32 out[MLX5_ST_SZ_DW(delete_vxlan_udp_dport_out)]; | 73 | u32 out[MLX5_ST_SZ_DW(delete_vxlan_udp_dport_out)]; |
| 74 | 74 | ||
| 75 | memset(&in, 0, sizeof(in)); | 75 | memset(in, 0, sizeof(in)); |
| 76 | memset(&out, 0, sizeof(out)); | 76 | memset(out, 0, sizeof(out)); |
| 77 | 77 | ||
| 78 | MLX5_SET(delete_vxlan_udp_dport_in, in, opcode, | 78 | MLX5_SET(delete_vxlan_udp_dport_in, in, opcode, |
| 79 | MLX5_CMD_OP_DELETE_VXLAN_UDP_DPORT); | 79 | MLX5_CMD_OP_DELETE_VXLAN_UDP_DPORT); |
| @@ -105,6 +105,9 @@ static void mlx5e_vxlan_add_port(struct work_struct *work) | |||
| 105 | struct mlx5e_vxlan *vxlan; | 105 | struct mlx5e_vxlan *vxlan; |
| 106 | int err; | 106 | int err; |
| 107 | 107 | ||
| 108 | if (mlx5e_vxlan_lookup_port(priv, port)) | ||
| 109 | goto free_work; | ||
| 110 | |||
| 108 | if (mlx5e_vxlan_core_add_port_cmd(priv->mdev, port)) | 111 | if (mlx5e_vxlan_core_add_port_cmd(priv->mdev, port)) |
| 109 | goto free_work; | 112 | goto free_work; |
| 110 | 113 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/wq.c b/drivers/net/ethernet/mellanox/mlx5/core/wq.c index ce21ee5b2357..821a087c7ae2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/wq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/wq.c | |||
| @@ -75,14 +75,14 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, | |||
| 75 | 75 | ||
| 76 | err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); | 76 | err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); |
| 77 | if (err) { | 77 | if (err) { |
| 78 | mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); | 78 | mlx5_core_warn(mdev, "mlx5_db_alloc_node() failed, %d\n", err); |
| 79 | return err; | 79 | return err; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | err = mlx5_buf_alloc_node(mdev, mlx5_wq_cyc_get_byte_size(wq), | 82 | err = mlx5_buf_alloc_node(mdev, mlx5_wq_cyc_get_byte_size(wq), |
| 83 | &wq_ctrl->buf, param->buf_numa_node); | 83 | &wq_ctrl->buf, param->buf_numa_node); |
| 84 | if (err) { | 84 | if (err) { |
| 85 | mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); | 85 | mlx5_core_warn(mdev, "mlx5_buf_alloc_node() failed, %d\n", err); |
| 86 | goto err_db_free; | 86 | goto err_db_free; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| @@ -111,14 +111,14 @@ int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, | |||
| 111 | 111 | ||
| 112 | err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); | 112 | err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); |
| 113 | if (err) { | 113 | if (err) { |
| 114 | mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); | 114 | mlx5_core_warn(mdev, "mlx5_db_alloc_node() failed, %d\n", err); |
| 115 | return err; | 115 | return err; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | err = mlx5_buf_alloc_node(mdev, mlx5_cqwq_get_byte_size(wq), | 118 | err = mlx5_buf_alloc_node(mdev, mlx5_cqwq_get_byte_size(wq), |
| 119 | &wq_ctrl->buf, param->buf_numa_node); | 119 | &wq_ctrl->buf, param->buf_numa_node); |
| 120 | if (err) { | 120 | if (err) { |
| 121 | mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); | 121 | mlx5_core_warn(mdev, "mlx5_buf_alloc_node() failed, %d\n", err); |
| 122 | goto err_db_free; | 122 | goto err_db_free; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| @@ -148,13 +148,14 @@ int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, | |||
| 148 | 148 | ||
| 149 | err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); | 149 | err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); |
| 150 | if (err) { | 150 | if (err) { |
| 151 | mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); | 151 | mlx5_core_warn(mdev, "mlx5_db_alloc_node() failed, %d\n", err); |
| 152 | return err; | 152 | return err; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | err = mlx5_buf_alloc(mdev, mlx5_wq_ll_get_byte_size(wq), &wq_ctrl->buf); | 155 | err = mlx5_buf_alloc_node(mdev, mlx5_wq_ll_get_byte_size(wq), |
| 156 | &wq_ctrl->buf, param->buf_numa_node); | ||
| 156 | if (err) { | 157 | if (err) { |
| 157 | mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); | 158 | mlx5_core_warn(mdev, "mlx5_buf_alloc_node() failed, %d\n", err); |
| 158 | goto err_db_free; | 159 | goto err_db_free; |
| 159 | } | 160 | } |
| 160 | 161 | ||
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index 1977e7a5c530..57d48da709fb 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h | |||
| @@ -2718,7 +2718,7 @@ static inline void mlxsw_reg_ppcnt_pack(char *payload, u8 local_port, | |||
| 2718 | * Configures the switch priority to buffer table. | 2718 | * Configures the switch priority to buffer table. |
| 2719 | */ | 2719 | */ |
| 2720 | #define MLXSW_REG_PPTB_ID 0x500B | 2720 | #define MLXSW_REG_PPTB_ID 0x500B |
| 2721 | #define MLXSW_REG_PPTB_LEN 0x0C | 2721 | #define MLXSW_REG_PPTB_LEN 0x10 |
| 2722 | 2722 | ||
| 2723 | static const struct mlxsw_reg_info mlxsw_reg_pptb = { | 2723 | static const struct mlxsw_reg_info mlxsw_reg_pptb = { |
| 2724 | .id = MLXSW_REG_PPTB_ID, | 2724 | .id = MLXSW_REG_PPTB_ID, |
| @@ -2784,6 +2784,13 @@ MLXSW_ITEM32(reg, pptb, pm_msb, 0x08, 24, 8); | |||
| 2784 | */ | 2784 | */ |
| 2785 | MLXSW_ITEM32(reg, pptb, untagged_buff, 0x08, 0, 4); | 2785 | MLXSW_ITEM32(reg, pptb, untagged_buff, 0x08, 0, 4); |
| 2786 | 2786 | ||
| 2787 | /* reg_pptb_prio_to_buff_msb | ||
| 2788 | * Mapping of switch priority <i+8> to one of the allocated receive port | ||
| 2789 | * buffers. | ||
| 2790 | * Access: RW | ||
| 2791 | */ | ||
| 2792 | MLXSW_ITEM_BIT_ARRAY(reg, pptb, prio_to_buff_msb, 0x0C, 0x04, 4); | ||
| 2793 | |||
| 2787 | #define MLXSW_REG_PPTB_ALL_PRIO 0xFF | 2794 | #define MLXSW_REG_PPTB_ALL_PRIO 0xFF |
| 2788 | 2795 | ||
| 2789 | static inline void mlxsw_reg_pptb_pack(char *payload, u8 local_port) | 2796 | static inline void mlxsw_reg_pptb_pack(char *payload, u8 local_port) |
| @@ -2792,6 +2799,14 @@ static inline void mlxsw_reg_pptb_pack(char *payload, u8 local_port) | |||
| 2792 | mlxsw_reg_pptb_mm_set(payload, MLXSW_REG_PPTB_MM_UM); | 2799 | mlxsw_reg_pptb_mm_set(payload, MLXSW_REG_PPTB_MM_UM); |
| 2793 | mlxsw_reg_pptb_local_port_set(payload, local_port); | 2800 | mlxsw_reg_pptb_local_port_set(payload, local_port); |
| 2794 | mlxsw_reg_pptb_pm_set(payload, MLXSW_REG_PPTB_ALL_PRIO); | 2801 | mlxsw_reg_pptb_pm_set(payload, MLXSW_REG_PPTB_ALL_PRIO); |
| 2802 | mlxsw_reg_pptb_pm_msb_set(payload, MLXSW_REG_PPTB_ALL_PRIO); | ||
| 2803 | } | ||
| 2804 | |||
| 2805 | static inline void mlxsw_reg_pptb_prio_to_buff_pack(char *payload, u8 prio, | ||
| 2806 | u8 buff) | ||
| 2807 | { | ||
| 2808 | mlxsw_reg_pptb_prio_to_buff_set(payload, prio, buff); | ||
| 2809 | mlxsw_reg_pptb_prio_to_buff_msb_set(payload, prio, buff); | ||
| 2795 | } | 2810 | } |
| 2796 | 2811 | ||
| 2797 | /* PBMC - Port Buffer Management Control Register | 2812 | /* PBMC - Port Buffer Management Control Register |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 6f9e3ddff4a8..374080027b2f 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |||
| @@ -171,23 +171,6 @@ static int mlxsw_sp_port_admin_status_set(struct mlxsw_sp_port *mlxsw_sp_port, | |||
| 171 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(paos), paos_pl); | 171 | return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(paos), paos_pl); |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | static int mlxsw_sp_port_oper_status_get(struct mlxsw_sp_port *mlxsw_sp_port, | ||
| 175 | bool *p_is_up) | ||
| 176 | { | ||
| 177 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | ||
| 178 | char paos_pl[MLXSW_REG_PAOS_LEN]; | ||
| 179 | u8 oper_status; | ||
| 180 | int err; | ||
| 181 | |||
| 182 | mlxsw_reg_paos_pack(paos_pl, mlxsw_sp_port->local_port, 0); | ||
| 183 | err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(paos), paos_pl); | ||
| 184 | if (err) | ||
| 185 | return err; | ||
| 186 | oper_status = mlxsw_reg_paos_oper_status_get(paos_pl); | ||
| 187 | *p_is_up = oper_status == MLXSW_PORT_ADMIN_STATUS_UP ? true : false; | ||
| 188 | return 0; | ||
| 189 | } | ||
| 190 | |||
| 191 | static int mlxsw_sp_port_dev_addr_set(struct mlxsw_sp_port *mlxsw_sp_port, | 174 | static int mlxsw_sp_port_dev_addr_set(struct mlxsw_sp_port *mlxsw_sp_port, |
| 192 | unsigned char *addr) | 175 | unsigned char *addr) |
| 193 | { | 176 | { |
| @@ -408,7 +391,11 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb, | |||
| 408 | } | 391 | } |
| 409 | 392 | ||
| 410 | mlxsw_sp_txhdr_construct(skb, &tx_info); | 393 | mlxsw_sp_txhdr_construct(skb, &tx_info); |
| 411 | len = skb->len; | 394 | /* TX header is consumed by HW on the way so we shouldn't count its |
| 395 | * bytes as being sent. | ||
| 396 | */ | ||
| 397 | len = skb->len - MLXSW_TXHDR_LEN; | ||
| 398 | |||
| 412 | /* Due to a race we might fail here because of a full queue. In that | 399 | /* Due to a race we might fail here because of a full queue. In that |
| 413 | * unlikely case we simply drop the packet. | 400 | * unlikely case we simply drop the packet. |
| 414 | */ | 401 | */ |
| @@ -1430,7 +1417,8 @@ static int mlxsw_sp_port_get_settings(struct net_device *dev, | |||
| 1430 | 1417 | ||
| 1431 | cmd->supported = mlxsw_sp_from_ptys_supported_port(eth_proto_cap) | | 1418 | cmd->supported = mlxsw_sp_from_ptys_supported_port(eth_proto_cap) | |
| 1432 | mlxsw_sp_from_ptys_supported_link(eth_proto_cap) | | 1419 | mlxsw_sp_from_ptys_supported_link(eth_proto_cap) | |
| 1433 | SUPPORTED_Pause | SUPPORTED_Asym_Pause; | 1420 | SUPPORTED_Pause | SUPPORTED_Asym_Pause | |
| 1421 | SUPPORTED_Autoneg; | ||
| 1434 | cmd->advertising = mlxsw_sp_from_ptys_advert_link(eth_proto_admin); | 1422 | cmd->advertising = mlxsw_sp_from_ptys_advert_link(eth_proto_admin); |
| 1435 | mlxsw_sp_from_ptys_speed_duplex(netif_carrier_ok(dev), | 1423 | mlxsw_sp_from_ptys_speed_duplex(netif_carrier_ok(dev), |
| 1436 | eth_proto_oper, cmd); | 1424 | eth_proto_oper, cmd); |
| @@ -1489,7 +1477,6 @@ static int mlxsw_sp_port_set_settings(struct net_device *dev, | |||
| 1489 | u32 eth_proto_new; | 1477 | u32 eth_proto_new; |
| 1490 | u32 eth_proto_cap; | 1478 | u32 eth_proto_cap; |
| 1491 | u32 eth_proto_admin; | 1479 | u32 eth_proto_admin; |
| 1492 | bool is_up; | ||
| 1493 | int err; | 1480 | int err; |
| 1494 | 1481 | ||
| 1495 | speed = ethtool_cmd_speed(cmd); | 1482 | speed = ethtool_cmd_speed(cmd); |
| @@ -1521,12 +1508,7 @@ static int mlxsw_sp_port_set_settings(struct net_device *dev, | |||
| 1521 | return err; | 1508 | return err; |
| 1522 | } | 1509 | } |
| 1523 | 1510 | ||
| 1524 | err = mlxsw_sp_port_oper_status_get(mlxsw_sp_port, &is_up); | 1511 | if (!netif_running(dev)) |
| 1525 | if (err) { | ||
| 1526 | netdev_err(dev, "Failed to get oper status"); | ||
| 1527 | return err; | ||
| 1528 | } | ||
| 1529 | if (!is_up) | ||
| 1530 | return 0; | 1512 | return 0; |
| 1531 | 1513 | ||
| 1532 | err = mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); | 1514 | err = mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c index a3720a0fad7d..074cdda7b6f3 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c | |||
| @@ -194,7 +194,7 @@ static int mlxsw_sp_port_pb_prio_init(struct mlxsw_sp_port *mlxsw_sp_port) | |||
| 194 | 194 | ||
| 195 | mlxsw_reg_pptb_pack(pptb_pl, mlxsw_sp_port->local_port); | 195 | mlxsw_reg_pptb_pack(pptb_pl, mlxsw_sp_port->local_port); |
| 196 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) | 196 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) |
| 197 | mlxsw_reg_pptb_prio_to_buff_set(pptb_pl, i, 0); | 197 | mlxsw_reg_pptb_prio_to_buff_pack(pptb_pl, i, 0); |
| 198 | return mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pptb), | 198 | return mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pptb), |
| 199 | pptb_pl); | 199 | pptb_pl); |
| 200 | } | 200 | } |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c index 0b323661c0b6..01cfb7512827 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c | |||
| @@ -103,7 +103,8 @@ static int mlxsw_sp_port_pg_prio_map(struct mlxsw_sp_port *mlxsw_sp_port, | |||
| 103 | 103 | ||
| 104 | mlxsw_reg_pptb_pack(pptb_pl, mlxsw_sp_port->local_port); | 104 | mlxsw_reg_pptb_pack(pptb_pl, mlxsw_sp_port->local_port); |
| 105 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) | 105 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) |
| 106 | mlxsw_reg_pptb_prio_to_buff_set(pptb_pl, i, prio_tc[i]); | 106 | mlxsw_reg_pptb_prio_to_buff_pack(pptb_pl, i, prio_tc[i]); |
| 107 | |||
| 107 | return mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pptb), | 108 | return mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(pptb), |
| 108 | pptb_pl); | 109 | pptb_pl); |
| 109 | } | 110 | } |
| @@ -249,6 +250,7 @@ static int mlxsw_sp_dcbnl_ieee_setets(struct net_device *dev, | |||
| 249 | return err; | 250 | return err; |
| 250 | 251 | ||
| 251 | memcpy(mlxsw_sp_port->dcb.ets, ets, sizeof(*ets)); | 252 | memcpy(mlxsw_sp_port->dcb.ets, ets, sizeof(*ets)); |
| 253 | mlxsw_sp_port->dcb.ets->ets_cap = IEEE_8021QAZ_MAX_TCS; | ||
| 252 | 254 | ||
| 253 | return 0; | 255 | return 0; |
| 254 | } | 256 | } |
| @@ -351,7 +353,8 @@ static int mlxsw_sp_dcbnl_ieee_setpfc(struct net_device *dev, | |||
| 351 | struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); | 353 | struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); |
| 352 | int err; | 354 | int err; |
| 353 | 355 | ||
| 354 | if (mlxsw_sp_port->link.tx_pause || mlxsw_sp_port->link.rx_pause) { | 356 | if ((mlxsw_sp_port->link.tx_pause || mlxsw_sp_port->link.rx_pause) && |
| 357 | pfc->pfc_en) { | ||
| 355 | netdev_err(dev, "PAUSE frames already enabled on port\n"); | 358 | netdev_err(dev, "PAUSE frames already enabled on port\n"); |
| 356 | return -EINVAL; | 359 | return -EINVAL; |
| 357 | } | 360 | } |
| @@ -371,6 +374,7 @@ static int mlxsw_sp_dcbnl_ieee_setpfc(struct net_device *dev, | |||
| 371 | } | 374 | } |
| 372 | 375 | ||
| 373 | memcpy(mlxsw_sp_port->dcb.pfc, pfc, sizeof(*pfc)); | 376 | memcpy(mlxsw_sp_port->dcb.pfc, pfc, sizeof(*pfc)); |
| 377 | mlxsw_sp_port->dcb.pfc->pfc_cap = IEEE_8021QAZ_MAX_TCS; | ||
| 374 | 378 | ||
| 375 | return 0; | 379 | return 0; |
| 376 | 380 | ||
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c index 3842eab9449a..25f658b3849a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c +++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c | |||
| @@ -316,7 +316,10 @@ static netdev_tx_t mlxsw_sx_port_xmit(struct sk_buff *skb, | |||
| 316 | } | 316 | } |
| 317 | } | 317 | } |
| 318 | mlxsw_sx_txhdr_construct(skb, &tx_info); | 318 | mlxsw_sx_txhdr_construct(skb, &tx_info); |
| 319 | len = skb->len; | 319 | /* TX header is consumed by HW on the way so we shouldn't count its |
| 320 | * bytes as being sent. | ||
| 321 | */ | ||
| 322 | len = skb->len - MLXSW_TXHDR_LEN; | ||
| 320 | /* Due to a race we might fail here because of a full queue. In that | 323 | /* Due to a race we might fail here because of a full queue. In that |
| 321 | * unlikely case we simply drop the packet. | 324 | * unlikely case we simply drop the packet. |
| 322 | */ | 325 | */ |
diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c index 7066954c39d6..0a26b11ca8f6 100644 --- a/drivers/net/ethernet/microchip/enc28j60.c +++ b/drivers/net/ethernet/microchip/enc28j60.c | |||
| @@ -1151,7 +1151,8 @@ static void enc28j60_irq_work_handler(struct work_struct *work) | |||
| 1151 | enc28j60_phy_read(priv, PHIR); | 1151 | enc28j60_phy_read(priv, PHIR); |
| 1152 | } | 1152 | } |
| 1153 | /* TX complete handler */ | 1153 | /* TX complete handler */ |
| 1154 | if ((intflags & EIR_TXIF) != 0) { | 1154 | if (((intflags & EIR_TXIF) != 0) && |
| 1155 | ((intflags & EIR_TXERIF) == 0)) { | ||
| 1155 | bool err = false; | 1156 | bool err = false; |
| 1156 | loop++; | 1157 | loop++; |
| 1157 | if (netif_msg_intr(priv)) | 1158 | if (netif_msg_intr(priv)) |
| @@ -1203,7 +1204,7 @@ static void enc28j60_irq_work_handler(struct work_struct *work) | |||
| 1203 | enc28j60_tx_clear(ndev, true); | 1204 | enc28j60_tx_clear(ndev, true); |
| 1204 | } else | 1205 | } else |
| 1205 | enc28j60_tx_clear(ndev, true); | 1206 | enc28j60_tx_clear(ndev, true); |
| 1206 | locked_reg_bfclr(priv, EIR, EIR_TXERIF); | 1207 | locked_reg_bfclr(priv, EIR, EIR_TXERIF | EIR_TXIF); |
| 1207 | } | 1208 | } |
| 1208 | /* RX Error handler */ | 1209 | /* RX Error handler */ |
| 1209 | if ((intflags & EIR_RXERIF) != 0) { | 1210 | if ((intflags & EIR_RXERIF) != 0) { |
| @@ -1238,6 +1239,8 @@ static void enc28j60_irq_work_handler(struct work_struct *work) | |||
| 1238 | */ | 1239 | */ |
| 1239 | static void enc28j60_hw_tx(struct enc28j60_net *priv) | 1240 | static void enc28j60_hw_tx(struct enc28j60_net *priv) |
| 1240 | { | 1241 | { |
| 1242 | BUG_ON(!priv->tx_skb); | ||
| 1243 | |||
| 1241 | if (netif_msg_tx_queued(priv)) | 1244 | if (netif_msg_tx_queued(priv)) |
| 1242 | printk(KERN_DEBUG DRV_NAME | 1245 | printk(KERN_DEBUG DRV_NAME |
| 1243 | ": Tx Packet Len:%d\n", priv->tx_skb->len); | 1246 | ": Tx Packet Len:%d\n", priv->tx_skb->len); |
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index fa47c14c743a..ba26bb356b8d 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c | |||
| @@ -2015,7 +2015,7 @@ static void nfp_net_open_stack(struct nfp_net *nn) | |||
| 2015 | 2015 | ||
| 2016 | netif_tx_wake_all_queues(nn->netdev); | 2016 | netif_tx_wake_all_queues(nn->netdev); |
| 2017 | 2017 | ||
| 2018 | enable_irq(nn->irq_entries[NFP_NET_CFG_LSC].vector); | 2018 | enable_irq(nn->irq_entries[NFP_NET_IRQ_LSC_IDX].vector); |
| 2019 | nfp_net_read_link_status(nn); | 2019 | nfp_net_read_link_status(nn); |
| 2020 | } | 2020 | } |
| 2021 | 2021 | ||
| @@ -2044,7 +2044,7 @@ static int nfp_net_netdev_open(struct net_device *netdev) | |||
| 2044 | NFP_NET_IRQ_LSC_IDX, nn->lsc_handler); | 2044 | NFP_NET_IRQ_LSC_IDX, nn->lsc_handler); |
| 2045 | if (err) | 2045 | if (err) |
| 2046 | goto err_free_exn; | 2046 | goto err_free_exn; |
| 2047 | disable_irq(nn->irq_entries[NFP_NET_CFG_LSC].vector); | 2047 | disable_irq(nn->irq_entries[NFP_NET_IRQ_LSC_IDX].vector); |
| 2048 | 2048 | ||
| 2049 | nn->rx_rings = kcalloc(nn->num_rx_rings, sizeof(*nn->rx_rings), | 2049 | nn->rx_rings = kcalloc(nn->num_rx_rings, sizeof(*nn->rx_rings), |
| 2050 | GFP_KERNEL); | 2050 | GFP_KERNEL); |
| @@ -2133,7 +2133,7 @@ static void nfp_net_close_stack(struct nfp_net *nn) | |||
| 2133 | { | 2133 | { |
| 2134 | unsigned int r; | 2134 | unsigned int r; |
| 2135 | 2135 | ||
| 2136 | disable_irq(nn->irq_entries[NFP_NET_CFG_LSC].vector); | 2136 | disable_irq(nn->irq_entries[NFP_NET_IRQ_LSC_IDX].vector); |
| 2137 | netif_carrier_off(nn->netdev); | 2137 | netif_carrier_off(nn->netdev); |
| 2138 | nn->link_up = false; | 2138 | nn->link_up = false; |
| 2139 | 2139 | ||
diff --git a/drivers/net/ethernet/qlogic/qed/qed_hsi.h b/drivers/net/ethernet/qlogic/qed/qed_hsi.h index 9afc15fdbb02..e29ed5a69566 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_hsi.h +++ b/drivers/net/ethernet/qlogic/qed/qed_hsi.h | |||
| @@ -3700,6 +3700,7 @@ struct public_port { | |||
| 3700 | #define MEDIA_DA_TWINAX 0x3 | 3700 | #define MEDIA_DA_TWINAX 0x3 |
| 3701 | #define MEDIA_BASE_T 0x4 | 3701 | #define MEDIA_BASE_T 0x4 |
| 3702 | #define MEDIA_SFP_1G_FIBER 0x5 | 3702 | #define MEDIA_SFP_1G_FIBER 0x5 |
| 3703 | #define MEDIA_MODULE_FIBER 0x6 | ||
| 3703 | #define MEDIA_KR 0xf0 | 3704 | #define MEDIA_KR 0xf0 |
| 3704 | #define MEDIA_NOT_PRESENT 0xff | 3705 | #define MEDIA_NOT_PRESENT 0xff |
| 3705 | 3706 | ||
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c index 8fba87dd48af..aada4c7e095f 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_l2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c | |||
| @@ -72,6 +72,7 @@ int qed_sp_eth_vport_start(struct qed_hwfn *p_hwfn, | |||
| 72 | p_ramrod->mtu = cpu_to_le16(p_params->mtu); | 72 | p_ramrod->mtu = cpu_to_le16(p_params->mtu); |
| 73 | p_ramrod->inner_vlan_removal_en = p_params->remove_inner_vlan; | 73 | p_ramrod->inner_vlan_removal_en = p_params->remove_inner_vlan; |
| 74 | p_ramrod->drop_ttl0_en = p_params->drop_ttl0; | 74 | p_ramrod->drop_ttl0_en = p_params->drop_ttl0; |
| 75 | p_ramrod->untagged = p_params->only_untagged; | ||
| 75 | 76 | ||
| 76 | SET_FIELD(rx_mode, ETH_VPORT_RX_MODE_UCAST_DROP_ALL, 1); | 77 | SET_FIELD(rx_mode, ETH_VPORT_RX_MODE_UCAST_DROP_ALL, 1); |
| 77 | SET_FIELD(rx_mode, ETH_VPORT_RX_MODE_MCAST_DROP_ALL, 1); | 78 | SET_FIELD(rx_mode, ETH_VPORT_RX_MODE_MCAST_DROP_ALL, 1); |
| @@ -247,10 +248,6 @@ qed_sp_update_accept_mode(struct qed_hwfn *p_hwfn, | |||
| 247 | SET_FIELD(state, ETH_VPORT_TX_MODE_UCAST_DROP_ALL, | 248 | SET_FIELD(state, ETH_VPORT_TX_MODE_UCAST_DROP_ALL, |
| 248 | !!(accept_filter & QED_ACCEPT_NONE)); | 249 | !!(accept_filter & QED_ACCEPT_NONE)); |
| 249 | 250 | ||
| 250 | SET_FIELD(state, ETH_VPORT_TX_MODE_UCAST_ACCEPT_ALL, | ||
| 251 | (!!(accept_filter & QED_ACCEPT_UCAST_MATCHED) && | ||
| 252 | !!(accept_filter & QED_ACCEPT_UCAST_UNMATCHED))); | ||
| 253 | |||
| 254 | SET_FIELD(state, ETH_VPORT_TX_MODE_MCAST_DROP_ALL, | 251 | SET_FIELD(state, ETH_VPORT_TX_MODE_MCAST_DROP_ALL, |
| 255 | !!(accept_filter & QED_ACCEPT_NONE)); | 252 | !!(accept_filter & QED_ACCEPT_NONE)); |
| 256 | 253 | ||
| @@ -1748,7 +1745,8 @@ static int qed_start_vport(struct qed_dev *cdev, | |||
| 1748 | start.vport_id, start.mtu); | 1745 | start.vport_id, start.mtu); |
| 1749 | } | 1746 | } |
| 1750 | 1747 | ||
| 1751 | qed_reset_vport_stats(cdev); | 1748 | if (params->clear_stats) |
| 1749 | qed_reset_vport_stats(cdev); | ||
| 1752 | 1750 | ||
| 1753 | return 0; | 1751 | return 0; |
| 1754 | } | 1752 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c index 61cc6869fa65..c7e01b303540 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_main.c +++ b/drivers/net/ethernet/qlogic/qed/qed_main.c | |||
| @@ -1085,6 +1085,7 @@ static int qed_get_port_type(u32 media_type) | |||
| 1085 | case MEDIA_SFPP_10G_FIBER: | 1085 | case MEDIA_SFPP_10G_FIBER: |
| 1086 | case MEDIA_SFP_1G_FIBER: | 1086 | case MEDIA_SFP_1G_FIBER: |
| 1087 | case MEDIA_XFP_FIBER: | 1087 | case MEDIA_XFP_FIBER: |
| 1088 | case MEDIA_MODULE_FIBER: | ||
| 1088 | case MEDIA_KR: | 1089 | case MEDIA_KR: |
| 1089 | port_type = PORT_FIBRE; | 1090 | port_type = PORT_FIBRE; |
| 1090 | break; | 1091 | break; |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c index acac6626a1b2..b122f6013b6c 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_spq.c +++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c | |||
| @@ -213,19 +213,15 @@ static int qed_spq_hw_post(struct qed_hwfn *p_hwfn, | |||
| 213 | SET_FIELD(db.params, CORE_DB_DATA_AGG_VAL_SEL, | 213 | SET_FIELD(db.params, CORE_DB_DATA_AGG_VAL_SEL, |
| 214 | DQ_XCM_CORE_SPQ_PROD_CMD); | 214 | DQ_XCM_CORE_SPQ_PROD_CMD); |
| 215 | db.agg_flags = DQ_XCM_CORE_DQ_CF_CMD; | 215 | db.agg_flags = DQ_XCM_CORE_DQ_CF_CMD; |
| 216 | |||
| 217 | /* validate producer is up to-date */ | ||
| 218 | rmb(); | ||
| 219 | |||
| 220 | db.spq_prod = cpu_to_le16(qed_chain_get_prod_idx(p_chain)); | 216 | db.spq_prod = cpu_to_le16(qed_chain_get_prod_idx(p_chain)); |
| 221 | 217 | ||
| 222 | /* do not reorder */ | 218 | /* make sure the SPQE is updated before the doorbell */ |
| 223 | barrier(); | 219 | wmb(); |
| 224 | 220 | ||
| 225 | DOORBELL(p_hwfn, qed_db_addr(p_spq->cid, DQ_DEMS_LEGACY), *(u32 *)&db); | 221 | DOORBELL(p_hwfn, qed_db_addr(p_spq->cid, DQ_DEMS_LEGACY), *(u32 *)&db); |
| 226 | 222 | ||
| 227 | /* make sure doorbell is rang */ | 223 | /* make sure doorbell is rang */ |
| 228 | mmiowb(); | 224 | wmb(); |
| 229 | 225 | ||
| 230 | DP_VERBOSE(p_hwfn, QED_MSG_SPQ, | 226 | DP_VERBOSE(p_hwfn, QED_MSG_SPQ, |
| 231 | "Doorbelled [0x%08x, CID 0x%08x] with Flags: %02x agg_params: %02x, prod: %04x\n", | 227 | "Doorbelled [0x%08x, CID 0x%08x] with Flags: %02x agg_params: %02x, prod: %04x\n", |
| @@ -614,7 +610,9 @@ qed_spq_add_entry(struct qed_hwfn *p_hwfn, | |||
| 614 | 610 | ||
| 615 | *p_en2 = *p_ent; | 611 | *p_en2 = *p_ent; |
| 616 | 612 | ||
| 617 | kfree(p_ent); | 613 | /* EBLOCK responsible to free the allocated p_ent */ |
| 614 | if (p_ent->comp_mode != QED_SPQ_MODE_EBLOCK) | ||
| 615 | kfree(p_ent); | ||
| 618 | 616 | ||
| 619 | p_ent = p_en2; | 617 | p_ent = p_en2; |
| 620 | } | 618 | } |
| @@ -749,6 +747,15 @@ int qed_spq_post(struct qed_hwfn *p_hwfn, | |||
| 749 | * Thus, after gaining the answer perform the cleanup here. | 747 | * Thus, after gaining the answer perform the cleanup here. |
| 750 | */ | 748 | */ |
| 751 | rc = qed_spq_block(p_hwfn, p_ent, fw_return_code); | 749 | rc = qed_spq_block(p_hwfn, p_ent, fw_return_code); |
| 750 | |||
| 751 | if (p_ent->queue == &p_spq->unlimited_pending) { | ||
| 752 | /* This is an allocated p_ent which does not need to | ||
| 753 | * return to pool. | ||
| 754 | */ | ||
| 755 | kfree(p_ent); | ||
| 756 | return rc; | ||
| 757 | } | ||
| 758 | |||
| 752 | if (rc) | 759 | if (rc) |
| 753 | goto spq_post_fail2; | 760 | goto spq_post_fail2; |
| 754 | 761 | ||
| @@ -844,8 +851,12 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, | |||
| 844 | found->comp_cb.function(p_hwfn, found->comp_cb.cookie, p_data, | 851 | found->comp_cb.function(p_hwfn, found->comp_cb.cookie, p_data, |
| 845 | fw_return_code); | 852 | fw_return_code); |
| 846 | 853 | ||
| 847 | if (found->comp_mode != QED_SPQ_MODE_EBLOCK) | 854 | if ((found->comp_mode != QED_SPQ_MODE_EBLOCK) || |
| 848 | /* EBLOCK is responsible for freeing its own entry */ | 855 | (found->queue == &p_spq->unlimited_pending)) |
| 856 | /* EBLOCK is responsible for returning its own entry into the | ||
| 857 | * free list, unless it originally added the entry into the | ||
| 858 | * unlimited pending list. | ||
| 859 | */ | ||
| 849 | qed_spq_return_entry(p_hwfn, found); | 860 | qed_spq_return_entry(p_hwfn, found); |
| 850 | 861 | ||
| 851 | /* Attempt to post pending requests */ | 862 | /* Attempt to post pending requests */ |
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index 5733d1888223..f8e11f953acb 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c | |||
| @@ -3231,7 +3231,7 @@ static int qede_stop_queues(struct qede_dev *edev) | |||
| 3231 | return rc; | 3231 | return rc; |
| 3232 | } | 3232 | } |
| 3233 | 3233 | ||
| 3234 | static int qede_start_queues(struct qede_dev *edev) | 3234 | static int qede_start_queues(struct qede_dev *edev, bool clear_stats) |
| 3235 | { | 3235 | { |
| 3236 | int rc, tc, i; | 3236 | int rc, tc, i; |
| 3237 | int vlan_removal_en = 1; | 3237 | int vlan_removal_en = 1; |
| @@ -3462,6 +3462,7 @@ out: | |||
| 3462 | 3462 | ||
| 3463 | enum qede_load_mode { | 3463 | enum qede_load_mode { |
| 3464 | QEDE_LOAD_NORMAL, | 3464 | QEDE_LOAD_NORMAL, |
| 3465 | QEDE_LOAD_RELOAD, | ||
| 3465 | }; | 3466 | }; |
| 3466 | 3467 | ||
| 3467 | static int qede_load(struct qede_dev *edev, enum qede_load_mode mode) | 3468 | static int qede_load(struct qede_dev *edev, enum qede_load_mode mode) |
| @@ -3500,7 +3501,7 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode) | |||
| 3500 | goto err3; | 3501 | goto err3; |
| 3501 | DP_INFO(edev, "Setup IRQs succeeded\n"); | 3502 | DP_INFO(edev, "Setup IRQs succeeded\n"); |
| 3502 | 3503 | ||
| 3503 | rc = qede_start_queues(edev); | 3504 | rc = qede_start_queues(edev, mode != QEDE_LOAD_RELOAD); |
| 3504 | if (rc) | 3505 | if (rc) |
| 3505 | goto err4; | 3506 | goto err4; |
| 3506 | DP_INFO(edev, "Start VPORT, RXQ and TXQ succeeded\n"); | 3507 | DP_INFO(edev, "Start VPORT, RXQ and TXQ succeeded\n"); |
| @@ -3555,7 +3556,7 @@ void qede_reload(struct qede_dev *edev, | |||
| 3555 | if (func) | 3556 | if (func) |
| 3556 | func(edev, args); | 3557 | func(edev, args); |
| 3557 | 3558 | ||
| 3558 | qede_load(edev, QEDE_LOAD_NORMAL); | 3559 | qede_load(edev, QEDE_LOAD_RELOAD); |
| 3559 | 3560 | ||
| 3560 | mutex_lock(&edev->qede_lock); | 3561 | mutex_lock(&edev->qede_lock); |
| 3561 | qede_config_rx_mode(edev->ndev); | 3562 | qede_config_rx_mode(edev->ndev); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index 7bd6f25b4625..87c642d3b075 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | |||
| @@ -772,6 +772,8 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 772 | tx_ring->tx_stats.tx_bytes += skb->len; | 772 | tx_ring->tx_stats.tx_bytes += skb->len; |
| 773 | tx_ring->tx_stats.xmit_called++; | 773 | tx_ring->tx_stats.xmit_called++; |
| 774 | 774 | ||
| 775 | /* Ensure writes are complete before HW fetches Tx descriptors */ | ||
| 776 | wmb(); | ||
| 775 | qlcnic_update_cmd_producer(tx_ring); | 777 | qlcnic_update_cmd_producer(tx_ring); |
| 776 | 778 | ||
| 777 | return NETDEV_TX_OK; | 779 | return NETDEV_TX_OK; |
| @@ -2220,7 +2222,7 @@ void qlcnic_83xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring) | |||
| 2220 | if (!opcode) | 2222 | if (!opcode) |
| 2221 | return; | 2223 | return; |
| 2222 | 2224 | ||
| 2223 | ring = QLCNIC_FETCH_RING_ID(qlcnic_83xx_hndl(sts_data[0])); | 2225 | ring = QLCNIC_FETCH_RING_ID(sts_data[0]); |
| 2224 | qlcnic_83xx_process_rcv_diag(adapter, ring, sts_data); | 2226 | qlcnic_83xx_process_rcv_diag(adapter, ring, sts_data); |
| 2225 | desc = &sds_ring->desc_head[consumer]; | 2227 | desc = &sds_ring->desc_head[consumer]; |
| 2226 | desc->status_desc_data[0] = cpu_to_le64(STATUS_OWNER_PHANTOM); | 2228 | desc->status_desc_data[0] = cpu_to_le64(STATUS_OWNER_PHANTOM); |
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c index 133e9e35be9e..4c83739d158f 100644 --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c | |||
| @@ -104,7 +104,8 @@ int efx_farch_test_registers(struct efx_nic *efx, | |||
| 104 | const struct efx_farch_register_test *regs, | 104 | const struct efx_farch_register_test *regs, |
| 105 | size_t n_regs) | 105 | size_t n_regs) |
| 106 | { | 106 | { |
| 107 | unsigned address = 0, i, j; | 107 | unsigned address = 0; |
| 108 | int i, j; | ||
| 108 | efx_oword_t mask, imask, original, reg, buf; | 109 | efx_oword_t mask, imask, original, reg, buf; |
| 109 | 110 | ||
| 110 | for (i = 0; i < n_regs; ++i) { | 111 | for (i = 0; i < n_regs; ++i) { |
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 8af25563f627..b5ab5e120bca 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
| @@ -116,7 +116,6 @@ struct smsc911x_data { | |||
| 116 | 116 | ||
| 117 | struct phy_device *phy_dev; | 117 | struct phy_device *phy_dev; |
| 118 | struct mii_bus *mii_bus; | 118 | struct mii_bus *mii_bus; |
| 119 | int phy_irq[PHY_MAX_ADDR]; | ||
| 120 | unsigned int using_extphy; | 119 | unsigned int using_extphy; |
| 121 | int last_duplex; | 120 | int last_duplex; |
| 122 | int last_carrier; | 121 | int last_carrier; |
| @@ -1073,7 +1072,6 @@ static int smsc911x_mii_init(struct platform_device *pdev, | |||
| 1073 | pdata->mii_bus->priv = pdata; | 1072 | pdata->mii_bus->priv = pdata; |
| 1074 | pdata->mii_bus->read = smsc911x_mii_read; | 1073 | pdata->mii_bus->read = smsc911x_mii_read; |
| 1075 | pdata->mii_bus->write = smsc911x_mii_write; | 1074 | pdata->mii_bus->write = smsc911x_mii_write; |
| 1076 | memcpy(pdata->mii_bus->irq, pdata->phy_irq, sizeof(pdata->mii_bus)); | ||
| 1077 | 1075 | ||
| 1078 | pdata->mii_bus->parent = &pdev->dev; | 1076 | pdata->mii_bus->parent = &pdev->dev; |
| 1079 | 1077 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a473c182c91d..e4071265be76 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -2804,7 +2804,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) | |||
| 2804 | priv->tx_path_in_lpi_mode = true; | 2804 | priv->tx_path_in_lpi_mode = true; |
| 2805 | if (status & CORE_IRQ_TX_PATH_EXIT_LPI_MODE) | 2805 | if (status & CORE_IRQ_TX_PATH_EXIT_LPI_MODE) |
| 2806 | priv->tx_path_in_lpi_mode = false; | 2806 | priv->tx_path_in_lpi_mode = false; |
| 2807 | if (status & CORE_IRQ_MTL_RX_OVERFLOW) | 2807 | if (status & CORE_IRQ_MTL_RX_OVERFLOW && priv->hw->dma->set_rx_tail_ptr) |
| 2808 | priv->hw->dma->set_rx_tail_ptr(priv->ioaddr, | 2808 | priv->hw->dma->set_rx_tail_ptr(priv->ioaddr, |
| 2809 | priv->rx_tail_addr, | 2809 | priv->rx_tail_addr, |
| 2810 | STMMAC_CHAN0); | 2810 | STMMAC_CHAN0); |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index e6bb0ecb12c7..53190894f17a 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
| @@ -2505,8 +2505,6 @@ static int cpsw_probe(struct platform_device *pdev) | |||
| 2505 | clean_ale_ret: | 2505 | clean_ale_ret: |
| 2506 | cpsw_ale_destroy(priv->ale); | 2506 | cpsw_ale_destroy(priv->ale); |
| 2507 | clean_dma_ret: | 2507 | clean_dma_ret: |
| 2508 | cpdma_chan_destroy(priv->txch); | ||
| 2509 | cpdma_chan_destroy(priv->rxch); | ||
| 2510 | cpdma_ctlr_destroy(priv->dma); | 2508 | cpdma_ctlr_destroy(priv->dma); |
| 2511 | clean_runtime_disable_ret: | 2509 | clean_runtime_disable_ret: |
| 2512 | pm_runtime_disable(&pdev->dev); | 2510 | pm_runtime_disable(&pdev->dev); |
| @@ -2534,8 +2532,6 @@ static int cpsw_remove(struct platform_device *pdev) | |||
| 2534 | unregister_netdev(ndev); | 2532 | unregister_netdev(ndev); |
| 2535 | 2533 | ||
| 2536 | cpsw_ale_destroy(priv->ale); | 2534 | cpsw_ale_destroy(priv->ale); |
| 2537 | cpdma_chan_destroy(priv->txch); | ||
| 2538 | cpdma_chan_destroy(priv->rxch); | ||
| 2539 | cpdma_ctlr_destroy(priv->dma); | 2535 | cpdma_ctlr_destroy(priv->dma); |
| 2540 | pm_runtime_disable(&pdev->dev); | 2536 | pm_runtime_disable(&pdev->dev); |
| 2541 | device_for_each_child(&pdev->dev, NULL, cpsw_remove_child_device); | 2537 | device_for_each_child(&pdev->dev, NULL, cpsw_remove_child_device); |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 0a15acc075b3..11213a38c795 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
| @@ -462,7 +462,7 @@ static void tile_tx_timestamp(struct sk_buff *skb, int instance) | |||
| 462 | if (unlikely((shtx->tx_flags & SKBTX_HW_TSTAMP) != 0)) { | 462 | if (unlikely((shtx->tx_flags & SKBTX_HW_TSTAMP) != 0)) { |
| 463 | struct mpipe_data *md = &mpipe_data[instance]; | 463 | struct mpipe_data *md = &mpipe_data[instance]; |
| 464 | struct skb_shared_hwtstamps shhwtstamps; | 464 | struct skb_shared_hwtstamps shhwtstamps; |
| 465 | struct timespec ts; | 465 | struct timespec64 ts; |
| 466 | 466 | ||
| 467 | shtx->tx_flags |= SKBTX_IN_PROGRESS; | 467 | shtx->tx_flags |= SKBTX_IN_PROGRESS; |
| 468 | gxio_mpipe_get_timestamp(&md->context, &ts); | 468 | gxio_mpipe_get_timestamp(&md->context, &ts); |
| @@ -886,9 +886,9 @@ static struct ptp_clock_info ptp_mpipe_caps = { | |||
| 886 | /* Sync mPIPE's timestamp up with Linux system time and register PTP clock. */ | 886 | /* Sync mPIPE's timestamp up with Linux system time and register PTP clock. */ |
| 887 | static void register_ptp_clock(struct net_device *dev, struct mpipe_data *md) | 887 | static void register_ptp_clock(struct net_device *dev, struct mpipe_data *md) |
| 888 | { | 888 | { |
| 889 | struct timespec ts; | 889 | struct timespec64 ts; |
| 890 | 890 | ||
| 891 | getnstimeofday(&ts); | 891 | ktime_get_ts64(&ts); |
| 892 | gxio_mpipe_set_timestamp(&md->context, &ts); | 892 | gxio_mpipe_set_timestamp(&md->context, &ts); |
| 893 | 893 | ||
| 894 | mutex_init(&md->ptp_lock); | 894 | mutex_init(&md->ptp_lock); |
diff --git a/drivers/net/fddi/skfp/Makefile b/drivers/net/fddi/skfp/Makefile index b0be0234abf6..a957a1c7e5ba 100644 --- a/drivers/net/fddi/skfp/Makefile +++ b/drivers/net/fddi/skfp/Makefile | |||
| @@ -17,4 +17,4 @@ skfp-objs := skfddi.o hwmtm.o fplustm.o smt.o cfm.o \ | |||
| 17 | # projects. To keep the source common for all those drivers (and | 17 | # projects. To keep the source common for all those drivers (and |
| 18 | # thus simplify fixes to it), please do not clean it up! | 18 | # thus simplify fixes to it), please do not clean it up! |
| 19 | 19 | ||
| 20 | ccflags-y := -Idrivers/net/skfp -DPCI -DMEM_MAPPED_IO -Wno-strict-prototypes | 20 | ccflags-y := -DPCI -DMEM_MAPPED_IO -Wno-strict-prototypes |
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index cadefe4fdaa2..9b3dc3c61e00 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c | |||
| @@ -958,8 +958,8 @@ tx_error: | |||
| 958 | dev->stats.collisions++; | 958 | dev->stats.collisions++; |
| 959 | else if (err == -ENETUNREACH) | 959 | else if (err == -ENETUNREACH) |
| 960 | dev->stats.tx_carrier_errors++; | 960 | dev->stats.tx_carrier_errors++; |
| 961 | else | 961 | |
| 962 | dev->stats.tx_errors++; | 962 | dev->stats.tx_errors++; |
| 963 | return NETDEV_TX_OK; | 963 | return NETDEV_TX_OK; |
| 964 | } | 964 | } |
| 965 | 965 | ||
| @@ -1048,8 +1048,8 @@ tx_error: | |||
| 1048 | dev->stats.collisions++; | 1048 | dev->stats.collisions++; |
| 1049 | else if (err == -ENETUNREACH) | 1049 | else if (err == -ENETUNREACH) |
| 1050 | dev->stats.tx_carrier_errors++; | 1050 | dev->stats.tx_carrier_errors++; |
| 1051 | else | 1051 | |
| 1052 | dev->stats.tx_errors++; | 1052 | dev->stats.tx_errors++; |
| 1053 | return NETDEV_TX_OK; | 1053 | return NETDEV_TX_OK; |
| 1054 | } | 1054 | } |
| 1055 | #endif | 1055 | #endif |
| @@ -1072,12 +1072,17 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1072 | 1072 | ||
| 1073 | static int __geneve_change_mtu(struct net_device *dev, int new_mtu, bool strict) | 1073 | static int __geneve_change_mtu(struct net_device *dev, int new_mtu, bool strict) |
| 1074 | { | 1074 | { |
| 1075 | struct geneve_dev *geneve = netdev_priv(dev); | ||
| 1075 | /* The max_mtu calculation does not take account of GENEVE | 1076 | /* The max_mtu calculation does not take account of GENEVE |
| 1076 | * options, to avoid excluding potentially valid | 1077 | * options, to avoid excluding potentially valid |
| 1077 | * configurations. | 1078 | * configurations. |
| 1078 | */ | 1079 | */ |
| 1079 | int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - sizeof(struct iphdr) | 1080 | int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - dev->hard_header_len; |
| 1080 | - dev->hard_header_len; | 1081 | |
| 1082 | if (geneve->remote.sa.sa_family == AF_INET6) | ||
| 1083 | max_mtu -= sizeof(struct ipv6hdr); | ||
| 1084 | else | ||
| 1085 | max_mtu -= sizeof(struct iphdr); | ||
| 1081 | 1086 | ||
| 1082 | if (new_mtu < 68) | 1087 | if (new_mtu < 68) |
| 1083 | return -EINVAL; | 1088 | return -EINVAL; |
| @@ -1508,6 +1513,7 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name, | |||
| 1508 | { | 1513 | { |
| 1509 | struct nlattr *tb[IFLA_MAX + 1]; | 1514 | struct nlattr *tb[IFLA_MAX + 1]; |
| 1510 | struct net_device *dev; | 1515 | struct net_device *dev; |
| 1516 | LIST_HEAD(list_kill); | ||
| 1511 | int err; | 1517 | int err; |
| 1512 | 1518 | ||
| 1513 | memset(tb, 0, sizeof(tb)); | 1519 | memset(tb, 0, sizeof(tb)); |
| @@ -1519,8 +1525,10 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name, | |||
| 1519 | err = geneve_configure(net, dev, &geneve_remote_unspec, | 1525 | err = geneve_configure(net, dev, &geneve_remote_unspec, |
| 1520 | 0, 0, 0, 0, htons(dst_port), true, | 1526 | 0, 0, 0, 0, htons(dst_port), true, |
| 1521 | GENEVE_F_UDP_ZERO_CSUM6_RX); | 1527 | GENEVE_F_UDP_ZERO_CSUM6_RX); |
| 1522 | if (err) | 1528 | if (err) { |
| 1523 | goto err; | 1529 | free_netdev(dev); |
| 1530 | return ERR_PTR(err); | ||
| 1531 | } | ||
| 1524 | 1532 | ||
| 1525 | /* openvswitch users expect packet sizes to be unrestricted, | 1533 | /* openvswitch users expect packet sizes to be unrestricted, |
| 1526 | * so set the largest MTU we can. | 1534 | * so set the largest MTU we can. |
| @@ -1529,10 +1537,15 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name, | |||
| 1529 | if (err) | 1537 | if (err) |
| 1530 | goto err; | 1538 | goto err; |
| 1531 | 1539 | ||
| 1540 | err = rtnl_configure_link(dev, NULL); | ||
| 1541 | if (err < 0) | ||
| 1542 | goto err; | ||
| 1543 | |||
| 1532 | return dev; | 1544 | return dev; |
| 1533 | 1545 | ||
| 1534 | err: | 1546 | err: |
| 1535 | free_netdev(dev); | 1547 | geneve_dellink(dev, &list_kill); |
| 1548 | unregister_netdevice_many(&list_kill); | ||
| 1536 | return ERR_PTR(err); | 1549 | return ERR_PTR(err); |
| 1537 | } | 1550 | } |
| 1538 | EXPORT_SYMBOL_GPL(geneve_dev_create_fb); | 1551 | EXPORT_SYMBOL_GPL(geneve_dev_create_fb); |
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 47ee2c840b55..8bcd78f94966 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c | |||
| @@ -605,12 +605,41 @@ static void macsec_encrypt_done(struct crypto_async_request *base, int err) | |||
| 605 | dev_put(dev); | 605 | dev_put(dev); |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | static struct aead_request *macsec_alloc_req(struct crypto_aead *tfm, | ||
| 609 | unsigned char **iv, | ||
| 610 | struct scatterlist **sg) | ||
| 611 | { | ||
| 612 | size_t size, iv_offset, sg_offset; | ||
| 613 | struct aead_request *req; | ||
| 614 | void *tmp; | ||
| 615 | |||
| 616 | size = sizeof(struct aead_request) + crypto_aead_reqsize(tfm); | ||
| 617 | iv_offset = size; | ||
| 618 | size += GCM_AES_IV_LEN; | ||
| 619 | |||
| 620 | size = ALIGN(size, __alignof__(struct scatterlist)); | ||
| 621 | sg_offset = size; | ||
| 622 | size += sizeof(struct scatterlist) * (MAX_SKB_FRAGS + 1); | ||
| 623 | |||
| 624 | tmp = kmalloc(size, GFP_ATOMIC); | ||
| 625 | if (!tmp) | ||
| 626 | return NULL; | ||
| 627 | |||
| 628 | *iv = (unsigned char *)(tmp + iv_offset); | ||
| 629 | *sg = (struct scatterlist *)(tmp + sg_offset); | ||
| 630 | req = tmp; | ||
| 631 | |||
| 632 | aead_request_set_tfm(req, tfm); | ||
| 633 | |||
| 634 | return req; | ||
| 635 | } | ||
| 636 | |||
| 608 | static struct sk_buff *macsec_encrypt(struct sk_buff *skb, | 637 | static struct sk_buff *macsec_encrypt(struct sk_buff *skb, |
| 609 | struct net_device *dev) | 638 | struct net_device *dev) |
| 610 | { | 639 | { |
| 611 | int ret; | 640 | int ret; |
| 612 | struct scatterlist sg[MAX_SKB_FRAGS + 1]; | 641 | struct scatterlist *sg; |
| 613 | unsigned char iv[GCM_AES_IV_LEN]; | 642 | unsigned char *iv; |
| 614 | struct ethhdr *eth; | 643 | struct ethhdr *eth; |
| 615 | struct macsec_eth_header *hh; | 644 | struct macsec_eth_header *hh; |
| 616 | size_t unprotected_len; | 645 | size_t unprotected_len; |
| @@ -668,8 +697,6 @@ static struct sk_buff *macsec_encrypt(struct sk_buff *skb, | |||
| 668 | macsec_fill_sectag(hh, secy, pn); | 697 | macsec_fill_sectag(hh, secy, pn); |
| 669 | macsec_set_shortlen(hh, unprotected_len - 2 * ETH_ALEN); | 698 | macsec_set_shortlen(hh, unprotected_len - 2 * ETH_ALEN); |
| 670 | 699 | ||
| 671 | macsec_fill_iv(iv, secy->sci, pn); | ||
| 672 | |||
| 673 | skb_put(skb, secy->icv_len); | 700 | skb_put(skb, secy->icv_len); |
| 674 | 701 | ||
| 675 | if (skb->len - ETH_HLEN > macsec_priv(dev)->real_dev->mtu) { | 702 | if (skb->len - ETH_HLEN > macsec_priv(dev)->real_dev->mtu) { |
| @@ -684,13 +711,15 @@ static struct sk_buff *macsec_encrypt(struct sk_buff *skb, | |||
| 684 | return ERR_PTR(-EINVAL); | 711 | return ERR_PTR(-EINVAL); |
| 685 | } | 712 | } |
| 686 | 713 | ||
| 687 | req = aead_request_alloc(tx_sa->key.tfm, GFP_ATOMIC); | 714 | req = macsec_alloc_req(tx_sa->key.tfm, &iv, &sg); |
| 688 | if (!req) { | 715 | if (!req) { |
| 689 | macsec_txsa_put(tx_sa); | 716 | macsec_txsa_put(tx_sa); |
| 690 | kfree_skb(skb); | 717 | kfree_skb(skb); |
| 691 | return ERR_PTR(-ENOMEM); | 718 | return ERR_PTR(-ENOMEM); |
| 692 | } | 719 | } |
| 693 | 720 | ||
| 721 | macsec_fill_iv(iv, secy->sci, pn); | ||
| 722 | |||
| 694 | sg_init_table(sg, MAX_SKB_FRAGS + 1); | 723 | sg_init_table(sg, MAX_SKB_FRAGS + 1); |
| 695 | skb_to_sgvec(skb, sg, 0, skb->len); | 724 | skb_to_sgvec(skb, sg, 0, skb->len); |
| 696 | 725 | ||
| @@ -861,7 +890,6 @@ static void macsec_decrypt_done(struct crypto_async_request *base, int err) | |||
| 861 | out: | 890 | out: |
| 862 | macsec_rxsa_put(rx_sa); | 891 | macsec_rxsa_put(rx_sa); |
| 863 | dev_put(dev); | 892 | dev_put(dev); |
| 864 | return; | ||
| 865 | } | 893 | } |
| 866 | 894 | ||
| 867 | static struct sk_buff *macsec_decrypt(struct sk_buff *skb, | 895 | static struct sk_buff *macsec_decrypt(struct sk_buff *skb, |
| @@ -871,8 +899,8 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb, | |||
| 871 | struct macsec_secy *secy) | 899 | struct macsec_secy *secy) |
| 872 | { | 900 | { |
| 873 | int ret; | 901 | int ret; |
| 874 | struct scatterlist sg[MAX_SKB_FRAGS + 1]; | 902 | struct scatterlist *sg; |
| 875 | unsigned char iv[GCM_AES_IV_LEN]; | 903 | unsigned char *iv; |
| 876 | struct aead_request *req; | 904 | struct aead_request *req; |
| 877 | struct macsec_eth_header *hdr; | 905 | struct macsec_eth_header *hdr; |
| 878 | u16 icv_len = secy->icv_len; | 906 | u16 icv_len = secy->icv_len; |
| @@ -882,7 +910,7 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb, | |||
| 882 | if (!skb) | 910 | if (!skb) |
| 883 | return ERR_PTR(-ENOMEM); | 911 | return ERR_PTR(-ENOMEM); |
| 884 | 912 | ||
| 885 | req = aead_request_alloc(rx_sa->key.tfm, GFP_ATOMIC); | 913 | req = macsec_alloc_req(rx_sa->key.tfm, &iv, &sg); |
| 886 | if (!req) { | 914 | if (!req) { |
| 887 | kfree_skb(skb); | 915 | kfree_skb(skb); |
| 888 | return ERR_PTR(-ENOMEM); | 916 | return ERR_PTR(-ENOMEM); |
| @@ -1234,7 +1262,7 @@ static struct crypto_aead *macsec_alloc_tfm(char *key, int key_len, int icv_len) | |||
| 1234 | struct crypto_aead *tfm; | 1262 | struct crypto_aead *tfm; |
| 1235 | int ret; | 1263 | int ret; |
| 1236 | 1264 | ||
| 1237 | tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC); | 1265 | tfm = crypto_alloc_aead("gcm(aes)", 0, 0); |
| 1238 | if (!tfm || IS_ERR(tfm)) | 1266 | if (!tfm || IS_ERR(tfm)) |
| 1239 | return NULL; | 1267 | return NULL; |
| 1240 | 1268 | ||
| @@ -2612,6 +2640,7 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb, | |||
| 2612 | u64_stats_update_begin(&secy_stats->syncp); | 2640 | u64_stats_update_begin(&secy_stats->syncp); |
| 2613 | secy_stats->stats.OutPktsUntagged++; | 2641 | secy_stats->stats.OutPktsUntagged++; |
| 2614 | u64_stats_update_end(&secy_stats->syncp); | 2642 | u64_stats_update_end(&secy_stats->syncp); |
| 2643 | skb->dev = macsec->real_dev; | ||
| 2615 | len = skb->len; | 2644 | len = skb->len; |
| 2616 | ret = dev_queue_xmit(skb); | 2645 | ret = dev_queue_xmit(skb); |
| 2617 | count_tx(dev, ret, len); | 2646 | count_tx(dev, ret, len); |
| @@ -3361,6 +3390,7 @@ static void __exit macsec_exit(void) | |||
| 3361 | genl_unregister_family(&macsec_fam); | 3390 | genl_unregister_family(&macsec_fam); |
| 3362 | rtnl_link_unregister(&macsec_link_ops); | 3391 | rtnl_link_unregister(&macsec_link_ops); |
| 3363 | unregister_netdevice_notifier(&macsec_notifier); | 3392 | unregister_netdevice_notifier(&macsec_notifier); |
| 3393 | rcu_barrier(); | ||
| 3364 | } | 3394 | } |
| 3365 | 3395 | ||
| 3366 | module_init(macsec_init); | 3396 | module_init(macsec_init); |
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index 2afa61b51d41..91177a4a32ad 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | 57 | ||
| 58 | /* PHY CTRL bits */ | 58 | /* PHY CTRL bits */ |
| 59 | #define DP83867_PHYCR_FIFO_DEPTH_SHIFT 14 | 59 | #define DP83867_PHYCR_FIFO_DEPTH_SHIFT 14 |
| 60 | #define DP83867_PHYCR_FIFO_DEPTH_MASK (3 << 14) | ||
| 60 | 61 | ||
| 61 | /* RGMIIDCTL bits */ | 62 | /* RGMIIDCTL bits */ |
| 62 | #define DP83867_RGMII_TX_CLK_DELAY_SHIFT 4 | 63 | #define DP83867_RGMII_TX_CLK_DELAY_SHIFT 4 |
| @@ -133,8 +134,8 @@ static int dp83867_of_init(struct phy_device *phydev) | |||
| 133 | static int dp83867_config_init(struct phy_device *phydev) | 134 | static int dp83867_config_init(struct phy_device *phydev) |
| 134 | { | 135 | { |
| 135 | struct dp83867_private *dp83867; | 136 | struct dp83867_private *dp83867; |
| 136 | int ret; | 137 | int ret, val; |
| 137 | u16 val, delay; | 138 | u16 delay; |
| 138 | 139 | ||
| 139 | if (!phydev->priv) { | 140 | if (!phydev->priv) { |
| 140 | dp83867 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83867), | 141 | dp83867 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83867), |
| @@ -151,8 +152,12 @@ static int dp83867_config_init(struct phy_device *phydev) | |||
| 151 | } | 152 | } |
| 152 | 153 | ||
| 153 | if (phy_interface_is_rgmii(phydev)) { | 154 | if (phy_interface_is_rgmii(phydev)) { |
| 154 | ret = phy_write(phydev, MII_DP83867_PHYCTRL, | 155 | val = phy_read(phydev, MII_DP83867_PHYCTRL); |
| 155 | (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT)); | 156 | if (val < 0) |
| 157 | return val; | ||
| 158 | val &= ~DP83867_PHYCR_FIFO_DEPTH_MASK; | ||
| 159 | val |= (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT); | ||
| 160 | ret = phy_write(phydev, MII_DP83867_PHYCTRL, val); | ||
| 156 | if (ret) | 161 | if (ret) |
| 157 | return ret; | 162 | return ret; |
| 158 | } | 163 | } |
diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c index 2d2e4339f0df..9ec7f7353434 100644 --- a/drivers/net/phy/fixed_phy.c +++ b/drivers/net/phy/fixed_phy.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/of.h> | 24 | #include <linux/of.h> |
| 25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
| 26 | #include <linux/idr.h> | ||
| 26 | 27 | ||
| 27 | #define MII_REGS_NUM 29 | 28 | #define MII_REGS_NUM 29 |
| 28 | 29 | ||
| @@ -286,6 +287,8 @@ err_regs: | |||
| 286 | } | 287 | } |
| 287 | EXPORT_SYMBOL_GPL(fixed_phy_add); | 288 | EXPORT_SYMBOL_GPL(fixed_phy_add); |
| 288 | 289 | ||
| 290 | static DEFINE_IDA(phy_fixed_ida); | ||
| 291 | |||
| 289 | static void fixed_phy_del(int phy_addr) | 292 | static void fixed_phy_del(int phy_addr) |
| 290 | { | 293 | { |
| 291 | struct fixed_mdio_bus *fmb = &platform_fmb; | 294 | struct fixed_mdio_bus *fmb = &platform_fmb; |
| @@ -297,14 +300,12 @@ static void fixed_phy_del(int phy_addr) | |||
| 297 | if (gpio_is_valid(fp->link_gpio)) | 300 | if (gpio_is_valid(fp->link_gpio)) |
| 298 | gpio_free(fp->link_gpio); | 301 | gpio_free(fp->link_gpio); |
| 299 | kfree(fp); | 302 | kfree(fp); |
| 303 | ida_simple_remove(&phy_fixed_ida, phy_addr); | ||
| 300 | return; | 304 | return; |
| 301 | } | 305 | } |
| 302 | } | 306 | } |
| 303 | } | 307 | } |
| 304 | 308 | ||
| 305 | static int phy_fixed_addr; | ||
| 306 | static DEFINE_SPINLOCK(phy_fixed_addr_lock); | ||
| 307 | |||
| 308 | struct phy_device *fixed_phy_register(unsigned int irq, | 309 | struct phy_device *fixed_phy_register(unsigned int irq, |
| 309 | struct fixed_phy_status *status, | 310 | struct fixed_phy_status *status, |
| 310 | int link_gpio, | 311 | int link_gpio, |
| @@ -319,17 +320,15 @@ struct phy_device *fixed_phy_register(unsigned int irq, | |||
| 319 | return ERR_PTR(-EPROBE_DEFER); | 320 | return ERR_PTR(-EPROBE_DEFER); |
| 320 | 321 | ||
| 321 | /* Get the next available PHY address, up to PHY_MAX_ADDR */ | 322 | /* Get the next available PHY address, up to PHY_MAX_ADDR */ |
| 322 | spin_lock(&phy_fixed_addr_lock); | 323 | phy_addr = ida_simple_get(&phy_fixed_ida, 0, PHY_MAX_ADDR, GFP_KERNEL); |
| 323 | if (phy_fixed_addr == PHY_MAX_ADDR) { | 324 | if (phy_addr < 0) |
| 324 | spin_unlock(&phy_fixed_addr_lock); | 325 | return ERR_PTR(phy_addr); |
| 325 | return ERR_PTR(-ENOSPC); | ||
| 326 | } | ||
| 327 | phy_addr = phy_fixed_addr++; | ||
| 328 | spin_unlock(&phy_fixed_addr_lock); | ||
| 329 | 326 | ||
| 330 | ret = fixed_phy_add(irq, phy_addr, status, link_gpio); | 327 | ret = fixed_phy_add(irq, phy_addr, status, link_gpio); |
| 331 | if (ret < 0) | 328 | if (ret < 0) { |
| 329 | ida_simple_remove(&phy_fixed_ida, phy_addr); | ||
| 332 | return ERR_PTR(ret); | 330 | return ERR_PTR(ret); |
| 331 | } | ||
| 333 | 332 | ||
| 334 | phy = get_phy_device(fmb->mii_bus, phy_addr, false); | 333 | phy = get_phy_device(fmb->mii_bus, phy_addr, false); |
| 335 | if (IS_ERR(phy)) { | 334 | if (IS_ERR(phy)) { |
| @@ -434,6 +433,7 @@ static void __exit fixed_mdio_bus_exit(void) | |||
| 434 | list_del(&fp->node); | 433 | list_del(&fp->node); |
| 435 | kfree(fp); | 434 | kfree(fp); |
| 436 | } | 435 | } |
| 436 | ida_destroy(&phy_fixed_ida); | ||
| 437 | } | 437 | } |
| 438 | module_exit(fixed_mdio_bus_exit); | 438 | module_exit(fixed_mdio_bus_exit); |
| 439 | 439 | ||
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 280e8795b463..ec2c1eee6405 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
| @@ -285,6 +285,48 @@ static int marvell_config_aneg(struct phy_device *phydev) | |||
| 285 | return 0; | 285 | return 0; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | static int m88e1111_config_aneg(struct phy_device *phydev) | ||
| 289 | { | ||
| 290 | int err; | ||
| 291 | |||
| 292 | /* The Marvell PHY has an errata which requires | ||
| 293 | * that certain registers get written in order | ||
| 294 | * to restart autonegotiation | ||
| 295 | */ | ||
| 296 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | ||
| 297 | |||
| 298 | err = marvell_set_polarity(phydev, phydev->mdix); | ||
| 299 | if (err < 0) | ||
| 300 | return err; | ||
| 301 | |||
| 302 | err = phy_write(phydev, MII_M1111_PHY_LED_CONTROL, | ||
| 303 | MII_M1111_PHY_LED_DIRECT); | ||
| 304 | if (err < 0) | ||
| 305 | return err; | ||
| 306 | |||
| 307 | err = genphy_config_aneg(phydev); | ||
| 308 | if (err < 0) | ||
| 309 | return err; | ||
| 310 | |||
| 311 | if (phydev->autoneg != AUTONEG_ENABLE) { | ||
| 312 | int bmcr; | ||
| 313 | |||
| 314 | /* A write to speed/duplex bits (that is performed by | ||
| 315 | * genphy_config_aneg() call above) must be followed by | ||
| 316 | * a software reset. Otherwise, the write has no effect. | ||
| 317 | */ | ||
| 318 | bmcr = phy_read(phydev, MII_BMCR); | ||
| 319 | if (bmcr < 0) | ||
| 320 | return bmcr; | ||
| 321 | |||
| 322 | err = phy_write(phydev, MII_BMCR, bmcr | BMCR_RESET); | ||
| 323 | if (err < 0) | ||
| 324 | return err; | ||
| 325 | } | ||
| 326 | |||
| 327 | return 0; | ||
| 328 | } | ||
| 329 | |||
| 288 | #ifdef CONFIG_OF_MDIO | 330 | #ifdef CONFIG_OF_MDIO |
| 289 | /* | 331 | /* |
| 290 | * Set and/or override some configuration registers based on the | 332 | * Set and/or override some configuration registers based on the |
| @@ -407,15 +449,7 @@ static int m88e1121_config_aneg(struct phy_device *phydev) | |||
| 407 | if (err < 0) | 449 | if (err < 0) |
| 408 | return err; | 450 | return err; |
| 409 | 451 | ||
| 410 | oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); | 452 | return genphy_config_aneg(phydev); |
| 411 | |||
| 412 | phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE); | ||
| 413 | phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF); | ||
| 414 | phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage); | ||
| 415 | |||
| 416 | err = genphy_config_aneg(phydev); | ||
| 417 | |||
| 418 | return err; | ||
| 419 | } | 453 | } |
| 420 | 454 | ||
| 421 | static int m88e1318_config_aneg(struct phy_device *phydev) | 455 | static int m88e1318_config_aneg(struct phy_device *phydev) |
| @@ -636,6 +670,28 @@ static int m88e1111_config_init(struct phy_device *phydev) | |||
| 636 | return phy_write(phydev, MII_BMCR, BMCR_RESET); | 670 | return phy_write(phydev, MII_BMCR, BMCR_RESET); |
| 637 | } | 671 | } |
| 638 | 672 | ||
| 673 | static int m88e1121_config_init(struct phy_device *phydev) | ||
| 674 | { | ||
| 675 | int err, oldpage; | ||
| 676 | |||
| 677 | oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); | ||
| 678 | |||
| 679 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE); | ||
| 680 | if (err < 0) | ||
| 681 | return err; | ||
| 682 | |||
| 683 | /* Default PHY LED config: LED[0] .. Link, LED[1] .. Activity */ | ||
| 684 | err = phy_write(phydev, MII_88E1121_PHY_LED_CTRL, | ||
| 685 | MII_88E1121_PHY_LED_DEF); | ||
| 686 | if (err < 0) | ||
| 687 | return err; | ||
| 688 | |||
| 689 | phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage); | ||
| 690 | |||
| 691 | /* Set marvell,reg-init configuration from device tree */ | ||
| 692 | return marvell_config_init(phydev); | ||
| 693 | } | ||
| 694 | |||
| 639 | static int m88e1510_config_init(struct phy_device *phydev) | 695 | static int m88e1510_config_init(struct phy_device *phydev) |
| 640 | { | 696 | { |
| 641 | int err; | 697 | int err; |
| @@ -668,7 +724,7 @@ static int m88e1510_config_init(struct phy_device *phydev) | |||
| 668 | return err; | 724 | return err; |
| 669 | } | 725 | } |
| 670 | 726 | ||
| 671 | return marvell_config_init(phydev); | 727 | return m88e1121_config_init(phydev); |
| 672 | } | 728 | } |
| 673 | 729 | ||
| 674 | static int m88e1118_config_aneg(struct phy_device *phydev) | 730 | static int m88e1118_config_aneg(struct phy_device *phydev) |
| @@ -1161,7 +1217,7 @@ static struct phy_driver marvell_drivers[] = { | |||
| 1161 | .flags = PHY_HAS_INTERRUPT, | 1217 | .flags = PHY_HAS_INTERRUPT, |
| 1162 | .probe = marvell_probe, | 1218 | .probe = marvell_probe, |
| 1163 | .config_init = &m88e1111_config_init, | 1219 | .config_init = &m88e1111_config_init, |
| 1164 | .config_aneg = &marvell_config_aneg, | 1220 | .config_aneg = &m88e1111_config_aneg, |
| 1165 | .read_status = &marvell_read_status, | 1221 | .read_status = &marvell_read_status, |
| 1166 | .ack_interrupt = &marvell_ack_interrupt, | 1222 | .ack_interrupt = &marvell_ack_interrupt, |
| 1167 | .config_intr = &marvell_config_intr, | 1223 | .config_intr = &marvell_config_intr, |
| @@ -1196,7 +1252,7 @@ static struct phy_driver marvell_drivers[] = { | |||
| 1196 | .features = PHY_GBIT_FEATURES, | 1252 | .features = PHY_GBIT_FEATURES, |
| 1197 | .flags = PHY_HAS_INTERRUPT, | 1253 | .flags = PHY_HAS_INTERRUPT, |
| 1198 | .probe = marvell_probe, | 1254 | .probe = marvell_probe, |
| 1199 | .config_init = &marvell_config_init, | 1255 | .config_init = &m88e1121_config_init, |
| 1200 | .config_aneg = &m88e1121_config_aneg, | 1256 | .config_aneg = &m88e1121_config_aneg, |
| 1201 | .read_status = &marvell_read_status, | 1257 | .read_status = &marvell_read_status, |
| 1202 | .ack_interrupt = &marvell_ack_interrupt, | 1258 | .ack_interrupt = &marvell_ack_interrupt, |
| @@ -1215,7 +1271,7 @@ static struct phy_driver marvell_drivers[] = { | |||
| 1215 | .features = PHY_GBIT_FEATURES, | 1271 | .features = PHY_GBIT_FEATURES, |
| 1216 | .flags = PHY_HAS_INTERRUPT, | 1272 | .flags = PHY_HAS_INTERRUPT, |
| 1217 | .probe = marvell_probe, | 1273 | .probe = marvell_probe, |
| 1218 | .config_init = &marvell_config_init, | 1274 | .config_init = &m88e1121_config_init, |
| 1219 | .config_aneg = &m88e1318_config_aneg, | 1275 | .config_aneg = &m88e1318_config_aneg, |
| 1220 | .read_status = &marvell_read_status, | 1276 | .read_status = &marvell_read_status, |
| 1221 | .ack_interrupt = &marvell_ack_interrupt, | 1277 | .ack_interrupt = &marvell_ack_interrupt, |
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 2e21e9366f76..b62c4aaee40b 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c | |||
| @@ -75,22 +75,13 @@ static int smsc_phy_reset(struct phy_device *phydev) | |||
| 75 | * in all capable mode before using it. | 75 | * in all capable mode before using it. |
| 76 | */ | 76 | */ |
| 77 | if ((rc & MII_LAN83C185_MODE_MASK) == MII_LAN83C185_MODE_POWERDOWN) { | 77 | if ((rc & MII_LAN83C185_MODE_MASK) == MII_LAN83C185_MODE_POWERDOWN) { |
| 78 | int timeout = 50000; | 78 | /* set "all capable" mode */ |
| 79 | |||
| 80 | /* set "all capable" mode and reset the phy */ | ||
| 81 | rc |= MII_LAN83C185_MODE_ALL; | 79 | rc |= MII_LAN83C185_MODE_ALL; |
| 82 | phy_write(phydev, MII_LAN83C185_SPECIAL_MODES, rc); | 80 | phy_write(phydev, MII_LAN83C185_SPECIAL_MODES, rc); |
| 83 | phy_write(phydev, MII_BMCR, BMCR_RESET); | ||
| 84 | |||
| 85 | /* wait end of reset (max 500 ms) */ | ||
| 86 | do { | ||
| 87 | udelay(10); | ||
| 88 | if (timeout-- == 0) | ||
| 89 | return -1; | ||
| 90 | rc = phy_read(phydev, MII_BMCR); | ||
| 91 | } while (rc & BMCR_RESET); | ||
| 92 | } | 81 | } |
| 93 | return 0; | 82 | |
| 83 | /* reset the phy */ | ||
| 84 | return genphy_soft_reset(phydev); | ||
| 94 | } | 85 | } |
| 95 | 86 | ||
| 96 | static int lan911x_config_init(struct phy_device *phydev) | 87 | static int lan911x_config_init(struct phy_device *phydev) |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 8dedafa1a95d..a30ee427efab 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
| @@ -2601,8 +2601,6 @@ ppp_unregister_channel(struct ppp_channel *chan) | |||
| 2601 | spin_lock_bh(&pn->all_channels_lock); | 2601 | spin_lock_bh(&pn->all_channels_lock); |
| 2602 | list_del(&pch->list); | 2602 | list_del(&pch->list); |
| 2603 | spin_unlock_bh(&pn->all_channels_lock); | 2603 | spin_unlock_bh(&pn->all_channels_lock); |
| 2604 | put_net(pch->chan_net); | ||
| 2605 | pch->chan_net = NULL; | ||
| 2606 | 2604 | ||
| 2607 | pch->file.dead = 1; | 2605 | pch->file.dead = 1; |
| 2608 | wake_up_interruptible(&pch->file.rwait); | 2606 | wake_up_interruptible(&pch->file.rwait); |
| @@ -3136,6 +3134,9 @@ ppp_disconnect_channel(struct channel *pch) | |||
| 3136 | */ | 3134 | */ |
| 3137 | static void ppp_destroy_channel(struct channel *pch) | 3135 | static void ppp_destroy_channel(struct channel *pch) |
| 3138 | { | 3136 | { |
| 3137 | put_net(pch->chan_net); | ||
| 3138 | pch->chan_net = NULL; | ||
| 3139 | |||
| 3139 | atomic_dec(&channel_count); | 3140 | atomic_dec(&channel_count); |
| 3140 | 3141 | ||
| 3141 | if (!pch->file.dead) { | 3142 | if (!pch->file.dead) { |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 2ace126533cd..fdee77207323 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
| @@ -1203,8 +1203,10 @@ static int team_port_add(struct team *team, struct net_device *port_dev) | |||
| 1203 | goto err_dev_open; | 1203 | goto err_dev_open; |
| 1204 | } | 1204 | } |
| 1205 | 1205 | ||
| 1206 | netif_addr_lock_bh(dev); | ||
| 1206 | dev_uc_sync_multiple(port_dev, dev); | 1207 | dev_uc_sync_multiple(port_dev, dev); |
| 1207 | dev_mc_sync_multiple(port_dev, dev); | 1208 | dev_mc_sync_multiple(port_dev, dev); |
| 1209 | netif_addr_unlock_bh(dev); | ||
| 1208 | 1210 | ||
| 1209 | err = vlan_vids_add_by_dev(port_dev, dev); | 1211 | err = vlan_vids_add_by_dev(port_dev, dev); |
| 1210 | if (err) { | 1212 | if (err) { |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 53759c315b97..877c9516e781 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
| @@ -854,6 +854,13 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ | |||
| 854 | if (cdc_ncm_init(dev)) | 854 | if (cdc_ncm_init(dev)) |
| 855 | goto error2; | 855 | goto error2; |
| 856 | 856 | ||
| 857 | /* Some firmwares need a pause here or they will silently fail | ||
| 858 | * to set up the interface properly. This value was decided | ||
| 859 | * empirically on a Sierra Wireless MC7455 running 02.08.02.00 | ||
| 860 | * firmware. | ||
| 861 | */ | ||
| 862 | usleep_range(10000, 20000); | ||
| 863 | |||
| 857 | /* configure data interface */ | 864 | /* configure data interface */ |
| 858 | temp = usb_set_interface(dev->udev, iface_no, data_altsetting); | 865 | temp = usb_set_interface(dev->udev, iface_no, data_altsetting); |
| 859 | if (temp) { | 866 | if (temp) { |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 3f9f6ed3eec4..e9654a685381 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
| @@ -26,12 +26,13 @@ | |||
| 26 | #include <linux/mdio.h> | 26 | #include <linux/mdio.h> |
| 27 | #include <linux/usb/cdc.h> | 27 | #include <linux/usb/cdc.h> |
| 28 | #include <linux/suspend.h> | 28 | #include <linux/suspend.h> |
| 29 | #include <linux/acpi.h> | ||
| 29 | 30 | ||
| 30 | /* Information for net-next */ | 31 | /* Information for net-next */ |
| 31 | #define NETNEXT_VERSION "08" | 32 | #define NETNEXT_VERSION "08" |
| 32 | 33 | ||
| 33 | /* Information for net */ | 34 | /* Information for net */ |
| 34 | #define NET_VERSION "3" | 35 | #define NET_VERSION "5" |
| 35 | 36 | ||
| 36 | #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION | 37 | #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION |
| 37 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" | 38 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" |
| @@ -116,6 +117,7 @@ | |||
| 116 | #define USB_TX_DMA 0xd434 | 117 | #define USB_TX_DMA 0xd434 |
| 117 | #define USB_TOLERANCE 0xd490 | 118 | #define USB_TOLERANCE 0xd490 |
| 118 | #define USB_LPM_CTRL 0xd41a | 119 | #define USB_LPM_CTRL 0xd41a |
| 120 | #define USB_BMU_RESET 0xd4b0 | ||
| 119 | #define USB_UPS_CTRL 0xd800 | 121 | #define USB_UPS_CTRL 0xd800 |
| 120 | #define USB_MISC_0 0xd81a | 122 | #define USB_MISC_0 0xd81a |
| 121 | #define USB_POWER_CUT 0xd80a | 123 | #define USB_POWER_CUT 0xd80a |
| @@ -338,6 +340,10 @@ | |||
| 338 | #define TEST_MODE_DISABLE 0x00000001 | 340 | #define TEST_MODE_DISABLE 0x00000001 |
| 339 | #define TX_SIZE_ADJUST1 0x00000100 | 341 | #define TX_SIZE_ADJUST1 0x00000100 |
| 340 | 342 | ||
| 343 | /* USB_BMU_RESET */ | ||
| 344 | #define BMU_RESET_EP_IN 0x01 | ||
| 345 | #define BMU_RESET_EP_OUT 0x02 | ||
| 346 | |||
| 341 | /* USB_UPS_CTRL */ | 347 | /* USB_UPS_CTRL */ |
| 342 | #define POWER_CUT 0x0100 | 348 | #define POWER_CUT 0x0100 |
| 343 | 349 | ||
| @@ -455,6 +461,11 @@ | |||
| 455 | /* SRAM_IMPEDANCE */ | 461 | /* SRAM_IMPEDANCE */ |
| 456 | #define RX_DRIVING_MASK 0x6000 | 462 | #define RX_DRIVING_MASK 0x6000 |
| 457 | 463 | ||
| 464 | /* MAC PASSTHRU */ | ||
| 465 | #define AD_MASK 0xfee0 | ||
| 466 | #define EFUSE 0xcfdb | ||
| 467 | #define PASS_THRU_MASK 0x1 | ||
| 468 | |||
| 458 | enum rtl_register_content { | 469 | enum rtl_register_content { |
| 459 | _1000bps = 0x10, | 470 | _1000bps = 0x10, |
| 460 | _100bps = 0x08, | 471 | _100bps = 0x08, |
| @@ -619,6 +630,7 @@ struct r8152 { | |||
| 619 | int (*eee_get)(struct r8152 *, struct ethtool_eee *); | 630 | int (*eee_get)(struct r8152 *, struct ethtool_eee *); |
| 620 | int (*eee_set)(struct r8152 *, struct ethtool_eee *); | 631 | int (*eee_set)(struct r8152 *, struct ethtool_eee *); |
| 621 | bool (*in_nway)(struct r8152 *); | 632 | bool (*in_nway)(struct r8152 *); |
| 633 | void (*autosuspend_en)(struct r8152 *tp, bool enable); | ||
| 622 | } rtl_ops; | 634 | } rtl_ops; |
| 623 | 635 | ||
| 624 | int intr_interval; | 636 | int intr_interval; |
| @@ -1030,6 +1042,65 @@ out1: | |||
| 1030 | return ret; | 1042 | return ret; |
| 1031 | } | 1043 | } |
| 1032 | 1044 | ||
| 1045 | /* Devices containing RTL8153-AD can support a persistent | ||
| 1046 | * host system provided MAC address. | ||
| 1047 | * Examples of this are Dell TB15 and Dell WD15 docks | ||
| 1048 | */ | ||
| 1049 | static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa) | ||
| 1050 | { | ||
| 1051 | acpi_status status; | ||
| 1052 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
| 1053 | union acpi_object *obj; | ||
| 1054 | int ret = -EINVAL; | ||
| 1055 | u32 ocp_data; | ||
| 1056 | unsigned char buf[6]; | ||
| 1057 | |||
| 1058 | /* test for -AD variant of RTL8153 */ | ||
| 1059 | ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0); | ||
| 1060 | if ((ocp_data & AD_MASK) != 0x1000) | ||
| 1061 | return -ENODEV; | ||
| 1062 | |||
| 1063 | /* test for MAC address pass-through bit */ | ||
| 1064 | ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, EFUSE); | ||
| 1065 | if ((ocp_data & PASS_THRU_MASK) != 1) | ||
| 1066 | return -ENODEV; | ||
| 1067 | |||
| 1068 | /* returns _AUXMAC_#AABBCCDDEEFF# */ | ||
| 1069 | status = acpi_evaluate_object(NULL, "\\_SB.AMAC", NULL, &buffer); | ||
| 1070 | obj = (union acpi_object *)buffer.pointer; | ||
| 1071 | if (!ACPI_SUCCESS(status)) | ||
| 1072 | return -ENODEV; | ||
| 1073 | if (obj->type != ACPI_TYPE_BUFFER || obj->string.length != 0x17) { | ||
| 1074 | netif_warn(tp, probe, tp->netdev, | ||
| 1075 | "Invalid buffer when reading pass-thru MAC addr: " | ||
| 1076 | "(%d, %d)\n", | ||
| 1077 | obj->type, obj->string.length); | ||
| 1078 | goto amacout; | ||
| 1079 | } | ||
| 1080 | if (strncmp(obj->string.pointer, "_AUXMAC_#", 9) != 0 || | ||
| 1081 | strncmp(obj->string.pointer + 0x15, "#", 1) != 0) { | ||
| 1082 | netif_warn(tp, probe, tp->netdev, | ||
| 1083 | "Invalid header when reading pass-thru MAC addr\n"); | ||
| 1084 | goto amacout; | ||
| 1085 | } | ||
| 1086 | ret = hex2bin(buf, obj->string.pointer + 9, 6); | ||
| 1087 | if (!(ret == 0 && is_valid_ether_addr(buf))) { | ||
| 1088 | netif_warn(tp, probe, tp->netdev, | ||
| 1089 | "Invalid MAC when reading pass-thru MAC addr: " | ||
| 1090 | "%d, %pM\n", ret, buf); | ||
| 1091 | ret = -EINVAL; | ||
| 1092 | goto amacout; | ||
| 1093 | } | ||
| 1094 | memcpy(sa->sa_data, buf, 6); | ||
| 1095 | ether_addr_copy(tp->netdev->dev_addr, sa->sa_data); | ||
| 1096 | netif_info(tp, probe, tp->netdev, | ||
| 1097 | "Using pass-thru MAC addr %pM\n", sa->sa_data); | ||
| 1098 | |||
| 1099 | amacout: | ||
| 1100 | kfree(obj); | ||
| 1101 | return ret; | ||
| 1102 | } | ||
| 1103 | |||
| 1033 | static int set_ethernet_addr(struct r8152 *tp) | 1104 | static int set_ethernet_addr(struct r8152 *tp) |
| 1034 | { | 1105 | { |
| 1035 | struct net_device *dev = tp->netdev; | 1106 | struct net_device *dev = tp->netdev; |
| @@ -1038,8 +1109,15 @@ static int set_ethernet_addr(struct r8152 *tp) | |||
| 1038 | 1109 | ||
| 1039 | if (tp->version == RTL_VER_01) | 1110 | if (tp->version == RTL_VER_01) |
| 1040 | ret = pla_ocp_read(tp, PLA_IDR, 8, sa.sa_data); | 1111 | ret = pla_ocp_read(tp, PLA_IDR, 8, sa.sa_data); |
| 1041 | else | 1112 | else { |
| 1042 | ret = pla_ocp_read(tp, PLA_BACKUP, 8, sa.sa_data); | 1113 | /* if this is not an RTL8153-AD, no eFuse mac pass thru set, |
| 1114 | * or system doesn't provide valid _SB.AMAC this will be | ||
| 1115 | * be expected to non-zero | ||
| 1116 | */ | ||
| 1117 | ret = vendor_mac_passthru_addr_read(tp, &sa); | ||
| 1118 | if (ret < 0) | ||
| 1119 | ret = pla_ocp_read(tp, PLA_BACKUP, 8, sa.sa_data); | ||
| 1120 | } | ||
| 1043 | 1121 | ||
| 1044 | if (ret < 0) { | 1122 | if (ret < 0) { |
| 1045 | netif_err(tp, probe, dev, "Get ether addr fail\n"); | 1123 | netif_err(tp, probe, dev, "Get ether addr fail\n"); |
| @@ -2169,7 +2247,7 @@ static void r8153_set_rx_early_timeout(struct r8152 *tp) | |||
| 2169 | static void r8153_set_rx_early_size(struct r8152 *tp) | 2247 | static void r8153_set_rx_early_size(struct r8152 *tp) |
| 2170 | { | 2248 | { |
| 2171 | u32 mtu = tp->netdev->mtu; | 2249 | u32 mtu = tp->netdev->mtu; |
| 2172 | u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 4; | 2250 | u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 8; |
| 2173 | 2251 | ||
| 2174 | ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data); | 2252 | ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data); |
| 2175 | } | 2253 | } |
| @@ -2290,10 +2368,6 @@ static u32 __rtl_get_wol(struct r8152 *tp) | |||
| 2290 | u32 ocp_data; | 2368 | u32 ocp_data; |
| 2291 | u32 wolopts = 0; | 2369 | u32 wolopts = 0; |
| 2292 | 2370 | ||
| 2293 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG5); | ||
| 2294 | if (!(ocp_data & LAN_WAKE_EN)) | ||
| 2295 | return 0; | ||
| 2296 | |||
| 2297 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_CONFIG34); | 2371 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_CONFIG34); |
| 2298 | if (ocp_data & LINK_ON_WAKE_EN) | 2372 | if (ocp_data & LINK_ON_WAKE_EN) |
| 2299 | wolopts |= WAKE_PHY; | 2373 | wolopts |= WAKE_PHY; |
| @@ -2326,15 +2400,13 @@ static void __rtl_set_wol(struct r8152 *tp, u32 wolopts) | |||
| 2326 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_CONFIG34, ocp_data); | 2400 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_CONFIG34, ocp_data); |
| 2327 | 2401 | ||
| 2328 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_CONFIG5); | 2402 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_CONFIG5); |
| 2329 | ocp_data &= ~(UWF_EN | BWF_EN | MWF_EN | LAN_WAKE_EN); | 2403 | ocp_data &= ~(UWF_EN | BWF_EN | MWF_EN); |
| 2330 | if (wolopts & WAKE_UCAST) | 2404 | if (wolopts & WAKE_UCAST) |
| 2331 | ocp_data |= UWF_EN; | 2405 | ocp_data |= UWF_EN; |
| 2332 | if (wolopts & WAKE_BCAST) | 2406 | if (wolopts & WAKE_BCAST) |
| 2333 | ocp_data |= BWF_EN; | 2407 | ocp_data |= BWF_EN; |
| 2334 | if (wolopts & WAKE_MCAST) | 2408 | if (wolopts & WAKE_MCAST) |
| 2335 | ocp_data |= MWF_EN; | 2409 | ocp_data |= MWF_EN; |
| 2336 | if (wolopts & WAKE_ANY) | ||
| 2337 | ocp_data |= LAN_WAKE_EN; | ||
| 2338 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_CONFIG5, ocp_data); | 2410 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_CONFIG5, ocp_data); |
| 2339 | 2411 | ||
| 2340 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); | 2412 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); |
| @@ -2403,9 +2475,6 @@ static void rtl_runtime_suspend_enable(struct r8152 *tp, bool enable) | |||
| 2403 | if (enable) { | 2475 | if (enable) { |
| 2404 | u32 ocp_data; | 2476 | u32 ocp_data; |
| 2405 | 2477 | ||
| 2406 | r8153_u1u2en(tp, false); | ||
| 2407 | r8153_u2p3en(tp, false); | ||
| 2408 | |||
| 2409 | __rtl_set_wol(tp, WAKE_ANY); | 2478 | __rtl_set_wol(tp, WAKE_ANY); |
| 2410 | 2479 | ||
| 2411 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG); | 2480 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG); |
| @@ -2416,7 +2485,28 @@ static void rtl_runtime_suspend_enable(struct r8152 *tp, bool enable) | |||
| 2416 | 2485 | ||
| 2417 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); | 2486 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); |
| 2418 | } else { | 2487 | } else { |
| 2488 | u32 ocp_data; | ||
| 2489 | |||
| 2419 | __rtl_set_wol(tp, tp->saved_wolopts); | 2490 | __rtl_set_wol(tp, tp->saved_wolopts); |
| 2491 | |||
| 2492 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG); | ||
| 2493 | |||
| 2494 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_CONFIG34); | ||
| 2495 | ocp_data &= ~LINK_OFF_WAKE_EN; | ||
| 2496 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_CONFIG34, ocp_data); | ||
| 2497 | |||
| 2498 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); | ||
| 2499 | } | ||
| 2500 | } | ||
| 2501 | |||
| 2502 | static void rtl8153_runtime_enable(struct r8152 *tp, bool enable) | ||
| 2503 | { | ||
| 2504 | rtl_runtime_suspend_enable(tp, enable); | ||
| 2505 | |||
| 2506 | if (enable) { | ||
| 2507 | r8153_u1u2en(tp, false); | ||
| 2508 | r8153_u2p3en(tp, false); | ||
| 2509 | } else { | ||
| 2420 | r8153_u2p3en(tp, true); | 2510 | r8153_u2p3en(tp, true); |
| 2421 | r8153_u1u2en(tp, true); | 2511 | r8153_u1u2en(tp, true); |
| 2422 | } | 2512 | } |
| @@ -2456,6 +2546,17 @@ static void r8153_teredo_off(struct r8152 *tp) | |||
| 2456 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TEREDO_TIMER, 0); | 2546 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TEREDO_TIMER, 0); |
| 2457 | } | 2547 | } |
| 2458 | 2548 | ||
| 2549 | static void rtl_reset_bmu(struct r8152 *tp) | ||
| 2550 | { | ||
| 2551 | u32 ocp_data; | ||
| 2552 | |||
| 2553 | ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_BMU_RESET); | ||
| 2554 | ocp_data &= ~(BMU_RESET_EP_IN | BMU_RESET_EP_OUT); | ||
| 2555 | ocp_write_byte(tp, MCU_TYPE_USB, USB_BMU_RESET, ocp_data); | ||
| 2556 | ocp_data |= BMU_RESET_EP_IN | BMU_RESET_EP_OUT; | ||
| 2557 | ocp_write_byte(tp, MCU_TYPE_USB, USB_BMU_RESET, ocp_data); | ||
| 2558 | } | ||
| 2559 | |||
| 2459 | static void r8152_aldps_en(struct r8152 *tp, bool enable) | 2560 | static void r8152_aldps_en(struct r8152 *tp, bool enable) |
| 2460 | { | 2561 | { |
| 2461 | if (enable) { | 2562 | if (enable) { |
| @@ -2681,6 +2782,7 @@ static void r8153_first_init(struct r8152 *tp) | |||
| 2681 | r8153_hw_phy_cfg(tp); | 2782 | r8153_hw_phy_cfg(tp); |
| 2682 | 2783 | ||
| 2683 | rtl8152_nic_reset(tp); | 2784 | rtl8152_nic_reset(tp); |
| 2785 | rtl_reset_bmu(tp); | ||
| 2684 | 2786 | ||
| 2685 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2787 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
| 2686 | ocp_data &= ~NOW_IS_OOB; | 2788 | ocp_data &= ~NOW_IS_OOB; |
| @@ -2742,6 +2844,7 @@ static void r8153_enter_oob(struct r8152 *tp) | |||
| 2742 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); | 2844 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); |
| 2743 | 2845 | ||
| 2744 | rtl_disable(tp); | 2846 | rtl_disable(tp); |
| 2847 | rtl_reset_bmu(tp); | ||
| 2745 | 2848 | ||
| 2746 | for (i = 0; i < 1000; i++) { | 2849 | for (i = 0; i < 1000; i++) { |
| 2747 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2850 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
| @@ -2803,6 +2906,7 @@ static void rtl8153_disable(struct r8152 *tp) | |||
| 2803 | { | 2906 | { |
| 2804 | r8153_aldps_en(tp, false); | 2907 | r8153_aldps_en(tp, false); |
| 2805 | rtl_disable(tp); | 2908 | rtl_disable(tp); |
| 2909 | rtl_reset_bmu(tp); | ||
| 2806 | r8153_aldps_en(tp, true); | 2910 | r8153_aldps_en(tp, true); |
| 2807 | usb_enable_lpm(tp->udev); | 2911 | usb_enable_lpm(tp->udev); |
| 2808 | } | 2912 | } |
| @@ -3382,15 +3486,11 @@ static void r8153_init(struct r8152 *tp) | |||
| 3382 | r8153_power_cut_en(tp, false); | 3486 | r8153_power_cut_en(tp, false); |
| 3383 | r8153_u1u2en(tp, true); | 3487 | r8153_u1u2en(tp, true); |
| 3384 | 3488 | ||
| 3385 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, ALDPS_SPDWN_RATIO); | 3489 | /* MAC clock speed down */ |
| 3386 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, EEE_SPDWN_RATIO); | 3490 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0); |
| 3387 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, | 3491 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, 0); |
| 3388 | PKT_AVAIL_SPDWN_EN | SUSPEND_SPDWN_EN | | 3492 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0); |
| 3389 | U1U2_SPDWN_EN | L1_SPDWN_EN); | 3493 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0); |
| 3390 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, | ||
| 3391 | PWRSAVE_SPDWN_EN | RXDV_SPDWN_EN | TX10MIDLE_EN | | ||
| 3392 | TP100_SPDWN_EN | TP500_SPDWN_EN | TP1000_SPDWN_EN | | ||
| 3393 | EEE_SPDWN_EN); | ||
| 3394 | 3494 | ||
| 3395 | r8153_enable_eee(tp); | 3495 | r8153_enable_eee(tp); |
| 3396 | r8153_aldps_en(tp, true); | 3496 | r8153_aldps_en(tp, true); |
| @@ -3497,7 +3597,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 3497 | napi_disable(&tp->napi); | 3597 | napi_disable(&tp->napi); |
| 3498 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3598 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
| 3499 | rtl_stop_rx(tp); | 3599 | rtl_stop_rx(tp); |
| 3500 | rtl_runtime_suspend_enable(tp, true); | 3600 | tp->rtl_ops.autosuspend_en(tp, true); |
| 3501 | } else { | 3601 | } else { |
| 3502 | cancel_delayed_work_sync(&tp->schedule); | 3602 | cancel_delayed_work_sync(&tp->schedule); |
| 3503 | tp->rtl_ops.down(tp); | 3603 | tp->rtl_ops.down(tp); |
| @@ -3523,7 +3623,7 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
| 3523 | 3623 | ||
| 3524 | if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) { | 3624 | if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) { |
| 3525 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3625 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
| 3526 | rtl_runtime_suspend_enable(tp, false); | 3626 | tp->rtl_ops.autosuspend_en(tp, false); |
| 3527 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | 3627 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
| 3528 | napi_disable(&tp->napi); | 3628 | napi_disable(&tp->napi); |
| 3529 | set_bit(WORK_ENABLE, &tp->flags); | 3629 | set_bit(WORK_ENABLE, &tp->flags); |
| @@ -3542,7 +3642,7 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
| 3542 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); | 3642 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); |
| 3543 | } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3643 | } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
| 3544 | if (tp->netdev->flags & IFF_UP) | 3644 | if (tp->netdev->flags & IFF_UP) |
| 3545 | rtl_runtime_suspend_enable(tp, false); | 3645 | tp->rtl_ops.autosuspend_en(tp, false); |
| 3546 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | 3646 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
| 3547 | } | 3647 | } |
| 3548 | 3648 | ||
| @@ -4122,6 +4222,7 @@ static int rtl_ops_init(struct r8152 *tp) | |||
| 4122 | ops->eee_get = r8152_get_eee; | 4222 | ops->eee_get = r8152_get_eee; |
| 4123 | ops->eee_set = r8152_set_eee; | 4223 | ops->eee_set = r8152_set_eee; |
| 4124 | ops->in_nway = rtl8152_in_nway; | 4224 | ops->in_nway = rtl8152_in_nway; |
| 4225 | ops->autosuspend_en = rtl_runtime_suspend_enable; | ||
| 4125 | break; | 4226 | break; |
| 4126 | 4227 | ||
| 4127 | case RTL_VER_03: | 4228 | case RTL_VER_03: |
| @@ -4137,6 +4238,7 @@ static int rtl_ops_init(struct r8152 *tp) | |||
| 4137 | ops->eee_get = r8153_get_eee; | 4238 | ops->eee_get = r8153_get_eee; |
| 4138 | ops->eee_set = r8153_set_eee; | 4239 | ops->eee_set = r8153_set_eee; |
| 4139 | ops->in_nway = rtl8153_in_nway; | 4240 | ops->in_nway = rtl8153_in_nway; |
| 4241 | ops->autosuspend_en = rtl8153_runtime_enable; | ||
| 4140 | break; | 4242 | break; |
| 4141 | 4243 | ||
| 4142 | default: | 4244 | default: |
| @@ -4323,3 +4425,4 @@ module_usb_driver(rtl8152_driver); | |||
| 4323 | MODULE_AUTHOR(DRIVER_AUTHOR); | 4425 | MODULE_AUTHOR(DRIVER_AUTHOR); |
| 4324 | MODULE_DESCRIPTION(DRIVER_DESC); | 4426 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 4325 | MODULE_LICENSE("GPL"); | 4427 | MODULE_LICENSE("GPL"); |
| 4428 | MODULE_VERSION(DRIVER_VERSION); | ||
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 61ba46404937..6086a0163249 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
| @@ -395,8 +395,11 @@ int usbnet_change_mtu (struct net_device *net, int new_mtu) | |||
| 395 | dev->hard_mtu = net->mtu + net->hard_header_len; | 395 | dev->hard_mtu = net->mtu + net->hard_header_len; |
| 396 | if (dev->rx_urb_size == old_hard_mtu) { | 396 | if (dev->rx_urb_size == old_hard_mtu) { |
| 397 | dev->rx_urb_size = dev->hard_mtu; | 397 | dev->rx_urb_size = dev->hard_mtu; |
| 398 | if (dev->rx_urb_size > old_rx_urb_size) | 398 | if (dev->rx_urb_size > old_rx_urb_size) { |
| 399 | usbnet_pause_rx(dev); | ||
| 399 | usbnet_unlink_rx_urbs(dev); | 400 | usbnet_unlink_rx_urbs(dev); |
| 401 | usbnet_resume_rx(dev); | ||
| 402 | } | ||
| 400 | } | 403 | } |
| 401 | 404 | ||
| 402 | /* max qlen depend on hard_mtu and rx_urb_size */ | 405 | /* max qlen depend on hard_mtu and rx_urb_size */ |
| @@ -1508,8 +1511,9 @@ static void usbnet_bh (unsigned long param) | |||
| 1508 | } else if (netif_running (dev->net) && | 1511 | } else if (netif_running (dev->net) && |
| 1509 | netif_device_present (dev->net) && | 1512 | netif_device_present (dev->net) && |
| 1510 | netif_carrier_ok(dev->net) && | 1513 | netif_carrier_ok(dev->net) && |
| 1511 | !timer_pending (&dev->delay) && | 1514 | !timer_pending(&dev->delay) && |
| 1512 | !test_bit (EVENT_RX_HALT, &dev->flags)) { | 1515 | !test_bit(EVENT_RX_PAUSED, &dev->flags) && |
| 1516 | !test_bit(EVENT_RX_HALT, &dev->flags)) { | ||
| 1513 | int temp = dev->rxq.qlen; | 1517 | int temp = dev->rxq.qlen; |
| 1514 | 1518 | ||
| 1515 | if (temp < RX_QLEN(dev)) { | 1519 | if (temp < RX_QLEN(dev)) { |
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index dff08842f26d..8bd8c7e1ee87 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c | |||
| @@ -304,7 +304,7 @@ static int vrf_rt6_create(struct net_device *dev) | |||
| 304 | dst_hold(&rt6->dst); | 304 | dst_hold(&rt6->dst); |
| 305 | 305 | ||
| 306 | rt6->rt6i_table = rt6i_table; | 306 | rt6->rt6i_table = rt6i_table; |
| 307 | rt6->dst.output = vrf_output6; | 307 | rt6->dst.output = vrf_output6; |
| 308 | rcu_assign_pointer(vrf->rt6, rt6); | 308 | rcu_assign_pointer(vrf->rt6, rt6); |
| 309 | 309 | ||
| 310 | rc = 0; | 310 | rc = 0; |
| @@ -403,7 +403,7 @@ static int vrf_rtable_create(struct net_device *dev) | |||
| 403 | if (!rth) | 403 | if (!rth) |
| 404 | return -ENOMEM; | 404 | return -ENOMEM; |
| 405 | 405 | ||
| 406 | rth->dst.output = vrf_output; | 406 | rth->dst.output = vrf_output; |
| 407 | rth->rt_table_id = vrf->tb_id; | 407 | rth->rt_table_id = vrf->tb_id; |
| 408 | 408 | ||
| 409 | rcu_assign_pointer(vrf->rth, rth); | 409 | rcu_assign_pointer(vrf->rth, rth); |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index f999db2f97b4..b3b9db68f758 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -2952,30 +2952,6 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
| 2952 | return 0; | 2952 | return 0; |
| 2953 | } | 2953 | } |
| 2954 | 2954 | ||
| 2955 | struct net_device *vxlan_dev_create(struct net *net, const char *name, | ||
| 2956 | u8 name_assign_type, struct vxlan_config *conf) | ||
| 2957 | { | ||
| 2958 | struct nlattr *tb[IFLA_MAX+1]; | ||
| 2959 | struct net_device *dev; | ||
| 2960 | int err; | ||
| 2961 | |||
| 2962 | memset(&tb, 0, sizeof(tb)); | ||
| 2963 | |||
| 2964 | dev = rtnl_create_link(net, name, name_assign_type, | ||
| 2965 | &vxlan_link_ops, tb); | ||
| 2966 | if (IS_ERR(dev)) | ||
| 2967 | return dev; | ||
| 2968 | |||
| 2969 | err = vxlan_dev_configure(net, dev, conf); | ||
| 2970 | if (err < 0) { | ||
| 2971 | free_netdev(dev); | ||
| 2972 | return ERR_PTR(err); | ||
| 2973 | } | ||
| 2974 | |||
| 2975 | return dev; | ||
| 2976 | } | ||
| 2977 | EXPORT_SYMBOL_GPL(vxlan_dev_create); | ||
| 2978 | |||
| 2979 | static int vxlan_newlink(struct net *src_net, struct net_device *dev, | 2955 | static int vxlan_newlink(struct net *src_net, struct net_device *dev, |
| 2980 | struct nlattr *tb[], struct nlattr *data[]) | 2956 | struct nlattr *tb[], struct nlattr *data[]) |
| 2981 | { | 2957 | { |
| @@ -3268,6 +3244,40 @@ static struct rtnl_link_ops vxlan_link_ops __read_mostly = { | |||
| 3268 | .get_link_net = vxlan_get_link_net, | 3244 | .get_link_net = vxlan_get_link_net, |
| 3269 | }; | 3245 | }; |
| 3270 | 3246 | ||
| 3247 | struct net_device *vxlan_dev_create(struct net *net, const char *name, | ||
| 3248 | u8 name_assign_type, | ||
| 3249 | struct vxlan_config *conf) | ||
| 3250 | { | ||
| 3251 | struct nlattr *tb[IFLA_MAX + 1]; | ||
| 3252 | struct net_device *dev; | ||
| 3253 | int err; | ||
| 3254 | |||
| 3255 | memset(&tb, 0, sizeof(tb)); | ||
| 3256 | |||
| 3257 | dev = rtnl_create_link(net, name, name_assign_type, | ||
| 3258 | &vxlan_link_ops, tb); | ||
| 3259 | if (IS_ERR(dev)) | ||
| 3260 | return dev; | ||
| 3261 | |||
| 3262 | err = vxlan_dev_configure(net, dev, conf); | ||
| 3263 | if (err < 0) { | ||
| 3264 | free_netdev(dev); | ||
| 3265 | return ERR_PTR(err); | ||
| 3266 | } | ||
| 3267 | |||
| 3268 | err = rtnl_configure_link(dev, NULL); | ||
| 3269 | if (err < 0) { | ||
| 3270 | LIST_HEAD(list_kill); | ||
| 3271 | |||
| 3272 | vxlan_dellink(dev, &list_kill); | ||
| 3273 | unregister_netdevice_many(&list_kill); | ||
| 3274 | return ERR_PTR(err); | ||
| 3275 | } | ||
| 3276 | |||
| 3277 | return dev; | ||
| 3278 | } | ||
| 3279 | EXPORT_SYMBOL_GPL(vxlan_dev_create); | ||
| 3280 | |||
| 3271 | static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn, | 3281 | static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn, |
| 3272 | struct net_device *dev) | 3282 | struct net_device *dev) |
| 3273 | { | 3283 | { |
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 49af62428c88..a92a0ba829f5 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
| @@ -1083,7 +1083,7 @@ int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name, | |||
| 1083 | } | 1083 | } |
| 1084 | 1084 | ||
| 1085 | ath10k_dbg_dump(ar, ATH10K_DBG_BOOT, "features", "", | 1085 | ath10k_dbg_dump(ar, ATH10K_DBG_BOOT, "features", "", |
| 1086 | ar->running_fw->fw_file.fw_features, | 1086 | fw_file->fw_features, |
| 1087 | sizeof(fw_file->fw_features)); | 1087 | sizeof(fw_file->fw_features)); |
| 1088 | break; | 1088 | break; |
| 1089 | case ATH10K_FW_IE_FW_IMAGE: | 1089 | case ATH10K_FW_IE_FW_IMAGE: |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index cc979a4faeb0..813cdd2621a1 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
| @@ -1904,7 +1904,6 @@ static void ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb) | |||
| 1904 | return; | 1904 | return; |
| 1905 | } | 1905 | } |
| 1906 | } | 1906 | } |
| 1907 | ath10k_htt_rx_msdu_buff_replenish(htt); | ||
| 1908 | } | 1907 | } |
| 1909 | 1908 | ||
| 1910 | static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar, | 1909 | static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar, |
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 6dd1d26b357f..4040f9413e86 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c | |||
| @@ -679,10 +679,10 @@ static int ath10k_peer_create(struct ath10k *ar, | |||
| 679 | 679 | ||
| 680 | peer = ath10k_peer_find(ar, vdev_id, addr); | 680 | peer = ath10k_peer_find(ar, vdev_id, addr); |
| 681 | if (!peer) { | 681 | if (!peer) { |
| 682 | spin_unlock_bh(&ar->data_lock); | ||
| 682 | ath10k_warn(ar, "failed to find peer %pM on vdev %i after creation\n", | 683 | ath10k_warn(ar, "failed to find peer %pM on vdev %i after creation\n", |
| 683 | addr, vdev_id); | 684 | addr, vdev_id); |
| 684 | ath10k_wmi_peer_delete(ar, vdev_id, addr); | 685 | ath10k_wmi_peer_delete(ar, vdev_id, addr); |
| 685 | spin_unlock_bh(&ar->data_lock); | ||
| 686 | return -ENOENT; | 686 | return -ENOENT; |
| 687 | } | 687 | } |
| 688 | 688 | ||
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index 9272ca90632b..80ff69f99229 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
| @@ -1122,12 +1122,12 @@ enum { | |||
| 1122 | #define AR9300_NUM_GPIO 16 | 1122 | #define AR9300_NUM_GPIO 16 |
| 1123 | #define AR9330_NUM_GPIO 16 | 1123 | #define AR9330_NUM_GPIO 16 |
| 1124 | #define AR9340_NUM_GPIO 23 | 1124 | #define AR9340_NUM_GPIO 23 |
| 1125 | #define AR9462_NUM_GPIO 10 | 1125 | #define AR9462_NUM_GPIO 14 |
| 1126 | #define AR9485_NUM_GPIO 12 | 1126 | #define AR9485_NUM_GPIO 12 |
| 1127 | #define AR9531_NUM_GPIO 18 | 1127 | #define AR9531_NUM_GPIO 18 |
| 1128 | #define AR9550_NUM_GPIO 24 | 1128 | #define AR9550_NUM_GPIO 24 |
| 1129 | #define AR9561_NUM_GPIO 23 | 1129 | #define AR9561_NUM_GPIO 23 |
| 1130 | #define AR9565_NUM_GPIO 12 | 1130 | #define AR9565_NUM_GPIO 14 |
| 1131 | #define AR9580_NUM_GPIO 16 | 1131 | #define AR9580_NUM_GPIO 16 |
| 1132 | #define AR7010_NUM_GPIO 16 | 1132 | #define AR7010_NUM_GPIO 16 |
| 1133 | 1133 | ||
| @@ -1139,12 +1139,12 @@ enum { | |||
| 1139 | #define AR9300_GPIO_MASK 0x0000F4FF | 1139 | #define AR9300_GPIO_MASK 0x0000F4FF |
| 1140 | #define AR9330_GPIO_MASK 0x0000F4FF | 1140 | #define AR9330_GPIO_MASK 0x0000F4FF |
| 1141 | #define AR9340_GPIO_MASK 0x0000000F | 1141 | #define AR9340_GPIO_MASK 0x0000000F |
| 1142 | #define AR9462_GPIO_MASK 0x000003FF | 1142 | #define AR9462_GPIO_MASK 0x00003FFF |
| 1143 | #define AR9485_GPIO_MASK 0x00000FFF | 1143 | #define AR9485_GPIO_MASK 0x00000FFF |
| 1144 | #define AR9531_GPIO_MASK 0x0000000F | 1144 | #define AR9531_GPIO_MASK 0x0000000F |
| 1145 | #define AR9550_GPIO_MASK 0x0000000F | 1145 | #define AR9550_GPIO_MASK 0x0000000F |
| 1146 | #define AR9561_GPIO_MASK 0x0000000F | 1146 | #define AR9561_GPIO_MASK 0x0000000F |
| 1147 | #define AR9565_GPIO_MASK 0x00000FFF | 1147 | #define AR9565_GPIO_MASK 0x00003FFF |
| 1148 | #define AR9580_GPIO_MASK 0x0000F4FF | 1148 | #define AR9580_GPIO_MASK 0x0000F4FF |
| 1149 | #define AR7010_GPIO_MASK 0x0000FFFF | 1149 | #define AR7010_GPIO_MASK 0x0000FFFF |
| 1150 | 1150 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index e5f267b21316..18a8474b5760 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | |||
| @@ -3851,8 +3851,8 @@ static int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx, | |||
| 3851 | if (idx != 0) | 3851 | if (idx != 0) |
| 3852 | return -ENOENT; | 3852 | return -ENOENT; |
| 3853 | 3853 | ||
| 3854 | if (fw_has_capa(&mvm->fw->ucode_capa, | 3854 | if (!fw_has_capa(&mvm->fw->ucode_capa, |
| 3855 | IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) | 3855 | IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) |
| 3856 | return -ENOENT; | 3856 | return -ENOENT; |
| 3857 | 3857 | ||
| 3858 | mutex_lock(&mvm->mutex); | 3858 | mutex_lock(&mvm->mutex); |
| @@ -3898,8 +3898,8 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, | |||
| 3898 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 3898 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
| 3899 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | 3899 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
| 3900 | 3900 | ||
| 3901 | if (fw_has_capa(&mvm->fw->ucode_capa, | 3901 | if (!fw_has_capa(&mvm->fw->ucode_capa, |
| 3902 | IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) | 3902 | IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) |
| 3903 | return; | 3903 | return; |
| 3904 | 3904 | ||
| 3905 | /* if beacon filtering isn't on mac80211 does it anyway */ | 3905 | /* if beacon filtering isn't on mac80211 does it anyway */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c index ac2c5718e454..2c61516d06ff 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | |||
| @@ -581,7 +581,7 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, | |||
| 581 | struct iwl_rx_mpdu_desc *desc) | 581 | struct iwl_rx_mpdu_desc *desc) |
| 582 | { | 582 | { |
| 583 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 583 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
| 584 | struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta); | 584 | struct iwl_mvm_sta *mvm_sta; |
| 585 | struct iwl_mvm_baid_data *baid_data; | 585 | struct iwl_mvm_baid_data *baid_data; |
| 586 | struct iwl_mvm_reorder_buffer *buffer; | 586 | struct iwl_mvm_reorder_buffer *buffer; |
| 587 | struct sk_buff *tail; | 587 | struct sk_buff *tail; |
| @@ -604,6 +604,8 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm, | |||
| 604 | if (WARN_ON(IS_ERR_OR_NULL(sta))) | 604 | if (WARN_ON(IS_ERR_OR_NULL(sta))) |
| 605 | return false; | 605 | return false; |
| 606 | 606 | ||
| 607 | mvm_sta = iwl_mvm_sta_from_mac80211(sta); | ||
| 608 | |||
| 607 | /* not a data packet */ | 609 | /* not a data packet */ |
| 608 | if (!ieee80211_is_data_qos(hdr->frame_control) || | 610 | if (!ieee80211_is_data_qos(hdr->frame_control) || |
| 609 | is_multicast_ether_addr(hdr->addr1)) | 611 | is_multicast_ether_addr(hdr->addr1)) |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 6f609dd5c222..e78fc567ff7d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c | |||
| @@ -1222,7 +1222,7 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) | |||
| 1222 | return -EIO; | 1222 | return -EIO; |
| 1223 | } | 1223 | } |
| 1224 | 1224 | ||
| 1225 | #define SCAN_TIMEOUT (16 * HZ) | 1225 | #define SCAN_TIMEOUT (20 * HZ) |
| 1226 | 1226 | ||
| 1227 | void iwl_mvm_scan_timeout(unsigned long data) | 1227 | void iwl_mvm_scan_timeout(unsigned long data) |
| 1228 | { | 1228 | { |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index fea4d3437e2f..b23ab4a4504f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | |||
| @@ -1852,12 +1852,18 @@ static struct iwl_mvm_sta *iwl_mvm_get_key_sta(struct iwl_mvm *mvm, | |||
| 1852 | mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { | 1852 | mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { |
| 1853 | u8 sta_id = mvmvif->ap_sta_id; | 1853 | u8 sta_id = mvmvif->ap_sta_id; |
| 1854 | 1854 | ||
| 1855 | sta = rcu_dereference_check(mvm->fw_id_to_mac_id[sta_id], | ||
| 1856 | lockdep_is_held(&mvm->mutex)); | ||
| 1857 | |||
| 1855 | /* | 1858 | /* |
| 1856 | * It is possible that the 'sta' parameter is NULL, | 1859 | * It is possible that the 'sta' parameter is NULL, |
| 1857 | * for example when a GTK is removed - the sta_id will then | 1860 | * for example when a GTK is removed - the sta_id will then |
| 1858 | * be the AP ID, and no station was passed by mac80211. | 1861 | * be the AP ID, and no station was passed by mac80211. |
| 1859 | */ | 1862 | */ |
| 1860 | return iwl_mvm_sta_from_staid_protected(mvm, sta_id); | 1863 | if (IS_ERR_OR_NULL(sta)) |
| 1864 | return NULL; | ||
| 1865 | |||
| 1866 | return iwl_mvm_sta_from_mac80211(sta); | ||
| 1861 | } | 1867 | } |
| 1862 | 1868 | ||
| 1863 | return NULL; | 1869 | return NULL; |
| @@ -1955,6 +1961,14 @@ static int iwl_mvm_send_sta_igtk(struct iwl_mvm *mvm, | |||
| 1955 | struct ieee80211_key_seq seq; | 1961 | struct ieee80211_key_seq seq; |
| 1956 | const u8 *pn; | 1962 | const u8 *pn; |
| 1957 | 1963 | ||
| 1964 | switch (keyconf->cipher) { | ||
| 1965 | case WLAN_CIPHER_SUITE_AES_CMAC: | ||
| 1966 | igtk_cmd.ctrl_flags |= cpu_to_le32(STA_KEY_FLG_CCM); | ||
| 1967 | break; | ||
| 1968 | default: | ||
| 1969 | return -EINVAL; | ||
| 1970 | } | ||
| 1971 | |||
| 1958 | memcpy(igtk_cmd.IGTK, keyconf->key, keyconf->keylen); | 1972 | memcpy(igtk_cmd.IGTK, keyconf->key, keyconf->keylen); |
| 1959 | ieee80211_get_key_rx_seq(keyconf, 0, &seq); | 1973 | ieee80211_get_key_rx_seq(keyconf, 0, &seq); |
| 1960 | pn = seq.aes_cmac.pn; | 1974 | pn = seq.aes_cmac.pn; |
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c index fe19ace0d6a0..b04cf30f3959 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | |||
| @@ -1149,7 +1149,7 @@ static void rtl8192eu_phy_iqcalibrate(struct rtl8xxxu_priv *priv, | |||
| 1149 | 1149 | ||
| 1150 | for (i = 0; i < retry; i++) { | 1150 | for (i = 0; i < retry; i++) { |
| 1151 | path_b_ok = rtl8192eu_rx_iqk_path_b(priv); | 1151 | path_b_ok = rtl8192eu_rx_iqk_path_b(priv); |
| 1152 | if (path_a_ok == 0x03) { | 1152 | if (path_b_ok == 0x03) { |
| 1153 | val32 = rtl8xxxu_read32(priv, | 1153 | val32 = rtl8xxxu_read32(priv, |
| 1154 | REG_RX_POWER_BEFORE_IQK_B_2); | 1154 | REG_RX_POWER_BEFORE_IQK_B_2); |
| 1155 | result[t][6] = (val32 >> 16) & 0x3ff; | 1155 | result[t][6] = (val32 >> 16) & 0x3ff; |
diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index f7718ec685fa..cea8350fbc7e 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c | |||
| @@ -344,6 +344,8 @@ struct device *nd_pfn_create(struct nd_region *nd_region) | |||
| 344 | int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) | 344 | int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) |
| 345 | { | 345 | { |
| 346 | u64 checksum, offset; | 346 | u64 checksum, offset; |
| 347 | unsigned long align; | ||
| 348 | enum nd_pfn_mode mode; | ||
| 347 | struct nd_namespace_io *nsio; | 349 | struct nd_namespace_io *nsio; |
| 348 | struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; | 350 | struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; |
| 349 | struct nd_namespace_common *ndns = nd_pfn->ndns; | 351 | struct nd_namespace_common *ndns = nd_pfn->ndns; |
| @@ -386,22 +388,50 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) | |||
| 386 | return -ENXIO; | 388 | return -ENXIO; |
| 387 | } | 389 | } |
| 388 | 390 | ||
| 391 | align = le32_to_cpu(pfn_sb->align); | ||
| 392 | offset = le64_to_cpu(pfn_sb->dataoff); | ||
| 393 | if (align == 0) | ||
| 394 | align = 1UL << ilog2(offset); | ||
| 395 | mode = le32_to_cpu(pfn_sb->mode); | ||
| 396 | |||
| 389 | if (!nd_pfn->uuid) { | 397 | if (!nd_pfn->uuid) { |
| 390 | /* from probe we allocate */ | 398 | /* |
| 399 | * When probing a namepace via nd_pfn_probe() the uuid | ||
| 400 | * is NULL (see: nd_pfn_devinit()) we init settings from | ||
| 401 | * pfn_sb | ||
| 402 | */ | ||
| 391 | nd_pfn->uuid = kmemdup(pfn_sb->uuid, 16, GFP_KERNEL); | 403 | nd_pfn->uuid = kmemdup(pfn_sb->uuid, 16, GFP_KERNEL); |
| 392 | if (!nd_pfn->uuid) | 404 | if (!nd_pfn->uuid) |
| 393 | return -ENOMEM; | 405 | return -ENOMEM; |
| 406 | nd_pfn->align = align; | ||
| 407 | nd_pfn->mode = mode; | ||
| 394 | } else { | 408 | } else { |
| 395 | /* from init we validate */ | 409 | /* |
| 410 | * When probing a pfn / dax instance we validate the | ||
| 411 | * live settings against the pfn_sb | ||
| 412 | */ | ||
| 396 | if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0) | 413 | if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0) |
| 397 | return -ENODEV; | 414 | return -ENODEV; |
| 415 | |||
| 416 | /* | ||
| 417 | * If the uuid validates, but other settings mismatch | ||
| 418 | * return EINVAL because userspace has managed to change | ||
| 419 | * the configuration without specifying new | ||
| 420 | * identification. | ||
| 421 | */ | ||
| 422 | if (nd_pfn->align != align || nd_pfn->mode != mode) { | ||
| 423 | dev_err(&nd_pfn->dev, | ||
| 424 | "init failed, settings mismatch\n"); | ||
| 425 | dev_dbg(&nd_pfn->dev, "align: %lx:%lx mode: %d:%d\n", | ||
| 426 | nd_pfn->align, align, nd_pfn->mode, | ||
| 427 | mode); | ||
| 428 | return -EINVAL; | ||
| 429 | } | ||
| 398 | } | 430 | } |
| 399 | 431 | ||
| 400 | if (nd_pfn->align == 0) | 432 | if (align > nvdimm_namespace_capacity(ndns)) { |
| 401 | nd_pfn->align = le32_to_cpu(pfn_sb->align); | ||
| 402 | if (nd_pfn->align > nvdimm_namespace_capacity(ndns)) { | ||
| 403 | dev_err(&nd_pfn->dev, "alignment: %lx exceeds capacity %llx\n", | 433 | dev_err(&nd_pfn->dev, "alignment: %lx exceeds capacity %llx\n", |
| 404 | nd_pfn->align, nvdimm_namespace_capacity(ndns)); | 434 | align, nvdimm_namespace_capacity(ndns)); |
| 405 | return -EINVAL; | 435 | return -EINVAL; |
| 406 | } | 436 | } |
| 407 | 437 | ||
| @@ -411,7 +441,6 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) | |||
| 411 | * namespace has changed since the pfn superblock was | 441 | * namespace has changed since the pfn superblock was |
| 412 | * established. | 442 | * established. |
| 413 | */ | 443 | */ |
| 414 | offset = le64_to_cpu(pfn_sb->dataoff); | ||
| 415 | nsio = to_nd_namespace_io(&ndns->dev); | 444 | nsio = to_nd_namespace_io(&ndns->dev); |
| 416 | if (offset >= resource_size(&nsio->res)) { | 445 | if (offset >= resource_size(&nsio->res)) { |
| 417 | dev_err(&nd_pfn->dev, "pfn array size exceeds capacity of %s\n", | 446 | dev_err(&nd_pfn->dev, "pfn array size exceeds capacity of %s\n", |
| @@ -419,10 +448,11 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) | |||
| 419 | return -EBUSY; | 448 | return -EBUSY; |
| 420 | } | 449 | } |
| 421 | 450 | ||
| 422 | if ((nd_pfn->align && !IS_ALIGNED(offset, nd_pfn->align)) | 451 | if ((align && !IS_ALIGNED(offset, align)) |
| 423 | || !IS_ALIGNED(offset, PAGE_SIZE)) { | 452 | || !IS_ALIGNED(offset, PAGE_SIZE)) { |
| 424 | dev_err(&nd_pfn->dev, "bad offset: %#llx dax disabled\n", | 453 | dev_err(&nd_pfn->dev, |
| 425 | offset); | 454 | "bad offset: %#llx dax disabled align: %#lx\n", |
| 455 | offset, align); | ||
| 426 | return -ENXIO; | 456 | return -ENXIO; |
| 427 | } | 457 | } |
| 428 | 458 | ||
| @@ -502,7 +532,6 @@ static struct vmem_altmap *__nvdimm_setup_pfn(struct nd_pfn *nd_pfn, | |||
| 502 | res->start += start_pad; | 532 | res->start += start_pad; |
| 503 | res->end -= end_trunc; | 533 | res->end -= end_trunc; |
| 504 | 534 | ||
| 505 | nd_pfn->mode = le32_to_cpu(nd_pfn->pfn_sb->mode); | ||
| 506 | if (nd_pfn->mode == PFN_MODE_RAM) { | 535 | if (nd_pfn->mode == PFN_MODE_RAM) { |
| 507 | if (offset < SZ_8K) | 536 | if (offset < SZ_8K) |
| 508 | return ERR_PTR(-EINVAL); | 537 | return ERR_PTR(-EINVAL); |
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 1a51584a382b..d5fb55c0a9d9 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
| @@ -1394,19 +1394,22 @@ static int ns_cmp(void *priv, struct list_head *a, struct list_head *b) | |||
| 1394 | return nsa->ns_id - nsb->ns_id; | 1394 | return nsa->ns_id - nsb->ns_id; |
| 1395 | } | 1395 | } |
| 1396 | 1396 | ||
| 1397 | static struct nvme_ns *nvme_find_ns(struct nvme_ctrl *ctrl, unsigned nsid) | 1397 | static struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) |
| 1398 | { | 1398 | { |
| 1399 | struct nvme_ns *ns; | 1399 | struct nvme_ns *ns, *ret = NULL; |
| 1400 | |||
| 1401 | lockdep_assert_held(&ctrl->namespaces_mutex); | ||
| 1402 | 1400 | ||
| 1401 | mutex_lock(&ctrl->namespaces_mutex); | ||
| 1403 | list_for_each_entry(ns, &ctrl->namespaces, list) { | 1402 | list_for_each_entry(ns, &ctrl->namespaces, list) { |
| 1404 | if (ns->ns_id == nsid) | 1403 | if (ns->ns_id == nsid) { |
| 1405 | return ns; | 1404 | kref_get(&ns->kref); |
| 1405 | ret = ns; | ||
| 1406 | break; | ||
| 1407 | } | ||
| 1406 | if (ns->ns_id > nsid) | 1408 | if (ns->ns_id > nsid) |
| 1407 | break; | 1409 | break; |
| 1408 | } | 1410 | } |
| 1409 | return NULL; | 1411 | mutex_unlock(&ctrl->namespaces_mutex); |
| 1412 | return ret; | ||
| 1410 | } | 1413 | } |
| 1411 | 1414 | ||
| 1412 | static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) | 1415 | static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) |
| @@ -1415,8 +1418,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) | |||
| 1415 | struct gendisk *disk; | 1418 | struct gendisk *disk; |
| 1416 | int node = dev_to_node(ctrl->dev); | 1419 | int node = dev_to_node(ctrl->dev); |
| 1417 | 1420 | ||
| 1418 | lockdep_assert_held(&ctrl->namespaces_mutex); | ||
| 1419 | |||
| 1420 | ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node); | 1421 | ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node); |
| 1421 | if (!ns) | 1422 | if (!ns) |
| 1422 | return; | 1423 | return; |
| @@ -1457,7 +1458,10 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) | |||
| 1457 | if (nvme_revalidate_disk(ns->disk)) | 1458 | if (nvme_revalidate_disk(ns->disk)) |
| 1458 | goto out_free_disk; | 1459 | goto out_free_disk; |
| 1459 | 1460 | ||
| 1460 | list_add_tail_rcu(&ns->list, &ctrl->namespaces); | 1461 | mutex_lock(&ctrl->namespaces_mutex); |
| 1462 | list_add_tail(&ns->list, &ctrl->namespaces); | ||
| 1463 | mutex_unlock(&ctrl->namespaces_mutex); | ||
| 1464 | |||
| 1461 | kref_get(&ctrl->kref); | 1465 | kref_get(&ctrl->kref); |
| 1462 | if (ns->type == NVME_NS_LIGHTNVM) | 1466 | if (ns->type == NVME_NS_LIGHTNVM) |
| 1463 | return; | 1467 | return; |
| @@ -1480,8 +1484,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) | |||
| 1480 | 1484 | ||
| 1481 | static void nvme_ns_remove(struct nvme_ns *ns) | 1485 | static void nvme_ns_remove(struct nvme_ns *ns) |
| 1482 | { | 1486 | { |
| 1483 | lockdep_assert_held(&ns->ctrl->namespaces_mutex); | ||
| 1484 | |||
| 1485 | if (test_and_set_bit(NVME_NS_REMOVING, &ns->flags)) | 1487 | if (test_and_set_bit(NVME_NS_REMOVING, &ns->flags)) |
| 1486 | return; | 1488 | return; |
| 1487 | 1489 | ||
| @@ -1494,8 +1496,11 @@ static void nvme_ns_remove(struct nvme_ns *ns) | |||
| 1494 | blk_mq_abort_requeue_list(ns->queue); | 1496 | blk_mq_abort_requeue_list(ns->queue); |
| 1495 | blk_cleanup_queue(ns->queue); | 1497 | blk_cleanup_queue(ns->queue); |
| 1496 | } | 1498 | } |
| 1499 | |||
| 1500 | mutex_lock(&ns->ctrl->namespaces_mutex); | ||
| 1497 | list_del_init(&ns->list); | 1501 | list_del_init(&ns->list); |
| 1498 | synchronize_rcu(); | 1502 | mutex_unlock(&ns->ctrl->namespaces_mutex); |
| 1503 | |||
| 1499 | nvme_put_ns(ns); | 1504 | nvme_put_ns(ns); |
| 1500 | } | 1505 | } |
| 1501 | 1506 | ||
| @@ -1503,10 +1508,11 @@ static void nvme_validate_ns(struct nvme_ctrl *ctrl, unsigned nsid) | |||
| 1503 | { | 1508 | { |
| 1504 | struct nvme_ns *ns; | 1509 | struct nvme_ns *ns; |
| 1505 | 1510 | ||
| 1506 | ns = nvme_find_ns(ctrl, nsid); | 1511 | ns = nvme_find_get_ns(ctrl, nsid); |
| 1507 | if (ns) { | 1512 | if (ns) { |
| 1508 | if (revalidate_disk(ns->disk)) | 1513 | if (revalidate_disk(ns->disk)) |
| 1509 | nvme_ns_remove(ns); | 1514 | nvme_ns_remove(ns); |
| 1515 | nvme_put_ns(ns); | ||
| 1510 | } else | 1516 | } else |
| 1511 | nvme_alloc_ns(ctrl, nsid); | 1517 | nvme_alloc_ns(ctrl, nsid); |
| 1512 | } | 1518 | } |
| @@ -1535,9 +1541,11 @@ static int nvme_scan_ns_list(struct nvme_ctrl *ctrl, unsigned nn) | |||
| 1535 | nvme_validate_ns(ctrl, nsid); | 1541 | nvme_validate_ns(ctrl, nsid); |
| 1536 | 1542 | ||
| 1537 | while (++prev < nsid) { | 1543 | while (++prev < nsid) { |
| 1538 | ns = nvme_find_ns(ctrl, prev); | 1544 | ns = nvme_find_get_ns(ctrl, prev); |
| 1539 | if (ns) | 1545 | if (ns) { |
| 1540 | nvme_ns_remove(ns); | 1546 | nvme_ns_remove(ns); |
| 1547 | nvme_put_ns(ns); | ||
| 1548 | } | ||
| 1541 | } | 1549 | } |
| 1542 | } | 1550 | } |
| 1543 | nn -= j; | 1551 | nn -= j; |
| @@ -1552,8 +1560,6 @@ static void nvme_scan_ns_sequential(struct nvme_ctrl *ctrl, unsigned nn) | |||
| 1552 | struct nvme_ns *ns, *next; | 1560 | struct nvme_ns *ns, *next; |
| 1553 | unsigned i; | 1561 | unsigned i; |
| 1554 | 1562 | ||
| 1555 | lockdep_assert_held(&ctrl->namespaces_mutex); | ||
| 1556 | |||
| 1557 | for (i = 1; i <= nn; i++) | 1563 | for (i = 1; i <= nn; i++) |
| 1558 | nvme_validate_ns(ctrl, i); | 1564 | nvme_validate_ns(ctrl, i); |
| 1559 | 1565 | ||
| @@ -1576,7 +1582,6 @@ static void nvme_scan_work(struct work_struct *work) | |||
| 1576 | if (nvme_identify_ctrl(ctrl, &id)) | 1582 | if (nvme_identify_ctrl(ctrl, &id)) |
| 1577 | return; | 1583 | return; |
| 1578 | 1584 | ||
| 1579 | mutex_lock(&ctrl->namespaces_mutex); | ||
| 1580 | nn = le32_to_cpu(id->nn); | 1585 | nn = le32_to_cpu(id->nn); |
| 1581 | if (ctrl->vs >= NVME_VS(1, 1) && | 1586 | if (ctrl->vs >= NVME_VS(1, 1) && |
| 1582 | !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) { | 1587 | !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) { |
| @@ -1585,6 +1590,7 @@ static void nvme_scan_work(struct work_struct *work) | |||
| 1585 | } | 1590 | } |
| 1586 | nvme_scan_ns_sequential(ctrl, nn); | 1591 | nvme_scan_ns_sequential(ctrl, nn); |
| 1587 | done: | 1592 | done: |
| 1593 | mutex_lock(&ctrl->namespaces_mutex); | ||
| 1588 | list_sort(NULL, &ctrl->namespaces, ns_cmp); | 1594 | list_sort(NULL, &ctrl->namespaces, ns_cmp); |
| 1589 | mutex_unlock(&ctrl->namespaces_mutex); | 1595 | mutex_unlock(&ctrl->namespaces_mutex); |
| 1590 | kfree(id); | 1596 | kfree(id); |
| @@ -1604,6 +1610,11 @@ void nvme_queue_scan(struct nvme_ctrl *ctrl) | |||
| 1604 | } | 1610 | } |
| 1605 | EXPORT_SYMBOL_GPL(nvme_queue_scan); | 1611 | EXPORT_SYMBOL_GPL(nvme_queue_scan); |
| 1606 | 1612 | ||
| 1613 | /* | ||
| 1614 | * This function iterates the namespace list unlocked to allow recovery from | ||
| 1615 | * controller failure. It is up to the caller to ensure the namespace list is | ||
| 1616 | * not modified by scan work while this function is executing. | ||
| 1617 | */ | ||
| 1607 | void nvme_remove_namespaces(struct nvme_ctrl *ctrl) | 1618 | void nvme_remove_namespaces(struct nvme_ctrl *ctrl) |
| 1608 | { | 1619 | { |
| 1609 | struct nvme_ns *ns, *next; | 1620 | struct nvme_ns *ns, *next; |
| @@ -1617,10 +1628,8 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl) | |||
| 1617 | if (ctrl->state == NVME_CTRL_DEAD) | 1628 | if (ctrl->state == NVME_CTRL_DEAD) |
| 1618 | nvme_kill_queues(ctrl); | 1629 | nvme_kill_queues(ctrl); |
| 1619 | 1630 | ||
| 1620 | mutex_lock(&ctrl->namespaces_mutex); | ||
| 1621 | list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) | 1631 | list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) |
| 1622 | nvme_ns_remove(ns); | 1632 | nvme_ns_remove(ns); |
| 1623 | mutex_unlock(&ctrl->namespaces_mutex); | ||
| 1624 | } | 1633 | } |
| 1625 | EXPORT_SYMBOL_GPL(nvme_remove_namespaces); | 1634 | EXPORT_SYMBOL_GPL(nvme_remove_namespaces); |
| 1626 | 1635 | ||
| @@ -1791,11 +1800,8 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl) | |||
| 1791 | { | 1800 | { |
| 1792 | struct nvme_ns *ns; | 1801 | struct nvme_ns *ns; |
| 1793 | 1802 | ||
| 1794 | rcu_read_lock(); | 1803 | mutex_lock(&ctrl->namespaces_mutex); |
| 1795 | list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { | 1804 | list_for_each_entry(ns, &ctrl->namespaces, list) { |
| 1796 | if (!kref_get_unless_zero(&ns->kref)) | ||
| 1797 | continue; | ||
| 1798 | |||
| 1799 | /* | 1805 | /* |
| 1800 | * Revalidating a dead namespace sets capacity to 0. This will | 1806 | * Revalidating a dead namespace sets capacity to 0. This will |
| 1801 | * end buffered writers dirtying pages that can't be synced. | 1807 | * end buffered writers dirtying pages that can't be synced. |
| @@ -1806,10 +1812,8 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl) | |||
| 1806 | blk_set_queue_dying(ns->queue); | 1812 | blk_set_queue_dying(ns->queue); |
| 1807 | blk_mq_abort_requeue_list(ns->queue); | 1813 | blk_mq_abort_requeue_list(ns->queue); |
| 1808 | blk_mq_start_stopped_hw_queues(ns->queue, true); | 1814 | blk_mq_start_stopped_hw_queues(ns->queue, true); |
| 1809 | |||
| 1810 | nvme_put_ns(ns); | ||
| 1811 | } | 1815 | } |
| 1812 | rcu_read_unlock(); | 1816 | mutex_unlock(&ctrl->namespaces_mutex); |
| 1813 | } | 1817 | } |
| 1814 | EXPORT_SYMBOL_GPL(nvme_kill_queues); | 1818 | EXPORT_SYMBOL_GPL(nvme_kill_queues); |
| 1815 | 1819 | ||
| @@ -1817,8 +1821,8 @@ void nvme_stop_queues(struct nvme_ctrl *ctrl) | |||
| 1817 | { | 1821 | { |
| 1818 | struct nvme_ns *ns; | 1822 | struct nvme_ns *ns; |
| 1819 | 1823 | ||
| 1820 | rcu_read_lock(); | 1824 | mutex_lock(&ctrl->namespaces_mutex); |
| 1821 | list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { | 1825 | list_for_each_entry(ns, &ctrl->namespaces, list) { |
| 1822 | spin_lock_irq(ns->queue->queue_lock); | 1826 | spin_lock_irq(ns->queue->queue_lock); |
| 1823 | queue_flag_set(QUEUE_FLAG_STOPPED, ns->queue); | 1827 | queue_flag_set(QUEUE_FLAG_STOPPED, ns->queue); |
| 1824 | spin_unlock_irq(ns->queue->queue_lock); | 1828 | spin_unlock_irq(ns->queue->queue_lock); |
| @@ -1826,7 +1830,7 @@ void nvme_stop_queues(struct nvme_ctrl *ctrl) | |||
| 1826 | blk_mq_cancel_requeue_work(ns->queue); | 1830 | blk_mq_cancel_requeue_work(ns->queue); |
| 1827 | blk_mq_stop_hw_queues(ns->queue); | 1831 | blk_mq_stop_hw_queues(ns->queue); |
| 1828 | } | 1832 | } |
| 1829 | rcu_read_unlock(); | 1833 | mutex_unlock(&ctrl->namespaces_mutex); |
| 1830 | } | 1834 | } |
| 1831 | EXPORT_SYMBOL_GPL(nvme_stop_queues); | 1835 | EXPORT_SYMBOL_GPL(nvme_stop_queues); |
| 1832 | 1836 | ||
| @@ -1834,13 +1838,13 @@ void nvme_start_queues(struct nvme_ctrl *ctrl) | |||
| 1834 | { | 1838 | { |
| 1835 | struct nvme_ns *ns; | 1839 | struct nvme_ns *ns; |
| 1836 | 1840 | ||
| 1837 | rcu_read_lock(); | 1841 | mutex_lock(&ctrl->namespaces_mutex); |
| 1838 | list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { | 1842 | list_for_each_entry(ns, &ctrl->namespaces, list) { |
| 1839 | queue_flag_clear_unlocked(QUEUE_FLAG_STOPPED, ns->queue); | 1843 | queue_flag_clear_unlocked(QUEUE_FLAG_STOPPED, ns->queue); |
| 1840 | blk_mq_start_stopped_hw_queues(ns->queue, true); | 1844 | blk_mq_start_stopped_hw_queues(ns->queue, true); |
| 1841 | blk_mq_kick_requeue_list(ns->queue); | 1845 | blk_mq_kick_requeue_list(ns->queue); |
| 1842 | } | 1846 | } |
| 1843 | rcu_read_unlock(); | 1847 | mutex_unlock(&ctrl->namespaces_mutex); |
| 1844 | } | 1848 | } |
| 1845 | EXPORT_SYMBOL_GPL(nvme_start_queues); | 1849 | EXPORT_SYMBOL_GPL(nvme_start_queues); |
| 1846 | 1850 | ||
diff --git a/drivers/phy/phy-bcm-ns-usb2.c b/drivers/phy/phy-bcm-ns-usb2.c index 95ab6b2a0de5..58dff80e9386 100644 --- a/drivers/phy/phy-bcm-ns-usb2.c +++ b/drivers/phy/phy-bcm-ns-usb2.c | |||
| @@ -109,8 +109,8 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | usb2->phy = devm_phy_create(dev, NULL, &ops); | 111 | usb2->phy = devm_phy_create(dev, NULL, &ops); |
| 112 | if (IS_ERR(dev)) | 112 | if (IS_ERR(usb2->phy)) |
| 113 | return PTR_ERR(dev); | 113 | return PTR_ERR(usb2->phy); |
| 114 | 114 | ||
| 115 | phy_set_drvdata(usb2->phy, usb2); | 115 | phy_set_drvdata(usb2->phy, usb2); |
| 116 | platform_set_drvdata(pdev, usb2); | 116 | platform_set_drvdata(pdev, usb2); |
diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c index 3acd2a1808df..213e2e15339c 100644 --- a/drivers/phy/phy-miphy28lp.c +++ b/drivers/phy/phy-miphy28lp.c | |||
| @@ -1143,7 +1143,8 @@ static int miphy28lp_probe_resets(struct device_node *node, | |||
| 1143 | struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; | 1143 | struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; |
| 1144 | int err; | 1144 | int err; |
| 1145 | 1145 | ||
| 1146 | miphy_phy->miphy_rst = of_reset_control_get(node, "miphy-sw-rst"); | 1146 | miphy_phy->miphy_rst = |
| 1147 | of_reset_control_get_shared(node, "miphy-sw-rst"); | ||
| 1147 | 1148 | ||
| 1148 | if (IS_ERR(miphy_phy->miphy_rst)) { | 1149 | if (IS_ERR(miphy_phy->miphy_rst)) { |
| 1149 | dev_err(miphy_dev->dev, | 1150 | dev_err(miphy_dev->dev, |
diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c index 76bb88f0700a..4be3f5dbbc9f 100644 --- a/drivers/phy/phy-rcar-gen3-usb2.c +++ b/drivers/phy/phy-rcar-gen3-usb2.c | |||
| @@ -144,12 +144,6 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch) | |||
| 144 | extcon_set_cable_state_(ch->extcon, EXTCON_USB, true); | 144 | extcon_set_cable_state_(ch->extcon, EXTCON_USB, true); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch) | ||
| 148 | { | ||
| 149 | return !!(readl(ch->base + USB2_ADPCTRL) & | ||
| 150 | USB2_ADPCTRL_OTGSESSVLD); | ||
| 151 | } | ||
| 152 | |||
| 153 | static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch) | 147 | static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch) |
| 154 | { | 148 | { |
| 155 | return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG); | 149 | return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG); |
| @@ -157,13 +151,7 @@ static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch) | |||
| 157 | 151 | ||
| 158 | static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch) | 152 | static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch) |
| 159 | { | 153 | { |
| 160 | bool is_host = true; | 154 | if (!rcar_gen3_check_id(ch)) |
| 161 | |||
| 162 | /* B-device? */ | ||
| 163 | if (rcar_gen3_check_id(ch) && rcar_gen3_check_vbus(ch)) | ||
| 164 | is_host = false; | ||
| 165 | |||
| 166 | if (is_host) | ||
| 167 | rcar_gen3_init_for_host(ch); | 155 | rcar_gen3_init_for_host(ch); |
| 168 | else | 156 | else |
| 169 | rcar_gen3_init_for_peri(ch); | 157 | rcar_gen3_init_for_peri(ch); |
diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c index 793ecb6d87bc..8b267a746576 100644 --- a/drivers/phy/phy-rockchip-dp.c +++ b/drivers/phy/phy-rockchip-dp.c | |||
| @@ -90,7 +90,7 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev) | |||
| 90 | return -ENODEV; | 90 | return -ENODEV; |
| 91 | 91 | ||
| 92 | dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); | 92 | dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); |
| 93 | if (IS_ERR(dp)) | 93 | if (!dp) |
| 94 | return -ENOMEM; | 94 | return -ENOMEM; |
| 95 | 95 | ||
| 96 | dp->dev = dev; | 96 | dp->dev = dev; |
diff --git a/drivers/phy/phy-stih407-usb.c b/drivers/phy/phy-stih407-usb.c index 1d5ae5f8ef69..b1f44ab669fb 100644 --- a/drivers/phy/phy-stih407-usb.c +++ b/drivers/phy/phy-stih407-usb.c | |||
| @@ -105,13 +105,13 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev) | |||
| 105 | phy_dev->dev = dev; | 105 | phy_dev->dev = dev; |
| 106 | dev_set_drvdata(dev, phy_dev); | 106 | dev_set_drvdata(dev, phy_dev); |
| 107 | 107 | ||
| 108 | phy_dev->rstc = devm_reset_control_get(dev, "global"); | 108 | phy_dev->rstc = devm_reset_control_get_shared(dev, "global"); |
| 109 | if (IS_ERR(phy_dev->rstc)) { | 109 | if (IS_ERR(phy_dev->rstc)) { |
| 110 | dev_err(dev, "failed to ctrl picoPHY reset\n"); | 110 | dev_err(dev, "failed to ctrl picoPHY reset\n"); |
| 111 | return PTR_ERR(phy_dev->rstc); | 111 | return PTR_ERR(phy_dev->rstc); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | phy_dev->rstport = devm_reset_control_get(dev, "port"); | 114 | phy_dev->rstport = devm_reset_control_get_exclusive(dev, "port"); |
| 115 | if (IS_ERR(phy_dev->rstport)) { | 115 | if (IS_ERR(phy_dev->rstport)) { |
| 116 | dev_err(dev, "failed to ctrl picoPHY reset\n"); | 116 | dev_err(dev, "failed to ctrl picoPHY reset\n"); |
| 117 | return PTR_ERR(phy_dev->rstport); | 117 | return PTR_ERR(phy_dev->rstport); |
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index bae54f7a1f48..de3101fbbf40 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c | |||
| @@ -175,7 +175,7 @@ static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data, | |||
| 175 | { | 175 | { |
| 176 | struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy); | 176 | struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy); |
| 177 | u32 temp, usbc_bit = BIT(phy->index * 2); | 177 | u32 temp, usbc_bit = BIT(phy->index * 2); |
| 178 | void *phyctl = phy_data->base + phy_data->cfg->phyctl_offset; | 178 | void __iomem *phyctl = phy_data->base + phy_data->cfg->phyctl_offset; |
| 179 | int i; | 179 | int i; |
| 180 | 180 | ||
| 181 | mutex_lock(&phy_data->mutex); | 181 | mutex_lock(&phy_data->mutex); |
| @@ -514,9 +514,9 @@ static int sun4i_usb_phy_remove(struct platform_device *pdev) | |||
| 514 | 514 | ||
| 515 | if (data->vbus_power_nb_registered) | 515 | if (data->vbus_power_nb_registered) |
| 516 | power_supply_unreg_notifier(&data->vbus_power_nb); | 516 | power_supply_unreg_notifier(&data->vbus_power_nb); |
| 517 | if (data->id_det_irq >= 0) | 517 | if (data->id_det_irq > 0) |
| 518 | devm_free_irq(dev, data->id_det_irq, data); | 518 | devm_free_irq(dev, data->id_det_irq, data); |
| 519 | if (data->vbus_det_irq >= 0) | 519 | if (data->vbus_det_irq > 0) |
| 520 | devm_free_irq(dev, data->vbus_det_irq, data); | 520 | devm_free_irq(dev, data->vbus_det_irq, data); |
| 521 | 521 | ||
| 522 | cancel_delayed_work_sync(&data->detect); | 522 | cancel_delayed_work_sync(&data->detect); |
| @@ -645,11 +645,11 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) | |||
| 645 | 645 | ||
| 646 | data->id_det_irq = gpiod_to_irq(data->id_det_gpio); | 646 | data->id_det_irq = gpiod_to_irq(data->id_det_gpio); |
| 647 | data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio); | 647 | data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio); |
| 648 | if ((data->id_det_gpio && data->id_det_irq < 0) || | 648 | if ((data->id_det_gpio && data->id_det_irq <= 0) || |
| 649 | (data->vbus_det_gpio && data->vbus_det_irq < 0)) | 649 | (data->vbus_det_gpio && data->vbus_det_irq <= 0)) |
| 650 | data->phy0_poll = true; | 650 | data->phy0_poll = true; |
| 651 | 651 | ||
| 652 | if (data->id_det_irq >= 0) { | 652 | if (data->id_det_irq > 0) { |
| 653 | ret = devm_request_irq(dev, data->id_det_irq, | 653 | ret = devm_request_irq(dev, data->id_det_irq, |
| 654 | sun4i_usb_phy0_id_vbus_det_irq, | 654 | sun4i_usb_phy0_id_vbus_det_irq, |
| 655 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 655 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
| @@ -660,7 +660,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) | |||
| 660 | } | 660 | } |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | if (data->vbus_det_irq >= 0) { | 663 | if (data->vbus_det_irq > 0) { |
| 664 | ret = devm_request_irq(dev, data->vbus_det_irq, | 664 | ret = devm_request_irq(dev, data->vbus_det_irq, |
| 665 | sun4i_usb_phy0_id_vbus_det_irq, | 665 | sun4i_usb_phy0_id_vbus_det_irq, |
| 666 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 666 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index e4bc1151e04f..42a5c1dddfef 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile | |||
| @@ -23,7 +23,7 @@ obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o | |||
| 23 | obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o | 23 | obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o |
| 24 | obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o | 24 | obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o |
| 25 | obj-$(CONFIG_PINCTRL_SIRF) += sirf/ | 25 | obj-$(CONFIG_PINCTRL_SIRF) += sirf/ |
| 26 | obj-$(CONFIG_PINCTRL_TEGRA) += tegra/ | 26 | obj-$(CONFIG_ARCH_TEGRA) += tegra/ |
| 27 | obj-$(CONFIG_PINCTRL_TZ1090) += pinctrl-tz1090.o | 27 | obj-$(CONFIG_PINCTRL_TZ1090) += pinctrl-tz1090.o |
| 28 | obj-$(CONFIG_PINCTRL_TZ1090_PDC) += pinctrl-tz1090-pdc.o | 28 | obj-$(CONFIG_PINCTRL_TZ1090_PDC) += pinctrl-tz1090-pdc.o |
| 29 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o | 29 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o |
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index 47ccfcc8a647..eccb47480e1d 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c | |||
| @@ -209,9 +209,9 @@ static int imx_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, | |||
| 209 | pin_reg = &info->pin_regs[pin_id]; | 209 | pin_reg = &info->pin_regs[pin_id]; |
| 210 | 210 | ||
| 211 | if (pin_reg->mux_reg == -1) { | 211 | if (pin_reg->mux_reg == -1) { |
| 212 | dev_err(ipctl->dev, "Pin(%s) does not support mux function\n", | 212 | dev_dbg(ipctl->dev, "Pin(%s) does not support mux function\n", |
| 213 | info->pins[pin_id].name); | 213 | info->pins[pin_id].name); |
| 214 | return -EINVAL; | 214 | continue; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | if (info->flags & SHARE_MUX_CONF_REG) { | 217 | if (info->flags & SHARE_MUX_CONF_REG) { |
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index 677a811b3a6f..7abfd42e8ffd 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c | |||
| @@ -401,9 +401,9 @@ static const struct byt_simple_func_mux byt_score_sata_mux[] = { | |||
| 401 | static const unsigned int byt_score_plt_clk0_pins[] = { 96 }; | 401 | static const unsigned int byt_score_plt_clk0_pins[] = { 96 }; |
| 402 | static const unsigned int byt_score_plt_clk1_pins[] = { 97 }; | 402 | static const unsigned int byt_score_plt_clk1_pins[] = { 97 }; |
| 403 | static const unsigned int byt_score_plt_clk2_pins[] = { 98 }; | 403 | static const unsigned int byt_score_plt_clk2_pins[] = { 98 }; |
| 404 | static const unsigned int byt_score_plt_clk4_pins[] = { 99 }; | 404 | static const unsigned int byt_score_plt_clk3_pins[] = { 99 }; |
| 405 | static const unsigned int byt_score_plt_clk5_pins[] = { 100 }; | 405 | static const unsigned int byt_score_plt_clk4_pins[] = { 100 }; |
| 406 | static const unsigned int byt_score_plt_clk3_pins[] = { 101 }; | 406 | static const unsigned int byt_score_plt_clk5_pins[] = { 101 }; |
| 407 | static const struct byt_simple_func_mux byt_score_plt_clk_mux[] = { | 407 | static const struct byt_simple_func_mux byt_score_plt_clk_mux[] = { |
| 408 | SIMPLE_FUNC("plt_clk", 1), | 408 | SIMPLE_FUNC("plt_clk", 1), |
| 409 | }; | 409 | }; |
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index cf9bafa10acf..bfdf720db270 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c | |||
| @@ -1580,6 +1580,9 @@ static inline void pcs_irq_set(struct pcs_soc_data *pcs_soc, | |||
| 1580 | else | 1580 | else |
| 1581 | mask &= ~soc_mask; | 1581 | mask &= ~soc_mask; |
| 1582 | pcs->write(mask, pcswi->reg); | 1582 | pcs->write(mask, pcswi->reg); |
| 1583 | |||
| 1584 | /* flush posted write */ | ||
| 1585 | mask = pcs->read(pcswi->reg); | ||
| 1583 | raw_spin_unlock(&pcs->lock); | 1586 | raw_spin_unlock(&pcs->lock); |
| 1584 | } | 1587 | } |
| 1585 | 1588 | ||
diff --git a/drivers/pinctrl/tegra/Makefile b/drivers/pinctrl/tegra/Makefile index a927379b6794..d9ea2be69cc4 100644 --- a/drivers/pinctrl/tegra/Makefile +++ b/drivers/pinctrl/tegra/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | obj-y += pinctrl-tegra.o | 1 | obj-$(CONFIG_PINCTRL_TEGRA) += pinctrl-tegra.o |
| 2 | obj-$(CONFIG_PINCTRL_TEGRA20) += pinctrl-tegra20.o | 2 | obj-$(CONFIG_PINCTRL_TEGRA20) += pinctrl-tegra20.o |
| 3 | obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o | 3 | obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o |
| 4 | obj-$(CONFIG_PINCTRL_TEGRA114) += pinctrl-tegra114.o | 4 | obj-$(CONFIG_PINCTRL_TEGRA114) += pinctrl-tegra114.o |
diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c index 6d8ee3b15872..8abd80dbcbed 100644 --- a/drivers/platform/chrome/cros_ec_dev.c +++ b/drivers/platform/chrome/cros_ec_dev.c | |||
| @@ -151,13 +151,19 @@ static long ec_device_ioctl_xcmd(struct cros_ec_dev *ec, void __user *arg) | |||
| 151 | goto exit; | 151 | goto exit; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | if (u_cmd.outsize != s_cmd->outsize || | ||
| 155 | u_cmd.insize != s_cmd->insize) { | ||
| 156 | ret = -EINVAL; | ||
| 157 | goto exit; | ||
| 158 | } | ||
| 159 | |||
| 154 | s_cmd->command += ec->cmd_offset; | 160 | s_cmd->command += ec->cmd_offset; |
| 155 | ret = cros_ec_cmd_xfer(ec->ec_dev, s_cmd); | 161 | ret = cros_ec_cmd_xfer(ec->ec_dev, s_cmd); |
| 156 | /* Only copy data to userland if data was received. */ | 162 | /* Only copy data to userland if data was received. */ |
| 157 | if (ret < 0) | 163 | if (ret < 0) |
| 158 | goto exit; | 164 | goto exit; |
| 159 | 165 | ||
| 160 | if (copy_to_user(arg, s_cmd, sizeof(*s_cmd) + u_cmd.insize)) | 166 | if (copy_to_user(arg, s_cmd, sizeof(*s_cmd) + s_cmd->insize)) |
| 161 | ret = -EFAULT; | 167 | ret = -EFAULT; |
| 162 | exit: | 168 | exit: |
| 163 | kfree(s_cmd); | 169 | kfree(s_cmd); |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 456987c88baa..b13cd074c52a 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
| @@ -565,11 +565,12 @@ static int power_supply_read_temp(struct thermal_zone_device *tzd, | |||
| 565 | 565 | ||
| 566 | WARN_ON(tzd == NULL); | 566 | WARN_ON(tzd == NULL); |
| 567 | psy = tzd->devdata; | 567 | psy = tzd->devdata; |
| 568 | ret = psy->desc->get_property(psy, POWER_SUPPLY_PROP_TEMP, &val); | 568 | ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &val); |
| 569 | if (ret) | ||
| 570 | return ret; | ||
| 569 | 571 | ||
| 570 | /* Convert tenths of degree Celsius to milli degree Celsius. */ | 572 | /* Convert tenths of degree Celsius to milli degree Celsius. */ |
| 571 | if (!ret) | 573 | *temp = val.intval * 100; |
| 572 | *temp = val.intval * 100; | ||
| 573 | 574 | ||
| 574 | return ret; | 575 | return ret; |
| 575 | } | 576 | } |
| @@ -612,10 +613,12 @@ static int ps_get_max_charge_cntl_limit(struct thermal_cooling_device *tcd, | |||
| 612 | int ret; | 613 | int ret; |
| 613 | 614 | ||
| 614 | psy = tcd->devdata; | 615 | psy = tcd->devdata; |
| 615 | ret = psy->desc->get_property(psy, | 616 | ret = power_supply_get_property(psy, |
| 616 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, &val); | 617 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, &val); |
| 617 | if (!ret) | 618 | if (ret) |
| 618 | *state = val.intval; | 619 | return ret; |
| 620 | |||
| 621 | *state = val.intval; | ||
| 619 | 622 | ||
| 620 | return ret; | 623 | return ret; |
| 621 | } | 624 | } |
| @@ -628,10 +631,12 @@ static int ps_get_cur_chrage_cntl_limit(struct thermal_cooling_device *tcd, | |||
| 628 | int ret; | 631 | int ret; |
| 629 | 632 | ||
| 630 | psy = tcd->devdata; | 633 | psy = tcd->devdata; |
| 631 | ret = psy->desc->get_property(psy, | 634 | ret = power_supply_get_property(psy, |
| 632 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val); | 635 | POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val); |
| 633 | if (!ret) | 636 | if (ret) |
| 634 | *state = val.intval; | 637 | return ret; |
| 638 | |||
| 639 | *state = val.intval; | ||
| 635 | 640 | ||
| 636 | return ret; | 641 | return ret; |
| 637 | } | 642 | } |
diff --git a/drivers/power/tps65217_charger.c b/drivers/power/tps65217_charger.c index d9f56730c735..73dfae41def8 100644 --- a/drivers/power/tps65217_charger.c +++ b/drivers/power/tps65217_charger.c | |||
| @@ -197,6 +197,7 @@ static int tps65217_charger_probe(struct platform_device *pdev) | |||
| 197 | { | 197 | { |
| 198 | struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); | 198 | struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); |
| 199 | struct tps65217_charger *charger; | 199 | struct tps65217_charger *charger; |
| 200 | struct power_supply_config cfg = {}; | ||
| 200 | int ret; | 201 | int ret; |
| 201 | 202 | ||
| 202 | dev_dbg(&pdev->dev, "%s\n", __func__); | 203 | dev_dbg(&pdev->dev, "%s\n", __func__); |
| @@ -208,9 +209,12 @@ static int tps65217_charger_probe(struct platform_device *pdev) | |||
| 208 | charger->tps = tps; | 209 | charger->tps = tps; |
| 209 | charger->dev = &pdev->dev; | 210 | charger->dev = &pdev->dev; |
| 210 | 211 | ||
| 212 | cfg.of_node = pdev->dev.of_node; | ||
| 213 | cfg.drv_data = charger; | ||
| 214 | |||
| 211 | charger->ac = devm_power_supply_register(&pdev->dev, | 215 | charger->ac = devm_power_supply_register(&pdev->dev, |
| 212 | &tps65217_charger_desc, | 216 | &tps65217_charger_desc, |
| 213 | NULL); | 217 | &cfg); |
| 214 | if (IS_ERR(charger->ac)) { | 218 | if (IS_ERR(charger->ac)) { |
| 215 | dev_err(&pdev->dev, "failed: power supply register\n"); | 219 | dev_err(&pdev->dev, "failed: power supply register\n"); |
| 216 | return PTR_ERR(charger->ac); | 220 | return PTR_ERR(charger->ac); |
diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c index 38a8bbe74810..83797d89c30f 100644 --- a/drivers/pps/clients/pps_parport.c +++ b/drivers/pps/clients/pps_parport.c | |||
| @@ -195,7 +195,7 @@ static void parport_detach(struct parport *port) | |||
| 195 | struct pps_client_pp *device; | 195 | struct pps_client_pp *device; |
| 196 | 196 | ||
| 197 | /* FIXME: oooh, this is ugly! */ | 197 | /* FIXME: oooh, this is ugly! */ |
| 198 | if (strcmp(pardev->name, KBUILD_MODNAME)) | 198 | if (!pardev || strcmp(pardev->name, KBUILD_MODNAME)) |
| 199 | /* not our port */ | 199 | /* not our port */ |
| 200 | return; | 200 | return; |
| 201 | 201 | ||
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 63cd5e68c864..3a6d0290c54c 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
| @@ -296,7 +296,7 @@ static int anatop_regulator_probe(struct platform_device *pdev) | |||
| 296 | if (!sreg->sel && !strcmp(sreg->name, "vddpu")) | 296 | if (!sreg->sel && !strcmp(sreg->name, "vddpu")) |
| 297 | sreg->sel = 22; | 297 | sreg->sel = 22; |
| 298 | 298 | ||
| 299 | if (!sreg->sel) { | 299 | if (!sreg->bypass && !sreg->sel) { |
| 300 | dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n"); | 300 | dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n"); |
| 301 | return -EINVAL; | 301 | return -EINVAL; |
| 302 | } | 302 | } |
diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c index 321e804aeab0..a1b49a6d538f 100644 --- a/drivers/regulator/max77620-regulator.c +++ b/drivers/regulator/max77620-regulator.c | |||
| @@ -123,6 +123,9 @@ static int max77620_regulator_set_fps_src(struct max77620_regulator *pmic, | |||
| 123 | unsigned int val; | 123 | unsigned int val; |
| 124 | int ret; | 124 | int ret; |
| 125 | 125 | ||
| 126 | if (!rinfo) | ||
| 127 | return 0; | ||
| 128 | |||
| 126 | switch (fps_src) { | 129 | switch (fps_src) { |
| 127 | case MAX77620_FPS_SRC_0: | 130 | case MAX77620_FPS_SRC_0: |
| 128 | case MAX77620_FPS_SRC_1: | 131 | case MAX77620_FPS_SRC_1: |
| @@ -171,6 +174,9 @@ static int max77620_regulator_set_fps_slots(struct max77620_regulator *pmic, | |||
| 171 | int pd = rpdata->active_fps_pd_slot; | 174 | int pd = rpdata->active_fps_pd_slot; |
| 172 | int ret = 0; | 175 | int ret = 0; |
| 173 | 176 | ||
| 177 | if (!rinfo) | ||
| 178 | return 0; | ||
| 179 | |||
| 174 | if (is_suspend) { | 180 | if (is_suspend) { |
| 175 | pu = rpdata->suspend_fps_pu_slot; | 181 | pu = rpdata->suspend_fps_pu_slot; |
| 176 | pd = rpdata->suspend_fps_pd_slot; | 182 | pd = rpdata->suspend_fps_pd_slot; |
| @@ -680,7 +686,6 @@ static struct max77620_regulator_info max77620_regs_info[MAX77620_NUM_REGS] = { | |||
| 680 | RAIL_SD(SD1, sd1, "in-sd1", SD1, 600000, 1550000, 12500, 0x22, SD1), | 686 | RAIL_SD(SD1, sd1, "in-sd1", SD1, 600000, 1550000, 12500, 0x22, SD1), |
| 681 | RAIL_SD(SD2, sd2, "in-sd2", SDX, 600000, 3787500, 12500, 0xFF, NONE), | 687 | RAIL_SD(SD2, sd2, "in-sd2", SDX, 600000, 3787500, 12500, 0xFF, NONE), |
| 682 | RAIL_SD(SD3, sd3, "in-sd3", SDX, 600000, 3787500, 12500, 0xFF, NONE), | 688 | RAIL_SD(SD3, sd3, "in-sd3", SDX, 600000, 3787500, 12500, 0xFF, NONE), |
| 683 | RAIL_SD(SD4, sd4, "in-sd4", SDX, 600000, 3787500, 12500, 0xFF, NONE), | ||
| 684 | 689 | ||
| 685 | RAIL_LDO(LDO0, ldo0, "in-ldo0-1", N, 800000, 2375000, 25000), | 690 | RAIL_LDO(LDO0, ldo0, "in-ldo0-1", N, 800000, 2375000, 25000), |
| 686 | RAIL_LDO(LDO1, ldo1, "in-ldo0-1", N, 800000, 2375000, 25000), | 691 | RAIL_LDO(LDO1, ldo1, "in-ldo0-1", N, 800000, 2375000, 25000), |
diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c index 526bf23dcb49..6c7fe4778793 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c | |||
| @@ -152,7 +152,6 @@ static const struct regulator_ops rpm_smps_ldo_ops_fixed = { | |||
| 152 | .enable = rpm_reg_enable, | 152 | .enable = rpm_reg_enable, |
| 153 | .disable = rpm_reg_disable, | 153 | .disable = rpm_reg_disable, |
| 154 | .is_enabled = rpm_reg_is_enabled, | 154 | .is_enabled = rpm_reg_is_enabled, |
| 155 | .list_voltage = regulator_list_voltage_linear_range, | ||
| 156 | 155 | ||
| 157 | .get_voltage = rpm_reg_get_voltage, | 156 | .get_voltage = rpm_reg_get_voltage, |
| 158 | .set_voltage = rpm_reg_set_voltage, | 157 | .set_voltage = rpm_reg_set_voltage, |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 80b1979e8d95..df036b872b05 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
| @@ -1051,6 +1051,7 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev) | |||
| 1051 | qeth_l2_set_offline(cgdev); | 1051 | qeth_l2_set_offline(cgdev); |
| 1052 | 1052 | ||
| 1053 | if (card->dev) { | 1053 | if (card->dev) { |
| 1054 | netif_napi_del(&card->napi); | ||
| 1054 | unregister_netdev(card->dev); | 1055 | unregister_netdev(card->dev); |
| 1055 | card->dev = NULL; | 1056 | card->dev = NULL; |
| 1056 | } | 1057 | } |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index ac544330daeb..709b52339ff9 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
| @@ -3226,6 +3226,7 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) | |||
| 3226 | qeth_l3_set_offline(cgdev); | 3226 | qeth_l3_set_offline(cgdev); |
| 3227 | 3227 | ||
| 3228 | if (card->dev) { | 3228 | if (card->dev) { |
| 3229 | netif_napi_del(&card->napi); | ||
| 3229 | unregister_netdev(card->dev); | 3230 | unregister_netdev(card->dev); |
| 3230 | card->dev = NULL; | 3231 | card->dev = NULL; |
| 3231 | } | 3232 | } |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index d6a691e27d33..d6803a9e5ab8 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
| @@ -10093,6 +10093,7 @@ static int ipr_probe_ioa(struct pci_dev *pdev, | |||
| 10093 | ioa_cfg->intr_flag = IPR_USE_MSI; | 10093 | ioa_cfg->intr_flag = IPR_USE_MSI; |
| 10094 | else { | 10094 | else { |
| 10095 | ioa_cfg->intr_flag = IPR_USE_LSI; | 10095 | ioa_cfg->intr_flag = IPR_USE_LSI; |
| 10096 | ioa_cfg->clear_isr = 1; | ||
| 10096 | ioa_cfg->nvectors = 1; | 10097 | ioa_cfg->nvectors = 1; |
| 10097 | dev_info(&pdev->dev, "Cannot enable MSI.\n"); | 10098 | dev_info(&pdev->dev, "Cannot enable MSI.\n"); |
| 10098 | } | 10099 | } |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 5649c200d37c..a92a62dea793 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
| @@ -2548,7 +2548,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, | |||
| 2548 | if (!vha->flags.online) | 2548 | if (!vha->flags.online) |
| 2549 | return; | 2549 | return; |
| 2550 | 2550 | ||
| 2551 | if (rsp->msix->cpuid != smp_processor_id()) { | 2551 | if (rsp->msix && rsp->msix->cpuid != smp_processor_id()) { |
| 2552 | /* if kernel does not notify qla of IRQ's CPU change, | 2552 | /* if kernel does not notify qla of IRQ's CPU change, |
| 2553 | * then set it here. | 2553 | * then set it here. |
| 2554 | */ | 2554 | */ |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index ff41c310c900..eaccd651ccda 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
| @@ -429,7 +429,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, | |||
| 429 | * here, and we don't know what device it is | 429 | * here, and we don't know what device it is |
| 430 | * trying to work with, leave it as-is. | 430 | * trying to work with, leave it as-is. |
| 431 | */ | 431 | */ |
| 432 | vmax = 8; /* max length of vendor */ | 432 | vmax = sizeof(devinfo->vendor); |
| 433 | vskip = vendor; | 433 | vskip = vendor; |
| 434 | while (vmax > 0 && *vskip == ' ') { | 434 | while (vmax > 0 && *vskip == ' ') { |
| 435 | vmax--; | 435 | vmax--; |
| @@ -439,7 +439,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, | |||
| 439 | while (vmax > 0 && vskip[vmax - 1] == ' ') | 439 | while (vmax > 0 && vskip[vmax - 1] == ' ') |
| 440 | --vmax; | 440 | --vmax; |
| 441 | 441 | ||
| 442 | mmax = 16; /* max length of model */ | 442 | mmax = sizeof(devinfo->model); |
| 443 | mskip = model; | 443 | mskip = model; |
| 444 | while (mmax > 0 && *mskip == ' ') { | 444 | while (mmax > 0 && *mskip == ' ') { |
| 445 | mmax--; | 445 | mmax--; |
| @@ -455,10 +455,12 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, | |||
| 455 | * Behave like the older version of get_device_flags. | 455 | * Behave like the older version of get_device_flags. |
| 456 | */ | 456 | */ |
| 457 | if (memcmp(devinfo->vendor, vskip, vmax) || | 457 | if (memcmp(devinfo->vendor, vskip, vmax) || |
| 458 | devinfo->vendor[vmax]) | 458 | (vmax < sizeof(devinfo->vendor) && |
| 459 | devinfo->vendor[vmax])) | ||
| 459 | continue; | 460 | continue; |
| 460 | if (memcmp(devinfo->model, mskip, mmax) || | 461 | if (memcmp(devinfo->model, mskip, mmax) || |
| 461 | devinfo->model[mmax]) | 462 | (mmax < sizeof(devinfo->model) && |
| 463 | devinfo->model[mmax])) | ||
| 462 | continue; | 464 | continue; |
| 463 | return devinfo; | 465 | return devinfo; |
| 464 | } else { | 466 | } else { |
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index cd89682065b9..1026e180eed7 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c | |||
| @@ -578,7 +578,7 @@ static int rockchip_spi_transfer_one( | |||
| 578 | struct spi_device *spi, | 578 | struct spi_device *spi, |
| 579 | struct spi_transfer *xfer) | 579 | struct spi_transfer *xfer) |
| 580 | { | 580 | { |
| 581 | int ret = 1; | 581 | int ret = 0; |
| 582 | struct rockchip_spi *rs = spi_master_get_devdata(master); | 582 | struct rockchip_spi *rs = spi_master_get_devdata(master); |
| 583 | 583 | ||
| 584 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && | 584 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && |
| @@ -627,6 +627,8 @@ static int rockchip_spi_transfer_one( | |||
| 627 | spi_enable_chip(rs, 1); | 627 | spi_enable_chip(rs, 1); |
| 628 | ret = rockchip_spi_prepare_dma(rs); | 628 | ret = rockchip_spi_prepare_dma(rs); |
| 629 | } | 629 | } |
| 630 | /* successful DMA prepare means the transfer is in progress */ | ||
| 631 | ret = ret ? ret : 1; | ||
| 630 | } else { | 632 | } else { |
| 631 | spi_enable_chip(rs, 1); | 633 | spi_enable_chip(rs, 1); |
| 632 | ret = rockchip_spi_pio_transfer(rs); | 634 | ret = rockchip_spi_pio_transfer(rs); |
diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c index 1ddd9e2309b6..cf007f3b83ec 100644 --- a/drivers/spi/spi-sun4i.c +++ b/drivers/spi/spi-sun4i.c | |||
| @@ -173,13 +173,17 @@ static int sun4i_spi_transfer_one(struct spi_master *master, | |||
| 173 | { | 173 | { |
| 174 | struct sun4i_spi *sspi = spi_master_get_devdata(master); | 174 | struct sun4i_spi *sspi = spi_master_get_devdata(master); |
| 175 | unsigned int mclk_rate, div, timeout; | 175 | unsigned int mclk_rate, div, timeout; |
| 176 | unsigned int start, end, tx_time; | ||
| 176 | unsigned int tx_len = 0; | 177 | unsigned int tx_len = 0; |
| 177 | int ret = 0; | 178 | int ret = 0; |
| 178 | u32 reg; | 179 | u32 reg; |
| 179 | 180 | ||
| 180 | /* We don't support transfer larger than the FIFO */ | 181 | /* We don't support transfer larger than the FIFO */ |
| 181 | if (tfr->len > SUN4I_FIFO_DEPTH) | 182 | if (tfr->len > SUN4I_FIFO_DEPTH) |
| 182 | return -EINVAL; | 183 | return -EMSGSIZE; |
| 184 | |||
| 185 | if (tfr->tx_buf && tfr->len >= SUN4I_FIFO_DEPTH) | ||
| 186 | return -EMSGSIZE; | ||
| 183 | 187 | ||
| 184 | reinit_completion(&sspi->done); | 188 | reinit_completion(&sspi->done); |
| 185 | sspi->tx_buf = tfr->tx_buf; | 189 | sspi->tx_buf = tfr->tx_buf; |
| @@ -269,8 +273,12 @@ static int sun4i_spi_transfer_one(struct spi_master *master, | |||
| 269 | sun4i_spi_write(sspi, SUN4I_BURST_CNT_REG, SUN4I_BURST_CNT(tfr->len)); | 273 | sun4i_spi_write(sspi, SUN4I_BURST_CNT_REG, SUN4I_BURST_CNT(tfr->len)); |
| 270 | sun4i_spi_write(sspi, SUN4I_XMIT_CNT_REG, SUN4I_XMIT_CNT(tx_len)); | 274 | sun4i_spi_write(sspi, SUN4I_XMIT_CNT_REG, SUN4I_XMIT_CNT(tx_len)); |
| 271 | 275 | ||
| 272 | /* Fill the TX FIFO */ | 276 | /* |
| 273 | sun4i_spi_fill_fifo(sspi, SUN4I_FIFO_DEPTH); | 277 | * Fill the TX FIFO |
| 278 | * Filling the FIFO fully causes timeout for some reason | ||
| 279 | * at least on spi2 on A10s | ||
| 280 | */ | ||
| 281 | sun4i_spi_fill_fifo(sspi, SUN4I_FIFO_DEPTH - 1); | ||
| 274 | 282 | ||
| 275 | /* Enable the interrupts */ | 283 | /* Enable the interrupts */ |
| 276 | sun4i_spi_write(sspi, SUN4I_INT_CTL_REG, SUN4I_INT_CTL_TC); | 284 | sun4i_spi_write(sspi, SUN4I_INT_CTL_REG, SUN4I_INT_CTL_TC); |
| @@ -279,9 +287,16 @@ static int sun4i_spi_transfer_one(struct spi_master *master, | |||
| 279 | reg = sun4i_spi_read(sspi, SUN4I_CTL_REG); | 287 | reg = sun4i_spi_read(sspi, SUN4I_CTL_REG); |
| 280 | sun4i_spi_write(sspi, SUN4I_CTL_REG, reg | SUN4I_CTL_XCH); | 288 | sun4i_spi_write(sspi, SUN4I_CTL_REG, reg | SUN4I_CTL_XCH); |
| 281 | 289 | ||
| 290 | tx_time = max(tfr->len * 8 * 2 / (tfr->speed_hz / 1000), 100U); | ||
| 291 | start = jiffies; | ||
| 282 | timeout = wait_for_completion_timeout(&sspi->done, | 292 | timeout = wait_for_completion_timeout(&sspi->done, |
| 283 | msecs_to_jiffies(1000)); | 293 | msecs_to_jiffies(tx_time)); |
| 294 | end = jiffies; | ||
| 284 | if (!timeout) { | 295 | if (!timeout) { |
| 296 | dev_warn(&master->dev, | ||
| 297 | "%s: timeout transferring %u bytes@%iHz for %i(%i)ms", | ||
| 298 | dev_name(&spi->dev), tfr->len, tfr->speed_hz, | ||
| 299 | jiffies_to_msecs(end - start), tx_time); | ||
| 285 | ret = -ETIMEDOUT; | 300 | ret = -ETIMEDOUT; |
| 286 | goto out; | 301 | goto out; |
| 287 | } | 302 | } |
diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c index 42e2c4bd690a..7fce79a60608 100644 --- a/drivers/spi/spi-sun6i.c +++ b/drivers/spi/spi-sun6i.c | |||
| @@ -160,6 +160,7 @@ static int sun6i_spi_transfer_one(struct spi_master *master, | |||
| 160 | { | 160 | { |
| 161 | struct sun6i_spi *sspi = spi_master_get_devdata(master); | 161 | struct sun6i_spi *sspi = spi_master_get_devdata(master); |
| 162 | unsigned int mclk_rate, div, timeout; | 162 | unsigned int mclk_rate, div, timeout; |
| 163 | unsigned int start, end, tx_time; | ||
| 163 | unsigned int tx_len = 0; | 164 | unsigned int tx_len = 0; |
| 164 | int ret = 0; | 165 | int ret = 0; |
| 165 | u32 reg; | 166 | u32 reg; |
| @@ -269,9 +270,16 @@ static int sun6i_spi_transfer_one(struct spi_master *master, | |||
| 269 | reg = sun6i_spi_read(sspi, SUN6I_TFR_CTL_REG); | 270 | reg = sun6i_spi_read(sspi, SUN6I_TFR_CTL_REG); |
| 270 | sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg | SUN6I_TFR_CTL_XCH); | 271 | sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg | SUN6I_TFR_CTL_XCH); |
| 271 | 272 | ||
| 273 | tx_time = max(tfr->len * 8 * 2 / (tfr->speed_hz / 1000), 100U); | ||
| 274 | start = jiffies; | ||
| 272 | timeout = wait_for_completion_timeout(&sspi->done, | 275 | timeout = wait_for_completion_timeout(&sspi->done, |
| 273 | msecs_to_jiffies(1000)); | 276 | msecs_to_jiffies(tx_time)); |
| 277 | end = jiffies; | ||
| 274 | if (!timeout) { | 278 | if (!timeout) { |
| 279 | dev_warn(&master->dev, | ||
| 280 | "%s: timeout transferring %u bytes@%iHz for %i(%i)ms", | ||
| 281 | dev_name(&spi->dev), tfr->len, tfr->speed_hz, | ||
| 282 | jiffies_to_msecs(end - start), tx_time); | ||
| 275 | ret = -ETIMEDOUT; | 283 | ret = -ETIMEDOUT; |
| 276 | goto out; | 284 | goto out; |
| 277 | } | 285 | } |
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 443f664534e1..29ea8d2f9824 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c | |||
| @@ -646,6 +646,13 @@ free_master: | |||
| 646 | 646 | ||
| 647 | static int ti_qspi_remove(struct platform_device *pdev) | 647 | static int ti_qspi_remove(struct platform_device *pdev) |
| 648 | { | 648 | { |
| 649 | struct ti_qspi *qspi = platform_get_drvdata(pdev); | ||
| 650 | int rc; | ||
| 651 | |||
| 652 | rc = spi_master_suspend(qspi->master); | ||
| 653 | if (rc) | ||
| 654 | return rc; | ||
| 655 | |||
| 649 | pm_runtime_put_sync(&pdev->dev); | 656 | pm_runtime_put_sync(&pdev->dev); |
| 650 | pm_runtime_disable(&pdev->dev); | 657 | pm_runtime_disable(&pdev->dev); |
| 651 | 658 | ||
diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c index a8f533af9eca..ec12181822e6 100644 --- a/drivers/staging/iio/accel/sca3000_core.c +++ b/drivers/staging/iio/accel/sca3000_core.c | |||
| @@ -594,7 +594,7 @@ static ssize_t sca3000_read_frequency(struct device *dev, | |||
| 594 | goto error_ret_mut; | 594 | goto error_ret_mut; |
| 595 | ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL); | 595 | ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL); |
| 596 | mutex_unlock(&st->lock); | 596 | mutex_unlock(&st->lock); |
| 597 | if (ret) | 597 | if (ret < 0) |
| 598 | goto error_ret; | 598 | goto error_ret; |
| 599 | val = ret; | 599 | val = ret; |
| 600 | if (base_freq > 0) | 600 | if (base_freq > 0) |
diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c index 825da0769936..9587fa86dc69 100644 --- a/drivers/staging/iio/adc/ad7606_spi.c +++ b/drivers/staging/iio/adc/ad7606_spi.c | |||
| @@ -21,7 +21,7 @@ static int ad7606_spi_read_block(struct device *dev, | |||
| 21 | { | 21 | { |
| 22 | struct spi_device *spi = to_spi_device(dev); | 22 | struct spi_device *spi = to_spi_device(dev); |
| 23 | int i, ret; | 23 | int i, ret; |
| 24 | unsigned short *data; | 24 | unsigned short *data = buf; |
| 25 | __be16 *bdata = buf; | 25 | __be16 *bdata = buf; |
| 26 | 26 | ||
| 27 | ret = spi_read(spi, buf, count * 2); | 27 | ret = spi_read(spi, buf, count * 2); |
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index 9f43976f4ef2..170ac980abcb 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c | |||
| @@ -444,10 +444,10 @@ static ssize_t ad5933_store(struct device *dev, | |||
| 444 | st->settling_cycles = val; | 444 | st->settling_cycles = val; |
| 445 | 445 | ||
| 446 | /* 2x, 4x handling, see datasheet */ | 446 | /* 2x, 4x handling, see datasheet */ |
| 447 | if (val > 511) | 447 | if (val > 1022) |
| 448 | val = (val >> 1) | (1 << 9); | ||
| 449 | else if (val > 1022) | ||
| 450 | val = (val >> 2) | (3 << 9); | 448 | val = (val >> 2) | (3 << 9); |
| 449 | else if (val > 511) | ||
| 450 | val = (val >> 1) | (1 << 9); | ||
| 451 | 451 | ||
| 452 | dat = cpu_to_be16(val); | 452 | dat = cpu_to_be16(val); |
| 453 | ret = ad5933_i2c_write(st->client, | 453 | ret = ad5933_i2c_write(st->client, |
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index f856c4544eea..51e0d32883ba 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
| @@ -667,8 +667,11 @@ static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) | |||
| 667 | fsi = tty->driver_data; | 667 | fsi = tty->driver_data; |
| 668 | else | 668 | else |
| 669 | fsi = tty->link->driver_data; | 669 | fsi = tty->link->driver_data; |
| 670 | devpts_kill_index(fsi, tty->index); | 670 | |
| 671 | devpts_release(fsi); | 671 | if (fsi) { |
| 672 | devpts_kill_index(fsi, tty->index); | ||
| 673 | devpts_release(fsi); | ||
| 674 | } | ||
| 672 | } | 675 | } |
| 673 | 676 | ||
| 674 | static const struct tty_operations ptm_unix98_ops = { | 677 | static const struct tty_operations ptm_unix98_ops = { |
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index f973bfce5d08..1e93a37e27f0 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c | |||
| @@ -366,34 +366,22 @@ static void to_utf8(struct vc_data *vc, uint c) | |||
| 366 | 366 | ||
| 367 | static void do_compute_shiftstate(void) | 367 | static void do_compute_shiftstate(void) |
| 368 | { | 368 | { |
| 369 | unsigned int i, j, k, sym, val; | 369 | unsigned int k, sym, val; |
| 370 | 370 | ||
| 371 | shift_state = 0; | 371 | shift_state = 0; |
| 372 | memset(shift_down, 0, sizeof(shift_down)); | 372 | memset(shift_down, 0, sizeof(shift_down)); |
| 373 | 373 | ||
| 374 | for (i = 0; i < ARRAY_SIZE(key_down); i++) { | 374 | for_each_set_bit(k, key_down, min(NR_KEYS, KEY_CNT)) { |
| 375 | 375 | sym = U(key_maps[0][k]); | |
| 376 | if (!key_down[i]) | 376 | if (KTYP(sym) != KT_SHIFT && KTYP(sym) != KT_SLOCK) |
| 377 | continue; | 377 | continue; |
| 378 | 378 | ||
| 379 | k = i * BITS_PER_LONG; | 379 | val = KVAL(sym); |
| 380 | 380 | if (val == KVAL(K_CAPSSHIFT)) | |
| 381 | for (j = 0; j < BITS_PER_LONG; j++, k++) { | 381 | val = KVAL(K_SHIFT); |
| 382 | |||
| 383 | if (!test_bit(k, key_down)) | ||
| 384 | continue; | ||
| 385 | 382 | ||
| 386 | sym = U(key_maps[0][k]); | 383 | shift_down[val]++; |
| 387 | if (KTYP(sym) != KT_SHIFT && KTYP(sym) != KT_SLOCK) | 384 | shift_state |= BIT(val); |
| 388 | continue; | ||
| 389 | |||
| 390 | val = KVAL(sym); | ||
| 391 | if (val == KVAL(K_CAPSSHIFT)) | ||
| 392 | val = KVAL(K_SHIFT); | ||
| 393 | |||
| 394 | shift_down[val]++; | ||
| 395 | shift_state |= (1 << val); | ||
| 396 | } | ||
| 397 | } | 385 | } |
| 398 | } | 386 | } |
| 399 | 387 | ||
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index dc125322f48f..5b0fe97c46ca 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
| @@ -750,6 +750,7 @@ static void visual_init(struct vc_data *vc, int num, int init) | |||
| 750 | vc->vc_complement_mask = 0; | 750 | vc->vc_complement_mask = 0; |
| 751 | vc->vc_can_do_color = 0; | 751 | vc->vc_can_do_color = 0; |
| 752 | vc->vc_panic_force_write = false; | 752 | vc->vc_panic_force_write = false; |
| 753 | vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; | ||
| 753 | vc->vc_sw->con_init(vc, init); | 754 | vc->vc_sw->con_init(vc, init); |
| 754 | if (!vc->vc_complement_mask) | 755 | if (!vc->vc_complement_mask) |
| 755 | vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; | 756 | vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; |
diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 9059b7dc185e..2f537bbdda09 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include <linux/module.h> | ||
| 24 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
| 25 | #include <linux/types.h> | 26 | #include <linux/types.h> |
| 26 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| @@ -450,3 +451,4 @@ int otg_statemachine(struct otg_fsm *fsm) | |||
| 450 | return fsm->state_changed; | 451 | return fsm->state_changed; |
| 451 | } | 452 | } |
| 452 | EXPORT_SYMBOL_GPL(otg_statemachine); | 453 | EXPORT_SYMBOL_GPL(otg_statemachine); |
| 454 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 34b837ae1ed7..d2e3f655c26f 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -2598,26 +2598,23 @@ EXPORT_SYMBOL_GPL(usb_create_hcd); | |||
| 2598 | * Don't deallocate the bandwidth_mutex until the last shared usb_hcd is | 2598 | * Don't deallocate the bandwidth_mutex until the last shared usb_hcd is |
| 2599 | * deallocated. | 2599 | * deallocated. |
| 2600 | * | 2600 | * |
| 2601 | * Make sure to only deallocate the bandwidth_mutex when the primary HCD is | 2601 | * Make sure to deallocate the bandwidth_mutex only when the last HCD is |
| 2602 | * freed. When hcd_release() is called for either hcd in a peer set | 2602 | * freed. When hcd_release() is called for either hcd in a peer set, |
| 2603 | * invalidate the peer's ->shared_hcd and ->primary_hcd pointers to | 2603 | * invalidate the peer's ->shared_hcd and ->primary_hcd pointers. |
| 2604 | * block new peering attempts | ||
| 2605 | */ | 2604 | */ |
| 2606 | static void hcd_release(struct kref *kref) | 2605 | static void hcd_release(struct kref *kref) |
| 2607 | { | 2606 | { |
| 2608 | struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref); | 2607 | struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref); |
| 2609 | 2608 | ||
| 2610 | mutex_lock(&usb_port_peer_mutex); | 2609 | mutex_lock(&usb_port_peer_mutex); |
| 2611 | if (usb_hcd_is_primary_hcd(hcd)) { | ||
| 2612 | kfree(hcd->address0_mutex); | ||
| 2613 | kfree(hcd->bandwidth_mutex); | ||
| 2614 | } | ||
| 2615 | if (hcd->shared_hcd) { | 2610 | if (hcd->shared_hcd) { |
| 2616 | struct usb_hcd *peer = hcd->shared_hcd; | 2611 | struct usb_hcd *peer = hcd->shared_hcd; |
| 2617 | 2612 | ||
| 2618 | peer->shared_hcd = NULL; | 2613 | peer->shared_hcd = NULL; |
| 2619 | if (peer->primary_hcd == hcd) | 2614 | peer->primary_hcd = NULL; |
| 2620 | peer->primary_hcd = NULL; | 2615 | } else { |
| 2616 | kfree(hcd->address0_mutex); | ||
| 2617 | kfree(hcd->bandwidth_mutex); | ||
| 2621 | } | 2618 | } |
| 2622 | mutex_unlock(&usb_port_peer_mutex); | 2619 | mutex_unlock(&usb_port_peer_mutex); |
| 2623 | kfree(hcd); | 2620 | kfree(hcd); |
diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index 50d6ae6f88bc..89a2f712fdfe 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c | |||
| @@ -233,7 +233,8 @@ static int st_dwc3_probe(struct platform_device *pdev) | |||
| 233 | dev_vdbg(&pdev->dev, "glue-logic addr 0x%p, syscfg-reg offset 0x%x\n", | 233 | dev_vdbg(&pdev->dev, "glue-logic addr 0x%p, syscfg-reg offset 0x%x\n", |
| 234 | dwc3_data->glue_base, dwc3_data->syscfg_reg_off); | 234 | dwc3_data->glue_base, dwc3_data->syscfg_reg_off); |
| 235 | 235 | ||
| 236 | dwc3_data->rstc_pwrdn = devm_reset_control_get(dev, "powerdown"); | 236 | dwc3_data->rstc_pwrdn = |
| 237 | devm_reset_control_get_exclusive(dev, "powerdown"); | ||
| 237 | if (IS_ERR(dwc3_data->rstc_pwrdn)) { | 238 | if (IS_ERR(dwc3_data->rstc_pwrdn)) { |
| 238 | dev_err(&pdev->dev, "could not get power controller\n"); | 239 | dev_err(&pdev->dev, "could not get power controller\n"); |
| 239 | ret = PTR_ERR(dwc3_data->rstc_pwrdn); | 240 | ret = PTR_ERR(dwc3_data->rstc_pwrdn); |
| @@ -243,7 +244,8 @@ static int st_dwc3_probe(struct platform_device *pdev) | |||
| 243 | /* Manage PowerDown */ | 244 | /* Manage PowerDown */ |
| 244 | reset_control_deassert(dwc3_data->rstc_pwrdn); | 245 | reset_control_deassert(dwc3_data->rstc_pwrdn); |
| 245 | 246 | ||
| 246 | dwc3_data->rstc_rst = devm_reset_control_get(dev, "softreset"); | 247 | dwc3_data->rstc_rst = |
| 248 | devm_reset_control_get_shared(dev, "softreset"); | ||
| 247 | if (IS_ERR(dwc3_data->rstc_rst)) { | 249 | if (IS_ERR(dwc3_data->rstc_rst)) { |
| 248 | dev_err(&pdev->dev, "could not get reset controller\n"); | 250 | dev_err(&pdev->dev, "could not get reset controller\n"); |
| 249 | ret = PTR_ERR(dwc3_data->rstc_rst); | 251 | ret = PTR_ERR(dwc3_data->rstc_rst); |
diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c index a94ed677d937..be4a2788fc58 100644 --- a/drivers/usb/host/ehci-st.c +++ b/drivers/usb/host/ehci-st.c | |||
| @@ -206,7 +206,8 @@ static int st_ehci_platform_probe(struct platform_device *dev) | |||
| 206 | priv->clk48 = NULL; | 206 | priv->clk48 = NULL; |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | priv->pwr = devm_reset_control_get_optional(&dev->dev, "power"); | 209 | priv->pwr = |
| 210 | devm_reset_control_get_optional_shared(&dev->dev, "power"); | ||
| 210 | if (IS_ERR(priv->pwr)) { | 211 | if (IS_ERR(priv->pwr)) { |
| 211 | err = PTR_ERR(priv->pwr); | 212 | err = PTR_ERR(priv->pwr); |
| 212 | if (err == -EPROBE_DEFER) | 213 | if (err == -EPROBE_DEFER) |
| @@ -214,7 +215,8 @@ static int st_ehci_platform_probe(struct platform_device *dev) | |||
| 214 | priv->pwr = NULL; | 215 | priv->pwr = NULL; |
| 215 | } | 216 | } |
| 216 | 217 | ||
| 217 | priv->rst = devm_reset_control_get_optional(&dev->dev, "softreset"); | 218 | priv->rst = |
| 219 | devm_reset_control_get_optional_shared(&dev->dev, "softreset"); | ||
| 218 | if (IS_ERR(priv->rst)) { | 220 | if (IS_ERR(priv->rst)) { |
| 219 | err = PTR_ERR(priv->rst); | 221 | err = PTR_ERR(priv->rst); |
| 220 | if (err == -EPROBE_DEFER) | 222 | if (err == -EPROBE_DEFER) |
diff --git a/drivers/usb/host/ohci-st.c b/drivers/usb/host/ohci-st.c index acf2eb2a5676..02816a1515a1 100644 --- a/drivers/usb/host/ohci-st.c +++ b/drivers/usb/host/ohci-st.c | |||
| @@ -188,13 +188,15 @@ static int st_ohci_platform_probe(struct platform_device *dev) | |||
| 188 | priv->clk48 = NULL; | 188 | priv->clk48 = NULL; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | priv->pwr = devm_reset_control_get_optional(&dev->dev, "power"); | 191 | priv->pwr = |
| 192 | devm_reset_control_get_optional_shared(&dev->dev, "power"); | ||
| 192 | if (IS_ERR(priv->pwr)) { | 193 | if (IS_ERR(priv->pwr)) { |
| 193 | err = PTR_ERR(priv->pwr); | 194 | err = PTR_ERR(priv->pwr); |
| 194 | goto err_put_clks; | 195 | goto err_put_clks; |
| 195 | } | 196 | } |
| 196 | 197 | ||
| 197 | priv->rst = devm_reset_control_get_optional(&dev->dev, "softreset"); | 198 | priv->rst = |
| 199 | devm_reset_control_get_optional_shared(&dev->dev, "softreset"); | ||
| 198 | if (IS_ERR(priv->rst)) { | 200 | if (IS_ERR(priv->rst)) { |
| 199 | err = PTR_ERR(priv->rst); | 201 | err = PTR_ERR(priv->rst); |
| 200 | goto err_put_clks; | 202 | goto err_put_clks; |
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index 076970a54f89..4ce10bcca18b 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c | |||
| @@ -423,36 +423,7 @@ upload: | |||
| 423 | 423 | ||
| 424 | return 0; | 424 | return 0; |
| 425 | } | 425 | } |
| 426 | static int __init check_prereq(void) | ||
| 427 | { | ||
| 428 | struct cpuinfo_x86 *c = &cpu_data(0); | ||
| 429 | |||
| 430 | if (!xen_initial_domain()) | ||
| 431 | return -ENODEV; | ||
| 432 | |||
| 433 | if (!acpi_gbl_FADT.smi_command) | ||
| 434 | return -ENODEV; | ||
| 435 | |||
| 436 | if (c->x86_vendor == X86_VENDOR_INTEL) { | ||
| 437 | if (!cpu_has(c, X86_FEATURE_EST)) | ||
| 438 | return -ENODEV; | ||
| 439 | 426 | ||
| 440 | return 0; | ||
| 441 | } | ||
| 442 | if (c->x86_vendor == X86_VENDOR_AMD) { | ||
| 443 | /* Copied from powernow-k8.h, can't include ../cpufreq/powernow | ||
| 444 | * as we get compile warnings for the static functions. | ||
| 445 | */ | ||
| 446 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 | ||
| 447 | #define USE_HW_PSTATE 0x00000080 | ||
| 448 | u32 eax, ebx, ecx, edx; | ||
| 449 | cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx); | ||
| 450 | if ((edx & USE_HW_PSTATE) != USE_HW_PSTATE) | ||
| 451 | return -ENODEV; | ||
| 452 | return 0; | ||
| 453 | } | ||
| 454 | return -ENODEV; | ||
| 455 | } | ||
| 456 | /* acpi_perf_data is a pointer to percpu data. */ | 427 | /* acpi_perf_data is a pointer to percpu data. */ |
| 457 | static struct acpi_processor_performance __percpu *acpi_perf_data; | 428 | static struct acpi_processor_performance __percpu *acpi_perf_data; |
| 458 | 429 | ||
| @@ -509,10 +480,10 @@ struct notifier_block xen_acpi_processor_resume_nb = { | |||
| 509 | static int __init xen_acpi_processor_init(void) | 480 | static int __init xen_acpi_processor_init(void) |
| 510 | { | 481 | { |
| 511 | unsigned int i; | 482 | unsigned int i; |
| 512 | int rc = check_prereq(); | 483 | int rc; |
| 513 | 484 | ||
| 514 | if (rc) | 485 | if (!xen_initial_domain()) |
| 515 | return rc; | 486 | return -ENODEV; |
| 516 | 487 | ||
| 517 | nr_acpi_bits = get_max_acpi_id() + 1; | 488 | nr_acpi_bits = get_max_acpi_id() + 1; |
| 518 | acpi_ids_done = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); | 489 | acpi_ids_done = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); |
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index cacf30d14747..7487971f9f78 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | |||
| @@ -316,11 +316,18 @@ static int xenbus_write_transaction(unsigned msg_type, | |||
| 316 | rc = -ENOMEM; | 316 | rc = -ENOMEM; |
| 317 | goto out; | 317 | goto out; |
| 318 | } | 318 | } |
| 319 | } else { | ||
| 320 | list_for_each_entry(trans, &u->transactions, list) | ||
| 321 | if (trans->handle.id == u->u.msg.tx_id) | ||
| 322 | break; | ||
| 323 | if (&trans->list == &u->transactions) | ||
| 324 | return -ESRCH; | ||
| 319 | } | 325 | } |
| 320 | 326 | ||
| 321 | reply = xenbus_dev_request_and_reply(&u->u.msg); | 327 | reply = xenbus_dev_request_and_reply(&u->u.msg); |
| 322 | if (IS_ERR(reply)) { | 328 | if (IS_ERR(reply)) { |
| 323 | kfree(trans); | 329 | if (msg_type == XS_TRANSACTION_START) |
| 330 | kfree(trans); | ||
| 324 | rc = PTR_ERR(reply); | 331 | rc = PTR_ERR(reply); |
| 325 | goto out; | 332 | goto out; |
| 326 | } | 333 | } |
| @@ -333,12 +340,7 @@ static int xenbus_write_transaction(unsigned msg_type, | |||
| 333 | list_add(&trans->list, &u->transactions); | 340 | list_add(&trans->list, &u->transactions); |
| 334 | } | 341 | } |
| 335 | } else if (u->u.msg.type == XS_TRANSACTION_END) { | 342 | } else if (u->u.msg.type == XS_TRANSACTION_END) { |
| 336 | list_for_each_entry(trans, &u->transactions, list) | ||
| 337 | if (trans->handle.id == u->u.msg.tx_id) | ||
| 338 | break; | ||
| 339 | BUG_ON(&trans->list == &u->transactions); | ||
| 340 | list_del(&trans->list); | 343 | list_del(&trans->list); |
| 341 | |||
| 342 | kfree(trans); | 344 | kfree(trans); |
| 343 | } | 345 | } |
| 344 | 346 | ||
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 374b12af8812..22f7cd711c57 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c | |||
| @@ -232,10 +232,10 @@ static void transaction_resume(void) | |||
| 232 | void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) | 232 | void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) |
| 233 | { | 233 | { |
| 234 | void *ret; | 234 | void *ret; |
| 235 | struct xsd_sockmsg req_msg = *msg; | 235 | enum xsd_sockmsg_type type = msg->type; |
| 236 | int err; | 236 | int err; |
| 237 | 237 | ||
| 238 | if (req_msg.type == XS_TRANSACTION_START) | 238 | if (type == XS_TRANSACTION_START) |
| 239 | transaction_start(); | 239 | transaction_start(); |
| 240 | 240 | ||
| 241 | mutex_lock(&xs_state.request_mutex); | 241 | mutex_lock(&xs_state.request_mutex); |
| @@ -249,12 +249,8 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) | |||
| 249 | 249 | ||
| 250 | mutex_unlock(&xs_state.request_mutex); | 250 | mutex_unlock(&xs_state.request_mutex); |
| 251 | 251 | ||
| 252 | if (IS_ERR(ret)) | ||
| 253 | return ret; | ||
| 254 | |||
| 255 | if ((msg->type == XS_TRANSACTION_END) || | 252 | if ((msg->type == XS_TRANSACTION_END) || |
| 256 | ((req_msg.type == XS_TRANSACTION_START) && | 253 | ((type == XS_TRANSACTION_START) && (msg->type == XS_ERROR))) |
| 257 | (msg->type == XS_ERROR))) | ||
| 258 | transaction_end(); | 254 | transaction_end(); |
| 259 | 255 | ||
| 260 | return ret; | 256 | return ret; |
