@@ -602,7 +602,7 @@ static inline int ans_send_burst(struct ans_lcore_queue *qconf, uint16_t n, uint
602
602
ret = rte_eth_tx_burst (port , queueid , m_table , n );
603
603
if (unlikely (ret < n ))
604
604
{
605
- ans_packet_stats (port , n - ret );
605
+ ans_eth_stats (port , n - ret );
606
606
607
607
do
608
608
{
@@ -624,7 +624,7 @@ static inline int ans_send_burst(struct ans_lcore_queue *qconf, uint16_t n, uint
624
624
*@return values:
625
625
*
626
626
**********************************************************************/
627
- static inline int ans_send_single_packet ( struct rte_mbuf * m , uint8_t port )
627
+ static inline int ans_send_packet ( uint8_t port , struct rte_mbuf * m )
628
628
{
629
629
uint32_t lcore_id ;
630
630
uint16_t len ;
@@ -659,11 +659,21 @@ static inline int ans_send_single_packet(struct rte_mbuf *m, uint8_t port)
659
659
*@return values:
660
660
*
661
661
**********************************************************************/
662
- static void ans_init_timer ( )
662
+ static inline int ans_bypass_packet ( uint8_t port_id , struct rte_mbuf * m )
663
663
{
664
- /* init RTE timer library */
665
- rte_timer_subsystem_init ();
666
- return ;
664
+ int ret = 0 ;
665
+
666
+ if (ans_user_conf .kni_on != 1 )
667
+ {
668
+ rte_pktmbuf_free (m );
669
+ return 0 ;
670
+ }
671
+
672
+ ret = ans_kni_send_burst (& m , 1 , port_id );
673
+ if (ret != 0 )
674
+ rte_pktmbuf_free (m );
675
+
676
+ return 0 ;
667
677
}
668
678
669
679
/**********************************************************************
@@ -677,20 +687,10 @@ static void ans_init_timer()
677
687
*@return values:
678
688
*
679
689
**********************************************************************/
680
- static inline void ans_to_linux ( unsigned port_id , struct rte_mbuf * m )
690
+ static void ans_init_timer ( )
681
691
{
682
- int ret = 0 ;
683
-
684
- if (ans_user_conf .kni_on != 1 )
685
- {
686
- rte_pktmbuf_free (m );
687
- return ;
688
- }
689
-
690
- ret = ans_kni_send_burst (& m , 1 , port_id );
691
- if (ret != 0 )
692
- rte_pktmbuf_free (m );
693
-
692
+ /* init RTE timer library */
693
+ rte_timer_subsystem_init ();
694
694
return ;
695
695
}
696
696
@@ -707,7 +707,6 @@ static inline void ans_to_linux(unsigned port_id, struct rte_mbuf *m)
707
707
**********************************************************************/
708
708
static int ans_main_loop (__attribute__((unused )) void * dummy )
709
709
{
710
- int ret ;
711
710
unsigned nb_ports ;
712
711
int i , j , nb_rx ;
713
712
unsigned lcore_id ;
@@ -802,38 +801,8 @@ static int ans_main_loop(__attribute__((unused)) void *dummy)
802
801
if (nb_rx == 0 )
803
802
continue ;
804
803
805
- /* Prefetch first packets */
806
- for (j = 0 ; j < PREFETCH_OFFSET && j < nb_rx ; j ++ )
807
- {
808
- rte_prefetch0 (rte_pktmbuf_mtod (pkts_burst [j ], void * ));
809
- }
810
-
811
- /* Prefetch and forward already prefetched packets */
812
- for (j = 0 ; j < (nb_rx - PREFETCH_OFFSET ); j ++ )
813
- {
814
- rte_prefetch0 (rte_pktmbuf_mtod (pkts_burst [j + PREFETCH_OFFSET ], void * ));
815
-
816
- /* add by ans_team ---start */
817
-
818
- ret = ans_packet_handle (pkts_burst [j ], portid );
819
- if (ret == ANS_MBUF_CONTINUE )
820
- ans_to_linux (portid , pkts_burst [j ]);
821
-
822
- /* add by ans_team ---end */
823
- }
824
-
825
- /* Forward remaining prefetched packets */
826
- for (; j < nb_rx ; j ++ )
827
- {
828
-
829
- /* add by ans_team ---start */
830
-
831
- ret = ans_packet_handle (pkts_burst [j ], portid );
832
- if (ret == ANS_MBUF_CONTINUE )
833
- ans_to_linux (portid , pkts_burst [j ]);
834
-
835
- /* add by ans_team ---end */
836
- }
804
+ ans_eth_rx_burst (portid , pkts_burst , nb_rx );
805
+
837
806
}
838
807
839
808
/* to support KNI, at 2014-12-15 */
@@ -935,20 +904,21 @@ int main(int argc, char **argv)
935
904
printf ("\ncore mask: %x, sockets number:%d, lcore number:%d \n" , ans_user_conf .lcore_mask , ans_user_conf .socket_nb , ans_user_conf .lcore_nb );
936
905
937
906
printf ("start to init ans \n" );
938
- init_conf .max_sock_conn = ans_user_conf .lcore_nb * 128 * 1024 ;
907
+ init_conf .sock_nb = ans_user_conf .lcore_nb * 128 * 1024 ;
939
908
940
909
init_conf .lcore_mask = ans_user_conf .lcore_mask ;
941
910
for (i = 0 ; i < MAX_NB_SOCKETS ; i ++ )
942
911
{
943
912
init_conf .pktmbuf_pool [i ] = ans_pktmbuf_pool [i ];
944
913
}
945
914
915
+ init_conf .port_send = ans_send_packet ;
916
+ init_conf .port_bypass = ans_bypass_packet ;
917
+
946
918
ret = ans_initialize (& init_conf );
947
919
if (ret != 0 )
948
920
rte_exit (EXIT_FAILURE , "Init ans failed \n" );
949
921
950
-
951
- ans_register (ans_send_single_packet );
952
922
/* add by ans_team ---end */
953
923
954
924
/* add by ans_team for testing ---start */
0 commit comments