]> git.karo-electronics.de Git - linux-beck.git/commitdiff
i40e: Patch to support trusted VF
authorAnjali Singhai Jain <anjali.singhai@intel.com>
Fri, 1 Apr 2016 10:56:07 +0000 (03:56 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 7 Apr 2016 01:31:06 +0000 (18:31 -0700)
This patch adds hook to support changing a VF from not-trusted
to trusted and vice-versa. Fixed the wrappers and function prototype.
Changed the dmesg to reflex the current state better. This patch also
disables turning on/off trusted VF in MFP mode.

Change-ID: Ibcd910935c01f0be1f3fdd6d427230291ee92ebe
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h

index 86abd086ccbd6d9bcacc8e961cb71fa62c3cb8a5..627acf0c5fea4537e7792f961ddaac3e3adf2d36 100644 (file)
@@ -9069,6 +9069,7 @@ static const struct net_device_ops i40e_netdev_ops = {
        .ndo_get_vf_config      = i40e_ndo_get_vf_config,
        .ndo_set_vf_link_state  = i40e_ndo_set_vf_link_state,
        .ndo_set_vf_spoofchk    = i40e_ndo_set_vf_spoofchk,
+       .ndo_set_vf_trust       = i40e_ndo_set_vf_trust,
 #if IS_ENABLED(CONFIG_VXLAN)
        .ndo_add_vxlan_port     = i40e_add_vxlan_port,
        .ndo_del_vxlan_port     = i40e_del_vxlan_port,
index f2a9c14829ca7f4fdd1da0794dde1b046bc11bf7..b3539660f4f122cbba09e476676d53e982b0036c 100644 (file)
@@ -2763,3 +2763,45 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable)
 out:
        return ret;
 }
+
+/**
+ * i40e_ndo_set_vf_trust
+ * @netdev: network interface device structure of the pf
+ * @vf_id: VF identifier
+ * @setting: trust setting
+ *
+ * Enable or disable VF trust setting
+ **/
+int i40e_ndo_set_vf_trust(struct net_device *netdev, int vf_id, bool setting)
+{
+       struct i40e_netdev_priv *np = netdev_priv(netdev);
+       struct i40e_pf *pf = np->vsi->back;
+       struct i40e_vf *vf;
+       int ret = 0;
+
+       /* validate the request */
+       if (vf_id >= pf->num_alloc_vfs) {
+               dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id);
+               return -EINVAL;
+       }
+
+       if (pf->flags & I40E_FLAG_MFP_ENABLED) {
+               dev_err(&pf->pdev->dev, "Trusted VF not supported in MFP mode.\n");
+               return -EINVAL;
+       }
+
+       vf = &pf->vf[vf_id];
+
+       if (!vf)
+               return -EINVAL;
+       if (setting == vf->trusted)
+               goto out;
+
+       vf->trusted = setting;
+       i40e_vc_notify_vf_reset(vf);
+       i40e_reset_vf(vf, false);
+       dev_info(&pf->pdev->dev, "VF %u is now %strusted\n",
+                vf_id, setting ? "" : "un");
+out:
+       return ret;
+}
index e7b2fba0309ee4af95ef247420987ad684eb1d7c..838cbd2299a427c7fce8d954811ab83f282417df 100644 (file)
@@ -88,6 +88,7 @@ struct i40e_vf {
        struct i40e_virtchnl_ether_addr default_fcoe_addr;
        u16 port_vlan_id;
        bool pf_set_mac;        /* The VMM admin set the VF MAC address */
+       bool trusted;
 
        /* VSI indices - actual VSI pointers are maintained in the PF structure
         * When assigned, these will be non-zero, because VSI 0 is always
@@ -127,6 +128,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
                              int vf_id, u16 vlan_id, u8 qos);
 int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
                       int max_tx_rate);
+int i40e_ndo_set_vf_trust(struct net_device *netdev, int vf_id, bool setting);
 int i40e_ndo_get_vf_config(struct net_device *netdev,
                           int vf_id, struct ifla_vf_info *ivi);
 int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link);