Shannon Nelson says: ==================== ionic: driver updates These are a couple of checkpatch cleanup patches, a bug fix, and something to alleviate memory pressure in tight places. ====================
Unified · Split
| @@ -206,6 +206,8 @@ do_check_time: · 205 unmodified lines | |||
| 206 | if (fw_status_ready != idev->fw_status_ready) { | 206 | if (fw_status_ready != idev->fw_status_ready) { |
| 207 | bool trigger = false; | 207 | bool trigger = false; |
| 208 | 208 | ||
| 209 | idev->fw_status_ready = fw_status_ready; | ||
| 210 | |||
| 209 | if (!fw_status_ready && lif && | 211 | if (!fw_status_ready && lif && |
| 210 | !test_bit(IONIC_LIF_F_FW_RESET, lif->state) && | 212 | !test_bit(IONIC_LIF_F_FW_RESET, lif->state) && |
| 211 | !test_and_set_bit(IONIC_LIF_F_FW_STOPPING, lif->state)) { | 213 | !test_and_set_bit(IONIC_LIF_F_FW_STOPPING, lif->state)) { |
| @@ -222,8 +224,6 @@ do_check_time: · 10 unmodified lines | |||
| 222 | if (trigger) { | 224 | if (trigger) { |
| 223 | struct ionic_deferred_work *work; | 225 | struct ionic_deferred_work *work; |
| 224 | 226 | ||
| 225 | idev->fw_status_ready = fw_status_ready; | ||
| 226 | |||
| 227 | work = kzalloc(sizeof(*work), GFP_ATOMIC); | 227 | work = kzalloc(sizeof(*work), GFP_ATOMIC); |
| 228 | if (work) { | 228 | if (work) { |
| 229 | work->type = IONIC_DW_TYPE_LIF_RESET; | 229 | work->type = IONIC_DW_TYPE_LIF_RESET; |
| @@ -74,10 +74,10 @@ static void ionic_get_drvinfo(struct net_device *netdev, · 73 unmodified lines | |||
| 74 | struct ionic_lif *lif = netdev_priv(netdev); | 74 | struct ionic_lif *lif = netdev_priv(netdev); |
| 75 | struct ionic *ionic = lif->ionic; | 75 | struct ionic *ionic = lif->ionic; |
| 76 | 76 | ||
| 77 | strlcpy(drvinfo->driver, IONIC_DRV_NAME, sizeof(drvinfo->driver)); | 77 | strscpy(drvinfo->driver, IONIC_DRV_NAME, sizeof(drvinfo->driver)); |
| 78 | strlcpy(drvinfo->fw_version, ionic->idev.dev_info.fw_version, | 78 | strscpy(drvinfo->fw_version, ionic->idev.dev_info.fw_version, |
| 79 | sizeof(drvinfo->fw_version)); | 79 | sizeof(drvinfo->fw_version)); |
| 80 | strlcpy(drvinfo->bus_info, ionic_bus_info(ionic), | 80 | strscpy(drvinfo->bus_info, ionic_bus_info(ionic), |
| 81 | sizeof(drvinfo->bus_info)); | 81 | sizeof(drvinfo->bus_info)); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| @@ -759,7 +759,7 @@ enum ionic_txq_desc_opcode { · 758 unmodified lines | |||
| 759 | * IONIC_TXQ_DESC_OPCODE_CSUM_HW: | 759 | * IONIC_TXQ_DESC_OPCODE_CSUM_HW: |
| 760 | * Offload 16-bit checksum computation to hardware. | 760 | * Offload 16-bit checksum computation to hardware. |
| 761 | * If @csum_l3 is set then the packet's L3 checksum is | 761 | * If @csum_l3 is set then the packet's L3 checksum is |
| 762 | * updated. Similarly, if @csum_l4 is set the the L4 | 762 | * updated. Similarly, if @csum_l4 is set the L4 |
| 763 | * checksum is updated. If @encap is set then encap header | 763 | * checksum is updated. If @encap is set then encap header |
| 764 | * checksums are also updated. | 764 | * checksums are also updated. |
| 765 | * | 765 | * |
| @@ -1368,9 +1368,9 @@ union ionic_port_config { · 602 unmodified lines | |||
| 1368 | * @status: link status (enum ionic_port_oper_status) | 1368 | * @status: link status (enum ionic_port_oper_status) |
| 1369 | * @id: port id | 1369 | * @id: port id |
| 1370 | * @speed: link speed (in Mbps) | 1370 | * @speed: link speed (in Mbps) |
| 1371 | * @link_down_count: number of times link went from from up to down | 1371 | * @link_down_count: number of times link went from up to down |
| 1372 | * @fec_type: fec type (enum ionic_port_fec_type) | 1372 | * @fec_type: fec type (enum ionic_port_fec_type) |
| 1373 | * @xcvr: tranceiver status | 1373 | * @xcvr: transceiver status |
| 1374 | */ | 1374 | */ |
| 1375 | struct ionic_port_status { | 1375 | struct ionic_port_status { |
| 1376 | __le32 id; | 1376 | __le32 id; |
| @@ -393,11 +393,11 @@ static void ionic_qcq_free(struct ionic_lif *lif, struct ionic_qcq *qcq) · 392 unmodified lines | |||
| 393 | ionic_qcq_intr_free(lif, qcq); | 393 | ionic_qcq_intr_free(lif, qcq); |
| 394 | 394 | ||
| 395 | if (qcq->cq.info) { | 395 | if (qcq->cq.info) { |
| 396 | devm_kfree(dev, qcq->cq.info); | 396 | vfree(qcq->cq.info); |
| 397 | qcq->cq.info = NULL; | 397 | qcq->cq.info = NULL; |
| 398 | } | 398 | } |
| 399 | if (qcq->q.info) { | 399 | if (qcq->q.info) { |
| 400 | devm_kfree(dev, qcq->q.info); | 400 | vfree(qcq->q.info); |
| 401 | qcq->q.info = NULL; | 401 | qcq->q.info = NULL; |
| 402 | } | 402 | } |
| 403 | } | 403 | } |
| @@ -528,8 +528,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type, · 124 unmodified lines | |||
| 528 | new->q.dev = dev; | 528 | new->q.dev = dev; |
| 529 | new->flags = flags; | 529 | new->flags = flags; |
| 530 | 530 | ||
| 531 | new->q.info = devm_kcalloc(dev, num_descs, sizeof(*new->q.info), | 531 | new->q.info = vzalloc(num_descs * sizeof(*new->q.info)); |
| 532 | GFP_KERNEL); | ||
| 533 | if (!new->q.info) { | 532 | if (!new->q.info) { |
| 534 | netdev_err(lif->netdev, "Cannot allocate queue info\n"); | 533 | netdev_err(lif->netdev, "Cannot allocate queue info\n"); |
| 535 | err = -ENOMEM; | 534 | err = -ENOMEM; |
| @@ -550,8 +549,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type, · 14 unmodified lines | |||
| 550 | if (err) | 549 | if (err) |
| 551 | goto err_out; | 550 | goto err_out; |
| 552 | 551 | ||
| 553 | new->cq.info = devm_kcalloc(dev, num_descs, sizeof(*new->cq.info), | 552 | new->cq.info = vzalloc(num_descs * sizeof(*new->cq.info)); |
| 554 | GFP_KERNEL); | ||
| 555 | if (!new->cq.info) { | 553 | if (!new->cq.info) { |
| 556 | netdev_err(lif->netdev, "Cannot allocate completion queue info\n"); | 554 | netdev_err(lif->netdev, "Cannot allocate completion queue info\n"); |
| 557 | err = -ENOMEM; | 555 | err = -ENOMEM; |
| @@ -640,14 +638,14 @@ err_out_free_cq: · 82 unmodified lines | |||
| 640 | err_out_free_q: | 638 | err_out_free_q: |
| 641 | dma_free_coherent(dev, new->q_size, new->q_base, new->q_base_pa); | 639 | dma_free_coherent(dev, new->q_size, new->q_base, new->q_base_pa); |
| 642 | err_out_free_cq_info: | 640 | err_out_free_cq_info: |
| 643 | devm_kfree(dev, new->cq.info); | 641 | vfree(new->cq.info); |
| 644 | err_out_free_irq: | 642 | err_out_free_irq: |
| 645 | if (flags & IONIC_QCQ_F_INTR) { | 643 | if (flags & IONIC_QCQ_F_INTR) { |
| 646 | devm_free_irq(dev, new->intr.vector, &new->napi); | 644 | devm_free_irq(dev, new->intr.vector, &new->napi); |
| 647 | ionic_intr_free(lif->ionic, new->intr.index); | 645 | ionic_intr_free(lif->ionic, new->intr.index); |
| 648 | } | 646 | } |
| 649 | err_out_free_q_info: | 647 | err_out_free_q_info: |
| 650 | devm_kfree(dev, new->q.info); | 648 | vfree(new->q.info); |
| 651 | err_out_free_qcq: | 649 | err_out_free_qcq: |
| 652 | devm_kfree(dev, new); | 650 | devm_kfree(dev, new); |
| 653 | err_out: | 651 | err_out: |
| @@ -3303,7 +3301,7 @@ static void ionic_lif_set_netdev_info(struct ionic_lif *lif) · 2649 unmodified lines | |||
| 3303 | }, | 3301 | }, |
| 3304 | }; | 3302 | }; |
| 3305 | 3303 | ||
| 3306 | strlcpy(ctx.cmd.lif_setattr.name, lif->netdev->name, | 3304 | strscpy(ctx.cmd.lif_setattr.name, lif->netdev->name, |
| 3307 | sizeof(ctx.cmd.lif_setattr.name)); | 3305 | sizeof(ctx.cmd.lif_setattr.name)); |
| 3308 | 3306 | ||
| 3309 | ionic_adminq_post_wait(lif, &ctx); | 3307 | ionic_adminq_post_wait(lif, &ctx); |
| @@ -151,7 +151,6 @@ static const struct ionic_stat_desc ionic_rx_stats_desc[] = { · 150 unmodified lines | |||
| 151 | IONIC_RX_STAT_DESC(vlan_stripped), | 151 | IONIC_RX_STAT_DESC(vlan_stripped), |
| 152 | }; | 152 | }; |
| 153 | 153 | ||
| 154 | |||
| 155 | #define IONIC_NUM_LIF_STATS ARRAY_SIZE(ionic_lif_stats_desc) | 154 | #define IONIC_NUM_LIF_STATS ARRAY_SIZE(ionic_lif_stats_desc) |
| 156 | #define IONIC_NUM_PORT_STATS ARRAY_SIZE(ionic_port_stats_desc) | 155 | #define IONIC_NUM_PORT_STATS ARRAY_SIZE(ionic_port_stats_desc) |
| 157 | #define IONIC_NUM_TX_STATS ARRAY_SIZE(ionic_tx_stats_desc) | 156 | #define IONIC_NUM_TX_STATS ARRAY_SIZE(ionic_tx_stats_desc) |
| @@ -10,7 +10,6 @@ · 9 unmodified lines | |||
| 10 | #include "ionic_lif.h" | 10 | #include "ionic_lif.h" |
| 11 | #include "ionic_txrx.h" | 11 | #include "ionic_txrx.h" |
| 12 | 12 | ||
| 13 | |||
| 14 | static inline void ionic_txq_post(struct ionic_queue *q, bool ring_dbell, | 13 | static inline void ionic_txq_post(struct ionic_queue *q, bool ring_dbell, |
| 15 | ionic_desc_cb cb_func, void *cb_arg) | 14 | ionic_desc_cb cb_func, void *cb_arg) |
| 16 | { | 15 | { |