@@ -8960,6 +8960,44 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb,
return features;
}
+#ifdef CONFIG_NETPOLICY
+
+#define NET_POLICY_NOT_SUPPORT -2
+#define NET_POLICY_END -3
+static int policy_param[NET_POLICY_MAX + 1][2] = {
+ /* rx-usec, tx-usec */
+ {0, 0},
+
+ {NET_POLICY_END, NET_POLICY_END},
+};
+
+/**
+ * i40e_ndo_netpolicy_init
+ * @dev: the net device pointer
+ * @info: netpolicy info which need to be updated
+ *
+ * Init and update available policy on i40e driver
+ * Returns 0 on success, negative on failure
+ */
+static int i40e_ndo_netpolicy_init(struct net_device *dev,
+ struct netpolicy_info *info)
+{
+ int i;
+
+ for (i = 0; i < NET_POLICY_MAX; i++) {
+ if ((policy_param[i][0] == NET_POLICY_END) &&
+ (policy_param[i][1] == NET_POLICY_END))
+ break;
+
+ if ((policy_param[i][0] != NET_POLICY_NOT_SUPPORT) &&
+ (policy_param[i][1] != NET_POLICY_NOT_SUPPORT))
+ set_bit(i, info->avail_policy);
+ }
+
+ return 0;
+}
+#endif /* CONFIG_NETPOLICY */
+
static const struct net_device_ops i40e_netdev_ops = {
.ndo_open = i40e_open,
.ndo_stop = i40e_close,
@@ -8996,6 +9034,9 @@ static const struct net_device_ops i40e_netdev_ops = {
.ndo_features_check = i40e_features_check,
.ndo_bridge_getlink = i40e_ndo_bridge_getlink,
.ndo_bridge_setlink = i40e_ndo_bridge_setlink,
+#ifdef CONFIG_NETPOLICY
+ .ndo_netpolicy_init = i40e_ndo_netpolicy_init,
+#endif /* CONFIG_NETPOLICY */
};
/**