Lines Matching refs:pvc
177 struct pvc_device *pvc = state(hdlc)->first_pvc; in find_pvc() local
179 while (pvc) { in find_pvc()
180 if (pvc->dlci == dlci) in find_pvc()
181 return pvc; in find_pvc()
182 if (pvc->dlci > dlci) in find_pvc()
184 pvc = pvc->next; in find_pvc()
194 struct pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc; in add_pvc() local
204 pvc = kzalloc(sizeof(*pvc), GFP_ATOMIC); in add_pvc()
206 printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); in add_pvc()
208 if (!pvc) in add_pvc()
211 pvc->dlci = dlci; in add_pvc()
212 pvc->frad = dev; in add_pvc()
213 pvc->next = *pvc_p; /* Put it in the chain */ in add_pvc()
214 *pvc_p = pvc; in add_pvc()
215 return pvc; in add_pvc()
219 static inline int pvc_is_used(struct pvc_device *pvc) in pvc_is_used() argument
221 return pvc->main || pvc->ether; in pvc_is_used()
225 static inline void pvc_carrier(int on, struct pvc_device *pvc) in pvc_carrier() argument
228 if (pvc->main) in pvc_carrier()
229 if (!netif_carrier_ok(pvc->main)) in pvc_carrier()
230 netif_carrier_on(pvc->main); in pvc_carrier()
231 if (pvc->ether) in pvc_carrier()
232 if (!netif_carrier_ok(pvc->ether)) in pvc_carrier()
233 netif_carrier_on(pvc->ether); in pvc_carrier()
235 if (pvc->main) in pvc_carrier()
236 if (netif_carrier_ok(pvc->main)) in pvc_carrier()
237 netif_carrier_off(pvc->main); in pvc_carrier()
238 if (pvc->ether) in pvc_carrier()
239 if (netif_carrier_ok(pvc->ether)) in pvc_carrier()
240 netif_carrier_off(pvc->ether); in pvc_carrier()
251 struct pvc_device *pvc = *pvc_p; in delete_unused_pvcs() local
253 printk(KERN_DEBUG "freeing unused pvc: %p\n", pvc); in delete_unused_pvcs()
255 *pvc_p = pvc->next; in delete_unused_pvcs()
256 kfree(pvc); in delete_unused_pvcs()
264 static inline struct net_device **get_dev_p(struct pvc_device *pvc, in get_dev_p() argument
268 return &pvc->ether; in get_dev_p()
270 return &pvc->main; in get_dev_p()
344 struct pvc_device *pvc = dev->ml_priv; in pvc_open() local
346 if ((pvc->frad->flags & IFF_UP) == 0) in pvc_open()
349 if (pvc->open_count++ == 0) { in pvc_open()
350 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_open()
352 pvc->state.active = netif_carrier_ok(pvc->frad); in pvc_open()
354 pvc_carrier(pvc->state.active, pvc); in pvc_open()
364 struct pvc_device *pvc = dev->ml_priv; in pvc_close() local
366 if (--pvc->open_count == 0) { in pvc_close()
367 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_close()
369 pvc->state.active = 0; in pvc_close()
373 pvc->state.active = 0; in pvc_close()
383 struct pvc_device *pvc = dev->ml_priv; in pvc_ioctl() local
398 info.dlci = pvc->dlci; in pvc_ioctl()
399 memcpy(info.master, pvc->frad->name, IFNAMSIZ); in pvc_ioctl()
411 struct pvc_device *pvc = dev->ml_priv; in pvc_xmit() local
413 if (pvc->state.active) { in pvc_xmit()
430 if (!fr_hard_header(&skb, pvc->dlci)) { in pvc_xmit()
433 if (pvc->state.fecn) /* TX Congestion counter */ in pvc_xmit()
435 skb->dev = pvc->frad; in pvc_xmit()
446 static inline void fr_log_dlci_active(struct pvc_device *pvc) in fr_log_dlci_active() argument
448 netdev_info(pvc->frad, "DLCI %d [%s%s%s]%s %s\n", in fr_log_dlci_active()
449 pvc->dlci, in fr_log_dlci_active()
450 pvc->main ? pvc->main->name : "", in fr_log_dlci_active()
451 pvc->main && pvc->ether ? " " : "", in fr_log_dlci_active()
452 pvc->ether ? pvc->ether->name : "", in fr_log_dlci_active()
453 pvc->state.new ? " new" : "", in fr_log_dlci_active()
454 !pvc->state.exist ? "deleted" : in fr_log_dlci_active()
455 pvc->state.active ? "active" : "inactive"); in fr_log_dlci_active()
471 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_lmi_send() local
517 while (pvc) { in fr_lmi_send()
523 if (state(hdlc)->reliable && !pvc->state.exist) { in fr_lmi_send()
524 pvc->state.exist = pvc->state.new = 1; in fr_lmi_send()
525 fr_log_dlci_active(pvc); in fr_lmi_send()
529 if (pvc->open_count && !pvc->state.active && in fr_lmi_send()
530 pvc->state.exist && !pvc->state.new) { in fr_lmi_send()
531 pvc_carrier(1, pvc); in fr_lmi_send()
532 pvc->state.active = 1; in fr_lmi_send()
533 fr_log_dlci_active(pvc); in fr_lmi_send()
537 data[i] = pvc->dlci >> 8; in fr_lmi_send()
538 data[i + 1] = pvc->dlci & 0xFF; in fr_lmi_send()
540 data[i] = (pvc->dlci >> 4) & 0x3F; in fr_lmi_send()
541 data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80; in fr_lmi_send()
545 if (pvc->state.new) in fr_lmi_send()
547 else if (pvc->state.active) in fr_lmi_send()
551 pvc = pvc->next; in fr_lmi_send()
568 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_set_link_state() local
577 while (pvc) { /* Activate all PVCs */ in fr_set_link_state()
578 pvc_carrier(1, pvc); in fr_set_link_state()
579 pvc->state.exist = pvc->state.active = 1; in fr_set_link_state()
580 pvc->state.new = 0; in fr_set_link_state()
581 pvc = pvc->next; in fr_set_link_state()
586 while (pvc) { /* Deactivate all PVCs */ in fr_set_link_state()
587 pvc_carrier(0, pvc); in fr_set_link_state()
588 pvc->state.exist = pvc->state.active = 0; in fr_set_link_state()
589 pvc->state.new = 0; in fr_set_link_state()
591 pvc->state.bandwidth = 0; in fr_set_link_state()
592 pvc = pvc->next; in fr_set_link_state()
653 struct pvc_device *pvc; in fr_lmi_recv() local
748 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
749 while (pvc) { in fr_lmi_recv()
750 if (pvc->state.new) { in fr_lmi_recv()
751 pvc->state.new = 0; in fr_lmi_recv()
756 pvc = pvc->next; in fr_lmi_recv()
781 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
783 while (pvc) { in fr_lmi_recv()
784 pvc->state.deleted = 1; in fr_lmi_recv()
785 pvc = pvc->next; in fr_lmi_recv()
821 pvc = add_pvc(dev, dlci); in fr_lmi_recv()
823 if (!pvc && !no_ram) { in fr_lmi_recv()
828 if (pvc) { in fr_lmi_recv()
829 pvc->state.exist = 1; in fr_lmi_recv()
830 pvc->state.deleted = 0; in fr_lmi_recv()
831 if (active != pvc->state.active || in fr_lmi_recv()
832 new != pvc->state.new || in fr_lmi_recv()
833 bw != pvc->state.bandwidth || in fr_lmi_recv()
834 !pvc->state.exist) { in fr_lmi_recv()
835 pvc->state.new = new; in fr_lmi_recv()
836 pvc->state.active = active; in fr_lmi_recv()
837 pvc->state.bandwidth = bw; in fr_lmi_recv()
838 pvc_carrier(active, pvc); in fr_lmi_recv()
839 fr_log_dlci_active(pvc); in fr_lmi_recv()
846 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
848 while (pvc) { in fr_lmi_recv()
849 if (pvc->state.deleted && pvc->state.exist) { in fr_lmi_recv()
850 pvc_carrier(0, pvc); in fr_lmi_recv()
851 pvc->state.active = pvc->state.new = 0; in fr_lmi_recv()
852 pvc->state.exist = 0; in fr_lmi_recv()
853 pvc->state.bandwidth = 0; in fr_lmi_recv()
854 fr_log_dlci_active(pvc); in fr_lmi_recv()
856 pvc = pvc->next; in fr_lmi_recv()
873 struct pvc_device *pvc; in fr_rx() local
892 pvc = find_pvc(hdlc, dlci); in fr_rx()
893 if (!pvc) { in fr_rx()
902 if (pvc->state.fecn != fh->fecn) { in fr_rx()
907 pvc->state.fecn ^= 1; in fr_rx()
910 if (pvc->state.becn != fh->becn) { in fr_rx()
915 pvc->state.becn ^= 1; in fr_rx()
926 dev = pvc->main; in fr_rx()
931 dev = pvc->main; in fr_rx()
945 dev = pvc->main; in fr_rx()
950 if ((dev = pvc->ether) != NULL) in fr_rx()
970 if (pvc->state.becn) in fr_rx()
1028 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_close() local
1030 while (pvc) { /* Shutdown all PVCs for this FRAD */ in fr_close()
1031 if (pvc->main) in fr_close()
1032 dev_close(pvc->main); in fr_close()
1033 if (pvc->ether) in fr_close()
1034 dev_close(pvc->ether); in fr_close()
1035 pvc = pvc->next; in fr_close()
1059 struct pvc_device *pvc; in fr_add_pvc() local
1063 if ((pvc = add_pvc(frad, dlci)) == NULL) { in fr_add_pvc()
1068 if (*get_dev_p(pvc, type)) in fr_add_pvc()
1071 used = pvc_is_used(pvc); in fr_add_pvc()
1097 dev->ml_priv = pvc; in fr_add_pvc()
1106 *get_dev_p(pvc, type) = dev; in fr_add_pvc()
1118 struct pvc_device *pvc; in fr_del_pvc() local
1121 if ((pvc = find_pvc(hdlc, dlci)) == NULL) in fr_del_pvc()
1124 if ((dev = *get_dev_p(pvc, type)) == NULL) in fr_del_pvc()
1131 *get_dev_p(pvc, type) = NULL; in fr_del_pvc()
1133 if (!pvc_is_used(pvc)) { in fr_del_pvc()
1146 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_destroy() local
1151 while (pvc) { in fr_destroy()
1152 struct pvc_device *next = pvc->next; in fr_destroy()
1154 if (pvc->main) in fr_destroy()
1155 unregister_netdevice(pvc->main); in fr_destroy()
1157 if (pvc->ether) in fr_destroy()
1158 unregister_netdevice(pvc->ether); in fr_destroy()
1160 kfree(pvc); in fr_destroy()
1161 pvc = next; in fr_destroy()
1183 fr_proto_pvc pvc; in fr_ioctl() local
1253 if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc, in fr_ioctl()
1257 if (pvc.dlci <= 0 || pvc.dlci >= 1024) in fr_ioctl()
1268 return fr_add_pvc(dev, pvc.dlci, result); in fr_ioctl()
1270 return fr_del_pvc(hdlc, pvc.dlci, result); in fr_ioctl()