static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb) { struct udphdr *udph; struct net_device *ndev = skb->dev; struct net_device *rdev = ndev; struct rxe_dev *rxe = rxe_get_dev_from_net(ndev); struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); if (!rxe && is_vlan_dev(rdev)) { rdev = vlan_dev_real_dev(ndev); rxe = rxe_get_dev_from_net(rdev); } if (!rxe) goto drop; if (skb_linearize(skb)) { pr_err("skb_linearize failed\n"); ib_device_put(&rxe->ib_dev); goto drop; } udph = udp_hdr(skb); pkt->rxe = rxe; pkt->port_num = 1; pkt->hdr = (u8 *)(udph + 1); pkt->mask = RXE_GRH_MASK; pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph); rxe_rcv(skb); /* * FIXME: this is in the wrong place, it needs to be done when pkt is * destroyed */ ib_device_put(&rxe->ib_dev); return 0; drop: kfree_skb(skb); return 0; }
static void roce_gid_cache_client_cleanup_work_handler(struct work_struct *work) { struct ib_cache *ib_cache = container_of(work, struct ib_cache, roce_gid_cache_cleanup_work); struct ib_device *ib_dev = container_of(ib_cache, struct ib_device, cache); /* Make sure no gid update task is still referencing this device */ flush_workqueue(roce_gid_mgmt_wq); /* No need to flush the system wq, even though we use it in * roce_rescan_device because we are guarenteed to run this * on the system_wq after roce_rescan_device. */ roce_gid_cache_cleanup_one(ib_dev); ib_device_put(ib_dev); }
static int rxe_notify(struct notifier_block *not_blk, unsigned long event, void *arg) { struct net_device *ndev = netdev_notifier_info_to_dev(arg); struct rxe_dev *rxe = rxe_get_dev_from_net(ndev); if (!rxe) return NOTIFY_OK; switch (event) { case NETDEV_UNREGISTER: ib_unregister_device_queued(&rxe->ib_dev); break; case NETDEV_UP: rxe_port_up(rxe); break; case NETDEV_DOWN: rxe_port_down(rxe); break; case NETDEV_CHANGEMTU: pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu); rxe_set_mtu(rxe, ndev->mtu); break; case NETDEV_CHANGE: rxe_set_port_state(rxe); break; case NETDEV_REBOOT: case NETDEV_GOING_DOWN: case NETDEV_CHANGEADDR: case NETDEV_CHANGENAME: case NETDEV_FEAT_CHANGE: default: pr_info("ignoring netdev event = %ld for %s\n", event, ndev->name); break; } ib_device_put(&rxe->ib_dev); return NOTIFY_OK; }
static int rxe_newlink(const char *ibdev_name, struct net_device *ndev) { struct rxe_dev *exists; int err = 0; exists = rxe_get_dev_from_net(ndev); if (exists) { ib_device_put(&exists->ib_dev); pr_err("already configured on %s\n", ndev->name); err = -EEXIST; goto err; } err = rxe_net_add(ibdev_name, ndev); if (err) { pr_err("failed to add %s\n", ndev->name); goto err; } err: return err; }