From 2a71eb5892bc947237a0c8f9d39a05cd77852c58 Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Thu, 17 May 2012 05:14:34 +0000 Subject: [PATCH] --- yaml --- r: 315394 b: refs/heads/master c: 15cbc70ea2b8a43ba3f0dc858299ed1c5b295b71 h: refs/heads/master v: v3 --- [refs] | 2 +- .../net/ethernet/intel/ixgbe/ixgbe_dcb.c | 30 ++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index da01d6a6f45d..a5da076e6bff 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 22a4cca2f4c2d60c703cdc42158c907570f508e6 +refs/heads/master: 15cbc70ea2b8a43ba3f0dc858299ed1c5b295b71 diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c index 8bfaaee5ac5b..4fd5a0d1e129 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb.c @@ -231,16 +231,32 @@ void ixgbe_dcb_unpack_prio(struct ixgbe_dcb_config *cfg, int direction, } } -void ixgbe_dcb_unpack_map(struct ixgbe_dcb_config *cfg, int direction, u8 *map) +static u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *cfg, + int direction, u8 up) { - int i, up; - unsigned long bitmap; + struct tc_configuration *tc_config = &cfg->tc_config[0]; + u8 prio_mask = 1 << up; + u8 tc; - for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { - bitmap = cfg->tc_config[i].path[direction].up_to_tc_bitmap; - for_each_set_bit(up, &bitmap, MAX_USER_PRIORITY) - map[up] = i; + /* + * Test for TCs 7 through 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--) { + if (prio_mask & tc_config[tc].path[direction].up_to_tc_bitmap) + break; } + + return tc; +} + +void ixgbe_dcb_unpack_map(struct ixgbe_dcb_config *cfg, int direction, u8 *map) +{ + u8 up; + + for (up = 0; up < MAX_USER_PRIORITY; up++) + map[up] = ixgbe_dcb_get_tc_from_up(cfg, direction, up); } /**