| .. | .. |
|---|
| 188 | 188 | * i40iw_dpc - tasklet for aeq and ceq 0 |
|---|
| 189 | 189 | * @data: iwarp device |
|---|
| 190 | 190 | */ |
|---|
| 191 | | -static void i40iw_dpc(unsigned long data) |
|---|
| 191 | +static void i40iw_dpc(struct tasklet_struct *t) |
|---|
| 192 | 192 | { |
|---|
| 193 | | - struct i40iw_device *iwdev = (struct i40iw_device *)data; |
|---|
| 193 | + struct i40iw_device *iwdev = from_tasklet(iwdev, t, dpc_tasklet); |
|---|
| 194 | 194 | |
|---|
| 195 | 195 | if (iwdev->msix_shared) |
|---|
| 196 | 196 | i40iw_process_ceq(iwdev, iwdev->ceqlist); |
|---|
| .. | .. |
|---|
| 202 | 202 | * i40iw_ceq_dpc - dpc handler for CEQ |
|---|
| 203 | 203 | * @data: data points to CEQ |
|---|
| 204 | 204 | */ |
|---|
| 205 | | -static void i40iw_ceq_dpc(unsigned long data) |
|---|
| 205 | +static void i40iw_ceq_dpc(struct tasklet_struct *t) |
|---|
| 206 | 206 | { |
|---|
| 207 | | - struct i40iw_ceq *iwceq = (struct i40iw_ceq *)data; |
|---|
| 207 | + struct i40iw_ceq *iwceq = from_tasklet(iwceq, t, dpc_tasklet); |
|---|
| 208 | 208 | struct i40iw_device *iwdev = iwceq->iwdev; |
|---|
| 209 | 209 | |
|---|
| 210 | 210 | i40iw_process_ceq(iwdev, iwceq); |
|---|
| .. | .. |
|---|
| 685 | 685 | enum i40iw_status_code status; |
|---|
| 686 | 686 | |
|---|
| 687 | 687 | if (iwdev->msix_shared && !ceq_id) { |
|---|
| 688 | | - tasklet_init(&iwdev->dpc_tasklet, i40iw_dpc, (unsigned long)iwdev); |
|---|
| 688 | + tasklet_setup(&iwdev->dpc_tasklet, i40iw_dpc); |
|---|
| 689 | 689 | status = request_irq(msix_vec->irq, i40iw_irq_handler, 0, "AEQCEQ", iwdev); |
|---|
| 690 | 690 | } else { |
|---|
| 691 | | - tasklet_init(&iwceq->dpc_tasklet, i40iw_ceq_dpc, (unsigned long)iwceq); |
|---|
| 691 | + tasklet_setup(&iwceq->dpc_tasklet, i40iw_ceq_dpc); |
|---|
| 692 | 692 | status = request_irq(msix_vec->irq, i40iw_ceq_handler, 0, "CEQ", iwceq); |
|---|
| 693 | 693 | } |
|---|
| 694 | 694 | |
|---|
| .. | .. |
|---|
| 837 | 837 | u32 ret = 0; |
|---|
| 838 | 838 | |
|---|
| 839 | 839 | if (!iwdev->msix_shared) { |
|---|
| 840 | | - tasklet_init(&iwdev->dpc_tasklet, i40iw_dpc, (unsigned long)iwdev); |
|---|
| 840 | + tasklet_setup(&iwdev->dpc_tasklet, i40iw_dpc); |
|---|
| 841 | 841 | ret = request_irq(msix_vec->irq, i40iw_irq_handler, 0, "i40iw", iwdev); |
|---|
| 842 | 842 | } |
|---|
| 843 | 843 | if (ret) { |
|---|
| .. | .. |
|---|
| 1208 | 1208 | { |
|---|
| 1209 | 1209 | struct net_device *dev; |
|---|
| 1210 | 1210 | struct in_device *idev; |
|---|
| 1211 | | - bool got_lock = true; |
|---|
| 1212 | 1211 | u32 ip_addr; |
|---|
| 1213 | 1212 | |
|---|
| 1214 | | - if (!rtnl_trylock()) |
|---|
| 1215 | | - got_lock = false; |
|---|
| 1216 | | - |
|---|
| 1217 | | - for_each_netdev(&init_net, dev) { |
|---|
| 1213 | + rcu_read_lock(); |
|---|
| 1214 | + for_each_netdev_rcu(&init_net, dev) { |
|---|
| 1218 | 1215 | if ((((rdma_vlan_dev_vlan_id(dev) < 0xFFFF) && |
|---|
| 1219 | 1216 | (rdma_vlan_dev_real_dev(dev) == iwdev->netdev)) || |
|---|
| 1220 | | - (dev == iwdev->netdev)) && (dev->flags & IFF_UP)) { |
|---|
| 1221 | | - idev = in_dev_get(dev); |
|---|
| 1222 | | - for_ifa(idev) { |
|---|
| 1217 | + (dev == iwdev->netdev)) && (READ_ONCE(dev->flags) & IFF_UP)) { |
|---|
| 1218 | + const struct in_ifaddr *ifa; |
|---|
| 1219 | + |
|---|
| 1220 | + idev = __in_dev_get_rcu(dev); |
|---|
| 1221 | + if (!idev) |
|---|
| 1222 | + continue; |
|---|
| 1223 | + in_dev_for_each_ifa_rcu(ifa, idev) { |
|---|
| 1223 | 1224 | i40iw_debug(&iwdev->sc_dev, I40IW_DEBUG_CM, |
|---|
| 1224 | 1225 | "IP=%pI4, vlan_id=%d, MAC=%pM\n", &ifa->ifa_address, |
|---|
| 1225 | 1226 | rdma_vlan_dev_vlan_id(dev), dev->dev_addr); |
|---|
| .. | .. |
|---|
| 1231 | 1232 | true, |
|---|
| 1232 | 1233 | I40IW_ARP_ADD); |
|---|
| 1233 | 1234 | } |
|---|
| 1234 | | - endfor_ifa(idev); |
|---|
| 1235 | | - in_dev_put(idev); |
|---|
| 1236 | 1235 | } |
|---|
| 1237 | 1236 | } |
|---|
| 1238 | | - if (got_lock) |
|---|
| 1239 | | - rtnl_unlock(); |
|---|
| 1237 | + rcu_read_unlock(); |
|---|
| 1240 | 1238 | } |
|---|
| 1241 | 1239 | |
|---|
| 1242 | 1240 | /** |
|---|
| .. | .. |
|---|
| 1487 | 1485 | iwdev->iw_status = 0; |
|---|
| 1488 | 1486 | i40iw_port_ibevent(iwdev); |
|---|
| 1489 | 1487 | i40iw_destroy_rdma_device(iwdev->iwibdev); |
|---|
| 1490 | | - /* fallthrough */ |
|---|
| 1488 | + fallthrough; |
|---|
| 1491 | 1489 | case IP_ADDR_REGISTERED: |
|---|
| 1492 | 1490 | if (!iwdev->reset) |
|---|
| 1493 | 1491 | i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx); |
|---|
| 1494 | | - /* fallthrough */ |
|---|
| 1495 | | - /* fallthrough */ |
|---|
| 1492 | + fallthrough; |
|---|
| 1496 | 1493 | case PBLE_CHUNK_MEM: |
|---|
| 1497 | 1494 | i40iw_destroy_pble_pool(dev, iwdev->pble_rsrc); |
|---|
| 1498 | | - /* fallthrough */ |
|---|
| 1495 | + fallthrough; |
|---|
| 1499 | 1496 | case CEQ_CREATED: |
|---|
| 1500 | 1497 | i40iw_dele_ceqs(iwdev); |
|---|
| 1501 | | - /* fallthrough */ |
|---|
| 1498 | + fallthrough; |
|---|
| 1502 | 1499 | case AEQ_CREATED: |
|---|
| 1503 | 1500 | i40iw_destroy_aeq(iwdev); |
|---|
| 1504 | | - /* fallthrough */ |
|---|
| 1501 | + fallthrough; |
|---|
| 1505 | 1502 | case IEQ_CREATED: |
|---|
| 1506 | 1503 | i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_IEQ, iwdev->reset); |
|---|
| 1507 | | - /* fallthrough */ |
|---|
| 1504 | + fallthrough; |
|---|
| 1508 | 1505 | case ILQ_CREATED: |
|---|
| 1509 | 1506 | i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_ILQ, iwdev->reset); |
|---|
| 1510 | | - /* fallthrough */ |
|---|
| 1507 | + fallthrough; |
|---|
| 1511 | 1508 | case CCQ_CREATED: |
|---|
| 1512 | 1509 | i40iw_destroy_ccq(iwdev); |
|---|
| 1513 | | - /* fallthrough */ |
|---|
| 1510 | + fallthrough; |
|---|
| 1514 | 1511 | case HMC_OBJS_CREATED: |
|---|
| 1515 | 1512 | i40iw_del_hmc_objects(dev, dev->hmc_info, true, iwdev->reset); |
|---|
| 1516 | | - /* fallthrough */ |
|---|
| 1513 | + fallthrough; |
|---|
| 1517 | 1514 | case CQP_CREATED: |
|---|
| 1518 | 1515 | i40iw_destroy_cqp(iwdev, true); |
|---|
| 1519 | | - /* fallthrough */ |
|---|
| 1516 | + fallthrough; |
|---|
| 1520 | 1517 | case INITIAL_STATE: |
|---|
| 1521 | 1518 | i40iw_cleanup_cm_core(&iwdev->cm_core); |
|---|
| 1522 | 1519 | if (iwdev->vsi.pestat) { |
|---|
| .. | .. |
|---|
| 1526 | 1523 | i40iw_del_init_mem(iwdev); |
|---|
| 1527 | 1524 | break; |
|---|
| 1528 | 1525 | case INVALID_STATE: |
|---|
| 1529 | | - /* fallthrough */ |
|---|
| 1530 | 1526 | default: |
|---|
| 1531 | 1527 | i40iw_pr_err("bad init_state = %d\n", iwdev->init_state); |
|---|
| 1532 | 1528 | break; |
|---|
| .. | .. |
|---|
| 1573 | 1569 | status = i40iw_save_msix_info(iwdev, ldev); |
|---|
| 1574 | 1570 | if (status) |
|---|
| 1575 | 1571 | return status; |
|---|
| 1576 | | - iwdev->hw.dev_context = (void *)ldev->pcidev; |
|---|
| 1572 | + iwdev->hw.pcidev = ldev->pcidev; |
|---|
| 1577 | 1573 | iwdev->hw.hw_addr = ldev->hw_addr; |
|---|
| 1578 | 1574 | status = i40iw_allocate_dma_mem(&iwdev->hw, |
|---|
| 1579 | 1575 | &iwdev->obj_mem, 8192, 4096); |
|---|
| .. | .. |
|---|
| 1636 | 1632 | iwdev = &hdl->device; |
|---|
| 1637 | 1633 | iwdev->hdl = hdl; |
|---|
| 1638 | 1634 | dev = &iwdev->sc_dev; |
|---|
| 1639 | | - i40iw_setup_cm_core(iwdev); |
|---|
| 1635 | + if (i40iw_setup_cm_core(iwdev)) { |
|---|
| 1636 | + kfree(iwdev->hdl); |
|---|
| 1637 | + return -ENOMEM; |
|---|
| 1638 | + } |
|---|
| 1640 | 1639 | |
|---|
| 1641 | 1640 | dev->back_dev = (void *)iwdev; |
|---|
| 1642 | 1641 | iwdev->ldev = &hdl->ldev; |
|---|
| .. | .. |
|---|
| 1677 | 1676 | status = i40iw_setup_ceqs(iwdev, ldev); |
|---|
| 1678 | 1677 | if (status) |
|---|
| 1679 | 1678 | break; |
|---|
| 1679 | + |
|---|
| 1680 | + status = i40iw_get_rdma_features(dev); |
|---|
| 1681 | + if (status) |
|---|
| 1682 | + dev->feature_info[I40IW_FEATURE_FW_INFO] = |
|---|
| 1683 | + I40IW_FW_VER_DEFAULT; |
|---|
| 1684 | + |
|---|
| 1680 | 1685 | iwdev->init_state = CEQ_CREATED; |
|---|
| 1681 | 1686 | status = i40iw_initialize_hw_resources(iwdev); |
|---|
| 1682 | 1687 | if (status) |
|---|