diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/core/pktgen.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 526236453908..a756847e3814 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -1961,6 +1961,8 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname) | |||
1961 | */ | 1961 | */ |
1962 | static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) | 1962 | static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) |
1963 | { | 1963 | { |
1964 | int ntxq; | ||
1965 | |||
1964 | if (!pkt_dev->odev) { | 1966 | if (!pkt_dev->odev) { |
1965 | printk(KERN_ERR "pktgen: ERROR: pkt_dev->odev == NULL in " | 1967 | printk(KERN_ERR "pktgen: ERROR: pkt_dev->odev == NULL in " |
1966 | "setup_inject.\n"); | 1968 | "setup_inject.\n"); |
@@ -1969,6 +1971,33 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) | |||
1969 | return; | 1971 | return; |
1970 | } | 1972 | } |
1971 | 1973 | ||
1974 | /* make sure that we don't pick a non-existing transmit queue */ | ||
1975 | ntxq = pkt_dev->odev->real_num_tx_queues; | ||
1976 | if (ntxq <= num_online_cpus() && (pkt_dev->flags & F_QUEUE_MAP_CPU)) { | ||
1977 | printk(KERN_WARNING "pktgen: WARNING: QUEUE_MAP_CPU " | ||
1978 | "disabled because CPU count (%d) exceeds number ", | ||
1979 | num_online_cpus()); | ||
1980 | printk(KERN_WARNING "pktgen: WARNING: of tx queues " | ||
1981 | "(%d) on %s \n", ntxq, pkt_dev->odev->name); | ||
1982 | pkt_dev->flags &= ~F_QUEUE_MAP_CPU; | ||
1983 | } | ||
1984 | if (ntxq <= pkt_dev->queue_map_min) { | ||
1985 | printk(KERN_WARNING "pktgen: WARNING: Requested " | ||
1986 | "queue_map_min (%d) exceeds number of tx\n", | ||
1987 | pkt_dev->queue_map_min); | ||
1988 | printk(KERN_WARNING "pktgen: WARNING: queues (%d) on " | ||
1989 | "%s, resetting\n", ntxq, pkt_dev->odev->name); | ||
1990 | pkt_dev->queue_map_min = ntxq - 1; | ||
1991 | } | ||
1992 | if (ntxq <= pkt_dev->queue_map_max) { | ||
1993 | printk(KERN_WARNING "pktgen: WARNING: Requested " | ||
1994 | "queue_map_max (%d) exceeds number of tx\n", | ||
1995 | pkt_dev->queue_map_max); | ||
1996 | printk(KERN_WARNING "pktgen: WARNING: queues (%d) on " | ||
1997 | "%s, resetting\n", ntxq, pkt_dev->odev->name); | ||
1998 | pkt_dev->queue_map_max = ntxq - 1; | ||
1999 | } | ||
2000 | |||
1972 | /* Default to the interface's mac if not explicitly set. */ | 2001 | /* Default to the interface's mac if not explicitly set. */ |
1973 | 2002 | ||
1974 | if (is_zero_ether_addr(pkt_dev->src_mac)) | 2003 | if (is_zero_ether_addr(pkt_dev->src_mac)) |