@@ -921,7 +921,7 @@ static void mana_pf_deregister_filter(struct mana_port_context *apc)
921921
922922static int mana_query_device_cfg (struct mana_context * ac , u32 proto_major_ver ,
923923 u32 proto_minor_ver , u32 proto_micro_ver ,
924- u16 * max_num_vports )
924+ u16 * max_num_vports , u8 * bm_hostmode )
925925{
926926 struct gdma_context * gc = ac -> gdma_dev -> gdma_context ;
927927 struct mana_query_device_cfg_resp resp = {};
@@ -932,7 +932,7 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
932932 mana_gd_init_req_hdr (& req .hdr , MANA_QUERY_DEV_CONFIG ,
933933 sizeof (req ), sizeof (resp ));
934934
935- req .hdr .resp .msg_version = GDMA_MESSAGE_V2 ;
935+ req .hdr .resp .msg_version = GDMA_MESSAGE_V3 ;
936936
937937 req .proto_major_ver = proto_major_ver ;
938938 req .proto_minor_ver = proto_minor_ver ;
@@ -956,11 +956,16 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
956956
957957 * max_num_vports = resp .max_num_vports ;
958958
959- if (resp .hdr .response .msg_version = = GDMA_MESSAGE_V2 )
959+ if (resp .hdr .response .msg_version > = GDMA_MESSAGE_V2 )
960960 gc -> adapter_mtu = resp .adapter_mtu ;
961961 else
962962 gc -> adapter_mtu = ETH_FRAME_LEN ;
963963
964+ if (resp .hdr .response .msg_version >= GDMA_MESSAGE_V3 )
965+ * bm_hostmode = resp .bm_hostmode ;
966+ else
967+ * bm_hostmode = 0 ;
968+
964969 debugfs_create_u16 ("adapter-MTU" , 0400 , gc -> mana_pci_debugfs , & gc -> adapter_mtu );
965970
966971 return 0 ;
@@ -2441,7 +2446,7 @@ static void mana_destroy_vport(struct mana_port_context *apc)
24412446 mana_destroy_txq (apc );
24422447 mana_uncfg_vport (apc );
24432448
2444- if (gd -> gdma_context -> is_pf )
2449+ if (gd -> gdma_context -> is_pf && ! apc -> ac -> bm_hostmode )
24452450 mana_pf_deregister_hw_vport (apc );
24462451}
24472452
@@ -2453,7 +2458,7 @@ static int mana_create_vport(struct mana_port_context *apc,
24532458
24542459 apc -> default_rxobj = INVALID_MANA_HANDLE ;
24552460
2456- if (gd -> gdma_context -> is_pf ) {
2461+ if (gd -> gdma_context -> is_pf && ! apc -> ac -> bm_hostmode ) {
24572462 err = mana_pf_register_hw_vport (apc );
24582463 if (err )
24592464 return err ;
@@ -2689,7 +2694,7 @@ int mana_alloc_queues(struct net_device *ndev)
26892694 goto destroy_vport ;
26902695 }
26912696
2692- if (gd -> gdma_context -> is_pf ) {
2697+ if (gd -> gdma_context -> is_pf && ! apc -> ac -> bm_hostmode ) {
26932698 err = mana_pf_register_filter (apc );
26942699 if (err )
26952700 goto destroy_vport ;
@@ -2751,7 +2756,7 @@ static int mana_dealloc_queues(struct net_device *ndev)
27512756
27522757 mana_chn_setxdp (apc , NULL );
27532758
2754- if (gd -> gdma_context -> is_pf )
2759+ if (gd -> gdma_context -> is_pf && ! apc -> ac -> bm_hostmode )
27552760 mana_pf_deregister_filter (apc );
27562761
27572762 /* No packet can be transmitted now since apc->port_is_up is false.
@@ -2998,6 +3003,7 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
29983003 struct gdma_context * gc = gd -> gdma_context ;
29993004 struct mana_context * ac = gd -> driver_data ;
30003005 struct device * dev = gc -> dev ;
3006+ u8 bm_hostmode = 0 ;
30013007 u16 num_ports = 0 ;
30023008 int err ;
30033009 int i ;
@@ -3026,10 +3032,12 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
30263032 }
30273033
30283034 err = mana_query_device_cfg (ac , MANA_MAJOR_VERSION , MANA_MINOR_VERSION ,
3029- MANA_MICRO_VERSION , & num_ports );
3035+ MANA_MICRO_VERSION , & num_ports , & bm_hostmode );
30303036 if (err )
30313037 goto out ;
30323038
3039+ ac -> bm_hostmode = bm_hostmode ;
3040+
30333041 if (!resuming ) {
30343042 ac -> num_ports = num_ports ;
30353043 } else {
0 commit comments