hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/ethernet/cisco/enic/vnic_dev.c
....@@ -193,9 +193,10 @@
193193 {
194194 vnic_dev_desc_ring_size(ring, desc_count, desc_size);
195195
196
- ring->descs_unaligned = pci_alloc_consistent(vdev->pdev,
197
- ring->size_unaligned,
198
- &ring->base_addr_unaligned);
196
+ ring->descs_unaligned = dma_alloc_coherent(&vdev->pdev->dev,
197
+ ring->size_unaligned,
198
+ &ring->base_addr_unaligned,
199
+ GFP_KERNEL);
199200
200201 if (!ring->descs_unaligned) {
201202 vdev_err(vdev, "Failed to allocate ring (size=%d), aborting\n",
....@@ -218,10 +219,9 @@
218219 void vnic_dev_free_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring)
219220 {
220221 if (ring->descs) {
221
- pci_free_consistent(vdev->pdev,
222
- ring->size_unaligned,
223
- ring->descs_unaligned,
224
- ring->base_addr_unaligned);
222
+ dma_free_coherent(&vdev->pdev->dev, ring->size_unaligned,
223
+ ring->descs_unaligned,
224
+ ring->base_addr_unaligned);
225225 ring->descs = NULL;
226226 }
227227 }
....@@ -551,9 +551,9 @@
551551 int err = 0;
552552
553553 if (!vdev->fw_info) {
554
- vdev->fw_info = pci_zalloc_consistent(vdev->pdev,
555
- sizeof(struct vnic_devcmd_fw_info),
556
- &vdev->fw_info_pa);
554
+ vdev->fw_info = dma_alloc_coherent(&vdev->pdev->dev,
555
+ sizeof(struct vnic_devcmd_fw_info),
556
+ &vdev->fw_info_pa, GFP_ATOMIC);
557557 if (!vdev->fw_info)
558558 return -ENOMEM;
559559
....@@ -603,8 +603,9 @@
603603 int wait = 1000;
604604
605605 if (!vdev->stats) {
606
- vdev->stats = pci_alloc_consistent(vdev->pdev,
607
- sizeof(struct vnic_stats), &vdev->stats_pa);
606
+ vdev->stats = dma_alloc_coherent(&vdev->pdev->dev,
607
+ sizeof(struct vnic_stats),
608
+ &vdev->stats_pa, GFP_ATOMIC);
608609 if (!vdev->stats)
609610 return -ENOMEM;
610611 }
....@@ -852,9 +853,9 @@
852853 return -EINVAL;
853854 }
854855
855
- notify_addr = pci_alloc_consistent(vdev->pdev,
856
- sizeof(struct vnic_devcmd_notify),
857
- &notify_pa);
856
+ notify_addr = dma_alloc_coherent(&vdev->pdev->dev,
857
+ sizeof(struct vnic_devcmd_notify),
858
+ &notify_pa, GFP_ATOMIC);
858859 if (!notify_addr)
859860 return -ENOMEM;
860861
....@@ -882,10 +883,9 @@
882883 int vnic_dev_notify_unset(struct vnic_dev *vdev)
883884 {
884885 if (vdev->notify) {
885
- pci_free_consistent(vdev->pdev,
886
- sizeof(struct vnic_devcmd_notify),
887
- vdev->notify,
888
- vdev->notify_pa);
886
+ dma_free_coherent(&vdev->pdev->dev,
887
+ sizeof(struct vnic_devcmd_notify),
888
+ vdev->notify, vdev->notify_pa);
889889 }
890890
891891 return vnic_dev_notify_unsetcmd(vdev);
....@@ -1046,18 +1046,17 @@
10461046 {
10471047 if (vdev) {
10481048 if (vdev->notify)
1049
- pci_free_consistent(vdev->pdev,
1050
- sizeof(struct vnic_devcmd_notify),
1051
- vdev->notify,
1052
- vdev->notify_pa);
1049
+ dma_free_coherent(&vdev->pdev->dev,
1050
+ sizeof(struct vnic_devcmd_notify),
1051
+ vdev->notify, vdev->notify_pa);
10531052 if (vdev->stats)
1054
- pci_free_consistent(vdev->pdev,
1055
- sizeof(struct vnic_stats),
1056
- vdev->stats, vdev->stats_pa);
1053
+ dma_free_coherent(&vdev->pdev->dev,
1054
+ sizeof(struct vnic_stats),
1055
+ vdev->stats, vdev->stats_pa);
10571056 if (vdev->fw_info)
1058
- pci_free_consistent(vdev->pdev,
1059
- sizeof(struct vnic_devcmd_fw_info),
1060
- vdev->fw_info, vdev->fw_info_pa);
1057
+ dma_free_coherent(&vdev->pdev->dev,
1058
+ sizeof(struct vnic_devcmd_fw_info),
1059
+ vdev->fw_info, vdev->fw_info_pa);
10611060 if (vdev->devcmd2)
10621061 vnic_dev_deinit_devcmd2(vdev);
10631062
....@@ -1127,7 +1126,7 @@
11271126 void *prov_buf;
11281127 int ret;
11291128
1130
- prov_buf = pci_alloc_consistent(vdev->pdev, len, &prov_pa);
1129
+ prov_buf = dma_alloc_coherent(&vdev->pdev->dev, len, &prov_pa, GFP_ATOMIC);
11311130 if (!prov_buf)
11321131 return -ENOMEM;
11331132
....@@ -1137,7 +1136,7 @@
11371136
11381137 ret = vnic_dev_cmd(vdev, CMD_INIT_PROV_INFO2, &a0, &a1, wait);
11391138
1140
- pci_free_consistent(vdev->pdev, len, prov_buf, prov_pa);
1139
+ dma_free_coherent(&vdev->pdev->dev, len, prov_buf, prov_pa);
11411140
11421141 return ret;
11431142 }
....@@ -1217,7 +1216,8 @@
12171216 tlv_size = sizeof(struct filter) +
12181217 sizeof(struct filter_action) +
12191218 2 * sizeof(struct filter_tlv);
1220
- tlv_va = pci_alloc_consistent(vdev->pdev, tlv_size, &tlv_pa);
1219
+ tlv_va = dma_alloc_coherent(&vdev->pdev->dev, tlv_size,
1220
+ &tlv_pa, GFP_ATOMIC);
12211221 if (!tlv_va)
12221222 return -ENOMEM;
12231223 tlv = tlv_va;
....@@ -1240,7 +1240,7 @@
12401240
12411241 ret = vnic_dev_cmd(vdev, CMD_ADD_FILTER, &a0, &a1, wait);
12421242 *entry = (u16)a0;
1243
- pci_free_consistent(vdev->pdev, tlv_size, tlv_va, tlv_pa);
1243
+ dma_free_coherent(&vdev->pdev->dev, tlv_size, tlv_va, tlv_pa);
12441244 } else if (cmd == CLSF_DEL) {
12451245 a0 = *entry;
12461246 ret = vnic_dev_cmd(vdev, CMD_DEL_FILTER, &a0, &a1, wait);