From ed503897e8ace2ec92e1f74a3d45699ebdab457f Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Fri, 25 May 2012 01:45:38 +0000 Subject: [PATCH] --- yaml --- r: 315767 b: refs/heads/master c: b92ad72dea9925359e9dfa70c4cbf8db6f1b2d65 h: refs/heads/master i: 315765: 502d3f94c217b596d8e4fd57ebdd248c63a23c27 315763: 593d686506e4108a8f93d095e0700e033bdbfa57 315759: 96dad23a1bcfb2de11369ecbf7f8ade2595172f2 v: v3 --- [refs] | 2 +- trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index fec2c18137e2..81155ad44548 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 252562c207a850106d9d5b41a41d29f96c0530b7 +refs/heads/master: b92ad72dea9925359e9dfa70c4cbf8db6f1b2d65 diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c index 5442b359141e..9bc17c0cb972 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c @@ -232,18 +232,22 @@ u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *cfg, int direction, u8 up) { struct tc_configuration *tc_config = &cfg->tc_config[0]; u8 prio_mask = 1 << up; - u8 tc; + u8 tc = cfg->num_tcs.pg_tcs; + + /* If tc is 0 then DCB is likely not enabled or supported */ + if (!tc) + goto out; /* - * Test for TCs 7 through 1 and report the first match we find. If + * Test from maximum TC to 1 and report the first match we find. If * we find no match we can assume that the TC is 0 since the TC must * be set for all user priorities */ - for (tc = MAX_TRAFFIC_CLASS - 1; tc; tc--) { + for (tc--; tc; tc--) { if (prio_mask & tc_config[tc].path[direction].up_to_tc_bitmap) break; } - +out: return tc; }