@@ -731,10 +731,15 @@ struct xps_map {
731731 */
732732struct xps_dev_maps {
733733 struct rcu_head rcu ;
734- struct xps_map __rcu * cpu_map [0 ];
734+ struct xps_map __rcu * attr_map [0 ]; /* Either CPUs map or RXQs map */
735735};
736- #define XPS_DEV_MAPS_SIZE (_tcs ) (sizeof(struct xps_dev_maps) + \
736+
737+ #define XPS_CPU_DEV_MAPS_SIZE (_tcs ) (sizeof(struct xps_dev_maps) + \
737738 (nr_cpu_ids * (_tcs) * sizeof(struct xps_map *)))
739+
740+ #define XPS_RXQ_DEV_MAPS_SIZE (_tcs , _rxqs ) (sizeof(struct xps_dev_maps) +\
741+ (_rxqs * (_tcs) * sizeof(struct xps_map *)))
742+
738743#endif /* CONFIG_XPS */
739744
740745#define TC_MAX_QUEUE 16
@@ -1910,7 +1915,8 @@ struct net_device {
19101915 int watchdog_timeo ;
19111916
19121917#ifdef CONFIG_XPS
1913- struct xps_dev_maps __rcu * xps_maps ;
1918+ struct xps_dev_maps __rcu * xps_cpus_map ;
1919+ struct xps_dev_maps __rcu * xps_rxqs_map ;
19141920#endif
19151921#ifdef CONFIG_NET_CLS_ACT
19161922 struct mini_Qdisc __rcu * miniq_egress ;
@@ -3259,6 +3265,92 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
32593265#ifdef CONFIG_XPS
32603266int netif_set_xps_queue (struct net_device * dev , const struct cpumask * mask ,
32613267 u16 index );
3268+ int __netif_set_xps_queue (struct net_device * dev , const unsigned long * mask ,
3269+ u16 index , bool is_rxqs_map );
3270+
3271+ /**
3272+ * netif_attr_test_mask - Test a CPU or Rx queue set in a mask
3273+ * @j: CPU/Rx queue index
3274+ * @mask: bitmask of all cpus/rx queues
3275+ * @nr_bits: number of bits in the bitmask
3276+ *
3277+ * Test if a CPU or Rx queue index is set in a mask of all CPU/Rx queues.
3278+ */
3279+ static inline bool netif_attr_test_mask (unsigned long j ,
3280+ const unsigned long * mask ,
3281+ unsigned int nr_bits )
3282+ {
3283+ cpu_max_bits_warn (j , nr_bits );
3284+ return test_bit (j , mask );
3285+ }
3286+
3287+ /**
3288+ * netif_attr_test_online - Test for online CPU/Rx queue
3289+ * @j: CPU/Rx queue index
3290+ * @online_mask: bitmask for CPUs/Rx queues that are online
3291+ * @nr_bits: number of bits in the bitmask
3292+ *
3293+ * Returns true if a CPU/Rx queue is online.
3294+ */
3295+ static inline bool netif_attr_test_online (unsigned long j ,
3296+ const unsigned long * online_mask ,
3297+ unsigned int nr_bits )
3298+ {
3299+ cpu_max_bits_warn (j , nr_bits );
3300+
3301+ if (online_mask )
3302+ return test_bit (j , online_mask );
3303+
3304+ return (j < nr_bits );
3305+ }
3306+
3307+ /**
3308+ * netif_attrmask_next - get the next CPU/Rx queue in a cpu/Rx queues mask
3309+ * @n: CPU/Rx queue index
3310+ * @srcp: the cpumask/Rx queue mask pointer
3311+ * @nr_bits: number of bits in the bitmask
3312+ *
3313+ * Returns >= nr_bits if no further CPUs/Rx queues set.
3314+ */
3315+ static inline unsigned int netif_attrmask_next (int n , const unsigned long * srcp ,
3316+ unsigned int nr_bits )
3317+ {
3318+ /* -1 is a legal arg here. */
3319+ if (n != -1 )
3320+ cpu_max_bits_warn (n , nr_bits );
3321+
3322+ if (srcp )
3323+ return find_next_bit (srcp , nr_bits , n + 1 );
3324+
3325+ return n + 1 ;
3326+ }
3327+
3328+ /**
3329+ * netif_attrmask_next_and - get the next CPU/Rx queue in *src1p & *src2p
3330+ * @n: CPU/Rx queue index
3331+ * @src1p: the first CPUs/Rx queues mask pointer
3332+ * @src2p: the second CPUs/Rx queues mask pointer
3333+ * @nr_bits: number of bits in the bitmask
3334+ *
3335+ * Returns >= nr_bits if no further CPUs/Rx queues set in both.
3336+ */
3337+ static inline int netif_attrmask_next_and (int n , const unsigned long * src1p ,
3338+ const unsigned long * src2p ,
3339+ unsigned int nr_bits )
3340+ {
3341+ /* -1 is a legal arg here. */
3342+ if (n != -1 )
3343+ cpu_max_bits_warn (n , nr_bits );
3344+
3345+ if (src1p && src2p )
3346+ return find_next_and_bit (src1p , src2p , nr_bits , n + 1 );
3347+ else if (src1p )
3348+ return find_next_bit (src1p , nr_bits , n + 1 );
3349+ else if (src2p )
3350+ return find_next_bit (src2p , nr_bits , n + 1 );
3351+
3352+ return n + 1 ;
3353+ }
32623354#else
32633355static inline int netif_set_xps_queue (struct net_device * dev ,
32643356 const struct cpumask * mask ,
0 commit comments