Lines Matching defs: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 */
178 struct list_head clist; /* link in list of channels per unit */
190 s32 unit;
215 * It also ensures that finding a ppp unit in the units_idr
280 static int ppp_create_interface(struct net *net, struct file *file, int *unit);
283 static struct ppp *ppp_find_unit(struct ppp_net *pn, int unit);
284 static struct channel *ppp_find_channel(struct ppp_net *pn, int unit);
285 static int ppp_connect_channel(struct channel *pch, int unit);
379 * The /dev/ppp device is used by pppd to control the ppp unit.
382 * unattached, attached to a ppp unit, or attached to a ppp channel.
622 int unit, cflags;
656 if (get_user(unit, p))
658 err = ppp_connect_channel(pch, unit);
921 int unit, err = -EFAULT;
929 /* Create a new ppp unit */
930 if (get_user(unit, p))
932 err = ppp_create_interface(net, file, &unit);
937 if (put_user(unit, p))
943 /* Attach to an existing ppp unit */
944 if (get_user(unit, p))
949 ppp = ppp_find_unit(pn, unit);
959 if (get_user(unit, p))
964 chan = ppp_find_channel(pn, unit);
1045 static int ppp_unit_register(struct ppp *ppp, int unit, bool ifname_is_set)
1052 if (unit < 0) {
1068 /* Caller asked for a specific unit number. Fail with -EEXIST
1071 * requesting a specific unit number.
1073 if (unit_find(&pn->units_idr, unit)) {
1077 ret = unit_set(&pn->units_idr, ppp, unit);
1147 err = ppp_unit_register(ppp, conf->unit, conf->ifname_is_set);
1183 .unit = -1,
1212 * the PPP unit identifer as suffix (i.e. ppp<unit_id>). This allows
1314 * Network interface unit routines.
2028 /* see if there is anything from the attached unit to be sent */
2172 * The receive side of the ppp unit is locked.
2476 * side of the ppp unit locked.
2526 ppp unit receive-side lock. */
2752 * Return the PPP unit number to which a channel is connected.
2757 int unit = -1;
2762 unit = pch->ppp->file.index;
2765 return unit;
3134 * Create a new ppp interface unit. Fails if it can't allocate memory
3135 * or if there is already a unit with the requested number.
3136 * unit == -1 means allocate a new number.
3138 static int ppp_create_interface(struct net *net, struct file *file, int *unit)
3142 .unit = *unit,
3163 *unit = ppp->file.index;
3190 * Free the memory used by a ppp unit. This is only called once
3191 * there are no channels connected to the unit and no file structs
3192 * that reference the unit.
3235 * Locate an existing ppp unit.
3239 ppp_find_unit(struct ppp_net *pn, int unit)
3241 return unit_find(&pn->units_idr, unit);
3253 ppp_find_channel(struct ppp_net *pn, int unit)
3258 if (pch->file.index == unit) {
3265 if (pch->file.index == unit)
3273 * Connect a PPP channel to a PPP interface unit.
3276 ppp_connect_channel(struct channel *pch, int unit)
3286 ppp = ppp_find_unit(pn, unit);
3324 * Disconnect a channel from its ppp unit.
3337 /* remove it from the ppp unit's list */
3390 int unit;
3392 unit = idr_alloc(p, ptr, n, n + 1, GFP_KERNEL);
3393 if (unit == -ENOSPC)
3394 unit = -EINVAL;
3395 return unit;
3398 /* get new free unit number and associate pointer with it */
3404 /* put unit number back to a pool */