aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/atm
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-10-11 15:39:35 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-11 15:39:35 -0400
commit56c5d900dbb8e042bfad035d18433476931d8f93 (patch)
tree00b793965beeef10db03e0ff021d2d965c410759 /drivers/atm
parent4dd95b63ae25c5cad6986829b5e8788e9faa0330 (diff)
parentead9d23d803ea3a73766c3cb27bf7563ac8d7266 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: sound/core/memalloc.c
Diffstat (limited to 'drivers/atm')
-rw-r--r--drivers/atm/eni.c2
-rw-r--r--drivers/atm/horizon.c8
-rw-r--r--drivers/atm/idt77252.c32
-rw-r--r--drivers/atm/idt77252.h4
-rw-r--r--drivers/atm/zatm.c6
5 files changed, 18 insertions, 34 deletions
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 41b2204ebc6e..5503bfc8e132 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1270,7 +1270,7 @@ static int comp_tx(struct eni_dev *eni_dev,int *pcr,int reserved,int *pre,
1270 if (*pre < 3) (*pre)++; /* else fail later */ 1270 if (*pre < 3) (*pre)++; /* else fail later */
1271 div = pre_div[*pre]*-*pcr; 1271 div = pre_div[*pre]*-*pcr;
1272 DPRINTK("max div %d\n",div); 1272 DPRINTK("max div %d\n",div);
1273 *res = (TS_CLOCK+div-1)/div-1; 1273 *res = DIV_ROUND_UP(TS_CLOCK, div)-1;
1274 } 1274 }
1275 if (*res < 0) *res = 0; 1275 if (*res < 0) *res = 0;
1276 if (*res > MID_SEG_MAX_RATE) *res = MID_SEG_MAX_RATE; 1276 if (*res > MID_SEG_MAX_RATE) *res = MID_SEG_MAX_RATE;
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index c0ac728dc564..615412364e99 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -635,7 +635,7 @@ static int make_rate (const hrz_dev * dev, u32 c, rounding r,
635 // take care of rounding 635 // take care of rounding
636 switch (r) { 636 switch (r) {
637 case round_down: 637 case round_down:
638 pre = (br+(c<<div)-1)/(c<<div); 638 pre = DIV_ROUND_UP(br, c<<div);
639 // but p must be non-zero 639 // but p must be non-zero
640 if (!pre) 640 if (!pre)
641 pre = 1; 641 pre = 1;
@@ -668,7 +668,7 @@ static int make_rate (const hrz_dev * dev, u32 c, rounding r,
668 // take care of rounding 668 // take care of rounding
669 switch (r) { 669 switch (r) {
670 case round_down: 670 case round_down:
671 pre = (br+(c<<div)-1)/(c<<div); 671 pre = DIV_ROUND_UP(br, c<<div);
672 break; 672 break;
673 case round_nearest: 673 case round_nearest:
674 pre = (br+(c<<div)/2)/(c<<div); 674 pre = (br+(c<<div)/2)/(c<<div);
@@ -698,7 +698,7 @@ got_it:
698 if (bits) 698 if (bits)
699 *bits = (div<<CLOCK_SELECT_SHIFT) | (pre-1); 699 *bits = (div<<CLOCK_SELECT_SHIFT) | (pre-1);
700 if (actual) { 700 if (actual) {
701 *actual = (br + (pre<<div) - 1) / (pre<<div); 701 *actual = DIV_ROUND_UP(br, pre<<div);
702 PRINTD (DBG_QOS, "actual rate: %u", *actual); 702 PRINTD (DBG_QOS, "actual rate: %u", *actual);
703 } 703 }
704 return 0; 704 return 0;
@@ -1967,7 +1967,7 @@ static int __devinit hrz_init (hrz_dev * dev) {
1967 // Set the max AAL5 cell count to be just enough to contain the 1967 // Set the max AAL5 cell count to be just enough to contain the
1968 // largest AAL5 frame that the user wants to receive 1968 // largest AAL5 frame that the user wants to receive
1969 wr_regw (dev, MAX_AAL5_CELL_COUNT_OFF, 1969 wr_regw (dev, MAX_AAL5_CELL_COUNT_OFF,
1970 (max_rx_size + ATM_AAL5_TRAILER + ATM_CELL_PAYLOAD - 1) / ATM_CELL_PAYLOAD); 1970 DIV_ROUND_UP(max_rx_size + ATM_AAL5_TRAILER, ATM_CELL_PAYLOAD));
1971 1971
1972 // Enable receive 1972 // Enable receive
1973 wr_regw (dev, RX_CONFIG_OFF, rd_regw (dev, RX_CONFIG_OFF) | RX_ENABLE); 1973 wr_regw (dev, RX_CONFIG_OFF, rd_regw (dev, RX_CONFIG_OFF) | RX_ENABLE);
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 3a504e94a4d9..e33ae0025b12 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -1114,11 +1114,8 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
1114 1114
1115 rpp = &vc->rcv.rx_pool; 1115 rpp = &vc->rcv.rx_pool;
1116 1116
1117 __skb_queue_tail(&rpp->queue, skb);
1117 rpp->len += skb->len; 1118 rpp->len += skb->len;
1118 if (!rpp->count++)
1119 rpp->first = skb;
1120 *rpp->last = skb;
1121 rpp->last = &skb->next;
1122 1119
1123 if (stat & SAR_RSQE_EPDU) { 1120 if (stat & SAR_RSQE_EPDU) {
1124 unsigned char *l1l2; 1121 unsigned char *l1l2;
@@ -1145,7 +1142,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
1145 atomic_inc(&vcc->stats->rx_err); 1142 atomic_inc(&vcc->stats->rx_err);
1146 return; 1143 return;
1147 } 1144 }
1148 if (rpp->count > 1) { 1145 if (skb_queue_len(&rpp->queue) > 1) {
1149 struct sk_buff *sb; 1146 struct sk_buff *sb;
1150 1147
1151 skb = dev_alloc_skb(rpp->len); 1148 skb = dev_alloc_skb(rpp->len);
@@ -1161,12 +1158,9 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
1161 dev_kfree_skb(skb); 1158 dev_kfree_skb(skb);
1162 return; 1159 return;
1163 } 1160 }
1164 sb = rpp->first; 1161 skb_queue_walk(&rpp->queue, sb)
1165 for (i = 0; i < rpp->count; i++) {
1166 memcpy(skb_put(skb, sb->len), 1162 memcpy(skb_put(skb, sb->len),
1167 sb->data, sb->len); 1163 sb->data, sb->len);
1168 sb = sb->next;
1169 }
1170 1164
1171 recycle_rx_pool_skb(card, rpp); 1165 recycle_rx_pool_skb(card, rpp);
1172 1166
@@ -1180,7 +1174,6 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
1180 return; 1174 return;
1181 } 1175 }
1182 1176
1183 skb->next = NULL;
1184 flush_rx_pool(card, rpp); 1177 flush_rx_pool(card, rpp);
1185 1178
1186 if (!atm_charge(vcc, skb->truesize)) { 1179 if (!atm_charge(vcc, skb->truesize)) {
@@ -1918,25 +1911,18 @@ recycle_rx_skb(struct idt77252_dev *card, struct sk_buff *skb)
1918static void 1911static void
1919flush_rx_pool(struct idt77252_dev *card, struct rx_pool *rpp) 1912flush_rx_pool(struct idt77252_dev *card, struct rx_pool *rpp)
1920{ 1913{
1914 skb_queue_head_init(&rpp->queue);
1921 rpp->len = 0; 1915 rpp->len = 0;
1922 rpp->count = 0;
1923 rpp->first = NULL;
1924 rpp->last = &rpp->first;
1925} 1916}
1926 1917
1927static void 1918static void
1928recycle_rx_pool_skb(struct idt77252_dev *card, struct rx_pool *rpp) 1919recycle_rx_pool_skb(struct idt77252_dev *card, struct rx_pool *rpp)
1929{ 1920{
1930 struct sk_buff *skb, *next; 1921 struct sk_buff *skb, *tmp;
1931 int i;
1932 1922
1933 skb = rpp->first; 1923 skb_queue_walk_safe(&rpp->queue, skb, tmp)
1934 for (i = 0; i < rpp->count; i++) {
1935 next = skb->next;
1936 skb->next = NULL;
1937 recycle_rx_skb(card, skb); 1924 recycle_rx_skb(card, skb);
1938 skb = next; 1925
1939 }
1940 flush_rx_pool(card, rpp); 1926 flush_rx_pool(card, rpp);
1941} 1927}
1942 1928
@@ -2537,7 +2523,7 @@ idt77252_close(struct atm_vcc *vcc)
2537 waitfor_idle(card); 2523 waitfor_idle(card);
2538 spin_unlock_irqrestore(&card->cmd_lock, flags); 2524 spin_unlock_irqrestore(&card->cmd_lock, flags);
2539 2525
2540 if (vc->rcv.rx_pool.count) { 2526 if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
2541 DPRINTK("%s: closing a VC with pending rx buffers.\n", 2527 DPRINTK("%s: closing a VC with pending rx buffers.\n",
2542 card->name); 2528 card->name);
2543 2529
@@ -2970,7 +2956,7 @@ close_card_oam(struct idt77252_dev *card)
2970 waitfor_idle(card); 2956 waitfor_idle(card);
2971 spin_unlock_irqrestore(&card->cmd_lock, flags); 2957 spin_unlock_irqrestore(&card->cmd_lock, flags);
2972 2958
2973 if (vc->rcv.rx_pool.count) { 2959 if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
2974 DPRINTK("%s: closing a VC " 2960 DPRINTK("%s: closing a VC "
2975 "with pending rx buffers.\n", 2961 "with pending rx buffers.\n",
2976 card->name); 2962 card->name);
diff --git a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h
index e83eaf120da0..5042bb2dab15 100644
--- a/drivers/atm/idt77252.h
+++ b/drivers/atm/idt77252.h
@@ -173,10 +173,8 @@ struct scq_info
173}; 173};
174 174
175struct rx_pool { 175struct rx_pool {
176 struct sk_buff *first; 176 struct sk_buff_head queue;
177 struct sk_buff **last;
178 unsigned int len; 177 unsigned int len;
179 unsigned int count;
180}; 178};
181 179
182struct aal1 { 180struct aal1 {
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 58583c6ac5be..752b1ba81f7e 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -496,8 +496,8 @@ static int open_rx_first(struct atm_vcc *vcc)
496 vcc->qos.rxtp.max_sdu = 65464; 496 vcc->qos.rxtp.max_sdu = 65464;
497 /* fix this - we may want to receive 64kB SDUs 497 /* fix this - we may want to receive 64kB SDUs
498 later */ 498 later */
499 cells = (vcc->qos.rxtp.max_sdu+ATM_AAL5_TRAILER+ 499 cells = DIV_ROUND_UP(vcc->qos.rxtp.max_sdu + ATM_AAL5_TRAILER,
500 ATM_CELL_PAYLOAD-1)/ATM_CELL_PAYLOAD; 500 ATM_CELL_PAYLOAD);
501 zatm_vcc->pool = pool_index(cells*ATM_CELL_PAYLOAD); 501 zatm_vcc->pool = pool_index(cells*ATM_CELL_PAYLOAD);
502 } 502 }
503 else { 503 else {
@@ -820,7 +820,7 @@ static int alloc_shaper(struct atm_dev *dev,int *pcr,int min,int max,int ubr)
820 } 820 }
821 else { 821 else {
822 i = 255; 822 i = 255;
823 m = (ATM_OC3_PCR*255+max-1)/max; 823 m = DIV_ROUND_UP(ATM_OC3_PCR*255, max);
824 } 824 }
825 } 825 }
826 if (i > m) { 826 if (i > m) {