@@ -966,14 +966,14 @@ static inline bool gve_is_qpl(struct gve_priv *priv)
966
966
priv -> queue_format == GVE_DQO_QPL_FORMAT ;
967
967
}
968
968
969
- /* Returns the number of tx queue page lists
970
- */
971
- static inline u32 gve_num_tx_qpls (struct gve_priv * priv )
969
+ /* Returns the number of tx queue page lists */
970
+ static inline u32 gve_num_tx_qpls (const struct gve_queue_config * tx_cfg ,
971
+ int num_xdp_queues ,
972
+ bool is_qpl )
972
973
{
973
- if (!gve_is_qpl ( priv ) )
974
+ if (!is_qpl )
974
975
return 0 ;
975
-
976
- return priv -> tx_cfg .num_queues + priv -> num_xdp_queues ;
976
+ return tx_cfg -> num_queues + num_xdp_queues ;
977
977
}
978
978
979
979
/* Returns the number of XDP tx queue page lists
@@ -986,14 +986,13 @@ static inline u32 gve_num_xdp_qpls(struct gve_priv *priv)
986
986
return priv -> num_xdp_queues ;
987
987
}
988
988
989
- /* Returns the number of rx queue page lists
990
- */
991
- static inline u32 gve_num_rx_qpls ( struct gve_priv * priv )
989
+ /* Returns the number of rx queue page lists */
990
+ static inline u32 gve_num_rx_qpls ( const struct gve_queue_config * rx_cfg ,
991
+ bool is_qpl )
992
992
{
993
- if (!gve_is_qpl ( priv ) )
993
+ if (!is_qpl )
994
994
return 0 ;
995
-
996
- return priv -> rx_cfg .num_queues ;
995
+ return rx_cfg -> num_queues ;
997
996
}
998
997
999
998
static inline u32 gve_tx_qpl_id (struct gve_priv * priv , int tx_qid )
@@ -1006,59 +1005,59 @@ static inline u32 gve_rx_qpl_id(struct gve_priv *priv, int rx_qid)
1006
1005
return priv -> tx_cfg .max_queues + rx_qid ;
1007
1006
}
1008
1007
1008
+ /* Returns the index into priv->qpls where a certain rx queue's QPL resides */
1009
+ static inline u32 gve_get_rx_qpl_id (const struct gve_queue_config * tx_cfg , int rx_qid )
1010
+ {
1011
+ return tx_cfg -> max_queues + rx_qid ;
1012
+ }
1013
+
1009
1014
static inline u32 gve_tx_start_qpl_id (struct gve_priv * priv )
1010
1015
{
1011
1016
return gve_tx_qpl_id (priv , 0 );
1012
1017
}
1013
1018
1014
- static inline u32 gve_rx_start_qpl_id (struct gve_priv * priv )
1019
+ /* Returns the index into priv->qpls where the first rx queue's QPL resides */
1020
+ static inline u32 gve_rx_start_qpl_id (const struct gve_queue_config * tx_cfg )
1015
1021
{
1016
- return gve_rx_qpl_id ( priv , 0 );
1022
+ return gve_get_rx_qpl_id ( tx_cfg , 0 );
1017
1023
}
1018
1024
1019
- /* Returns a pointer to the next available tx qpl in the list of qpls
1020
- */
1025
+ /* Returns a pointer to the next available tx qpl in the list of qpls */
1021
1026
static inline
1022
- struct gve_queue_page_list * gve_assign_tx_qpl (struct gve_priv * priv , int tx_qid )
1027
+ struct gve_queue_page_list * gve_assign_tx_qpl (struct gve_tx_alloc_rings_cfg * cfg ,
1028
+ int tx_qid )
1023
1029
{
1024
- int id = gve_tx_qpl_id (priv , tx_qid );
1025
-
1026
1030
/* QPL already in use */
1027
- if (test_bit (id , priv -> qpl_cfg . qpl_id_map ))
1031
+ if (test_bit (tx_qid , cfg -> qpl_cfg -> qpl_id_map ))
1028
1032
return NULL ;
1029
-
1030
- set_bit (id , priv -> qpl_cfg .qpl_id_map );
1031
- return & priv -> qpls [id ];
1033
+ set_bit (tx_qid , cfg -> qpl_cfg -> qpl_id_map );
1034
+ return & cfg -> qpls [tx_qid ];
1032
1035
}
1033
1036
1034
- /* Returns a pointer to the next available rx qpl in the list of qpls
1035
- */
1037
+ /* Returns a pointer to the next available rx qpl in the list of qpls */
1036
1038
static inline
1037
- struct gve_queue_page_list * gve_assign_rx_qpl (struct gve_priv * priv , int rx_qid )
1039
+ struct gve_queue_page_list * gve_assign_rx_qpl (struct gve_rx_alloc_rings_cfg * cfg ,
1040
+ int rx_qid )
1038
1041
{
1039
- int id = gve_rx_qpl_id (priv , rx_qid );
1040
-
1042
+ int id = gve_get_rx_qpl_id (cfg -> qcfg_tx , rx_qid );
1041
1043
/* QPL already in use */
1042
- if (test_bit (id , priv -> qpl_cfg . qpl_id_map ))
1044
+ if (test_bit (id , cfg -> qpl_cfg -> qpl_id_map ))
1043
1045
return NULL ;
1044
-
1045
- set_bit (id , priv -> qpl_cfg .qpl_id_map );
1046
- return & priv -> qpls [id ];
1046
+ set_bit (id , cfg -> qpl_cfg -> qpl_id_map );
1047
+ return & cfg -> qpls [id ];
1047
1048
}
1048
1049
1049
- /* Unassigns the qpl with the given id
1050
- */
1051
- static inline void gve_unassign_qpl (struct gve_priv * priv , int id )
1050
+ /* Unassigns the qpl with the given id */
1051
+ static inline void gve_unassign_qpl (struct gve_qpl_config * qpl_cfg , int id )
1052
1052
{
1053
- clear_bit (id , priv -> qpl_cfg . qpl_id_map );
1053
+ clear_bit (id , qpl_cfg -> qpl_id_map );
1054
1054
}
1055
1055
1056
- /* Returns the correct dma direction for tx and rx qpls
1057
- */
1056
+ /* Returns the correct dma direction for tx and rx qpls */
1058
1057
static inline enum dma_data_direction gve_qpl_dma_dir (struct gve_priv * priv ,
1059
1058
int id )
1060
1059
{
1061
- if (id < gve_rx_start_qpl_id (priv ))
1060
+ if (id < gve_rx_start_qpl_id (& priv -> tx_cfg ))
1062
1061
return DMA_TO_DEVICE ;
1063
1062
else
1064
1063
return DMA_FROM_DEVICE ;
@@ -1103,8 +1102,12 @@ int gve_xdp_xmit_one(struct gve_priv *priv, struct gve_tx_ring *tx,
1103
1102
void gve_xdp_tx_flush (struct gve_priv * priv , u32 xdp_qid );
1104
1103
bool gve_tx_poll (struct gve_notify_block * block , int budget );
1105
1104
bool gve_xdp_poll (struct gve_notify_block * block , int budget );
1106
- int gve_tx_alloc_rings (struct gve_priv * priv , int start_id , int num_rings );
1107
- void gve_tx_free_rings_gqi (struct gve_priv * priv , int start_id , int num_rings );
1105
+ int gve_tx_alloc_rings_gqi (struct gve_priv * priv ,
1106
+ struct gve_tx_alloc_rings_cfg * cfg );
1107
+ void gve_tx_free_rings_gqi (struct gve_priv * priv ,
1108
+ struct gve_tx_alloc_rings_cfg * cfg );
1109
+ void gve_tx_start_ring_gqi (struct gve_priv * priv , int idx );
1110
+ void gve_tx_stop_ring_gqi (struct gve_priv * priv , int idx );
1108
1111
u32 gve_tx_load_event_counter (struct gve_priv * priv ,
1109
1112
struct gve_tx_ring * tx );
1110
1113
bool gve_tx_clean_pending (struct gve_priv * priv , struct gve_tx_ring * tx );
@@ -1113,7 +1116,12 @@ void gve_rx_write_doorbell(struct gve_priv *priv, struct gve_rx_ring *rx);
1113
1116
int gve_rx_poll (struct gve_notify_block * block , int budget );
1114
1117
bool gve_rx_work_pending (struct gve_rx_ring * rx );
1115
1118
int gve_rx_alloc_rings (struct gve_priv * priv );
1116
- void gve_rx_free_rings_gqi (struct gve_priv * priv );
1119
+ int gve_rx_alloc_rings_gqi (struct gve_priv * priv ,
1120
+ struct gve_rx_alloc_rings_cfg * cfg );
1121
+ void gve_rx_free_rings_gqi (struct gve_priv * priv ,
1122
+ struct gve_rx_alloc_rings_cfg * cfg );
1123
+ void gve_rx_start_ring_gqi (struct gve_priv * priv , int idx );
1124
+ void gve_rx_stop_ring_gqi (struct gve_priv * priv , int idx );
1117
1125
/* Reset */
1118
1126
void gve_schedule_reset (struct gve_priv * priv );
1119
1127
int gve_reset (struct gve_priv * priv , bool attempt_teardown );
0 commit comments