Lines Matching refs:pvc

179 	struct pvc_device *pvc = state(hdlc)->first_pvc;  in find_pvc()  local
181 while (pvc) { in find_pvc()
182 if (pvc->dlci == dlci) in find_pvc()
183 return pvc; in find_pvc()
184 if (pvc->dlci > dlci) in find_pvc()
186 pvc = pvc->next; in find_pvc()
196 struct pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc; in add_pvc() local
206 pvc = kzalloc(sizeof(*pvc), GFP_ATOMIC); in add_pvc()
208 printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); in add_pvc()
210 if (!pvc) in add_pvc()
213 pvc->dlci = dlci; in add_pvc()
214 pvc->frad = dev; in add_pvc()
215 pvc->next = *pvc_p; /* Put it in the chain */ in add_pvc()
216 *pvc_p = pvc; in add_pvc()
217 return pvc; in add_pvc()
221 static inline int pvc_is_used(struct pvc_device *pvc) in pvc_is_used() argument
223 return pvc->main || pvc->ether; in pvc_is_used()
227 static inline void pvc_carrier(int on, struct pvc_device *pvc) in pvc_carrier() argument
230 if (pvc->main) in pvc_carrier()
231 if (!netif_carrier_ok(pvc->main)) in pvc_carrier()
232 netif_carrier_on(pvc->main); in pvc_carrier()
233 if (pvc->ether) in pvc_carrier()
234 if (!netif_carrier_ok(pvc->ether)) in pvc_carrier()
235 netif_carrier_on(pvc->ether); in pvc_carrier()
237 if (pvc->main) in pvc_carrier()
238 if (netif_carrier_ok(pvc->main)) in pvc_carrier()
239 netif_carrier_off(pvc->main); in pvc_carrier()
240 if (pvc->ether) in pvc_carrier()
241 if (netif_carrier_ok(pvc->ether)) in pvc_carrier()
242 netif_carrier_off(pvc->ether); in pvc_carrier()
253 struct pvc_device *pvc = *pvc_p; in delete_unused_pvcs() local
255 printk(KERN_DEBUG "freeing unused pvc: %p\n", pvc); in delete_unused_pvcs()
257 *pvc_p = pvc->next; in delete_unused_pvcs()
258 kfree(pvc); in delete_unused_pvcs()
266 static inline struct net_device **get_dev_p(struct pvc_device *pvc, in get_dev_p() argument
270 return &pvc->ether; in get_dev_p()
272 return &pvc->main; in get_dev_p()
346 struct pvc_device *pvc = dev->ml_priv; in pvc_open() local
348 if ((pvc->frad->flags & IFF_UP) == 0) in pvc_open()
351 if (pvc->open_count++ == 0) { in pvc_open()
352 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_open()
354 pvc->state.active = netif_carrier_ok(pvc->frad); in pvc_open()
356 pvc_carrier(pvc->state.active, pvc); in pvc_open()
366 struct pvc_device *pvc = dev->ml_priv; in pvc_close() local
368 if (--pvc->open_count == 0) { in pvc_close()
369 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_close()
371 pvc->state.active = 0; in pvc_close()
375 pvc->state.active = 0; in pvc_close()
385 struct pvc_device *pvc = dev->ml_priv; in pvc_ioctl() local
400 info.dlci = pvc->dlci; in pvc_ioctl()
401 memcpy(info.master, pvc->frad->name, IFNAMSIZ); in pvc_ioctl()
413 struct pvc_device *pvc = dev->ml_priv; in pvc_xmit() local
415 if (pvc->state.active) { in pvc_xmit()
432 if (!fr_hard_header(&skb, pvc->dlci)) { in pvc_xmit()
435 if (pvc->state.fecn) /* TX Congestion counter */ in pvc_xmit()
437 skb->dev = pvc->frad; in pvc_xmit()
448 static inline void fr_log_dlci_active(struct pvc_device *pvc) in fr_log_dlci_active() argument
450 netdev_info(pvc->frad, "DLCI %d [%s%s%s]%s %s\n", in fr_log_dlci_active()
451 pvc->dlci, in fr_log_dlci_active()
452 pvc->main ? pvc->main->name : "", in fr_log_dlci_active()
453 pvc->main && pvc->ether ? " " : "", in fr_log_dlci_active()
454 pvc->ether ? pvc->ether->name : "", in fr_log_dlci_active()
455 pvc->state.new ? " new" : "", in fr_log_dlci_active()
456 !pvc->state.exist ? "deleted" : in fr_log_dlci_active()
457 pvc->state.active ? "active" : "inactive"); in fr_log_dlci_active()
473 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_lmi_send() local
519 while (pvc) { in fr_lmi_send()
525 if (state(hdlc)->reliable && !pvc->state.exist) { in fr_lmi_send()
526 pvc->state.exist = pvc->state.new = 1; in fr_lmi_send()
527 fr_log_dlci_active(pvc); in fr_lmi_send()
531 if (pvc->open_count && !pvc->state.active && in fr_lmi_send()
532 pvc->state.exist && !pvc->state.new) { in fr_lmi_send()
533 pvc_carrier(1, pvc); in fr_lmi_send()
534 pvc->state.active = 1; in fr_lmi_send()
535 fr_log_dlci_active(pvc); in fr_lmi_send()
539 data[i] = pvc->dlci >> 8; in fr_lmi_send()
540 data[i + 1] = pvc->dlci & 0xFF; in fr_lmi_send()
542 data[i] = (pvc->dlci >> 4) & 0x3F; in fr_lmi_send()
543 data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80; in fr_lmi_send()
547 if (pvc->state.new) in fr_lmi_send()
549 else if (pvc->state.active) in fr_lmi_send()
553 pvc = pvc->next; in fr_lmi_send()
570 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_set_link_state() local
579 while (pvc) { /* Activate all PVCs */ in fr_set_link_state()
580 pvc_carrier(1, pvc); in fr_set_link_state()
581 pvc->state.exist = pvc->state.active = 1; in fr_set_link_state()
582 pvc->state.new = 0; in fr_set_link_state()
583 pvc = pvc->next; in fr_set_link_state()
588 while (pvc) { /* Deactivate all PVCs */ in fr_set_link_state()
589 pvc_carrier(0, pvc); in fr_set_link_state()
590 pvc->state.exist = pvc->state.active = 0; in fr_set_link_state()
591 pvc->state.new = 0; in fr_set_link_state()
593 pvc->state.bandwidth = 0; in fr_set_link_state()
594 pvc = pvc->next; in fr_set_link_state()
656 struct pvc_device *pvc; in fr_lmi_recv() local
751 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
752 while (pvc) { in fr_lmi_recv()
753 if (pvc->state.new) { in fr_lmi_recv()
754 pvc->state.new = 0; in fr_lmi_recv()
759 pvc = pvc->next; in fr_lmi_recv()
784 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
786 while (pvc) { in fr_lmi_recv()
787 pvc->state.deleted = 1; in fr_lmi_recv()
788 pvc = pvc->next; in fr_lmi_recv()
824 pvc = add_pvc(dev, dlci); in fr_lmi_recv()
826 if (!pvc && !no_ram) { in fr_lmi_recv()
831 if (pvc) { in fr_lmi_recv()
832 pvc->state.exist = 1; in fr_lmi_recv()
833 pvc->state.deleted = 0; in fr_lmi_recv()
834 if (active != pvc->state.active || in fr_lmi_recv()
835 new != pvc->state.new || in fr_lmi_recv()
836 bw != pvc->state.bandwidth || in fr_lmi_recv()
837 !pvc->state.exist) { in fr_lmi_recv()
838 pvc->state.new = new; in fr_lmi_recv()
839 pvc->state.active = active; in fr_lmi_recv()
840 pvc->state.bandwidth = bw; in fr_lmi_recv()
841 pvc_carrier(active, pvc); in fr_lmi_recv()
842 fr_log_dlci_active(pvc); in fr_lmi_recv()
849 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
851 while (pvc) { in fr_lmi_recv()
852 if (pvc->state.deleted && pvc->state.exist) { in fr_lmi_recv()
853 pvc_carrier(0, pvc); in fr_lmi_recv()
854 pvc->state.active = pvc->state.new = 0; in fr_lmi_recv()
855 pvc->state.exist = 0; in fr_lmi_recv()
856 pvc->state.bandwidth = 0; in fr_lmi_recv()
857 fr_log_dlci_active(pvc); in fr_lmi_recv()
859 pvc = pvc->next; in fr_lmi_recv()
876 struct pvc_device *pvc; in fr_rx() local
895 pvc = find_pvc(hdlc, dlci); in fr_rx()
896 if (!pvc) { in fr_rx()
905 if (pvc->state.fecn != fh->fecn) { in fr_rx()
910 pvc->state.fecn ^= 1; in fr_rx()
913 if (pvc->state.becn != fh->becn) { in fr_rx()
918 pvc->state.becn ^= 1; in fr_rx()
929 dev = pvc->main; in fr_rx()
934 dev = pvc->main; in fr_rx()
948 dev = pvc->main; in fr_rx()
953 if ((dev = pvc->ether) != NULL) in fr_rx()
973 if (pvc->state.becn) in fr_rx()
1032 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_close() local
1034 while (pvc) { /* Shutdown all PVCs for this FRAD */ in fr_close()
1035 if (pvc->main) in fr_close()
1036 dev_close(pvc->main); in fr_close()
1037 if (pvc->ether) in fr_close()
1038 dev_close(pvc->ether); in fr_close()
1039 pvc = pvc->next; in fr_close()
1064 struct pvc_device *pvc; in fr_add_pvc() local
1068 if ((pvc = add_pvc(frad, dlci)) == NULL) { in fr_add_pvc()
1073 if (*get_dev_p(pvc, type)) in fr_add_pvc()
1076 used = pvc_is_used(pvc); in fr_add_pvc()
1100 dev->ml_priv = pvc; in fr_add_pvc()
1109 *get_dev_p(pvc, type) = dev; in fr_add_pvc()
1121 struct pvc_device *pvc; in fr_del_pvc() local
1124 if ((pvc = find_pvc(hdlc, dlci)) == NULL) in fr_del_pvc()
1127 if ((dev = *get_dev_p(pvc, type)) == NULL) in fr_del_pvc()
1134 *get_dev_p(pvc, type) = NULL; in fr_del_pvc()
1136 if (!pvc_is_used(pvc)) { in fr_del_pvc()
1149 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_destroy() local
1154 while (pvc) { in fr_destroy()
1155 struct pvc_device *next = pvc->next; in fr_destroy()
1157 if (pvc->main) in fr_destroy()
1158 unregister_netdevice(pvc->main); in fr_destroy()
1160 if (pvc->ether) in fr_destroy()
1161 unregister_netdevice(pvc->ether); in fr_destroy()
1163 kfree(pvc); in fr_destroy()
1164 pvc = next; in fr_destroy()
1186 fr_proto_pvc pvc; in fr_ioctl() local
1255 if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc, in fr_ioctl()
1259 if (pvc.dlci <= 0 || pvc.dlci >= 1024) in fr_ioctl()
1270 return fr_add_pvc(dev, pvc.dlci, result); in fr_ioctl()
1272 return fr_del_pvc(hdlc, pvc.dlci, result); in fr_ioctl()