idt77252.c (9b4f2e9576658c4e52d95dc8d309f51b2e2db096) idt77252.c (0c1cca1d8e0d58775dad43374f925e6cddf1bebc)
1/*******************************************************************
2 * ident "$Id: idt77252.c,v 1.2 2001/11/11 08:13:54 ecd Exp $"
3 *
4 * $Author: ecd $
5 * $Date: 2001/11/11 08:13:54 $
6 *
7 * Copyright (c) 2000 ATecoM GmbH
8 *

--- 628 unchanged lines hidden (view full) ---

637 return card->sbpool[queue].skb[index];
638}
639
640static struct scq_info *
641alloc_scq(struct idt77252_dev *card, int class)
642{
643 struct scq_info *scq;
644
1/*******************************************************************
2 * ident "$Id: idt77252.c,v 1.2 2001/11/11 08:13:54 ecd Exp $"
3 *
4 * $Author: ecd $
5 * $Date: 2001/11/11 08:13:54 $
6 *
7 * Copyright (c) 2000 ATecoM GmbH
8 *

--- 628 unchanged lines hidden (view full) ---

637 return card->sbpool[queue].skb[index];
638}
639
640static struct scq_info *
641alloc_scq(struct idt77252_dev *card, int class)
642{
643 struct scq_info *scq;
644
645 scq = (struct scq_info *) kmalloc(sizeof(struct scq_info), GFP_KERNEL);
645 scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL);
646 if (!scq)
647 return NULL;
646 if (!scq)
647 return NULL;
648 memset(scq, 0, sizeof(struct scq_info));
649
650 scq->base = pci_alloc_consistent(card->pcidev, SCQ_SIZE,
651 &scq->paddr);
652 if (scq->base == NULL) {
653 kfree(scq);
654 return NULL;
655 }
656 memset(scq->base, 0, SCQ_SIZE);
657

--- 1479 unchanged lines hidden (view full) ---

2137 spin_unlock_irqrestore(&vc->lock, flags);
2138}
2139
2140static struct rate_estimator *
2141idt77252_init_est(struct vc_map *vc, int pcr)
2142{
2143 struct rate_estimator *est;
2144
648 scq->base = pci_alloc_consistent(card->pcidev, SCQ_SIZE,
649 &scq->paddr);
650 if (scq->base == NULL) {
651 kfree(scq);
652 return NULL;
653 }
654 memset(scq->base, 0, SCQ_SIZE);
655

--- 1479 unchanged lines hidden (view full) ---

2135 spin_unlock_irqrestore(&vc->lock, flags);
2136}
2137
2138static struct rate_estimator *
2139idt77252_init_est(struct vc_map *vc, int pcr)
2140{
2141 struct rate_estimator *est;
2142
2145 est = kmalloc(sizeof(struct rate_estimator), GFP_KERNEL);
2143 est = kzalloc(sizeof(struct rate_estimator), GFP_KERNEL);
2146 if (!est)
2147 return NULL;
2144 if (!est)
2145 return NULL;
2148 memset(est, 0, sizeof(*est));
2149
2150 est->maxcps = pcr < 0 ? -pcr : pcr;
2151 est->cps = est->maxcps;
2152 est->avcps = est->cps << 5;
2153
2154 est->interval = 2; /* XXX: make this configurable */
2155 est->ewma_log = 2; /* XXX: make this configurable */
2156 init_timer(&est->timer);
2157 est->timer.data = (unsigned long)vc;

--- 288 unchanged lines hidden (view full) ---

2446 default:
2447 printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal);
2448 up(&card->mutex);
2449 return -EPROTONOSUPPORT;
2450 }
2451
2452 index = VPCI2VC(card, vpi, vci);
2453 if (!card->vcs[index]) {
2146 est->maxcps = pcr < 0 ? -pcr : pcr;
2147 est->cps = est->maxcps;
2148 est->avcps = est->cps << 5;
2149
2150 est->interval = 2; /* XXX: make this configurable */
2151 est->ewma_log = 2; /* XXX: make this configurable */
2152 init_timer(&est->timer);
2153 est->timer.data = (unsigned long)vc;

--- 288 unchanged lines hidden (view full) ---

2442 default:
2443 printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal);
2444 up(&card->mutex);
2445 return -EPROTONOSUPPORT;
2446 }
2447
2448 index = VPCI2VC(card, vpi, vci);
2449 if (!card->vcs[index]) {
2454 card->vcs[index] = kmalloc(sizeof(struct vc_map), GFP_KERNEL);
2450 card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
2455 if (!card->vcs[index]) {
2456 printk("%s: can't alloc vc in open()\n", card->name);
2457 up(&card->mutex);
2458 return -ENOMEM;
2459 }
2451 if (!card->vcs[index]) {
2452 printk("%s: can't alloc vc in open()\n", card->name);
2453 up(&card->mutex);
2454 return -ENOMEM;
2455 }
2460 memset(card->vcs[index], 0, sizeof(struct vc_map));
2461
2462 card->vcs[index]->card = card;
2463 card->vcs[index]->index = index;
2464
2465 spin_lock_init(&card->vcs[index]->lock);
2466 }
2467 vc = card->vcs[index];
2468
2469 vcc->dev_data = vc;

--- 451 unchanged lines hidden (view full) ---

2921 int vpi, vci;
2922 int index;
2923 u32 rcte;
2924
2925 for (vpi = 0; vpi < (1 << card->vpibits); vpi++) {
2926 for (vci = 3; vci < 5; vci++) {
2927 index = VPCI2VC(card, vpi, vci);
2928
2456 card->vcs[index]->card = card;
2457 card->vcs[index]->index = index;
2458
2459 spin_lock_init(&card->vcs[index]->lock);
2460 }
2461 vc = card->vcs[index];
2462
2463 vcc->dev_data = vc;

--- 451 unchanged lines hidden (view full) ---

2915 int vpi, vci;
2916 int index;
2917 u32 rcte;
2918
2919 for (vpi = 0; vpi < (1 << card->vpibits); vpi++) {
2920 for (vci = 3; vci < 5; vci++) {
2921 index = VPCI2VC(card, vpi, vci);
2922
2929 vc = kmalloc(sizeof(struct vc_map), GFP_KERNEL);
2923 vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
2930 if (!vc) {
2931 printk("%s: can't alloc vc\n", card->name);
2932 return -ENOMEM;
2933 }
2924 if (!vc) {
2925 printk("%s: can't alloc vc\n", card->name);
2926 return -ENOMEM;
2927 }
2934 memset(vc, 0, sizeof(struct vc_map));
2935
2936 vc->index = index;
2937 card->vcs[index] = vc;
2938
2939 flush_rx_pool(card, &vc->rcv.rx_pool);
2940
2941 rcte = SAR_RCTE_CONNECTOPEN |
2942 SAR_RCTE_RAWCELLINTEN |
2943 SAR_RCTE_RCQ |

--- 46 unchanged lines hidden (view full) ---

2990 }
2991}
2992
2993static int
2994open_card_ubr0(struct idt77252_dev *card)
2995{
2996 struct vc_map *vc;
2997
2928 vc->index = index;
2929 card->vcs[index] = vc;
2930
2931 flush_rx_pool(card, &vc->rcv.rx_pool);
2932
2933 rcte = SAR_RCTE_CONNECTOPEN |
2934 SAR_RCTE_RAWCELLINTEN |
2935 SAR_RCTE_RCQ |

--- 46 unchanged lines hidden (view full) ---

2982 }
2983}
2984
2985static int
2986open_card_ubr0(struct idt77252_dev *card)
2987{
2988 struct vc_map *vc;
2989
2998 vc = kmalloc(sizeof(struct vc_map), GFP_KERNEL);
2990 vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
2999 if (!vc) {
3000 printk("%s: can't alloc vc\n", card->name);
3001 return -ENOMEM;
3002 }
2991 if (!vc) {
2992 printk("%s: can't alloc vc\n", card->name);
2993 return -ENOMEM;
2994 }
3003 memset(vc, 0, sizeof(struct vc_map));
3004 card->vcs[0] = vc;
3005 vc->class = SCHED_UBR0;
3006
3007 vc->scq = alloc_scq(card, vc->class);
3008 if (!vc->scq) {
3009 printk("%s: can't get SCQ.\n", card->name);
3010 return -ENOMEM;
3011 }

--- 678 unchanged lines hidden (view full) ---

3690 }
3691
3692 if (pci_read_config_word(pcidev, PCI_REVISION_ID, &revision)) {
3693 printk("idt77252-%d: can't read PCI_REVISION_ID\n", index);
3694 err = -ENODEV;
3695 goto err_out_disable_pdev;
3696 }
3697
2995 card->vcs[0] = vc;
2996 vc->class = SCHED_UBR0;
2997
2998 vc->scq = alloc_scq(card, vc->class);
2999 if (!vc->scq) {
3000 printk("%s: can't get SCQ.\n", card->name);
3001 return -ENOMEM;
3002 }

--- 678 unchanged lines hidden (view full) ---

3681 }
3682
3683 if (pci_read_config_word(pcidev, PCI_REVISION_ID, &revision)) {
3684 printk("idt77252-%d: can't read PCI_REVISION_ID\n", index);
3685 err = -ENODEV;
3686 goto err_out_disable_pdev;
3687 }
3688
3698 card = kmalloc(sizeof(struct idt77252_dev), GFP_KERNEL);
3689 card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL);
3699 if (!card) {
3700 printk("idt77252-%d: can't allocate private data\n", index);
3701 err = -ENOMEM;
3702 goto err_out_disable_pdev;
3703 }
3690 if (!card) {
3691 printk("idt77252-%d: can't allocate private data\n", index);
3692 err = -ENOMEM;
3693 goto err_out_disable_pdev;
3694 }
3704 memset(card, 0, sizeof(struct idt77252_dev));
3705
3706 card->revision = revision;
3707 card->index = index;
3708 card->pcidev = pcidev;
3709 sprintf(card->name, "idt77252-%d", card->index);
3710
3711 INIT_WORK(&card->tqueue, idt77252_softint, (void *)card);
3712
3713 membase = pci_resource_start(pcidev, 1);

--- 170 unchanged lines hidden ---
3695 card->revision = revision;
3696 card->index = index;
3697 card->pcidev = pcidev;
3698 sprintf(card->name, "idt77252-%d", card->index);
3699
3700 INIT_WORK(&card->tqueue, idt77252_softint, (void *)card);
3701
3702 membase = pci_resource_start(pcidev, 1);

--- 170 unchanged lines hidden ---