Lines Matching refs:pvc

169 	struct pvc_device *pvc = state(hdlc)->first_pvc;  in find_pvc()  local
171 while (pvc) { in find_pvc()
172 if (pvc->dlci == dlci) in find_pvc()
173 return pvc; in find_pvc()
174 if (pvc->dlci > dlci) in find_pvc()
176 pvc = pvc->next; in find_pvc()
185 struct pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc; in add_pvc() local
195 pvc = kzalloc(sizeof(*pvc), GFP_ATOMIC); in add_pvc()
197 printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); in add_pvc()
199 if (!pvc) in add_pvc()
202 pvc->dlci = dlci; in add_pvc()
203 pvc->frad = dev; in add_pvc()
204 pvc->next = *pvc_p; /* Put it in the chain */ in add_pvc()
205 *pvc_p = pvc; in add_pvc()
206 return pvc; in add_pvc()
209 static inline int pvc_is_used(struct pvc_device *pvc) in pvc_is_used() argument
211 return pvc->main || pvc->ether; in pvc_is_used()
214 static inline void pvc_carrier(int on, struct pvc_device *pvc) in pvc_carrier() argument
217 if (pvc->main) in pvc_carrier()
218 if (!netif_carrier_ok(pvc->main)) in pvc_carrier()
219 netif_carrier_on(pvc->main); in pvc_carrier()
220 if (pvc->ether) in pvc_carrier()
221 if (!netif_carrier_ok(pvc->ether)) in pvc_carrier()
222 netif_carrier_on(pvc->ether); in pvc_carrier()
224 if (pvc->main) in pvc_carrier()
225 if (netif_carrier_ok(pvc->main)) in pvc_carrier()
226 netif_carrier_off(pvc->main); in pvc_carrier()
227 if (pvc->ether) in pvc_carrier()
228 if (netif_carrier_ok(pvc->ether)) in pvc_carrier()
229 netif_carrier_off(pvc->ether); in pvc_carrier()
239 struct pvc_device *pvc = *pvc_p; in delete_unused_pvcs() local
241 printk(KERN_DEBUG "freeing unused pvc: %p\n", pvc); in delete_unused_pvcs()
243 *pvc_p = pvc->next; in delete_unused_pvcs()
244 kfree(pvc); in delete_unused_pvcs()
251 static inline struct net_device **get_dev_p(struct pvc_device *pvc, in get_dev_p() argument
255 return &pvc->ether; in get_dev_p()
257 return &pvc->main; in get_dev_p()
325 struct pvc_device *pvc = dev->ml_priv; in pvc_open() local
327 if ((pvc->frad->flags & IFF_UP) == 0) in pvc_open()
330 if (pvc->open_count++ == 0) { in pvc_open()
331 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_open()
334 pvc->state.active = netif_carrier_ok(pvc->frad); in pvc_open()
336 pvc_carrier(pvc->state.active, pvc); in pvc_open()
344 struct pvc_device *pvc = dev->ml_priv; in pvc_close() local
346 if (--pvc->open_count == 0) { in pvc_close()
347 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); in pvc_close()
350 pvc->state.active = 0; in pvc_close()
354 pvc->state.active = 0; in pvc_close()
362 struct pvc_device *pvc = dev->ml_priv; in pvc_ioctl() local
377 info.dlci = pvc->dlci; in pvc_ioctl()
378 memcpy(info.master, pvc->frad->name, IFNAMSIZ); in pvc_ioctl()
390 struct pvc_device *pvc = dev->ml_priv; in pvc_xmit() local
392 if (!pvc->state.active) in pvc_xmit()
419 if (fr_hard_header(skb, pvc->dlci)) in pvc_xmit()
424 if (pvc->state.fecn) /* TX Congestion counter */ in pvc_xmit()
426 skb->dev = pvc->frad; in pvc_xmit()
438 static inline void fr_log_dlci_active(struct pvc_device *pvc) in fr_log_dlci_active() argument
440 netdev_info(pvc->frad, "DLCI %d [%s%s%s]%s %s\n", in fr_log_dlci_active()
441 pvc->dlci, in fr_log_dlci_active()
442 pvc->main ? pvc->main->name : "", in fr_log_dlci_active()
443 pvc->main && pvc->ether ? " " : "", in fr_log_dlci_active()
444 pvc->ether ? pvc->ether->name : "", in fr_log_dlci_active()
445 pvc->state.new ? " new" : "", in fr_log_dlci_active()
446 !pvc->state.exist ? "deleted" : in fr_log_dlci_active()
447 pvc->state.active ? "active" : "inactive"); in fr_log_dlci_active()
460 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_lmi_send() local
503 while (pvc) { in fr_lmi_send()
509 if (state(hdlc)->reliable && !pvc->state.exist) { in fr_lmi_send()
510 pvc->state.exist = pvc->state.new = 1; in fr_lmi_send()
511 fr_log_dlci_active(pvc); in fr_lmi_send()
515 if (pvc->open_count && !pvc->state.active && in fr_lmi_send()
516 pvc->state.exist && !pvc->state.new) { in fr_lmi_send()
517 pvc_carrier(1, pvc); in fr_lmi_send()
518 pvc->state.active = 1; in fr_lmi_send()
519 fr_log_dlci_active(pvc); in fr_lmi_send()
523 data[i] = pvc->dlci >> 8; in fr_lmi_send()
524 data[i + 1] = pvc->dlci & 0xFF; in fr_lmi_send()
526 data[i] = (pvc->dlci >> 4) & 0x3F; in fr_lmi_send()
527 data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80; in fr_lmi_send()
531 if (pvc->state.new) in fr_lmi_send()
533 else if (pvc->state.active) in fr_lmi_send()
537 pvc = pvc->next; in fr_lmi_send()
553 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_set_link_state() local
562 while (pvc) { /* Activate all PVCs */ in fr_set_link_state()
563 pvc_carrier(1, pvc); in fr_set_link_state()
564 pvc->state.exist = pvc->state.active = 1; in fr_set_link_state()
565 pvc->state.new = 0; in fr_set_link_state()
566 pvc = pvc->next; in fr_set_link_state()
571 while (pvc) { /* Deactivate all PVCs */ in fr_set_link_state()
572 pvc_carrier(0, pvc); in fr_set_link_state()
573 pvc->state.exist = pvc->state.active = 0; in fr_set_link_state()
574 pvc->state.new = 0; in fr_set_link_state()
576 pvc->state.bandwidth = 0; in fr_set_link_state()
577 pvc = pvc->next; in fr_set_link_state()
636 struct pvc_device *pvc; in fr_lmi_recv() local
732 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
733 while (pvc) { in fr_lmi_recv()
734 if (pvc->state.new) { in fr_lmi_recv()
735 pvc->state.new = 0; in fr_lmi_recv()
740 pvc = pvc->next; in fr_lmi_recv()
765 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
767 while (pvc) { in fr_lmi_recv()
768 pvc->state.deleted = 1; in fr_lmi_recv()
769 pvc = pvc->next; in fr_lmi_recv()
805 pvc = add_pvc(dev, dlci); in fr_lmi_recv()
807 if (!pvc && !no_ram) { in fr_lmi_recv()
812 if (pvc) { in fr_lmi_recv()
813 pvc->state.exist = 1; in fr_lmi_recv()
814 pvc->state.deleted = 0; in fr_lmi_recv()
815 if (active != pvc->state.active || in fr_lmi_recv()
816 new != pvc->state.new || in fr_lmi_recv()
817 bw != pvc->state.bandwidth || in fr_lmi_recv()
818 !pvc->state.exist) { in fr_lmi_recv()
819 pvc->state.new = new; in fr_lmi_recv()
820 pvc->state.active = active; in fr_lmi_recv()
821 pvc->state.bandwidth = bw; in fr_lmi_recv()
822 pvc_carrier(active, pvc); in fr_lmi_recv()
823 fr_log_dlci_active(pvc); in fr_lmi_recv()
830 pvc = state(hdlc)->first_pvc; in fr_lmi_recv()
832 while (pvc) { in fr_lmi_recv()
833 if (pvc->state.deleted && pvc->state.exist) { in fr_lmi_recv()
834 pvc_carrier(0, pvc); in fr_lmi_recv()
835 pvc->state.active = pvc->state.new = 0; in fr_lmi_recv()
836 pvc->state.exist = 0; in fr_lmi_recv()
837 pvc->state.bandwidth = 0; in fr_lmi_recv()
838 fr_log_dlci_active(pvc); in fr_lmi_recv()
840 pvc = pvc->next; in fr_lmi_recv()
849 static int fr_snap_parse(struct sk_buff *skb, struct pvc_device *pvc) in fr_snap_parse() argument
855 if (!pvc->main) in fr_snap_parse()
857 skb->dev = pvc->main; in fr_snap_parse()
870 if (!pvc->ether) in fr_snap_parse()
875 skb->protocol = eth_type_trans(skb, pvc->ether); in fr_snap_parse()
896 struct pvc_device *pvc; in fr_rx() local
915 pvc = find_pvc(hdlc, dlci); in fr_rx()
916 if (!pvc) { in fr_rx()
924 if (pvc->state.fecn != fh->fecn) { in fr_rx()
929 pvc->state.fecn ^= 1; in fr_rx()
932 if (pvc->state.becn != fh->becn) { in fr_rx()
937 pvc->state.becn ^= 1; in fr_rx()
947 if (!pvc->main) in fr_rx()
950 skb->dev = pvc->main; in fr_rx()
955 if (!pvc->main) in fr_rx()
958 skb->dev = pvc->main; in fr_rx()
969 if (fr_snap_parse(skb, pvc)) in fr_rx()
984 if (pvc->state.becn) in fr_rx()
1035 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_close() local
1037 while (pvc) { /* Shutdown all PVCs for this FRAD */ in fr_close()
1038 if (pvc->main) in fr_close()
1039 dev_close(pvc->main); in fr_close()
1040 if (pvc->ether) in fr_close()
1041 dev_close(pvc->ether); in fr_close()
1042 pvc = pvc->next; in fr_close()
1065 struct pvc_device *pvc; in fr_add_pvc() local
1069 pvc = add_pvc(frad, dlci); in fr_add_pvc()
1070 if (!pvc) { in fr_add_pvc()
1075 if (*get_dev_p(pvc, type)) in fr_add_pvc()
1078 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()
1126 struct pvc_device *pvc; in fr_del_pvc() local
1129 pvc = find_pvc(hdlc, dlci); in fr_del_pvc()
1130 if (!pvc) in fr_del_pvc()
1133 dev = *get_dev_p(pvc, type); 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()
1154 struct pvc_device *pvc = state(hdlc)->first_pvc; in fr_destroy() local
1160 while (pvc) { in fr_destroy()
1161 struct pvc_device *next = pvc->next; in fr_destroy()
1163 if (pvc->main) in fr_destroy()
1164 unregister_netdevice(pvc->main); in fr_destroy()
1166 if (pvc->ether) in fr_destroy()
1167 unregister_netdevice(pvc->ether); in fr_destroy()
1169 kfree(pvc); in fr_destroy()
1170 pvc = next; in fr_destroy()
1190 fr_proto_pvc pvc; in fr_ioctl() local
1261 if (copy_from_user(&pvc, ifs->ifs_ifsu.fr_pvc, in fr_ioctl()
1265 if (pvc.dlci <= 0 || pvc.dlci >= 1024) in fr_ioctl()
1276 return fr_add_pvc(dev, pvc.dlci, result); in fr_ioctl()
1278 return fr_del_pvc(hdlc, pvc.dlci, result); in fr_ioctl()