@@ -53,6 +53,7 @@ static ssize_t i40e_dbg_command_read(struct file *filp, char __user *buffer,
5353 size_t count , loff_t * ppos )
5454{
5555 struct i40e_pf * pf = filp -> private_data ;
56+ struct i40e_vsi * main_vsi ;
5657 int bytes_not_copied ;
5758 int buf_size = 256 ;
5859 char * buf ;
@@ -68,8 +69,8 @@ static ssize_t i40e_dbg_command_read(struct file *filp, char __user *buffer,
6869 if (!buf )
6970 return - ENOSPC ;
7071
71- len = snprintf ( buf , buf_size , "%s: %s\n" ,
72- pf -> vsi [ pf -> lan_vsi ] -> netdev -> name ,
72+ main_vsi = i40e_pf_get_main_vsi ( pf );
73+ len = snprintf ( buf , buf_size , "%s: %s\n" , main_vsi -> netdev -> name ,
7374 i40e_dbg_command_buf );
7475
7576 bytes_not_copied = copy_to_user (buffer , buf , len );
@@ -786,7 +787,8 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
786787 cnt = sscanf (& cmd_buf [7 ], "%i" , & vsi_seid );
787788 if (cnt == 0 ) {
788789 /* default to PF VSI */
789- vsi_seid = pf -> vsi [pf -> lan_vsi ]-> seid ;
790+ vsi = i40e_pf_get_main_vsi (pf );
791+ vsi_seid = vsi -> seid ;
790792 } else if (vsi_seid < 0 ) {
791793 dev_info (& pf -> pdev -> dev , "add VSI %d: bad vsi seid\n" ,
792794 vsi_seid );
@@ -1030,7 +1032,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
10301032 goto command_write_done ;
10311033 }
10321034
1033- vsi = pf -> vsi [ pf -> lan_vsi ] ;
1035+ vsi = i40e_pf_get_main_vsi ( pf ) ;
10341036 switch_id =
10351037 le16_to_cpu (vsi -> info .switch_id ) &
10361038 I40E_AQ_VSI_SW_ID_MASK ;
@@ -1380,6 +1382,9 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
13801382 dev_info (& pf -> pdev -> dev , "FD current total filter count for this interface: %d\n" ,
13811383 i40e_get_current_fd_count (pf ));
13821384 } else if (strncmp (cmd_buf , "lldp" , 4 ) == 0 ) {
1385+ /* Get main VSI */
1386+ struct i40e_vsi * main_vsi = i40e_pf_get_main_vsi (pf );
1387+
13831388 if (strncmp (& cmd_buf [5 ], "stop" , 4 ) == 0 ) {
13841389 int ret ;
13851390
@@ -1391,10 +1396,9 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
13911396 goto command_write_done ;
13921397 }
13931398 ret = i40e_aq_add_rem_control_packet_filter (& pf -> hw ,
1394- pf -> hw .mac .addr ,
1395- ETH_P_LLDP , 0 ,
1396- pf -> vsi [pf -> lan_vsi ]-> seid ,
1397- 0 , true, NULL , NULL );
1399+ pf -> hw .mac .addr , ETH_P_LLDP , 0 ,
1400+ main_vsi -> seid , 0 , true, NULL ,
1401+ NULL );
13981402 if (ret ) {
13991403 dev_info (& pf -> pdev -> dev ,
14001404 "%s: Add Control Packet Filter AQ command failed =0x%x\n" ,
@@ -1409,10 +1413,9 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
14091413 int ret ;
14101414
14111415 ret = i40e_aq_add_rem_control_packet_filter (& pf -> hw ,
1412- pf -> hw .mac .addr ,
1413- ETH_P_LLDP , 0 ,
1414- pf -> vsi [pf -> lan_vsi ]-> seid ,
1415- 0 , false, NULL , NULL );
1416+ pf -> hw .mac .addr , ETH_P_LLDP , 0 ,
1417+ main_vsi -> seid , 0 , false, NULL ,
1418+ NULL );
14161419 if (ret ) {
14171420 dev_info (& pf -> pdev -> dev ,
14181421 "%s: Remove Control Packet Filter AQ command failed =0x%x\n" ,
@@ -1639,6 +1642,7 @@ static ssize_t i40e_dbg_netdev_ops_read(struct file *filp, char __user *buffer,
16391642 size_t count , loff_t * ppos )
16401643{
16411644 struct i40e_pf * pf = filp -> private_data ;
1645+ struct i40e_vsi * main_vsi ;
16421646 int bytes_not_copied ;
16431647 int buf_size = 256 ;
16441648 char * buf ;
@@ -1654,8 +1658,8 @@ static ssize_t i40e_dbg_netdev_ops_read(struct file *filp, char __user *buffer,
16541658 if (!buf )
16551659 return - ENOSPC ;
16561660
1657- len = snprintf ( buf , buf_size , "%s: %s\n" ,
1658- pf -> vsi [ pf -> lan_vsi ] -> netdev -> name ,
1661+ main_vsi = i40e_pf_get_main_vsi ( pf );
1662+ len = snprintf ( buf , buf_size , "%s: %s\n" , main_vsi -> netdev -> name ,
16591663 i40e_dbg_netdev_ops_buf );
16601664
16611665 bytes_not_copied = copy_to_user (buffer , buf , len );
0 commit comments