/* called by ifc layer to create new rxe device caller should allocate memory for rxe by calling ib_alloc_device */ int rxe_add(struct rxe_dev *rxe, unsigned int mtu) { int err; unsigned port_num = 1; __module_get(THIS_MODULE); kref_init(&rxe->ref_cnt); err = rxe_init(rxe); if (err) goto err1; err = rxe_set_mtu(rxe, mtu, port_num); if (err) goto err2; err = rxe_register_device(rxe); if (err) goto err2; return 0; err2: rxe_cleanup(rxe); err1: kref_put(&rxe->ref_cnt, rxe_release); module_put(THIS_MODULE); return err; }
/* called by ifc layer to create new rxe device. * The caller should allocate memory for rxe by calling ib_alloc_device. */ int rxe_add(struct rxe_dev *rxe, unsigned int mtu, const char *ibdev_name) { int err; err = rxe_init(rxe); if (err) return err; rxe_set_mtu(rxe, mtu); return rxe_register_device(rxe, ibdev_name); }