aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r--net/core/pktgen.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index a756847e3814..a47f5bad110d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1973,28 +1973,27 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
1973 1973
1974 /* make sure that we don't pick a non-existing transmit queue */ 1974 /* make sure that we don't pick a non-existing transmit queue */
1975 ntxq = pkt_dev->odev->real_num_tx_queues; 1975 ntxq = pkt_dev->odev->real_num_tx_queues;
1976 if (ntxq <= num_online_cpus() && (pkt_dev->flags & F_QUEUE_MAP_CPU)) { 1976 if (ntxq > num_online_cpus() && (pkt_dev->flags & F_QUEUE_MAP_CPU)) {
1977 printk(KERN_WARNING "pktgen: WARNING: QUEUE_MAP_CPU " 1977 printk(KERN_WARNING "pktgen: WARNING: QUEUE_MAP_CPU "
1978 "disabled because CPU count (%d) exceeds number ", 1978 "disabled because CPU count (%d) exceeds number "
1979 num_online_cpus()); 1979 "of tx queues (%d) on %s\n", num_online_cpus(), ntxq,
1980 printk(KERN_WARNING "pktgen: WARNING: of tx queues " 1980 pkt_dev->odev->name);
1981 "(%d) on %s \n", ntxq, pkt_dev->odev->name);
1982 pkt_dev->flags &= ~F_QUEUE_MAP_CPU; 1981 pkt_dev->flags &= ~F_QUEUE_MAP_CPU;
1983 } 1982 }
1984 if (ntxq <= pkt_dev->queue_map_min) { 1983 if (ntxq <= pkt_dev->queue_map_min) {
1985 printk(KERN_WARNING "pktgen: WARNING: Requested " 1984 printk(KERN_WARNING "pktgen: WARNING: Requested "
1986 "queue_map_min (%d) exceeds number of tx\n", 1985 "queue_map_min (zero-based) (%d) exceeds valid range "
1987 pkt_dev->queue_map_min); 1986 "[0 - %d] for (%d) queues on %s, resetting\n",
1988 printk(KERN_WARNING "pktgen: WARNING: queues (%d) on " 1987 pkt_dev->queue_map_min, (ntxq ?: 1)- 1, ntxq,
1989 "%s, resetting\n", ntxq, pkt_dev->odev->name); 1988 pkt_dev->odev->name);
1990 pkt_dev->queue_map_min = ntxq - 1; 1989 pkt_dev->queue_map_min = ntxq - 1;
1991 } 1990 }
1992 if (ntxq <= pkt_dev->queue_map_max) { 1991 if (pkt_dev->queue_map_max >= ntxq) {
1993 printk(KERN_WARNING "pktgen: WARNING: Requested " 1992 printk(KERN_WARNING "pktgen: WARNING: Requested "
1994 "queue_map_max (%d) exceeds number of tx\n", 1993 "queue_map_max (zero-based) (%d) exceeds valid range "
1995 pkt_dev->queue_map_max); 1994 "[0 - %d] for (%d) queues on %s, resetting\n",
1996 printk(KERN_WARNING "pktgen: WARNING: queues (%d) on " 1995 pkt_dev->queue_map_max, (ntxq ?: 1)- 1, ntxq,
1997 "%s, resetting\n", ntxq, pkt_dev->odev->name); 1996 pkt_dev->odev->name);
1998 pkt_dev->queue_map_max = ntxq - 1; 1997 pkt_dev->queue_map_max = ntxq - 1;
1999 } 1998 }
2000 1999
@@ -2474,7 +2473,7 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
2474 if (ret < 0) { 2473 if (ret < 0) {
2475 printk(KERN_ERR "Error expanding " 2474 printk(KERN_ERR "Error expanding "
2476 "ipsec packet %d\n",ret); 2475 "ipsec packet %d\n",ret);
2477 return 0; 2476 goto err;
2478 } 2477 }
2479 } 2478 }
2480 2479
@@ -2484,8 +2483,7 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
2484 if (ret) { 2483 if (ret) {
2485 printk(KERN_ERR "Error creating ipsec " 2484 printk(KERN_ERR "Error creating ipsec "
2486 "packet %d\n",ret); 2485 "packet %d\n",ret);
2487 kfree_skb(skb); 2486 goto err;
2488 return 0;
2489 } 2487 }
2490 /* restore ll */ 2488 /* restore ll */
2491 eth = (__u8 *) skb_push(skb, ETH_HLEN); 2489 eth = (__u8 *) skb_push(skb, ETH_HLEN);
@@ -2494,6 +2492,9 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
2494 } 2492 }
2495 } 2493 }
2496 return 1; 2494 return 1;
2495err:
2496 kfree_skb(skb);
2497 return 0;
2497} 2498}
2498#endif 2499#endif
2499 2500