net/ice/base: add some helper macros
[dpdk.git] / drivers / net / ice / ice_ethdev.c
index 5fb70ee..b145d9c 100644 (file)
@@ -112,6 +112,8 @@ static const struct eth_dev_ops ice_eth_dev_ops = {
        .get_eeprom_length            = ice_get_eeprom_length,
        .get_eeprom                   = ice_get_eeprom,
        .rx_queue_count               = ice_rx_queue_count,
+       .rx_descriptor_status         = ice_rx_descriptor_status,
+       .tx_descriptor_status         = ice_tx_descriptor_status,
        .stats_get                    = ice_stats_get,
        .stats_reset                  = ice_stats_reset,
        .xstats_get                   = ice_xstats_get,
@@ -2181,14 +2183,20 @@ ice_vsi_config_vlan_filter(struct ice_vsi *vsi, bool on)
        if (ret) {
                PMD_DRV_LOG(INFO, "Update VSI failed to %s vlan rx pruning",
                            on ? "enable" : "disable");
-               ret = -EINVAL;
+               return -EINVAL;
        } else {
                vsi->info.valid_sections |=
                        rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID |
                                         ICE_AQ_VSI_PROP_SECURITY_VALID);
        }
 
-       return ret;
+       /* consist with other drivers, allow untagged packet when vlan filter on */
+       if (on)
+               ret = ice_add_vlan_filter(vsi, 0);
+       else
+               ret = ice_remove_vlan_filter(vsi, 0);
+
+       return 0;
 }
 
 static int
@@ -2588,11 +2596,22 @@ static int
 ice_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 {
        struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       u32 full_ver;
+       u8 ver, patch;
+       u16 build;
        int ret;
 
-       ret = snprintf(fw_version, fw_size, "%d.%d.%05d %d.%d",
-                      hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build,
-                      hw->api_maj_ver, hw->api_min_ver);
+       full_ver = hw->nvm.oem_ver;
+       ver = (u8)(full_ver >> 24);
+       build = (u16)((full_ver >> 8) & 0xffff);
+       patch = (u8)(full_ver & 0xff);
+
+       ret = snprintf(fw_version, fw_size,
+                       "%d.%d%d 0x%08x %d.%d.%d",
+                       ((hw->nvm.ver >> 12) & 0xf),
+                       ((hw->nvm.ver >> 4) & 0xff),
+                       (hw->nvm.ver & 0xf), hw->nvm.eetrack,
+                       ver, build, patch);
 
        /* add the size of '\0' */
        ret += 1;