@@ -822,7 +822,7 @@ static inline int octep_iq_full_check(struct octep_iq *iq)
822822 if (unlikely (IQ_INSTR_SPACE (iq ) >
823823 OCTEP_WAKE_QUEUE_THRESHOLD )) {
824824 netif_start_subqueue (iq -> netdev , iq -> q_no );
825- iq -> stats . restart_cnt ++ ;
825+ iq -> stats -> restart_cnt ++ ;
826826 return 0 ;
827827 }
828828
@@ -960,7 +960,7 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
960960 wmb ();
961961 /* Ring Doorbell to notify the NIC of new packets */
962962 writel (iq -> fill_cnt , iq -> doorbell_reg );
963- iq -> stats . instr_posted += iq -> fill_cnt ;
963+ iq -> stats -> instr_posted += iq -> fill_cnt ;
964964 iq -> fill_cnt = 0 ;
965965 return NETDEV_TX_OK ;
966966
@@ -991,37 +991,24 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
991991static void octep_get_stats64 (struct net_device * netdev ,
992992 struct rtnl_link_stats64 * stats )
993993{
994- u64 tx_packets , tx_bytes , rx_packets , rx_bytes ;
995994 struct octep_device * oct = netdev_priv (netdev );
995+ u64 tx_packets , tx_bytes , rx_packets , rx_bytes ;
996996 int q ;
997997
998- if (netif_running (netdev ))
999- octep_ctrl_net_get_if_stats (oct ,
1000- OCTEP_CTRL_NET_INVALID_VFID ,
1001- & oct -> iface_rx_stats ,
1002- & oct -> iface_tx_stats );
1003-
1004998 tx_packets = 0 ;
1005999 tx_bytes = 0 ;
10061000 rx_packets = 0 ;
10071001 rx_bytes = 0 ;
1008- for (q = 0 ; q < oct -> num_oqs ; q ++ ) {
1009- struct octep_iq * iq = oct -> iq [q ];
1010- struct octep_oq * oq = oct -> oq [q ];
1011-
1012- tx_packets += iq -> stats .instr_completed ;
1013- tx_bytes += iq -> stats .bytes_sent ;
1014- rx_packets += oq -> stats .packets ;
1015- rx_bytes += oq -> stats .bytes ;
1002+ for (q = 0 ; q < OCTEP_MAX_QUEUES ; q ++ ) {
1003+ tx_packets += oct -> stats_iq [q ].instr_completed ;
1004+ tx_bytes += oct -> stats_iq [q ].bytes_sent ;
1005+ rx_packets += oct -> stats_oq [q ].packets ;
1006+ rx_bytes += oct -> stats_oq [q ].bytes ;
10161007 }
10171008 stats -> tx_packets = tx_packets ;
10181009 stats -> tx_bytes = tx_bytes ;
10191010 stats -> rx_packets = rx_packets ;
10201011 stats -> rx_bytes = rx_bytes ;
1021- stats -> multicast = oct -> iface_rx_stats .mcast_pkts ;
1022- stats -> rx_errors = oct -> iface_rx_stats .err_pkts ;
1023- stats -> collisions = oct -> iface_tx_stats .xscol ;
1024- stats -> tx_fifo_errors = oct -> iface_tx_stats .undflw ;
10251012}
10261013
10271014/**
@@ -1137,6 +1124,43 @@ static int octep_set_features(struct net_device *dev, netdev_features_t features
11371124 return err ;
11381125}
11391126
1127+ static int octep_get_vf_config (struct net_device * dev , int vf ,
1128+ struct ifla_vf_info * ivi )
1129+ {
1130+ struct octep_device * oct = netdev_priv (dev );
1131+
1132+ ivi -> vf = vf ;
1133+ ether_addr_copy (ivi -> mac , oct -> vf_info [vf ].mac_addr );
1134+ ivi -> spoofchk = true;
1135+ ivi -> linkstate = IFLA_VF_LINK_STATE_ENABLE ;
1136+ ivi -> trusted = false;
1137+
1138+ return 0 ;
1139+ }
1140+
1141+ static int octep_set_vf_mac (struct net_device * dev , int vf , u8 * mac )
1142+ {
1143+ struct octep_device * oct = netdev_priv (dev );
1144+ int err ;
1145+
1146+ if (!is_valid_ether_addr (mac )) {
1147+ dev_err (& oct -> pdev -> dev , "Invalid MAC Address %pM\n" , mac );
1148+ return - EADDRNOTAVAIL ;
1149+ }
1150+
1151+ dev_dbg (& oct -> pdev -> dev , "set vf-%d mac to %pM\n" , vf , mac );
1152+ ether_addr_copy (oct -> vf_info [vf ].mac_addr , mac );
1153+ oct -> vf_info [vf ].flags |= OCTEON_PFVF_FLAG_MAC_SET_BY_PF ;
1154+
1155+ err = octep_ctrl_net_set_mac_addr (oct , vf , mac , true);
1156+ if (err )
1157+ dev_err (& oct -> pdev -> dev ,
1158+ "Set VF%d MAC address failed via host control Mbox\n" ,
1159+ vf );
1160+
1161+ return err ;
1162+ }
1163+
11401164static const struct net_device_ops octep_netdev_ops = {
11411165 .ndo_open = octep_open ,
11421166 .ndo_stop = octep_stop ,
@@ -1146,6 +1170,8 @@ static const struct net_device_ops octep_netdev_ops = {
11461170 .ndo_set_mac_address = octep_set_mac ,
11471171 .ndo_change_mtu = octep_change_mtu ,
11481172 .ndo_set_features = octep_set_features ,
1173+ .ndo_get_vf_config = octep_get_vf_config ,
1174+ .ndo_set_vf_mac = octep_set_vf_mac
11491175};
11501176
11511177/**
0 commit comments