@@ -333,6 +333,15 @@ struct gro_list {
333333 */
334334#define GRO_HASH_BUCKETS 8
335335
336+ /*
337+ * Structure for per-NAPI config
338+ */
339+ struct napi_config {
340+ u64 gro_flush_timeout ;
341+ u32 defer_hard_irqs ;
342+ unsigned int napi_id ;
343+ };
344+
336345/*
337346 * Structure for NAPI scheduling similar to tasklet but with weighting
338347 */
@@ -364,10 +373,14 @@ struct napi_struct {
364373 unsigned int napi_id ;
365374 struct hrtimer timer ;
366375 struct task_struct * thread ;
376+ unsigned long gro_flush_timeout ;
377+ u32 defer_hard_irqs ;
367378 /* control-path-only fields follow */
368379 struct list_head dev_list ;
369380 struct hlist_node napi_hash_node ;
370381 int irq ;
382+ int index ;
383+ struct napi_config * config ;
371384
372385 RH_KABI_RESERVE (1 )
373386 RH_KABI_RESERVE (2 )
@@ -1928,9 +1941,6 @@ enum netdev_reg_state {
19281941 * allocated at register_netdev() time
19291942 * @real_num_rx_queues: Number of RX queues currently active in device
19301943 * @xdp_prog: XDP sockets filter program pointer
1931- * @gro_flush_timeout: timeout for GRO layer in NAPI
1932- * @napi_defer_hard_irqs: If not zero, provides a counter that would
1933- * allow to avoid NIC hard IRQ, on busy queues.
19341944 *
19351945 * @rx_handler: handler for received packets
19361946 * @rx_handler_data: XXX: need comments on this one
@@ -2078,6 +2088,12 @@ enum netdev_reg_state {
20782088 * @dpll_pin: Pointer to the SyncE source pin of a DPLL subsystem,
20792089 * where the clock is recovered.
20802090 *
2091+ * @napi_config: An array of napi_config structures containing per-NAPI
2092+ * settings.
2093+ * @gro_flush_timeout: timeout for GRO layer in NAPI
2094+ * @napi_defer_hard_irqs: If not zero, provides a counter that would
2095+ * allow to avoid NIC hard IRQ, on busy queues.
2096+ *
20812097 * FIXME: cleanup struct net_device such that network protocol info
20822098 * moves out.
20832099 */
@@ -2143,8 +2159,6 @@ struct net_device {
21432159 int ifindex ;
21442160 unsigned int real_num_rx_queues ;
21452161 struct netdev_rx_queue * _rx ;
2146- unsigned long gro_flush_timeout ;
2147- u32 napi_defer_hard_irqs ;
21482162 unsigned int gro_max_size ;
21492163 unsigned int gro_ipv4_max_size ;
21502164 rx_handler_func_t __rcu * rx_handler ;
@@ -2473,6 +2487,9 @@ struct net_device {
24732487
24742488 /** @irq_moder: dim parameters used if IS_ENABLED(CONFIG_DIMLIB). */
24752489 struct dim_irq_moder * irq_moder ;
2490+ struct napi_config * napi_config ;
2491+ unsigned long gro_flush_timeout ;
2492+ u32 napi_defer_hard_irqs ;
24762493
24772494 RH_KABI_RESERVE (1 )
24782495 RH_KABI_RESERVE (2 )
@@ -2758,6 +2775,22 @@ netif_napi_add_tx_weight(struct net_device *dev,
27582775 netif_napi_add_weight (dev , napi , poll , weight );
27592776}
27602777
2778+ /**
2779+ * netif_napi_add_config - initialize a NAPI context with persistent config
2780+ * @dev: network device
2781+ * @napi: NAPI context
2782+ * @poll: polling function
2783+ * @index: the NAPI index
2784+ */
2785+ static inline void
2786+ netif_napi_add_config (struct net_device * dev , struct napi_struct * napi ,
2787+ int (* poll )(struct napi_struct * , int ), int index )
2788+ {
2789+ napi -> index = index ;
2790+ napi -> config = & dev -> napi_config [index ];
2791+ netif_napi_add_weight (dev , napi , poll , NAPI_POLL_WEIGHT );
2792+ }
2793+
27612794/**
27622795 * netif_napi_add_tx() - initialize a NAPI context to be used for Tx only
27632796 * @dev: network device
@@ -3251,7 +3284,6 @@ struct net_device *netdev_get_by_index(struct net *net, int ifindex,
32513284struct net_device * netdev_get_by_name (struct net * net , const char * name ,
32523285 netdevice_tracker * tracker , gfp_t gfp );
32533286struct net_device * dev_get_by_index_rcu (struct net * net , int ifindex );
3254- struct net_device * dev_get_by_napi_id (unsigned int napi_id );
32553287void netdev_copy_name (struct net_device * dev , char * name );
32563288
32573289static inline int dev_hard_header (struct sk_buff * skb , struct net_device * dev ,
0 commit comments