@@ -2551,8 +2551,10 @@ vtnet_txq_enqueue_buf(struct vtnet_txq *txq, struct mbuf **m_head,
25512551 error = sglist_append_mbuf (sg , m );
25522552 if (error ) {
25532553 m = m_defrag (m , M_NOWAIT );
2554- if (m == NULL )
2554+ if (m == NULL ) {
2555+ sc -> vtnet_stats .tx_defrag_failed ++ ;
25552556 goto fail ;
2557+ }
25562558
25572559 * m_head = m ;
25582560 sc -> vtnet_stats .tx_defragged ++ ;
@@ -2568,7 +2570,6 @@ vtnet_txq_enqueue_buf(struct vtnet_txq *txq, struct mbuf **m_head,
25682570 return (error );
25692571
25702572fail :
2571- sc -> vtnet_stats .tx_defrag_failed ++ ;
25722573 m_freem (* m_head );
25732574 * m_head = NULL ;
25742575
@@ -4170,6 +4171,102 @@ vtnet_setup_queue_sysctl(struct vtnet_softc *sc)
41704171 }
41714172}
41724173
4174+ static int
4175+ vtnet_sysctl_rx_csum_failed (SYSCTL_HANDLER_ARGS )
4176+ {
4177+ struct vtnet_softc * sc = (struct vtnet_softc * )arg1 ;
4178+ struct vtnet_statistics * stats = & sc -> vtnet_stats ;
4179+ struct vtnet_rxq_stats * rxst ;
4180+ int i ;
4181+
4182+ stats -> rx_csum_failed = 0 ;
4183+ for (i = 0 ; i < sc -> vtnet_max_vq_pairs ; i ++ ) {
4184+ rxst = & sc -> vtnet_rxqs [i ].vtnrx_stats ;
4185+ stats -> rx_csum_failed += rxst -> vrxs_csum_failed ;
4186+ }
4187+ return (sysctl_handle_64 (oidp , NULL , stats -> rx_csum_failed , req ));
4188+ }
4189+
4190+ static int
4191+ vtnet_sysctl_rx_csum_offloaded (SYSCTL_HANDLER_ARGS )
4192+ {
4193+ struct vtnet_softc * sc = (struct vtnet_softc * )arg1 ;
4194+ struct vtnet_statistics * stats = & sc -> vtnet_stats ;
4195+ struct vtnet_rxq_stats * rxst ;
4196+ int i ;
4197+
4198+ stats -> rx_csum_offloaded = 0 ;
4199+ for (i = 0 ; i < sc -> vtnet_max_vq_pairs ; i ++ ) {
4200+ rxst = & sc -> vtnet_rxqs [i ].vtnrx_stats ;
4201+ stats -> rx_csum_offloaded += rxst -> vrxs_csum ;
4202+ }
4203+ return (sysctl_handle_64 (oidp , NULL , stats -> rx_csum_offloaded , req ));
4204+ }
4205+
4206+ static int
4207+ vtnet_sysctl_rx_task_rescheduled (SYSCTL_HANDLER_ARGS )
4208+ {
4209+ struct vtnet_softc * sc = (struct vtnet_softc * )arg1 ;
4210+ struct vtnet_statistics * stats = & sc -> vtnet_stats ;
4211+ struct vtnet_rxq_stats * rxst ;
4212+ int i ;
4213+
4214+ stats -> rx_task_rescheduled = 0 ;
4215+ for (i = 0 ; i < sc -> vtnet_max_vq_pairs ; i ++ ) {
4216+ rxst = & sc -> vtnet_rxqs [i ].vtnrx_stats ;
4217+ stats -> rx_task_rescheduled += rxst -> vrxs_rescheduled ;
4218+ }
4219+ return (sysctl_handle_64 (oidp , NULL , stats -> rx_task_rescheduled , req ));
4220+ }
4221+
4222+ static int
4223+ vtnet_sysctl_tx_csum_offloaded (SYSCTL_HANDLER_ARGS )
4224+ {
4225+ struct vtnet_softc * sc = (struct vtnet_softc * )arg1 ;
4226+ struct vtnet_statistics * stats = & sc -> vtnet_stats ;
4227+ struct vtnet_txq_stats * txst ;
4228+ int i ;
4229+
4230+ stats -> tx_csum_offloaded = 0 ;
4231+ for (i = 0 ; i < sc -> vtnet_max_vq_pairs ; i ++ ) {
4232+ txst = & sc -> vtnet_txqs [i ].vtntx_stats ;
4233+ stats -> tx_csum_offloaded += txst -> vtxs_csum ;
4234+ }
4235+ return (sysctl_handle_64 (oidp , NULL , stats -> tx_csum_offloaded , req ));
4236+ }
4237+
4238+ static int
4239+ vtnet_sysctl_tx_tso_offloaded (SYSCTL_HANDLER_ARGS )
4240+ {
4241+ struct vtnet_softc * sc = (struct vtnet_softc * )arg1 ;
4242+ struct vtnet_statistics * stats = & sc -> vtnet_stats ;
4243+ struct vtnet_txq_stats * txst ;
4244+ int i ;
4245+
4246+ stats -> tx_tso_offloaded = 0 ;
4247+ for (i = 0 ; i < sc -> vtnet_max_vq_pairs ; i ++ ) {
4248+ txst = & sc -> vtnet_txqs [i ].vtntx_stats ;
4249+ stats -> tx_tso_offloaded += txst -> vtxs_tso ;
4250+ }
4251+ return (sysctl_handle_64 (oidp , NULL , stats -> tx_tso_offloaded , req ));
4252+ }
4253+
4254+ static int
4255+ vtnet_sysctl_tx_task_rescheduled (SYSCTL_HANDLER_ARGS )
4256+ {
4257+ struct vtnet_softc * sc = (struct vtnet_softc * )arg1 ;
4258+ struct vtnet_statistics * stats = & sc -> vtnet_stats ;
4259+ struct vtnet_txq_stats * txst ;
4260+ int i ;
4261+
4262+ stats -> tx_task_rescheduled = 0 ;
4263+ for (i = 0 ; i < sc -> vtnet_max_vq_pairs ; i ++ ) {
4264+ txst = & sc -> vtnet_txqs [i ].vtntx_stats ;
4265+ stats -> tx_task_rescheduled += txst -> vtxs_rescheduled ;
4266+ }
4267+ return (sysctl_handle_64 (oidp , NULL , stats -> tx_task_rescheduled , req ));
4268+ }
4269+
41734270static void
41744271vtnet_setup_stat_sysctl (struct sysctl_ctx_list * ctx ,
41754272 struct sysctl_oid_list * child , struct vtnet_softc * sc )
@@ -4214,14 +4311,17 @@ vtnet_setup_stat_sysctl(struct sysctl_ctx_list *ctx,
42144311 SYSCTL_ADD_UQUAD (ctx , child , OID_AUTO , "rx_csum_bad_proto" ,
42154312 CTLFLAG_RD , & stats -> rx_csum_bad_proto ,
42164313 "Received checksum offloaded buffer with incorrect protocol" );
4217- SYSCTL_ADD_UQUAD (ctx , child , OID_AUTO , "rx_csum_failed" ,
4218- CTLFLAG_RD , & stats -> rx_csum_failed ,
4314+ SYSCTL_ADD_PROC (ctx , child , OID_AUTO , "rx_csum_failed" ,
4315+ CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_STATS ,
4316+ sc , 0 , vtnet_sysctl_rx_csum_failed , "QU" ,
42194317 "Received buffer checksum offload failed" );
4220- SYSCTL_ADD_UQUAD (ctx , child , OID_AUTO , "rx_csum_offloaded" ,
4221- CTLFLAG_RD , & stats -> rx_csum_offloaded ,
4318+ SYSCTL_ADD_PROC (ctx , child , OID_AUTO , "rx_csum_offloaded" ,
4319+ CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_STATS ,
4320+ sc , 0 , vtnet_sysctl_rx_csum_offloaded , "QU" ,
42224321 "Received buffer checksum offload succeeded" );
4223- SYSCTL_ADD_UQUAD (ctx , child , OID_AUTO , "rx_task_rescheduled" ,
4224- CTLFLAG_RD , & stats -> rx_task_rescheduled ,
4322+ SYSCTL_ADD_PROC (ctx , child , OID_AUTO , "rx_task_rescheduled" ,
4323+ CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_STATS ,
4324+ sc , 0 , vtnet_sysctl_rx_task_rescheduled , "QU" ,
42254325 "Times the receive interrupt task rescheduled itself" );
42264326
42274327 SYSCTL_ADD_UQUAD (ctx , child , OID_AUTO , "tx_csum_unknown_ethtype" ,
@@ -4244,14 +4344,17 @@ vtnet_setup_stat_sysctl(struct sysctl_ctx_list *ctx,
42444344 SYSCTL_ADD_UQUAD (ctx , child , OID_AUTO , "tx_defrag_failed" ,
42454345 CTLFLAG_RD , & stats -> tx_defrag_failed ,
42464346 "Aborted transmit of buffer because defrag failed" );
4247- SYSCTL_ADD_UQUAD (ctx , child , OID_AUTO , "tx_csum_offloaded" ,
4248- CTLFLAG_RD , & stats -> tx_csum_offloaded ,
4347+ SYSCTL_ADD_PROC (ctx , child , OID_AUTO , "tx_csum_offloaded" ,
4348+ CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_STATS ,
4349+ sc , 0 , vtnet_sysctl_tx_csum_offloaded , "QU" ,
42494350 "Offloaded checksum of transmitted buffer" );
4250- SYSCTL_ADD_UQUAD (ctx , child , OID_AUTO , "tx_tso_offloaded" ,
4251- CTLFLAG_RD , & stats -> tx_tso_offloaded ,
4351+ SYSCTL_ADD_PROC (ctx , child , OID_AUTO , "tx_tso_offloaded" ,
4352+ CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_STATS ,
4353+ sc , 0 , vtnet_sysctl_tx_tso_offloaded , "QU" ,
42524354 "Segmentation offload of transmitted buffer" );
4253- SYSCTL_ADD_UQUAD (ctx , child , OID_AUTO , "tx_task_rescheduled" ,
4254- CTLFLAG_RD , & stats -> tx_task_rescheduled ,
4355+ SYSCTL_ADD_PROC (ctx , child , OID_AUTO , "tx_task_rescheduled" ,
4356+ CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_STATS ,
4357+ sc , 0 , vtnet_sysctl_tx_task_rescheduled , "QU" ,
42554358 "Times the transmit interrupt task rescheduled itself" );
42564359}
42574360
0 commit comments