From 9aa70813c98ae360d4320dfdb6112b7a1e3b593b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 2 May 2011 15:28:56 -0700 Subject: Fix irq-affinity mapping for multiqueue NIC's Bug 7032 Fix matchinging of irq's named 'eth0-TxRx-0'. And change the code to handle any form of IRQ naming of multiqueue that is eth0-xxx-0. --- scripts/system/irq-affinity.pl | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/scripts/system/irq-affinity.pl b/scripts/system/irq-affinity.pl index 9b2e6b79..fa8e770a 100755 --- a/scripts/system/irq-affinity.pl +++ b/scripts/system/irq-affinity.pl @@ -280,7 +280,8 @@ sub affinity_auto { assign_single( $ifname, $irq) if $irq; } elsif ($numirq > 1) { - my $nrx= grep { /^$ifname-rx-/ } @irqnames; + # Match seperate irq for Rx and Tx + my $nrx = grep { /^$ifname-rx-/ } @irqnames; if ( $nrx > 0 ) { my $ntx = grep { /^$ifname-tx-/ } @irqnames; die "$ifname: rx queues $nrx != tx queues $ntx" @@ -290,21 +291,23 @@ sub affinity_auto { [ '%s-rx-%d', '%s-tx-%d' ] ); } - # There seems to be no absolute convention for multiqueue irq naming - # Known values: - # intel: eth0-TxRx-1 - # vmxnet3: eth0-rxtx-1 - # bnx2x: eth0-fp-1 - # other: eth0-1 - my @seperator = qw/- -TxRx- -rxtx- -fp-/; - foreach my $sep (@seperator) { - my $regex = '/^' . $ifname . $sep . '\d$/'; - my $nq = grep { $regex } @irqnames; + # Match eth0-N form + my $nq = grep { /^$ifname-\d+$/ } @irqnames; + if ( $nq > 0 ) { + return assign_multiqueue( $ifname, $nq, $irqmap, [ '%s-%d' ] ); + } + + # Match eth-sometext-N + if ($irqnames[0] =~ /^$ifname(.*-)\d+$/) { + my $sep = $1; + my $regex = '^' . $ifname . $sep . '\d+$'; + $nq = grep { $regex } @irqnames; if ( $nq > 0 ) { - return assign_multiqueue( $ifname, $nq, $irqmap, - [ "%s$sep%d" ]); + return assign_multiqueue( $ifname, $nq, $irqmap, + [ "%s$sep%d" ] ); } } + syslog(LOG_ERR, "%s: Unknown multiqueue irq naming: %s\n", $ifname, join(' ', @irqnames)); } -- cgit v1.2.3