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()
341 struct pvc_device *pvc = dev->ml_priv; in pvc_open() local
343 if ((pvc->frad->flags & IFF_UP) == 0) in pvc_open()
346 if (pvc->open_count++ == 0) { in pvc_open()
347 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_open()
349 pvc->state.active = netif_carrier_ok(pvc->frad); in pvc_open()
351 pvc_carrier(pvc->state.active, pvc); in pvc_open()
361 struct pvc_device *pvc = dev->ml_priv; in pvc_close() local
363 if (--pvc->open_count == 0) { in pvc_close()
364 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_close()
366 pvc->state.active = 0; in pvc_close()
370 pvc->state.active = 0; in pvc_close()
380 struct pvc_device *pvc = dev->ml_priv; in pvc_ioctl() local
395 info.dlci = pvc->dlci; in pvc_ioctl()
396 memcpy(info.master, pvc->frad->name, IFNAMSIZ); in pvc_ioctl()
408 struct pvc_device *pvc = dev->ml_priv; in pvc_xmit() local
410 if (!pvc->state.active) in pvc_xmit()
437 if (fr_hard_header(skb, pvc->dlci)) in pvc_xmit()
442 if (pvc->state.fecn) /* TX Congestion counter */ in pvc_xmit()
444 skb->dev = pvc->frad; in pvc_xmit()
456 static inline void fr_log_dlci_active(struct pvc_device *pvc) in fr_log_dlci_active() argument
458 netdev_info(pvc->frad, "DLCI %d [%s%s%s]%s %s\n", in fr_log_dlci_active()
459 pvc->dlci, in fr_log_dlci_active()
460 pvc->main ? pvc->main->name : "", in fr_log_dlci_active()
461 pvc->main && pvc->ether ? " " : "", in fr_log_dlci_active()
462 pvc->ether ? pvc->ether->name : "", in fr_log_dlci_active()
463 pvc->state.new ? " new" : "", in fr_log_dlci_active()
464 !pvc->state.exist ? "deleted" : in fr_log_dlci_active()
465 pvc->state.active ? "active" : "inactive"); in fr_log_dlci_active()
481 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_lmi_send() local
525 while (pvc) { in fr_lmi_send()
531 if (state(hdlc)->reliable && !pvc->state.exist) { in fr_lmi_send()
532 pvc->state.exist = pvc->state.new = 1; in fr_lmi_send()
533 fr_log_dlci_active(pvc); in fr_lmi_send()
537 if (pvc->open_count && !pvc->state.active && in fr_lmi_send()
538 pvc->state.exist && !pvc->state.new) { in fr_lmi_send()
539 pvc_carrier(1, pvc); in fr_lmi_send()
540 pvc->state.active = 1; in fr_lmi_send()
541 fr_log_dlci_active(pvc); in fr_lmi_send()
545 data[i] = pvc->dlci >> 8; in fr_lmi_send()
546 data[i + 1] = pvc->dlci & 0xFF; in fr_lmi_send()
548 data[i] = (pvc->dlci >> 4) & 0x3F; in fr_lmi_send()
549 data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80; in fr_lmi_send()
553 if (pvc->state.new) in fr_lmi_send()
555 else if (pvc->state.active) in fr_lmi_send()
559 pvc = pvc->next; in fr_lmi_send()
577 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_set_link_state() local
586 while (pvc) { /* Activate all PVCs */ in fr_set_link_state()
587 pvc_carrier(1, pvc); in fr_set_link_state()
588 pvc->state.exist = pvc->state.active = 1; in fr_set_link_state()
589 pvc->state.new = 0; in fr_set_link_state()
590 pvc = pvc->next; in fr_set_link_state()
595 while (pvc) { /* Deactivate all PVCs */ in fr_set_link_state()
596 pvc_carrier(0, pvc); in fr_set_link_state()
597 pvc->state.exist = pvc->state.active = 0; in fr_set_link_state()
598 pvc->state.new = 0; in fr_set_link_state()
600 pvc->state.bandwidth = 0; in fr_set_link_state()
601 pvc = pvc->next; in fr_set_link_state()
662 struct pvc_device *pvc; in fr_lmi_recv() local
757 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
758 while (pvc) { in fr_lmi_recv()
759 if (pvc->state.new) { in fr_lmi_recv()
760 pvc->state.new = 0; in fr_lmi_recv()
765 pvc = pvc->next; in fr_lmi_recv()
790 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
792 while (pvc) { in fr_lmi_recv()
793 pvc->state.deleted = 1; in fr_lmi_recv()
794 pvc = pvc->next; in fr_lmi_recv()
830 pvc = add_pvc(dev, dlci); in fr_lmi_recv()
832 if (!pvc && !no_ram) { in fr_lmi_recv()
837 if (pvc) { in fr_lmi_recv()
838 pvc->state.exist = 1; in fr_lmi_recv()
839 pvc->state.deleted = 0; in fr_lmi_recv()
840 if (active != pvc->state.active || in fr_lmi_recv()
841 new != pvc->state.new || in fr_lmi_recv()
842 bw != pvc->state.bandwidth || in fr_lmi_recv()
843 !pvc->state.exist) { in fr_lmi_recv()
844 pvc->state.new = new; in fr_lmi_recv()
845 pvc->state.active = active; in fr_lmi_recv()
846 pvc->state.bandwidth = bw; in fr_lmi_recv()
847 pvc_carrier(active, pvc); in fr_lmi_recv()
848 fr_log_dlci_active(pvc); in fr_lmi_recv()
855 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
857 while (pvc) { in fr_lmi_recv()
858 if (pvc->state.deleted && pvc->state.exist) { in fr_lmi_recv()
859 pvc_carrier(0, pvc); in fr_lmi_recv()
860 pvc->state.active = pvc->state.new = 0; in fr_lmi_recv()
861 pvc->state.exist = 0; in fr_lmi_recv()
862 pvc->state.bandwidth = 0; in fr_lmi_recv()
863 fr_log_dlci_active(pvc); in fr_lmi_recv()
865 pvc = pvc->next; in fr_lmi_recv()
882 struct pvc_device *pvc; in fr_rx() local
901 pvc = find_pvc(hdlc, dlci); in fr_rx()
902 if (!pvc) { in fr_rx()
911 if (pvc->state.fecn != fh->fecn) { in fr_rx()
916 pvc->state.fecn ^= 1; in fr_rx()
919 if (pvc->state.becn != fh->becn) { in fr_rx()
924 pvc->state.becn ^= 1; in fr_rx()
935 dev = pvc->main; in fr_rx()
940 dev = pvc->main; in fr_rx()
954 dev = pvc->main; in fr_rx()
959 if ((dev = pvc->ether) != NULL) in fr_rx()
979 if (pvc->state.becn) in fr_rx()
1037 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_close() local
1039 while (pvc) { /* Shutdown all PVCs for this FRAD */ in fr_close()
1040 if (pvc->main) in fr_close()
1041 dev_close(pvc->main); in fr_close()
1042 if (pvc->ether) in fr_close()
1043 dev_close(pvc->ether); in fr_close()
1044 pvc = pvc->next; in fr_close()
1068 struct pvc_device *pvc; in fr_add_pvc() local
1072 if ((pvc = add_pvc(frad, dlci)) == NULL) { in fr_add_pvc()
1077 if (*get_dev_p(pvc, type)) in fr_add_pvc()
1080 used = pvc_is_used(pvc); in fr_add_pvc()
1107 dev->ml_priv = pvc; in fr_add_pvc()
1116 *get_dev_p(pvc, type) = dev; in fr_add_pvc()
1128 struct pvc_device *pvc; in fr_del_pvc() local
1131 if ((pvc = find_pvc(hdlc, dlci)) == NULL) in fr_del_pvc()
1134 if ((dev = *get_dev_p(pvc, type)) == NULL) in fr_del_pvc()
1141 *get_dev_p(pvc, type) = NULL; in fr_del_pvc()
1143 if (!pvc_is_used(pvc)) { in fr_del_pvc()
1156 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_destroy() local
1161 while (pvc) { in fr_destroy()
1162 struct pvc_device *next = pvc->next; in fr_destroy()
1164 if (pvc->main) in fr_destroy()
1165 unregister_netdevice(pvc->main); in fr_destroy()
1167 if (pvc->ether) in fr_destroy()
1168 unregister_netdevice(pvc->ether); in fr_destroy()
1170 kfree(pvc); in fr_destroy()
1171 pvc = next; in fr_destroy()
1193 fr_proto_pvc pvc; in fr_ioctl() local
1263 if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc, in fr_ioctl()
1267 if (pvc.dlci <= 0 || pvc.dlci >= 1024) in fr_ioctl()
1278 return fr_add_pvc(dev, pvc.dlci, result); in fr_ioctl()
1280 return fr_del_pvc(hdlc, pvc.dlci, result); in fr_ioctl()