aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-12-10 16:21:55 -0500
committerDavid S. Miller <davem@davemloft.net>2016-12-10 16:21:55 -0500
commit821781a9f40673c2aa0f29d9d8226ec320dff20c (patch)
treec9d5cb8a184fff84a9d841d8cb5da4b26be5c551 /drivers
parent3174fed9820edc95cff74ad0934c3240c7fb5115 (diff)
parent045169816b31b10faed984b01c390db1b32ee4c1 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/nfit/core.c55
-rw-r--r--drivers/acpi/nfit/nfit.h2
-rw-r--r--drivers/ata/libata-scsi.c1
-rw-r--r--drivers/ata/sata_mv.c15
-rw-r--r--drivers/block/zram/zram_drv.c8
-rw-r--r--drivers/crypto/caam/ctrl.c5
-rw-r--r--drivers/crypto/marvell/hash.c11
-rw-r--r--drivers/dax/dax.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c5
-rw-r--r--drivers/isdn/gigaset/ser-gigaset.c4
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb_core.c6
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c1
-rw-r--r--drivers/net/ethernet/ibm/ibmveth.c65
-rw-r--r--drivers/net/ethernet/ibm/ibmveth.h1
-rw-r--r--drivers/net/ethernet/lantiq_etop.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/Kconfig2
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c9
-rw-r--r--drivers/net/ethernet/ti/cpmac.c1
-rw-r--r--drivers/net/ethernet/ti/cpsw-phy-sel.c1
-rw-r--r--drivers/net/hyperv/netvsc_drv.c5
-rw-r--r--drivers/net/ipvlan/ipvlan_main.c4
-rw-r--r--drivers/net/phy/phy_device.c16
-rw-r--r--drivers/net/usb/cdc_mbim.c21
-rw-r--r--drivers/net/usb/cdc_ncm.c14
-rw-r--r--drivers/nvdimm/bus.c25
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c14
-rw-r--r--drivers/vhost/vsock.c2
31 files changed, 243 insertions, 58 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 71a7d07c28c9..312c4b4dc363 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -94,7 +94,7 @@ static struct acpi_device *to_acpi_dev(struct acpi_nfit_desc *acpi_desc)
94 return to_acpi_device(acpi_desc->dev); 94 return to_acpi_device(acpi_desc->dev);
95} 95}
96 96
97static int xlat_status(void *buf, unsigned int cmd, u32 status) 97static int xlat_bus_status(void *buf, unsigned int cmd, u32 status)
98{ 98{
99 struct nd_cmd_clear_error *clear_err; 99 struct nd_cmd_clear_error *clear_err;
100 struct nd_cmd_ars_status *ars_status; 100 struct nd_cmd_ars_status *ars_status;
@@ -113,7 +113,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status)
113 flags = ND_ARS_PERSISTENT | ND_ARS_VOLATILE; 113 flags = ND_ARS_PERSISTENT | ND_ARS_VOLATILE;
114 if ((status >> 16 & flags) == 0) 114 if ((status >> 16 & flags) == 0)
115 return -ENOTTY; 115 return -ENOTTY;
116 break; 116 return 0;
117 case ND_CMD_ARS_START: 117 case ND_CMD_ARS_START:
118 /* ARS is in progress */ 118 /* ARS is in progress */
119 if ((status & 0xffff) == NFIT_ARS_START_BUSY) 119 if ((status & 0xffff) == NFIT_ARS_START_BUSY)
@@ -122,7 +122,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status)
122 /* Command failed */ 122 /* Command failed */
123 if (status & 0xffff) 123 if (status & 0xffff)
124 return -EIO; 124 return -EIO;
125 break; 125 return 0;
126 case ND_CMD_ARS_STATUS: 126 case ND_CMD_ARS_STATUS:
127 ars_status = buf; 127 ars_status = buf;
128 /* Command failed */ 128 /* Command failed */
@@ -146,7 +146,8 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status)
146 * then just continue with the returned results. 146 * then just continue with the returned results.
147 */ 147 */
148 if (status == NFIT_ARS_STATUS_INTR) { 148 if (status == NFIT_ARS_STATUS_INTR) {
149 if (ars_status->flags & NFIT_ARS_F_OVERFLOW) 149 if (ars_status->out_length >= 40 && (ars_status->flags
150 & NFIT_ARS_F_OVERFLOW))
150 return -ENOSPC; 151 return -ENOSPC;
151 return 0; 152 return 0;
152 } 153 }
@@ -154,7 +155,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status)
154 /* Unknown status */ 155 /* Unknown status */
155 if (status >> 16) 156 if (status >> 16)
156 return -EIO; 157 return -EIO;
157 break; 158 return 0;
158 case ND_CMD_CLEAR_ERROR: 159 case ND_CMD_CLEAR_ERROR:
159 clear_err = buf; 160 clear_err = buf;
160 if (status & 0xffff) 161 if (status & 0xffff)
@@ -163,7 +164,7 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status)
163 return -EIO; 164 return -EIO;
164 if (clear_err->length > clear_err->cleared) 165 if (clear_err->length > clear_err->cleared)
165 return clear_err->cleared; 166 return clear_err->cleared;
166 break; 167 return 0;
167 default: 168 default:
168 break; 169 break;
169 } 170 }
@@ -174,9 +175,18 @@ static int xlat_status(void *buf, unsigned int cmd, u32 status)
174 return 0; 175 return 0;
175} 176}
176 177
177static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, 178static int xlat_status(struct nvdimm *nvdimm, void *buf, unsigned int cmd,
178 struct nvdimm *nvdimm, unsigned int cmd, void *buf, 179 u32 status)
179 unsigned int buf_len, int *cmd_rc) 180{
181 if (!nvdimm)
182 return xlat_bus_status(buf, cmd, status);
183 if (status)
184 return -EIO;
185 return 0;
186}
187
188int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
189 unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc)
180{ 190{
181 struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); 191 struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc);
182 union acpi_object in_obj, in_buf, *out_obj; 192 union acpi_object in_obj, in_buf, *out_obj;
@@ -298,7 +308,8 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
298 308
299 for (i = 0, offset = 0; i < desc->out_num; i++) { 309 for (i = 0, offset = 0; i < desc->out_num; i++) {
300 u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i, buf, 310 u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i, buf,
301 (u32 *) out_obj->buffer.pointer); 311 (u32 *) out_obj->buffer.pointer,
312 out_obj->buffer.length - offset);
302 313
303 if (offset + out_size > out_obj->buffer.length) { 314 if (offset + out_size > out_obj->buffer.length) {
304 dev_dbg(dev, "%s:%s output object underflow cmd: %s field: %d\n", 315 dev_dbg(dev, "%s:%s output object underflow cmd: %s field: %d\n",
@@ -333,7 +344,8 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
333 */ 344 */
334 rc = buf_len - offset - in_buf.buffer.length; 345 rc = buf_len - offset - in_buf.buffer.length;
335 if (cmd_rc) 346 if (cmd_rc)
336 *cmd_rc = xlat_status(buf, cmd, fw_status); 347 *cmd_rc = xlat_status(nvdimm, buf, cmd,
348 fw_status);
337 } else { 349 } else {
338 dev_err(dev, "%s:%s underrun cmd: %s buf_len: %d out_len: %d\n", 350 dev_err(dev, "%s:%s underrun cmd: %s buf_len: %d out_len: %d\n",
339 __func__, dimm_name, cmd_name, buf_len, 351 __func__, dimm_name, cmd_name, buf_len,
@@ -343,7 +355,7 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
343 } else { 355 } else {
344 rc = 0; 356 rc = 0;
345 if (cmd_rc) 357 if (cmd_rc)
346 *cmd_rc = xlat_status(buf, cmd, fw_status); 358 *cmd_rc = xlat_status(nvdimm, buf, cmd, fw_status);
347 } 359 }
348 360
349 out: 361 out:
@@ -351,6 +363,7 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
351 363
352 return rc; 364 return rc;
353} 365}
366EXPORT_SYMBOL_GPL(acpi_nfit_ctl);
354 367
355static const char *spa_type_name(u16 type) 368static const char *spa_type_name(u16 type)
356{ 369{
@@ -2001,19 +2014,32 @@ static int ars_get_status(struct acpi_nfit_desc *acpi_desc)
2001 return cmd_rc; 2014 return cmd_rc;
2002} 2015}
2003 2016
2004static int ars_status_process_records(struct nvdimm_bus *nvdimm_bus, 2017static int ars_status_process_records(struct acpi_nfit_desc *acpi_desc,
2005 struct nd_cmd_ars_status *ars_status) 2018 struct nd_cmd_ars_status *ars_status)
2006{ 2019{
2020 struct nvdimm_bus *nvdimm_bus = acpi_desc->nvdimm_bus;
2007 int rc; 2021 int rc;
2008 u32 i; 2022 u32 i;
2009 2023
2024 /*
2025 * First record starts at 44 byte offset from the start of the
2026 * payload.
2027 */
2028 if (ars_status->out_length < 44)
2029 return 0;
2010 for (i = 0; i < ars_status->num_records; i++) { 2030 for (i = 0; i < ars_status->num_records; i++) {
2031 /* only process full records */
2032 if (ars_status->out_length
2033 < 44 + sizeof(struct nd_ars_record) * (i + 1))
2034 break;
2011 rc = nvdimm_bus_add_poison(nvdimm_bus, 2035 rc = nvdimm_bus_add_poison(nvdimm_bus,
2012 ars_status->records[i].err_address, 2036 ars_status->records[i].err_address,
2013 ars_status->records[i].length); 2037 ars_status->records[i].length);
2014 if (rc) 2038 if (rc)
2015 return rc; 2039 return rc;
2016 } 2040 }
2041 if (i < ars_status->num_records)
2042 dev_warn(acpi_desc->dev, "detected truncated ars results\n");
2017 2043
2018 return 0; 2044 return 0;
2019} 2045}
@@ -2266,8 +2292,7 @@ static int acpi_nfit_query_poison(struct acpi_nfit_desc *acpi_desc,
2266 if (rc < 0 && rc != -ENOSPC) 2292 if (rc < 0 && rc != -ENOSPC)
2267 return rc; 2293 return rc;
2268 2294
2269 if (ars_status_process_records(acpi_desc->nvdimm_bus, 2295 if (ars_status_process_records(acpi_desc, acpi_desc->ars_status))
2270 acpi_desc->ars_status))
2271 return -ENOMEM; 2296 return -ENOMEM;
2272 2297
2273 return 0; 2298 return 0;
diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h
index 14296f5267c8..fc29c2e9832e 100644
--- a/drivers/acpi/nfit/nfit.h
+++ b/drivers/acpi/nfit/nfit.h
@@ -240,5 +240,7 @@ const u8 *to_nfit_uuid(enum nfit_uuids id);
240int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *nfit, acpi_size sz); 240int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *nfit, acpi_size sz);
241void __acpi_nfit_notify(struct device *dev, acpi_handle handle, u32 event); 241void __acpi_nfit_notify(struct device *dev, acpi_handle handle, u32 event);
242void __acpi_nvdimm_notify(struct device *dev, u32 event); 242void __acpi_nvdimm_notify(struct device *dev, u32 event);
243int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
244 unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc);
243void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev); 245void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev);
244#endif /* __NFIT_H__ */ 246#endif /* __NFIT_H__ */
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index c4eb4ae9c3aa..8e575fbdf31d 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1159,6 +1159,7 @@ static void ata_scsi_sdev_config(struct scsi_device *sdev)
1159{ 1159{
1160 sdev->use_10_for_rw = 1; 1160 sdev->use_10_for_rw = 1;
1161 sdev->use_10_for_ms = 1; 1161 sdev->use_10_for_ms = 1;
1162 sdev->no_write_same = 1;
1162 1163
1163 /* Schedule policy is determined by ->qc_defer() callback and 1164 /* Schedule policy is determined by ->qc_defer() callback and
1164 * it needs to see every deferred qc. Set dev_blocked to 1 to 1165 * it needs to see every deferred qc. Set dev_blocked to 1 to
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index efc48bf89d51..823e938c9a78 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -4090,7 +4090,20 @@ static int mv_platform_probe(struct platform_device *pdev)
4090 4090
4091 /* allocate host */ 4091 /* allocate host */
4092 if (pdev->dev.of_node) { 4092 if (pdev->dev.of_node) {
4093 of_property_read_u32(pdev->dev.of_node, "nr-ports", &n_ports); 4093 rc = of_property_read_u32(pdev->dev.of_node, "nr-ports",
4094 &n_ports);
4095 if (rc) {
4096 dev_err(&pdev->dev,
4097 "error parsing nr-ports property: %d\n", rc);
4098 return rc;
4099 }
4100
4101 if (n_ports <= 0) {
4102 dev_err(&pdev->dev, "nr-ports must be positive: %d\n",
4103 n_ports);
4104 return -EINVAL;
4105 }
4106
4094 irq = irq_of_parse_and_map(pdev->dev.of_node, 0); 4107 irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
4095 } else { 4108 } else {
4096 mv_platform_data = dev_get_platdata(&pdev->dev); 4109 mv_platform_data = dev_get_platdata(&pdev->dev);
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 5163c8f918cb..5497f7fc44d0 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1413,8 +1413,14 @@ static ssize_t hot_remove_store(struct class *class,
1413 return ret ? ret : count; 1413 return ret ? ret : count;
1414} 1414}
1415 1415
1416/*
1417 * NOTE: hot_add attribute is not the usual read-only sysfs attribute. In a
1418 * sense that reading from this file does alter the state of your system -- it
1419 * creates a new un-initialized zram device and returns back this device's
1420 * device_id (or an error code if it fails to create a new device).
1421 */
1416static struct class_attribute zram_control_class_attrs[] = { 1422static struct class_attribute zram_control_class_attrs[] = {
1417 __ATTR_RO(hot_add), 1423 __ATTR(hot_add, 0400, hot_add_show, NULL),
1418 __ATTR_WO(hot_remove), 1424 __ATTR_WO(hot_remove),
1419 __ATTR_NULL, 1425 __ATTR_NULL,
1420}; 1426};
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 72ff19658985..e483b78c6343 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -558,8 +558,9 @@ static int caam_probe(struct platform_device *pdev)
558 * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel, 558 * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel,
559 * long pointers in master configuration register 559 * long pointers in master configuration register
560 */ 560 */
561 clrsetbits_32(&ctrl->mcr, MCFGR_AWCACHE_MASK, MCFGR_AWCACHE_CACH | 561 clrsetbits_32(&ctrl->mcr, MCFGR_AWCACHE_MASK | MCFGR_LONG_PTR,
562 MCFGR_AWCACHE_BUFF | MCFGR_WDENABLE | MCFGR_LARGE_BURST | 562 MCFGR_AWCACHE_CACH | MCFGR_AWCACHE_BUFF |
563 MCFGR_WDENABLE | MCFGR_LARGE_BURST |
563 (sizeof(dma_addr_t) == sizeof(u64) ? MCFGR_LONG_PTR : 0)); 564 (sizeof(dma_addr_t) == sizeof(u64) ? MCFGR_LONG_PTR : 0));
564 565
565 /* 566 /*
diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c
index 9f284682c091..77712b375b84 100644
--- a/drivers/crypto/marvell/hash.c
+++ b/drivers/crypto/marvell/hash.c
@@ -168,12 +168,11 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req)
168 mv_cesa_adjust_op(engine, &creq->op_tmpl); 168 mv_cesa_adjust_op(engine, &creq->op_tmpl);
169 memcpy_toio(engine->sram, &creq->op_tmpl, sizeof(creq->op_tmpl)); 169 memcpy_toio(engine->sram, &creq->op_tmpl, sizeof(creq->op_tmpl));
170 170
171 digsize = crypto_ahash_digestsize(crypto_ahash_reqtfm(req)); 171 if (!sreq->offset) {
172 for (i = 0; i < digsize / 4; i++) 172 digsize = crypto_ahash_digestsize(crypto_ahash_reqtfm(req));
173 writel_relaxed(creq->state[i], engine->regs + CESA_IVDIG(i)); 173 for (i = 0; i < digsize / 4; i++)
174 174 writel_relaxed(creq->state[i], engine->regs + CESA_IVDIG(i));
175 mv_cesa_adjust_op(engine, &creq->op_tmpl); 175 }
176 memcpy_toio(engine->sram, &creq->op_tmpl, sizeof(creq->op_tmpl));
177 176
178 if (creq->cache_ptr) 177 if (creq->cache_ptr)
179 memcpy_toio(engine->sram + CESA_SA_DATA_SRAM_OFFSET, 178 memcpy_toio(engine->sram + CESA_SA_DATA_SRAM_OFFSET,
diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
index 3d94ff20fdca..286447a83dab 100644
--- a/drivers/dax/dax.c
+++ b/drivers/dax/dax.c
@@ -271,7 +271,7 @@ static int check_vma(struct dax_dev *dax_dev, struct vm_area_struct *vma,
271 return -ENXIO; 271 return -ENXIO;
272 272
273 /* prevent private mappings from being established */ 273 /* prevent private mappings from being established */
274 if ((vma->vm_flags & VM_SHARED) != VM_SHARED) { 274 if ((vma->vm_flags & VM_MAYSHARE) != VM_MAYSHARE) {
275 dev_info(dev, "%s: %s: fail, attempted private mapping\n", 275 dev_info(dev, "%s: %s: fail, attempted private mapping\n",
276 current->comm, func); 276 current->comm, func);
277 return -EINVAL; 277 return -EINVAL;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 496f72b134eb..05c2850c04b0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -2472,6 +2472,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
2472 struct drm_file *file_priv); 2472 struct drm_file *file_priv);
2473void amdgpu_driver_preclose_kms(struct drm_device *dev, 2473void amdgpu_driver_preclose_kms(struct drm_device *dev,
2474 struct drm_file *file_priv); 2474 struct drm_file *file_priv);
2475int amdgpu_suspend(struct amdgpu_device *adev);
2475int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon); 2476int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon);
2476int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon); 2477int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon);
2477u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe); 2478u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 3161d77bf299..e41d4baebf86 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1493,7 +1493,7 @@ static int amdgpu_fini(struct amdgpu_device *adev)
1493 return 0; 1493 return 0;
1494} 1494}
1495 1495
1496static int amdgpu_suspend(struct amdgpu_device *adev) 1496int amdgpu_suspend(struct amdgpu_device *adev)
1497{ 1497{
1498 int i, r; 1498 int i, r;
1499 1499
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 02ff0747197c..e0890deccb2f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -479,12 +479,15 @@ amdgpu_pci_remove(struct pci_dev *pdev)
479static void 479static void
480amdgpu_pci_shutdown(struct pci_dev *pdev) 480amdgpu_pci_shutdown(struct pci_dev *pdev)
481{ 481{
482 struct drm_device *dev = pci_get_drvdata(pdev);
483 struct amdgpu_device *adev = dev->dev_private;
484
482 /* if we are running in a VM, make sure the device 485 /* if we are running in a VM, make sure the device
483 * torn down properly on reboot/shutdown. 486 * torn down properly on reboot/shutdown.
484 * unfortunately we can't detect certain 487 * unfortunately we can't detect certain
485 * hypervisors so just do this all the time. 488 * hypervisors so just do this all the time.
486 */ 489 */
487 amdgpu_pci_remove(pdev); 490 amdgpu_suspend(adev);
488} 491}
489 492
490static int amdgpu_pmops_suspend(struct device *dev) 493static int amdgpu_pmops_suspend(struct device *dev)
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index d1f8ab915b15..b90776ef56ec 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -755,8 +755,10 @@ static int __init ser_gigaset_init(void)
755 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 755 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
756 GIGASET_MODULENAME, GIGASET_DEVNAME, 756 GIGASET_MODULENAME, GIGASET_DEVNAME,
757 &ops, THIS_MODULE); 757 &ops, THIS_MODULE);
758 if (!driver) 758 if (!driver) {
759 rc = -ENOMEM;
759 goto error; 760 goto error;
761 }
760 762
761 rc = tty_register_ldisc(N_GIGASET_M101, &gigaset_ldisc); 763 rc = tty_register_ldisc(N_GIGASET_M101, &gigaset_ldisc);
762 if (rc != 0) { 764 if (rc != 0) {
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index f3141ca56bc3..0b0302af3bd2 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -870,23 +870,25 @@ lbl_free_candev:
870static void peak_usb_disconnect(struct usb_interface *intf) 870static void peak_usb_disconnect(struct usb_interface *intf)
871{ 871{
872 struct peak_usb_device *dev; 872 struct peak_usb_device *dev;
873 struct peak_usb_device *dev_prev_siblings;
873 874
874 /* unregister as many netdev devices as siblings */ 875 /* unregister as many netdev devices as siblings */
875 for (dev = usb_get_intfdata(intf); dev; dev = dev->prev_siblings) { 876 for (dev = usb_get_intfdata(intf); dev; dev = dev_prev_siblings) {
876 struct net_device *netdev = dev->netdev; 877 struct net_device *netdev = dev->netdev;
877 char name[IFNAMSIZ]; 878 char name[IFNAMSIZ];
878 879
880 dev_prev_siblings = dev->prev_siblings;
879 dev->state &= ~PCAN_USB_STATE_CONNECTED; 881 dev->state &= ~PCAN_USB_STATE_CONNECTED;
880 strncpy(name, netdev->name, IFNAMSIZ); 882 strncpy(name, netdev->name, IFNAMSIZ);
881 883
882 unregister_netdev(netdev); 884 unregister_netdev(netdev);
883 free_candev(netdev);
884 885
885 kfree(dev->cmd_buf); 886 kfree(dev->cmd_buf);
886 dev->next_siblings = NULL; 887 dev->next_siblings = NULL;
887 if (dev->adapter->dev_free) 888 if (dev->adapter->dev_free)
888 dev->adapter->dev_free(dev); 889 dev->adapter->dev_free(dev);
889 890
891 free_candev(netdev);
890 dev_info(&intf->dev, "%s removed\n", name); 892 dev_info(&intf->dev, "%s removed\n", name);
891 } 893 }
892 894
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 48113c6609db..66c37fac59b2 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -4921,6 +4921,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
4921 */ 4921 */
4922 for_each_port(adapter, i) { 4922 for_each_port(adapter, i) {
4923 pi = adap2pinfo(adapter, i); 4923 pi = adap2pinfo(adapter, i);
4924 adapter->port[i]->dev_port = pi->lport;
4924 netif_set_real_num_tx_queues(adapter->port[i], pi->nqsets); 4925 netif_set_real_num_tx_queues(adapter->port[i], pi->nqsets);
4925 netif_set_real_num_rx_queues(adapter->port[i], pi->nqsets); 4926 netif_set_real_num_rx_queues(adapter->port[i], pi->nqsets);
4926 4927
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 20dec85da63d..e8139514d32c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -7851,7 +7851,6 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf)
7851 return ret; 7851 return ret;
7852 7852
7853 memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); 7853 memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN);
7854 adap->port[i]->dev_port = j;
7855 j++; 7854 j++;
7856 } 7855 }
7857 return 0; 7856 return 0;
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index fa43e06d3a29..0d1a134c8174 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -2960,6 +2960,7 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
2960 2960
2961 netdev->netdev_ops = &cxgb4vf_netdev_ops; 2961 netdev->netdev_ops = &cxgb4vf_netdev_ops;
2962 netdev->ethtool_ops = &cxgb4vf_ethtool_ops; 2962 netdev->ethtool_ops = &cxgb4vf_ethtool_ops;
2963 netdev->dev_port = pi->port_id;
2963 2964
2964 /* 2965 /*
2965 * Initialize the hardware/software state for the port. 2966 * Initialize the hardware/software state for the port.
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 4a81c892fc31..fbece63395a8 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -58,7 +58,7 @@ static struct kobj_type ktype_veth_pool;
58 58
59static const char ibmveth_driver_name[] = "ibmveth"; 59static const char ibmveth_driver_name[] = "ibmveth";
60static const char ibmveth_driver_string[] = "IBM Power Virtual Ethernet Driver"; 60static const char ibmveth_driver_string[] = "IBM Power Virtual Ethernet Driver";
61#define ibmveth_driver_version "1.05" 61#define ibmveth_driver_version "1.06"
62 62
63MODULE_AUTHOR("Santiago Leon <santil@linux.vnet.ibm.com>"); 63MODULE_AUTHOR("Santiago Leon <santil@linux.vnet.ibm.com>");
64MODULE_DESCRIPTION("IBM Power Virtual Ethernet Driver"); 64MODULE_DESCRIPTION("IBM Power Virtual Ethernet Driver");
@@ -137,6 +137,11 @@ static inline int ibmveth_rxq_frame_offset(struct ibmveth_adapter *adapter)
137 return ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_OFF_MASK; 137 return ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_OFF_MASK;
138} 138}
139 139
140static inline int ibmveth_rxq_large_packet(struct ibmveth_adapter *adapter)
141{
142 return ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_LRG_PKT;
143}
144
140static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter) 145static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter)
141{ 146{
142 return be32_to_cpu(adapter->rx_queue.queue_addr[adapter->rx_queue.index].length); 147 return be32_to_cpu(adapter->rx_queue.queue_addr[adapter->rx_queue.index].length);
@@ -1174,6 +1179,45 @@ map_failed:
1174 goto retry_bounce; 1179 goto retry_bounce;
1175} 1180}
1176 1181
1182static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
1183{
1184 int offset = 0;
1185
1186 /* only TCP packets will be aggregated */
1187 if (skb->protocol == htons(ETH_P_IP)) {
1188 struct iphdr *iph = (struct iphdr *)skb->data;
1189
1190 if (iph->protocol == IPPROTO_TCP) {
1191 offset = iph->ihl * 4;
1192 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
1193 } else {
1194 return;
1195 }
1196 } else if (skb->protocol == htons(ETH_P_IPV6)) {
1197 struct ipv6hdr *iph6 = (struct ipv6hdr *)skb->data;
1198
1199 if (iph6->nexthdr == IPPROTO_TCP) {
1200 offset = sizeof(struct ipv6hdr);
1201 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
1202 } else {
1203 return;
1204 }
1205 } else {
1206 return;
1207 }
1208 /* if mss is not set through Large Packet bit/mss in rx buffer,
1209 * expect that the mss will be written to the tcp header checksum.
1210 */
1211 if (lrg_pkt) {
1212 skb_shinfo(skb)->gso_size = mss;
1213 } else if (offset) {
1214 struct tcphdr *tcph = (struct tcphdr *)(skb->data + offset);
1215
1216 skb_shinfo(skb)->gso_size = ntohs(tcph->check);
1217 tcph->check = 0;
1218 }
1219}
1220
1177static int ibmveth_poll(struct napi_struct *napi, int budget) 1221static int ibmveth_poll(struct napi_struct *napi, int budget)
1178{ 1222{
1179 struct ibmveth_adapter *adapter = 1223 struct ibmveth_adapter *adapter =
@@ -1182,6 +1226,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
1182 int frames_processed = 0; 1226 int frames_processed = 0;
1183 unsigned long lpar_rc; 1227 unsigned long lpar_rc;
1184 struct iphdr *iph; 1228 struct iphdr *iph;
1229 u16 mss = 0;
1185 1230
1186restart_poll: 1231restart_poll:
1187 while (frames_processed < budget) { 1232 while (frames_processed < budget) {
@@ -1199,9 +1244,21 @@ restart_poll:
1199 int length = ibmveth_rxq_frame_length(adapter); 1244 int length = ibmveth_rxq_frame_length(adapter);
1200 int offset = ibmveth_rxq_frame_offset(adapter); 1245 int offset = ibmveth_rxq_frame_offset(adapter);
1201 int csum_good = ibmveth_rxq_csum_good(adapter); 1246 int csum_good = ibmveth_rxq_csum_good(adapter);
1247 int lrg_pkt = ibmveth_rxq_large_packet(adapter);
1202 1248
1203 skb = ibmveth_rxq_get_buffer(adapter); 1249 skb = ibmveth_rxq_get_buffer(adapter);
1204 1250
1251 /* if the large packet bit is set in the rx queue
1252 * descriptor, the mss will be written by PHYP eight
1253 * bytes from the start of the rx buffer, which is
1254 * skb->data at this stage
1255 */
1256 if (lrg_pkt) {
1257 __be64 *rxmss = (__be64 *)(skb->data + 8);
1258
1259 mss = (u16)be64_to_cpu(*rxmss);
1260 }
1261
1205 new_skb = NULL; 1262 new_skb = NULL;
1206 if (length < rx_copybreak) 1263 if (length < rx_copybreak)
1207 new_skb = netdev_alloc_skb(netdev, length); 1264 new_skb = netdev_alloc_skb(netdev, length);
@@ -1235,11 +1292,15 @@ restart_poll:
1235 if (iph->check == 0xffff) { 1292 if (iph->check == 0xffff) {
1236 iph->check = 0; 1293 iph->check = 0;
1237 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); 1294 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
1238 adapter->rx_large_packets++;
1239 } 1295 }
1240 } 1296 }
1241 } 1297 }
1242 1298
1299 if (length > netdev->mtu + ETH_HLEN) {
1300 ibmveth_rx_mss_helper(skb, mss, lrg_pkt);
1301 adapter->rx_large_packets++;
1302 }
1303
1243 napi_gro_receive(napi, skb); /* send it up */ 1304 napi_gro_receive(napi, skb); /* send it up */
1244 1305
1245 netdev->stats.rx_packets++; 1306 netdev->stats.rx_packets++;
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h
index 4eade67fe30c..7acda04d034e 100644
--- a/drivers/net/ethernet/ibm/ibmveth.h
+++ b/drivers/net/ethernet/ibm/ibmveth.h
@@ -209,6 +209,7 @@ struct ibmveth_rx_q_entry {
209#define IBMVETH_RXQ_TOGGLE 0x80000000 209#define IBMVETH_RXQ_TOGGLE 0x80000000
210#define IBMVETH_RXQ_TOGGLE_SHIFT 31 210#define IBMVETH_RXQ_TOGGLE_SHIFT 31
211#define IBMVETH_RXQ_VALID 0x40000000 211#define IBMVETH_RXQ_VALID 0x40000000
212#define IBMVETH_RXQ_LRG_PKT 0x04000000
212#define IBMVETH_RXQ_NO_CSUM 0x02000000 213#define IBMVETH_RXQ_NO_CSUM 0x02000000
213#define IBMVETH_RXQ_CSUM_GOOD 0x01000000 214#define IBMVETH_RXQ_CSUM_GOOD 0x01000000
214#define IBMVETH_RXQ_OFF_MASK 0x0000FFFF 215#define IBMVETH_RXQ_OFF_MASK 0x0000FFFF
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 9d931373a9b9..faea52da8dae 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -696,6 +696,7 @@ ltq_etop_probe(struct platform_device *pdev)
696 priv->pldata = dev_get_platdata(&pdev->dev); 696 priv->pldata = dev_get_platdata(&pdev->dev);
697 priv->netdev = dev; 697 priv->netdev = dev;
698 spin_lock_init(&priv->lock); 698 spin_lock_init(&priv->lock);
699 SET_NETDEV_DEV(dev, &pdev->dev);
699 700
700 for (i = 0; i < MAX_DMA_CHAN; i++) { 701 for (i = 0; i < MAX_DMA_CHAN; i++) {
701 if (IS_TX(i)) 702 if (IS_TX(i))
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index aae46884bf93..521cfdb7d11e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -18,8 +18,6 @@ config MLX5_CORE_EN
18 default n 18 default n
19 ---help--- 19 ---help---
20 Ethernet support in Mellanox Technologies ConnectX-4 NIC. 20 Ethernet support in Mellanox Technologies ConnectX-4 NIC.
21 Ethernet and Infiniband support in ConnectX-4 are currently mutually
22 exclusive.
23 21
24config MLX5_CORE_EN_DCB 22config MLX5_CORE_EN_DCB
25 bool "Data Center Bridging (DCB) Support" 23 bool "Data Center Bridging (DCB) Support"
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index be09573c6ced..c48fc0c4abd9 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -438,9 +438,16 @@ static int smsc911x_request_resources(struct platform_device *pdev)
438 ret = regulator_bulk_get(&pdev->dev, 438 ret = regulator_bulk_get(&pdev->dev,
439 ARRAY_SIZE(pdata->supplies), 439 ARRAY_SIZE(pdata->supplies),
440 pdata->supplies); 440 pdata->supplies);
441 if (ret) 441 if (ret) {
442 /*
443 * Retry on deferrals, else just report the error
444 * and try to continue.
445 */
446 if (ret == -EPROBE_DEFER)
447 return ret;
442 netdev_err(ndev, "couldn't get regulators %d\n", 448 netdev_err(ndev, "couldn't get regulators %d\n",
443 ret); 449 ret);
450 }
444 451
445 /* Request optional RESET GPIO */ 452 /* Request optional RESET GPIO */
446 pdata->reset_gpiod = devm_gpiod_get_optional(&pdev->dev, 453 pdata->reset_gpiod = devm_gpiod_get_optional(&pdev->dev,
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index c56e7030c44e..77c88fcf2b86 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1112,6 +1112,7 @@ static int cpmac_probe(struct platform_device *pdev)
1112 if (!dev) 1112 if (!dev)
1113 return -ENOMEM; 1113 return -ENOMEM;
1114 1114
1115 SET_NETDEV_DEV(dev, &pdev->dev);
1115 platform_set_drvdata(pdev, dev); 1116 platform_set_drvdata(pdev, dev);
1116 priv = netdev_priv(dev); 1117 priv = netdev_priv(dev);
1117 1118
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c
index ba1e45ff6aae..18013645e76c 100644
--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c
+++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c
@@ -81,6 +81,7 @@ static void cpsw_gmii_sel_am3352(struct cpsw_phy_sel_priv *priv,
81 }; 81 };
82 82
83 mask = GMII_SEL_MODE_MASK << (slave * 2) | BIT(slave + 6); 83 mask = GMII_SEL_MODE_MASK << (slave * 2) | BIT(slave + 6);
84 mask |= BIT(slave + 4);
84 mode <<= slave * 2; 85 mode <<= slave * 2;
85 86
86 if (priv->rmii_clock_external) { 87 if (priv->rmii_clock_external) {
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 9522763c8faf..c9414c054852 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -47,6 +47,10 @@
47 NETIF_F_TSO | \ 47 NETIF_F_TSO | \
48 NETIF_F_TSO6 | \ 48 NETIF_F_TSO6 | \
49 NETIF_F_HW_CSUM) 49 NETIF_F_HW_CSUM)
50
51/* Restrict GSO size to account for NVGRE */
52#define NETVSC_GSO_MAX_SIZE 62768
53
50static int ring_size = 128; 54static int ring_size = 128;
51module_param(ring_size, int, S_IRUGO); 55module_param(ring_size, int, S_IRUGO);
52MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); 56MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
@@ -1393,6 +1397,7 @@ static int netvsc_probe(struct hv_device *dev,
1393 nvdev = net_device_ctx->nvdev; 1397 nvdev = net_device_ctx->nvdev;
1394 netif_set_real_num_tx_queues(net, nvdev->num_chn); 1398 netif_set_real_num_tx_queues(net, nvdev->num_chn);
1395 netif_set_real_num_rx_queues(net, nvdev->num_chn); 1399 netif_set_real_num_rx_queues(net, nvdev->num_chn);
1400 netif_set_gso_max_size(net, NETVSC_GSO_MAX_SIZE);
1396 1401
1397 /* MTU range: 68 - 1500 or 65521 */ 1402 /* MTU range: 68 - 1500 or 65521 */
1398 net->min_mtu = NETVSC_MTU_MIN; 1403 net->min_mtu = NETVSC_MTU_MIN;
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index ffe8994e64fc..693ec5b66222 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -546,13 +546,15 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
546 } 546 }
547 err = ipvlan_set_port_mode(port, mode); 547 err = ipvlan_set_port_mode(port, mode);
548 if (err) { 548 if (err) {
549 goto unregister_netdev; 549 goto unlink_netdev;
550 } 550 }
551 551
552 list_add_tail_rcu(&ipvlan->pnode, &port->ipvlans); 552 list_add_tail_rcu(&ipvlan->pnode, &port->ipvlans);
553 netif_stacked_transfer_operstate(phy_dev, dev); 553 netif_stacked_transfer_operstate(phy_dev, dev);
554 return 0; 554 return 0;
555 555
556unlink_netdev:
557 netdev_upper_dev_unlink(phy_dev, dev);
556unregister_netdev: 558unregister_netdev:
557 unregister_netdevice(dev); 559 unregister_netdevice(dev);
558destroy_ipvlan_port: 560destroy_ipvlan_port:
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 32fa7c76f29c..0aadef9fc7dd 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -905,11 +905,17 @@ EXPORT_SYMBOL(phy_attached_print);
905int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, 905int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
906 u32 flags, phy_interface_t interface) 906 u32 flags, phy_interface_t interface)
907{ 907{
908 struct module *ndev_owner = dev->dev.parent->driver->owner;
908 struct mii_bus *bus = phydev->mdio.bus; 909 struct mii_bus *bus = phydev->mdio.bus;
909 struct device *d = &phydev->mdio.dev; 910 struct device *d = &phydev->mdio.dev;
910 int err; 911 int err;
911 912
912 if (!try_module_get(bus->owner)) { 913 /* For Ethernet device drivers that register their own MDIO bus, we
914 * will have bus->owner match ndev_mod, so we do not want to increment
915 * our own module->refcnt here, otherwise we would not be able to
916 * unload later on.
917 */
918 if (ndev_owner != bus->owner && !try_module_get(bus->owner)) {
913 dev_err(&dev->dev, "failed to get the bus module\n"); 919 dev_err(&dev->dev, "failed to get the bus module\n");
914 return -EIO; 920 return -EIO;
915 } 921 }
@@ -971,7 +977,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
971error: 977error:
972 phy_detach(phydev); 978 phy_detach(phydev);
973 put_device(d); 979 put_device(d);
974 module_put(bus->owner); 980 if (ndev_owner != bus->owner)
981 module_put(bus->owner);
975 return err; 982 return err;
976} 983}
977EXPORT_SYMBOL(phy_attach_direct); 984EXPORT_SYMBOL(phy_attach_direct);
@@ -1021,6 +1028,8 @@ EXPORT_SYMBOL(phy_attach);
1021 */ 1028 */
1022void phy_detach(struct phy_device *phydev) 1029void phy_detach(struct phy_device *phydev)
1023{ 1030{
1031 struct net_device *dev = phydev->attached_dev;
1032 struct module *ndev_owner = dev->dev.parent->driver->owner;
1024 struct mii_bus *bus; 1033 struct mii_bus *bus;
1025 int i; 1034 int i;
1026 1035
@@ -1050,7 +1059,8 @@ void phy_detach(struct phy_device *phydev)
1050 bus = phydev->mdio.bus; 1059 bus = phydev->mdio.bus;
1051 1060
1052 put_device(&phydev->mdio.dev); 1061 put_device(&phydev->mdio.dev);
1053 module_put(bus->owner); 1062 if (ndev_owner != bus->owner)
1063 module_put(bus->owner);
1054} 1064}
1055EXPORT_SYMBOL(phy_detach); 1065EXPORT_SYMBOL(phy_detach);
1056 1066
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 96a5028621c8..3a98f3762a4c 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -602,6 +602,21 @@ static const struct driver_info cdc_mbim_info_ndp_to_end = {
602 .data = CDC_NCM_FLAG_NDP_TO_END, 602 .data = CDC_NCM_FLAG_NDP_TO_END,
603}; 603};
604 604
605/* Some modems (e.g. Telit LE922A6) do not work properly with altsetting
606 * toggle done in cdc_ncm_bind_common. CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE
607 * flag is used to avoid this procedure.
608 */
609static const struct driver_info cdc_mbim_info_avoid_altsetting_toggle = {
610 .description = "CDC MBIM",
611 .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN,
612 .bind = cdc_mbim_bind,
613 .unbind = cdc_mbim_unbind,
614 .manage_power = cdc_mbim_manage_power,
615 .rx_fixup = cdc_mbim_rx_fixup,
616 .tx_fixup = cdc_mbim_tx_fixup,
617 .data = CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE,
618};
619
605static const struct usb_device_id mbim_devs[] = { 620static const struct usb_device_id mbim_devs[] = {
606 /* This duplicate NCM entry is intentional. MBIM devices can 621 /* This duplicate NCM entry is intentional. MBIM devices can
607 * be disguised as NCM by default, and this is necessary to 622 * be disguised as NCM by default, and this is necessary to
@@ -626,6 +641,12 @@ static const struct usb_device_id mbim_devs[] = {
626 { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), 641 { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
627 .driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end, 642 .driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end,
628 }, 643 },
644
645 /* Telit LE922A6 in MBIM composition */
646 { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1041, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
647 .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle,
648 },
649
629 /* default entry */ 650 /* default entry */
630 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), 651 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
631 .driver_info = (unsigned long)&cdc_mbim_info_zlp, 652 .driver_info = (unsigned long)&cdc_mbim_info_zlp,
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 7141817946f0..2d1a6f2e16ab 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -835,11 +835,18 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
835 835
836 iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber; 836 iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
837 837
838 /* Device-specific flags */
839 ctx->drvflags = drvflags;
840
838 /* Reset data interface. Some devices will not reset properly 841 /* Reset data interface. Some devices will not reset properly
839 * unless they are configured first. Toggle the altsetting to 842 * unless they are configured first. Toggle the altsetting to
840 * force a reset 843 * force a reset.
844 * Some other devices do not work properly with this procedure
845 * that can be avoided using quirk CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE
841 */ 846 */
842 usb_set_interface(dev->udev, iface_no, data_altsetting); 847 if (!(ctx->drvflags & CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE))
848 usb_set_interface(dev->udev, iface_no, data_altsetting);
849
843 temp = usb_set_interface(dev->udev, iface_no, 0); 850 temp = usb_set_interface(dev->udev, iface_no, 0);
844 if (temp) { 851 if (temp) {
845 dev_dbg(&intf->dev, "set interface failed\n"); 852 dev_dbg(&intf->dev, "set interface failed\n");
@@ -886,9 +893,6 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
886 /* finish setting up the device specific data */ 893 /* finish setting up the device specific data */
887 cdc_ncm_setup(dev); 894 cdc_ncm_setup(dev);
888 895
889 /* Device-specific flags */
890 ctx->drvflags = drvflags;
891
892 /* Allocate the delayed NDP if needed. */ 896 /* Allocate the delayed NDP if needed. */
893 if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { 897 if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
894 ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL); 898 ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL);
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index a8b6949a8778..23d4a1728cdf 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -715,7 +715,7 @@ EXPORT_SYMBOL_GPL(nd_cmd_in_size);
715 715
716u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd, 716u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd,
717 const struct nd_cmd_desc *desc, int idx, const u32 *in_field, 717 const struct nd_cmd_desc *desc, int idx, const u32 *in_field,
718 const u32 *out_field) 718 const u32 *out_field, unsigned long remainder)
719{ 719{
720 if (idx >= desc->out_num) 720 if (idx >= desc->out_num)
721 return UINT_MAX; 721 return UINT_MAX;
@@ -727,9 +727,24 @@ u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd,
727 return in_field[1]; 727 return in_field[1];
728 else if (nvdimm && cmd == ND_CMD_VENDOR && idx == 2) 728 else if (nvdimm && cmd == ND_CMD_VENDOR && idx == 2)
729 return out_field[1]; 729 return out_field[1];
730 else if (!nvdimm && cmd == ND_CMD_ARS_STATUS && idx == 2) 730 else if (!nvdimm && cmd == ND_CMD_ARS_STATUS && idx == 2) {
731 return out_field[1] - 8; 731 /*
732 else if (cmd == ND_CMD_CALL) { 732 * Per table 9-276 ARS Data in ACPI 6.1, out_field[1] is
733 * "Size of Output Buffer in bytes, including this
734 * field."
735 */
736 if (out_field[1] < 4)
737 return 0;
738 /*
739 * ACPI 6.1 is ambiguous if 'status' is included in the
740 * output size. If we encounter an output size that
741 * overshoots the remainder by 4 bytes, assume it was
742 * including 'status'.
743 */
744 if (out_field[1] - 8 == remainder)
745 return remainder;
746 return out_field[1] - 4;
747 } else if (cmd == ND_CMD_CALL) {
733 struct nd_cmd_pkg *pkg = (struct nd_cmd_pkg *) in_field; 748 struct nd_cmd_pkg *pkg = (struct nd_cmd_pkg *) in_field;
734 749
735 return pkg->nd_size_out; 750 return pkg->nd_size_out;
@@ -876,7 +891,7 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
876 /* process an output envelope */ 891 /* process an output envelope */
877 for (i = 0; i < desc->out_num; i++) { 892 for (i = 0; i < desc->out_num; i++) {
878 u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i, 893 u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i,
879 (u32 *) in_env, (u32 *) out_env); 894 (u32 *) in_env, (u32 *) out_env, 0);
880 u32 copy; 895 u32 copy;
881 896
882 if (out_size == UINT_MAX) { 897 if (out_size == UINT_MAX) {
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index c5326055beee..f4f77c5b0c83 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1323,18 +1323,20 @@ lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1323{ 1323{
1324 lockdep_assert_held(&phba->hbalock); 1324 lockdep_assert_held(&phba->hbalock);
1325 1325
1326 BUG_ON(!piocb || !piocb->vport); 1326 BUG_ON(!piocb);
1327 1327
1328 list_add_tail(&piocb->list, &pring->txcmplq); 1328 list_add_tail(&piocb->list, &pring->txcmplq);
1329 piocb->iocb_flag |= LPFC_IO_ON_TXCMPLQ; 1329 piocb->iocb_flag |= LPFC_IO_ON_TXCMPLQ;
1330 1330
1331 if ((unlikely(pring->ringno == LPFC_ELS_RING)) && 1331 if ((unlikely(pring->ringno == LPFC_ELS_RING)) &&
1332 (piocb->iocb.ulpCommand != CMD_ABORT_XRI_CN) && 1332 (piocb->iocb.ulpCommand != CMD_ABORT_XRI_CN) &&
1333 (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN) && 1333 (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) {
1334 (!(piocb->vport->load_flag & FC_UNLOADING))) 1334 BUG_ON(!piocb->vport);
1335 mod_timer(&piocb->vport->els_tmofunc, 1335 if (!(piocb->vport->load_flag & FC_UNLOADING))
1336 jiffies + 1336 mod_timer(&piocb->vport->els_tmofunc,
1337 msecs_to_jiffies(1000 * (phba->fc_ratov << 1))); 1337 jiffies +
1338 msecs_to_jiffies(1000 * (phba->fc_ratov << 1)));
1339 }
1338 1340
1339 return 0; 1341 return 0;
1340} 1342}
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index 9c3c68b9a49e..e6b70966c19d 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -503,7 +503,7 @@ static void vhost_vsock_reset_orphans(struct sock *sk)
503 * executing. 503 * executing.
504 */ 504 */
505 505
506 if (!vhost_vsock_get(vsk->local_addr.svm_cid)) { 506 if (!vhost_vsock_get(vsk->remote_addr.svm_cid)) {
507 sock_set_flag(sk, SOCK_DONE); 507 sock_set_flag(sk, SOCK_DONE);
508 vsk->peer_shutdown = SHUTDOWN_MASK; 508 vsk->peer_shutdown = SHUTDOWN_MASK;
509 sk->sk_state = SS_UNCONNECTED; 509 sk->sk_state = SS_UNCONNECTED;