diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/hwbm.c | 3 | ||||
-rw-r--r-- | net/core/pktgen.c | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/net/core/hwbm.c b/net/core/hwbm.c index 941c28486896..2cab489ae62e 100644 --- a/net/core/hwbm.c +++ b/net/core/hwbm.c | |||
@@ -55,18 +55,21 @@ int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp) | |||
55 | spin_lock_irqsave(&bm_pool->lock, flags); | 55 | spin_lock_irqsave(&bm_pool->lock, flags); |
56 | if (bm_pool->buf_num == bm_pool->size) { | 56 | if (bm_pool->buf_num == bm_pool->size) { |
57 | pr_warn("pool already filled\n"); | 57 | pr_warn("pool already filled\n"); |
58 | spin_unlock_irqrestore(&bm_pool->lock, flags); | ||
58 | return bm_pool->buf_num; | 59 | return bm_pool->buf_num; |
59 | } | 60 | } |
60 | 61 | ||
61 | if (buf_num + bm_pool->buf_num > bm_pool->size) { | 62 | if (buf_num + bm_pool->buf_num > bm_pool->size) { |
62 | pr_warn("cannot allocate %d buffers for pool\n", | 63 | pr_warn("cannot allocate %d buffers for pool\n", |
63 | buf_num); | 64 | buf_num); |
65 | spin_unlock_irqrestore(&bm_pool->lock, flags); | ||
64 | return 0; | 66 | return 0; |
65 | } | 67 | } |
66 | 68 | ||
67 | if ((buf_num + bm_pool->buf_num) < bm_pool->buf_num) { | 69 | if ((buf_num + bm_pool->buf_num) < bm_pool->buf_num) { |
68 | pr_warn("Adding %d buffers to the %d current buffers will overflow\n", | 70 | pr_warn("Adding %d buffers to the %d current buffers will overflow\n", |
69 | buf_num, bm_pool->buf_num); | 71 | buf_num, bm_pool->buf_num); |
72 | spin_unlock_irqrestore(&bm_pool->lock, flags); | ||
70 | return 0; | 73 | return 0; |
71 | } | 74 | } |
72 | 75 | ||
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 8604ae245960..8b02df0d354d 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -2245,10 +2245,8 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until) | |||
2245 | hrtimer_set_expires(&t.timer, spin_until); | 2245 | hrtimer_set_expires(&t.timer, spin_until); |
2246 | 2246 | ||
2247 | remaining = ktime_to_ns(hrtimer_expires_remaining(&t.timer)); | 2247 | remaining = ktime_to_ns(hrtimer_expires_remaining(&t.timer)); |
2248 | if (remaining <= 0) { | 2248 | if (remaining <= 0) |
2249 | pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay); | 2249 | goto out; |
2250 | return; | ||
2251 | } | ||
2252 | 2250 | ||
2253 | start_time = ktime_get(); | 2251 | start_time = ktime_get(); |
2254 | if (remaining < 100000) { | 2252 | if (remaining < 100000) { |
@@ -2273,7 +2271,9 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until) | |||
2273 | } | 2271 | } |
2274 | 2272 | ||
2275 | pkt_dev->idle_acc += ktime_to_ns(ktime_sub(end_time, start_time)); | 2273 | pkt_dev->idle_acc += ktime_to_ns(ktime_sub(end_time, start_time)); |
2274 | out: | ||
2276 | pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay); | 2275 | pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay); |
2276 | destroy_hrtimer_on_stack(&t.timer); | ||
2277 | } | 2277 | } |
2278 | 2278 | ||
2279 | static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev) | 2279 | static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev) |