net: add rte prefix to ether structures
[dpdk.git] / drivers / net / i40e / rte_pmd_i40e.c
index 921dfc0..8e56255 100644 (file)
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2017 Intel Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_tailq.h>
 
@@ -338,7 +339,7 @@ i40e_vsi_set_tx_loopback(struct i40e_vsi *vsi, uint8_t on)
        hw = I40E_VSI_TO_HW(vsi);
 
        /* Use the FW API if FW >= v5.0 */
-       if (hw->aq.fw_maj_ver < 5) {
+       if (hw->aq.fw_maj_ver < 5 && hw->mac.type != I40E_MAC_X722) {
                PMD_INIT_LOG(ERR, "FW < v5.0, cannot enable loopback");
                return -ENOTSUP;
        }
@@ -528,7 +529,7 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on)
 
 int
 rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,
-                            struct ether_addr *mac_addr)
+                            struct rte_ether_addr *mac_addr)
 {
        struct i40e_mac_filter *f;
        struct rte_eth_dev *dev;
@@ -570,11 +571,11 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,
        return 0;
 }
 
-static const struct ether_addr null_mac_addr;
+static const struct rte_ether_addr null_mac_addr;
 
 int
 rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id,
-       struct ether_addr *mac_addr)
+       struct rte_ether_addr *mac_addr)
 {
        struct rte_eth_dev *dev;
        struct i40e_pf_vf *vf;
@@ -723,7 +724,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id,
        struct i40e_vsi *vsi;
        struct i40e_hw *hw;
        struct i40e_mac_filter_info filter;
-       struct ether_addr broadcast = {
+       struct rte_ether_addr broadcast = {
                .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} };
        int ret;
 
@@ -1709,6 +1710,7 @@ rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
                                PMD_DRV_LOG(ERR, "Profile of group 0 already exists.");
                        else if (is_exist == 3)
                                PMD_DRV_LOG(ERR, "Profile of different group already exists");
+                       i40e_update_customized_info(dev, buff, size, op);
                        rte_free(profile_info_sec);
                        return -EEXIST;
                }
@@ -1982,8 +1984,8 @@ int rte_pmd_i40e_get_ddp_info(uint8_t *pkg_buff, uint32_t pkg_size,
                tlv = (struct i40e_profile_tlv_section_record *)&proto[1];
                for (i = j = 0; i < nb_rec; j++) {
                        pinfo[j].proto_id = tlv->data[0];
-                       snprintf(pinfo[j].name, I40E_DDP_NAME_SIZE, "%s",
-                                (const char *)&tlv->data[1]);
+                       strlcpy(pinfo[j].name, (const char *)&tlv->data[1],
+                               I40E_DDP_NAME_SIZE);
                        i += tlv->len;
                        tlv = &tlv[tlv->len];
                }
@@ -2353,7 +2355,7 @@ int rte_pmd_i40e_ptype_mapping_replace(uint16_t port,
 
 int
 rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id,
-                            struct ether_addr *mac_addr)
+                            struct rte_ether_addr *mac_addr)
 {
        struct rte_eth_dev *dev;
        struct i40e_pf_vf *vf;
@@ -2490,10 +2492,11 @@ rte_pmd_i40e_flow_type_mapping_update(
 }
 
 int
-rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct ether_addr *vf_mac)
+rte_pmd_i40e_query_vfid_by_mac(uint16_t port,
+                       const struct rte_ether_addr *vf_mac)
 {
        struct rte_eth_dev *dev;
-       struct ether_addr *mac;
+       struct rte_ether_addr *mac;
        struct i40e_pf *pf;
        int vf_id;
        struct i40e_pf_vf *vf;
@@ -2817,13 +2820,23 @@ i40e_queue_region_dcb_configure(struct i40e_hw *hw,
        struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
        int32_t ret = -EINVAL;
        uint16_t i, j, prio_index, region_index;
-       uint8_t tc_map, tc_bw, bw_lf;
+       uint8_t tc_map, tc_bw, bw_lf, dcb_flag = 0;
 
        if (!info->queue_region_number) {
                PMD_DRV_LOG(ERR, "No queue region been set before");
                return ret;
        }
 
+       for (i = 0; i < info->queue_region_number; i++) {
+               if (info->region[i].user_priority_num) {
+                       dcb_flag = 1;
+                       break;
+               }
+       }
+
+       if (dcb_flag == 0)
+               return 0;
+
        dcb_cfg = &dcb_cfg_local;
        memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));