.. | .. |
---|
404 | 404 | if (pdata) |
---|
405 | 405 | pd_len = pdata->size; |
---|
406 | 406 | |
---|
407 | | - if (cm_node->vlan_id < VLAN_TAG_PRESENT) |
---|
| 407 | + if (cm_node->vlan_id <= VLAN_VID_MASK) |
---|
408 | 408 | eth_hlen += 4; |
---|
409 | 409 | |
---|
410 | 410 | if (cm_node->ipv4) |
---|
.. | .. |
---|
433 | 433 | |
---|
434 | 434 | ether_addr_copy(ethh->h_dest, cm_node->rem_mac); |
---|
435 | 435 | ether_addr_copy(ethh->h_source, cm_node->loc_mac); |
---|
436 | | - if (cm_node->vlan_id < VLAN_TAG_PRESENT) { |
---|
| 436 | + if (cm_node->vlan_id <= VLAN_VID_MASK) { |
---|
437 | 437 | ((struct vlan_ethhdr *)ethh)->h_vlan_proto = htons(ETH_P_8021Q); |
---|
438 | 438 | vtag = (cm_node->user_pri << VLAN_PRIO_SHIFT) | cm_node->vlan_id; |
---|
439 | 439 | ((struct vlan_ethhdr *)ethh)->h_vlan_TCI = htons(vtag); |
---|
.. | .. |
---|
463 | 463 | |
---|
464 | 464 | ether_addr_copy(ethh->h_dest, cm_node->rem_mac); |
---|
465 | 465 | ether_addr_copy(ethh->h_source, cm_node->loc_mac); |
---|
466 | | - if (cm_node->vlan_id < VLAN_TAG_PRESENT) { |
---|
| 466 | + if (cm_node->vlan_id <= VLAN_VID_MASK) { |
---|
467 | 467 | ((struct vlan_ethhdr *)ethh)->h_vlan_proto = htons(ETH_P_8021Q); |
---|
468 | 468 | vtag = (cm_node->user_pri << VLAN_PRIO_SHIFT) | cm_node->vlan_id; |
---|
469 | 469 | ((struct vlan_ethhdr *)ethh)->h_vlan_TCI = htons(vtag); |
---|
.. | .. |
---|
1773 | 1773 | if ((((rdma_vlan_dev_vlan_id(dev) < I40IW_NO_VLAN) && |
---|
1774 | 1774 | (rdma_vlan_dev_real_dev(dev) == iwdev->netdev)) || |
---|
1775 | 1775 | (dev == iwdev->netdev)) && (dev->flags & IFF_UP)) { |
---|
| 1776 | + const struct in_ifaddr *ifa; |
---|
| 1777 | + |
---|
1776 | 1778 | idev = in_dev_get(dev); |
---|
1777 | | - for_ifa(idev) { |
---|
| 1779 | + |
---|
| 1780 | + in_dev_for_each_ifa_rtnl(ifa, idev) { |
---|
1778 | 1781 | i40iw_debug(&iwdev->sc_dev, |
---|
1779 | 1782 | I40IW_DEBUG_CM, |
---|
1780 | 1783 | "Allocating child CM Listener forIP=%pI4, vlan_id=%d, MAC=%pM\n", |
---|
.. | .. |
---|
1819 | 1822 | cm_parent_listen_node->cm_core->stats_listen_nodes_created--; |
---|
1820 | 1823 | } |
---|
1821 | 1824 | } |
---|
1822 | | - endfor_ifa(idev); |
---|
| 1825 | + |
---|
1823 | 1826 | in_dev_put(idev); |
---|
1824 | 1827 | } |
---|
1825 | 1828 | } |
---|
.. | .. |
---|
2319 | 2322 | iwqp = cm_node->iwqp; |
---|
2320 | 2323 | if (iwqp) { |
---|
2321 | 2324 | iwqp->cm_node = NULL; |
---|
2322 | | - i40iw_rem_ref(&iwqp->ibqp); |
---|
| 2325 | + i40iw_qp_rem_ref(&iwqp->ibqp); |
---|
2323 | 2326 | cm_node->iwqp = NULL; |
---|
2324 | 2327 | } else if (cm_node->qhash_set) { |
---|
2325 | 2328 | i40iw_get_addr_info(cm_node, &nfo); |
---|
.. | .. |
---|
2440 | 2443 | case I40IW_CM_STATE_FIN_WAIT1: |
---|
2441 | 2444 | case I40IW_CM_STATE_LAST_ACK: |
---|
2442 | 2445 | cm_node->cm_id->rem_ref(cm_node->cm_id); |
---|
2443 | | - /* fall through */ |
---|
| 2446 | + fallthrough; |
---|
2444 | 2447 | case I40IW_CM_STATE_TIME_WAIT: |
---|
2445 | 2448 | cm_node->state = I40IW_CM_STATE_CLOSED; |
---|
2446 | 2449 | i40iw_rem_ref_cm_node(cm_node); |
---|
.. | .. |
---|
3229 | 3232 | * core |
---|
3230 | 3233 | * @iwdev: iwarp device structure |
---|
3231 | 3234 | */ |
---|
3232 | | -void i40iw_setup_cm_core(struct i40iw_device *iwdev) |
---|
| 3235 | +int i40iw_setup_cm_core(struct i40iw_device *iwdev) |
---|
3233 | 3236 | { |
---|
3234 | 3237 | struct i40iw_cm_core *cm_core = &iwdev->cm_core; |
---|
3235 | 3238 | |
---|
.. | .. |
---|
3248 | 3251 | |
---|
3249 | 3252 | cm_core->event_wq = alloc_ordered_workqueue("iwewq", |
---|
3250 | 3253 | WQ_MEM_RECLAIM); |
---|
| 3254 | + if (!cm_core->event_wq) |
---|
| 3255 | + goto error; |
---|
3251 | 3256 | |
---|
3252 | 3257 | cm_core->disconn_wq = alloc_ordered_workqueue("iwdwq", |
---|
3253 | 3258 | WQ_MEM_RECLAIM); |
---|
| 3259 | + if (!cm_core->disconn_wq) |
---|
| 3260 | + goto error; |
---|
| 3261 | + |
---|
| 3262 | + return 0; |
---|
| 3263 | +error: |
---|
| 3264 | + i40iw_cleanup_cm_core(&iwdev->cm_core); |
---|
| 3265 | + |
---|
| 3266 | + return -ENOMEM; |
---|
3254 | 3267 | } |
---|
3255 | 3268 | |
---|
3256 | 3269 | /** |
---|
.. | .. |
---|
3270 | 3283 | del_timer_sync(&cm_core->tcp_timer); |
---|
3271 | 3284 | spin_unlock_irqrestore(&cm_core->ht_lock, flags); |
---|
3272 | 3285 | |
---|
3273 | | - destroy_workqueue(cm_core->event_wq); |
---|
3274 | | - destroy_workqueue(cm_core->disconn_wq); |
---|
| 3286 | + if (cm_core->event_wq) |
---|
| 3287 | + destroy_workqueue(cm_core->event_wq); |
---|
| 3288 | + if (cm_core->disconn_wq) |
---|
| 3289 | + destroy_workqueue(cm_core->disconn_wq); |
---|
3275 | 3290 | } |
---|
3276 | 3291 | |
---|
3277 | 3292 | /** |
---|
.. | .. |
---|
3315 | 3330 | |
---|
3316 | 3331 | tcp_info->flow_label = 0; |
---|
3317 | 3332 | tcp_info->snd_mss = cpu_to_le32(((u32)cm_node->tcp_cntxt.mss)); |
---|
3318 | | - if (cm_node->vlan_id < VLAN_TAG_PRESENT) { |
---|
| 3333 | + if (cm_node->vlan_id <= VLAN_VID_MASK) { |
---|
3319 | 3334 | tcp_info->insert_vlan_tag = true; |
---|
3320 | 3335 | tcp_info->vlan_tag = cpu_to_le16(((u16)cm_node->user_pri << I40IW_VLAN_PRIO_SHIFT) | |
---|
3321 | 3336 | cm_node->vlan_id); |
---|
.. | .. |
---|
3437 | 3452 | kfree(work); |
---|
3438 | 3453 | return; |
---|
3439 | 3454 | } |
---|
3440 | | - i40iw_add_ref(&iwqp->ibqp); |
---|
| 3455 | + i40iw_qp_add_ref(&iwqp->ibqp); |
---|
3441 | 3456 | spin_unlock_irqrestore(&iwdev->qptable_lock, flags); |
---|
3442 | 3457 | |
---|
3443 | 3458 | work->iwqp = iwqp; |
---|
.. | .. |
---|
3470 | 3485 | /* Need to free the Last Streaming Mode Message */ |
---|
3471 | 3486 | if (iwqp->ietf_mem.va) { |
---|
3472 | 3487 | if (iwqp->lsmm_mr) |
---|
3473 | | - iwibdev->ibdev.dereg_mr(iwqp->lsmm_mr); |
---|
| 3488 | + iwibdev->ibdev.ops.dereg_mr(iwqp->lsmm_mr, |
---|
| 3489 | + NULL); |
---|
3474 | 3490 | i40iw_free_dma_mem(iwdev->sc_dev.hw, &iwqp->ietf_mem); |
---|
3475 | 3491 | } |
---|
3476 | 3492 | } |
---|
.. | .. |
---|
3607 | 3623 | |
---|
3608 | 3624 | kfree(dwork); |
---|
3609 | 3625 | i40iw_cm_disconn_true(iwqp); |
---|
3610 | | - i40iw_rem_ref(&iwqp->ibqp); |
---|
| 3626 | + i40iw_qp_rem_ref(&iwqp->ibqp); |
---|
3611 | 3627 | } |
---|
3612 | 3628 | |
---|
3613 | 3629 | /** |
---|
.. | .. |
---|
3729 | 3745 | cm_node->lsmm_size = accept.size + conn_param->private_data_len; |
---|
3730 | 3746 | i40iw_cm_init_tsa_conn(iwqp, cm_node); |
---|
3731 | 3747 | cm_id->add_ref(cm_id); |
---|
3732 | | - i40iw_add_ref(&iwqp->ibqp); |
---|
| 3748 | + i40iw_qp_add_ref(&iwqp->ibqp); |
---|
3733 | 3749 | |
---|
3734 | 3750 | attr.qp_state = IB_QPS_RTS; |
---|
3735 | 3751 | cm_node->qhash_set = false; |
---|
.. | .. |
---|
3892 | 3908 | iwqp->cm_node = cm_node; |
---|
3893 | 3909 | cm_node->iwqp = iwqp; |
---|
3894 | 3910 | iwqp->cm_id = cm_id; |
---|
3895 | | - i40iw_add_ref(&iwqp->ibqp); |
---|
| 3911 | + i40iw_qp_add_ref(&iwqp->ibqp); |
---|
3896 | 3912 | |
---|
3897 | 3913 | if (cm_node->state != I40IW_CM_STATE_OFFLOADED) { |
---|
3898 | 3914 | cm_node->state = I40IW_CM_STATE_SYN_SENT; |
---|
.. | .. |
---|
4255 | 4271 | /* if not found then add a child listener if interface is going up */ |
---|
4256 | 4272 | if (!ifup) |
---|
4257 | 4273 | return; |
---|
4258 | | - child_listen_node = kzalloc(sizeof(*child_listen_node), GFP_ATOMIC); |
---|
| 4274 | + child_listen_node = kmemdup(parent_listen_node, |
---|
| 4275 | + sizeof(*child_listen_node), GFP_ATOMIC); |
---|
4259 | 4276 | if (!child_listen_node) |
---|
4260 | 4277 | return; |
---|
4261 | 4278 | node_allocated = true; |
---|
4262 | | - memcpy(child_listen_node, parent_listen_node, sizeof(*child_listen_node)); |
---|
4263 | 4279 | |
---|
4264 | 4280 | memcpy(child_listen_node->loc_addr, ipaddr, ipv4 ? 4 : 16); |
---|
4265 | 4281 | |
---|