diff options
author | David S. Miller <davem@davemloft.net> | 2008-09-22 00:38:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-09-22 00:38:26 -0400 |
commit | ceade961c4c8d8bc033dc7907047818c9525c326 (patch) | |
tree | 96a53d443e934f4726fd9ef5ee049c09d6d409c3 /drivers/atm/idt77252.c | |
parent | 43f59c89399fd76883a06c551f24794e98409432 (diff) |
atm: idt77252: Use generic SKB queue management instead of home-grown scheme.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm/idt77252.c')
-rw-r--r-- | drivers/atm/idt77252.c | 32 |
1 files changed, 9 insertions, 23 deletions
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) | |||
1918 | static void | 1911 | static void |
1919 | flush_rx_pool(struct idt77252_dev *card, struct rx_pool *rpp) | 1912 | flush_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 | ||
1927 | static void | 1918 | static void |
1928 | recycle_rx_pool_skb(struct idt77252_dev *card, struct rx_pool *rpp) | 1919 | recycle_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); |