Lines Matching refs:unit
76 * interface unit or a ppp channel. In both cases, file->private_data
88 int index; /* interface unit / channel number */
89 int dead; /* unit/channel has been shut down */
110 * Data structure describing one ppp unit.
111 * A ppp unit corresponds to a ppp network interface device
117 struct file *owner; /* file that owns this unit 48 */
123 int mru; /* max receive unit 60 */
142 int mrru; /* MP: max reconst. receive unit */
176 struct ppp *ppp; /* ppp unit we're connected to */
179 struct list_head clist; /* link in list of channels per unit */
192 s32 unit;
217 * It also ensures that finding a ppp unit in the units_idr
282 static int ppp_create_interface(struct net *net, struct file *file, int *unit);
285 static struct ppp *ppp_find_unit(struct ppp_net *pn, int unit);
286 static struct channel *ppp_find_channel(struct ppp_net *pn, int unit);
287 static int ppp_connect_channel(struct channel *pch, int unit);
381 * The /dev/ppp device is used by pppd to control the ppp unit.
384 * unattached, attached to a ppp unit, or attached to a ppp channel.
620 * part of a bridge instance, or which form part of an existing unit.
707 int unit, cflags;
742 if (get_user(unit, p))
744 err = ppp_connect_channel(pch, unit);
752 if (get_user(unit, p))
757 pchb = ppp_find_channel(pn, unit);
1032 int unit, err = -EFAULT;
1040 /* Create a new ppp unit */
1041 if (get_user(unit, p))
1043 err = ppp_create_interface(net, file, &unit);
1048 if (put_user(unit, p))
1054 /* Attach to an existing ppp unit */
1055 if (get_user(unit, p))
1060 ppp = ppp_find_unit(pn, unit);
1070 if (get_user(unit, p))
1075 chan = ppp_find_channel(pn, unit);
1156 static int ppp_unit_register(struct ppp *ppp, int unit, bool ifname_is_set)
1163 if (unit < 0) {
1179 /* Caller asked for a specific unit number. Fail with -EEXIST
1182 * requesting a specific unit number.
1184 if (unit_find(&pn->units_idr, unit)) {
1188 ret = unit_set(&pn->units_idr, ppp, unit);
1258 err = ppp_unit_register(ppp, conf->unit, conf->ifname_is_set);
1294 .unit = -1,
1323 * the PPP unit identifer as suffix (i.e. ppp<unit_id>). This allows
1425 * Network interface unit routines.
2161 /* see if there is anything from the attached unit to be sent */
2343 * The receive side of the ppp unit is locked.
2647 * side of the ppp unit locked.
2697 ppp unit receive-side lock. */
2923 * Return the PPP unit number to which a channel is connected.
2928 int unit = -1;
2933 unit = pch->ppp->file.index;
2936 return unit;
3308 * Create a new ppp interface unit. Fails if it can't allocate memory
3309 * or if there is already a unit with the requested number.
3310 * unit == -1 means allocate a new number.
3312 static int ppp_create_interface(struct net *net, struct file *file, int *unit)
3316 .unit = *unit,
3337 *unit = ppp->file.index;
3364 * Free the memory used by a ppp unit. This is only called once
3365 * there are no channels connected to the unit and no file structs
3366 * that reference the unit.
3409 * Locate an existing ppp unit.
3413 ppp_find_unit(struct ppp_net *pn, int unit)
3415 return unit_find(&pn->units_idr, unit);
3427 ppp_find_channel(struct ppp_net *pn, int unit)
3432 if (pch->file.index == unit) {
3439 if (pch->file.index == unit)
3447 * Connect a PPP channel to a PPP interface unit.
3450 ppp_connect_channel(struct channel *pch, int unit)
3460 ppp = ppp_find_unit(pn, unit);
3499 * Disconnect a channel from its ppp unit.
3512 /* remove it from the ppp unit's list */
3565 int unit;
3567 unit = idr_alloc(p, ptr, n, n + 1, GFP_KERNEL);
3568 if (unit == -ENOSPC)
3569 unit = -EINVAL;
3570 return unit;
3573 /* get new free unit number and associate pointer with it */
3579 /* put unit number back to a pool */