Skip to content

Commit 04f762e

Browse files
committed
Merge branch 'xps-DCB'
Alexander Duyck says: ==================== Add support for XPS when using DCB This patch series enables proper isolation between traffic classes when using XPS while DCB is enabled. Previously enabling XPS would cause the traffic to be potentially pulled from one traffic class into another on egress. This change essentially multiplies the XPS map by the number of traffic classes and allows us to do a lookup per traffic class for a given CPU. To guarantee the isolation I invalidate the XPS map for any queues that are moved from one traffic class to another, or if we change the number of traffic classes. v2: Added sysfs to display traffic class Replaced do/while with for loop Cleaned up several other for for loops throughout the patch ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 20861f2 + 184c449 commit 04f762e

File tree

3 files changed

+219
-94
lines changed

3 files changed

+219
-94
lines changed

include/linux/netdevice.h

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,8 @@ struct xps_dev_maps {
732732
struct rcu_head rcu;
733733
struct xps_map __rcu *cpu_map[0];
734734
};
735-
#define XPS_DEV_MAPS_SIZE (sizeof(struct xps_dev_maps) + \
736-
(nr_cpu_ids * sizeof(struct xps_map *)))
735+
#define XPS_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \
736+
(nr_cpu_ids * (_tcs) * sizeof(struct xps_map *)))
737737
#endif /* CONFIG_XPS */
738738

739739
#define TC_MAX_QUEUE 16
@@ -1920,34 +1920,10 @@ int netdev_set_prio_tc_map(struct net_device *dev, u8 prio, u8 tc)
19201920
return 0;
19211921
}
19221922

1923-
static inline
1924-
void netdev_reset_tc(struct net_device *dev)
1925-
{
1926-
dev->num_tc = 0;
1927-
memset(dev->tc_to_txq, 0, sizeof(dev->tc_to_txq));
1928-
memset(dev->prio_tc_map, 0, sizeof(dev->prio_tc_map));
1929-
}
1930-
1931-
static inline
1932-
int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset)
1933-
{
1934-
if (tc >= dev->num_tc)
1935-
return -EINVAL;
1936-
1937-
dev->tc_to_txq[tc].count = count;
1938-
dev->tc_to_txq[tc].offset = offset;
1939-
return 0;
1940-
}
1941-
1942-
static inline
1943-
int netdev_set_num_tc(struct net_device *dev, u8 num_tc)
1944-
{
1945-
if (num_tc > TC_MAX_QUEUE)
1946-
return -EINVAL;
1947-
1948-
dev->num_tc = num_tc;
1949-
return 0;
1950-
}
1923+
int netdev_txq_to_tc(struct net_device *dev, unsigned int txq);
1924+
void netdev_reset_tc(struct net_device *dev);
1925+
int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset);
1926+
int netdev_set_num_tc(struct net_device *dev, u8 num_tc);
19511927

19521928
static inline
19531929
int netdev_get_num_tc(struct net_device *dev)

0 commit comments

Comments
 (0)