Lines Matching defs:pvc
177 struct pvc_device *pvc = state(hdlc)->first_pvc;
179 while (pvc) {
180 if (pvc->dlci == dlci)
181 return pvc;
182 if (pvc->dlci > dlci)
184 pvc = pvc->next;
194 struct pvc_device *pvc, **pvc_p = &state(hdlc)->first_pvc;
204 pvc = kzalloc(sizeof(*pvc), GFP_ATOMIC);
206 printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev);
208 if (!pvc)
211 pvc->dlci = dlci;
212 pvc->frad = dev;
213 pvc->next = *pvc_p; /* Put it in the chain */
214 *pvc_p = pvc;
215 return pvc;
219 static inline int pvc_is_used(struct pvc_device *pvc)
221 return pvc->main || pvc->ether;
225 static inline void pvc_carrier(int on, struct pvc_device *pvc)
228 if (pvc->main)
229 if (!netif_carrier_ok(pvc->main))
230 netif_carrier_on(pvc->main);
231 if (pvc->ether)
232 if (!netif_carrier_ok(pvc->ether))
233 netif_carrier_on(pvc->ether);
235 if (pvc->main)
236 if (netif_carrier_ok(pvc->main))
237 netif_carrier_off(pvc->main);
238 if (pvc->ether)
239 if (netif_carrier_ok(pvc->ether))
240 netif_carrier_off(pvc->ether);
251 struct pvc_device *pvc = *pvc_p;
253 printk(KERN_DEBUG "freeing unused pvc: %p\n", pvc);
255 *pvc_p = pvc->next;
256 kfree(pvc);
264 static inline struct net_device **get_dev_p(struct pvc_device *pvc,
268 return &pvc->ether;
270 return &pvc->main;
341 struct pvc_device *pvc = dev->ml_priv;
343 if ((pvc->frad->flags & IFF_UP) == 0)
346 if (pvc->open_count++ == 0) {
347 hdlc_device *hdlc = dev_to_hdlc(pvc->frad);
349 pvc->state.active = netif_carrier_ok(pvc->frad);
351 pvc_carrier(pvc->state.active, pvc);
361 struct pvc_device *pvc = dev->ml_priv;
363 if (--pvc->open_count == 0) {
364 hdlc_device *hdlc = dev_to_hdlc(pvc->frad);
366 pvc->state.active = 0;
370 pvc->state.active = 0;
380 struct pvc_device *pvc = dev->ml_priv;
395 info.dlci = pvc->dlci;
396 memcpy(info.master, pvc->frad->name, IFNAMSIZ);
408 struct pvc_device *pvc = dev->ml_priv;
410 if (!pvc->state.active)
437 if (fr_hard_header(skb, pvc->dlci))
442 if (pvc->state.fecn) /* TX Congestion counter */
444 skb->dev = pvc->frad;
456 static inline void fr_log_dlci_active(struct pvc_device *pvc)
458 netdev_info(pvc->frad, "DLCI %d [%s%s%s]%s %s\n",
459 pvc->dlci,
460 pvc->main ? pvc->main->name : "",
461 pvc->main && pvc->ether ? " " : "",
462 pvc->ether ? pvc->ether->name : "",
463 pvc->state.new ? " new" : "",
464 !pvc->state.exist ? "deleted" :
465 pvc->state.active ? "active" : "inactive");
481 struct pvc_device *pvc = state(hdlc)->first_pvc;
525 while (pvc) {
531 if (state(hdlc)->reliable && !pvc->state.exist) {
532 pvc->state.exist = pvc->state.new = 1;
533 fr_log_dlci_active(pvc);
537 if (pvc->open_count && !pvc->state.active &&
538 pvc->state.exist && !pvc->state.new) {
539 pvc_carrier(1, pvc);
540 pvc->state.active = 1;
541 fr_log_dlci_active(pvc);
545 data[i] = pvc->dlci >> 8;
546 data[i + 1] = pvc->dlci & 0xFF;
548 data[i] = (pvc->dlci >> 4) & 0x3F;
549 data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80;
553 if (pvc->state.new)
555 else if (pvc->state.active)
559 pvc = pvc->next;
577 struct pvc_device *pvc = state(hdlc)->first_pvc;
586 while (pvc) { /* Activate all PVCs */
587 pvc_carrier(1, pvc);
588 pvc->state.exist = pvc->state.active = 1;
589 pvc->state.new = 0;
590 pvc = pvc->next;
595 while (pvc) { /* Deactivate all PVCs */
596 pvc_carrier(0, pvc);
597 pvc->state.exist = pvc->state.active = 0;
598 pvc->state.new = 0;
600 pvc->state.bandwidth = 0;
601 pvc = pvc->next;
662 struct pvc_device *pvc;
757 pvc = state(hdlc)->first_pvc;
758 while (pvc) {
759 if (pvc->state.new) {
760 pvc->state.new = 0;
765 pvc = pvc->next;
790 pvc = state(hdlc)->first_pvc;
792 while (pvc) {
793 pvc->state.deleted = 1;
794 pvc = pvc->next;
830 pvc = add_pvc(dev, dlci);
832 if (!pvc && !no_ram) {
837 if (pvc) {
838 pvc->state.exist = 1;
839 pvc->state.deleted = 0;
840 if (active != pvc->state.active ||
841 new != pvc->state.new ||
842 bw != pvc->state.bandwidth ||
843 !pvc->state.exist) {
844 pvc->state.new = new;
845 pvc->state.active = active;
846 pvc->state.bandwidth = bw;
847 pvc_carrier(active, pvc);
848 fr_log_dlci_active(pvc);
855 pvc = state(hdlc)->first_pvc;
857 while (pvc) {
858 if (pvc->state.deleted && pvc->state.exist) {
859 pvc_carrier(0, pvc);
860 pvc->state.active = pvc->state.new = 0;
861 pvc->state.exist = 0;
862 pvc->state.bandwidth = 0;
863 fr_log_dlci_active(pvc);
865 pvc = pvc->next;
882 struct pvc_device *pvc;
901 pvc = find_pvc(hdlc, dlci);
902 if (!pvc) {
911 if (pvc->state.fecn != fh->fecn) {
916 pvc->state.fecn ^= 1;
919 if (pvc->state.becn != fh->becn) {
924 pvc->state.becn ^= 1;
935 dev = pvc->main;
940 dev = pvc->main;
954 dev = pvc->main;
959 if ((dev = pvc->ether) != NULL)
979 if (pvc->state.becn)
1037 struct pvc_device *pvc = state(hdlc)->first_pvc;
1039 while (pvc) { /* Shutdown all PVCs for this FRAD */
1040 if (pvc->main)
1041 dev_close(pvc->main);
1042 if (pvc->ether)
1043 dev_close(pvc->ether);
1044 pvc = pvc->next;
1068 struct pvc_device *pvc;
1072 if ((pvc = add_pvc(frad, dlci)) == NULL) {
1077 if (*get_dev_p(pvc, type))
1080 used = pvc_is_used(pvc);
1086 dev = alloc_netdev(0, "pvc%d", NET_NAME_UNKNOWN, pvc_setup);
1107 dev->ml_priv = pvc;
1116 *get_dev_p(pvc, type) = dev;
1128 struct pvc_device *pvc;
1131 if ((pvc = find_pvc(hdlc, dlci)) == NULL)
1134 if ((dev = *get_dev_p(pvc, type)) == NULL)
1141 *get_dev_p(pvc, type) = NULL;
1143 if (!pvc_is_used(pvc)) {
1156 struct pvc_device *pvc = state(hdlc)->first_pvc;
1161 while (pvc) {
1162 struct pvc_device *next = pvc->next;
1164 if (pvc->main)
1165 unregister_netdevice(pvc->main);
1167 if (pvc->ether)
1168 unregister_netdevice(pvc->ether);
1170 kfree(pvc);
1171 pvc = next;
1193 fr_proto_pvc pvc;
1263 if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc,
1267 if (pvc.dlci <= 0 || pvc.dlci >= 1024)
1278 return fr_add_pvc(dev, pvc.dlci, result);
1280 return fr_del_pvc(hdlc, pvc.dlci, result);