net/sfc: use own logging helper macros
[dpdk.git] / drivers / net / hns3 / hns3_fdir.c
index 26c3117..5c3dd05 100644 (file)
@@ -41,6 +41,8 @@
 #define HNS3_FD_AD_WR_RULE_ID_B        0
 #define HNS3_FD_AD_RULE_ID_S           1
 #define HNS3_FD_AD_RULE_ID_M           GENMASK(13, 1)
+#define HNS3_FD_AD_COUNTER_HIGH_BIT     7
+#define HNS3_FD_AD_COUNTER_HIGH_BIT_B   26
 
 enum HNS3_PORT_TYPE {
        HOST_PORT,
@@ -424,6 +426,9 @@ static int hns3_fd_ad_config(struct hns3_hw *hw, int loc,
                     action->write_rule_id_to_bd);
        hns3_set_field(ad_data, HNS3_FD_AD_RULE_ID_M, HNS3_FD_AD_RULE_ID_S,
                       action->rule_id);
+       /* set extend bit if counter_id is in [128 ~ 255] */
+       if (action->counter_id & BIT(HNS3_FD_AD_COUNTER_HIGH_BIT))
+               hns3_set_bit(ad_data, HNS3_FD_AD_COUNTER_HIGH_BIT_B, 1);
        ad_data <<= HNS3_FD_AD_DATA_S;
        hns3_set_bit(ad_data, HNS3_FD_AD_DROP_B, action->drop_packet);
        hns3_set_bit(ad_data, HNS3_FD_AD_DIRECT_QID_B,
@@ -619,7 +624,7 @@ static void hns3_fd_convert_meta_data(struct hns3_fd_key_cfg *cfg,
                                      uint8_t *key_x, uint8_t *key_y)
 {
        uint16_t meta_data = 0;
-       uint16_t port_number;
+       uint32_t port_number;
        uint8_t cur_pos = 0;
        uint8_t tuple_size;
        uint8_t shift_bits;
@@ -637,7 +642,7 @@ static void hns3_fd_convert_meta_data(struct hns3_fd_key_cfg *cfg,
                                     rule->key_conf.spec.tunnel_type ? 1 : 0);
                        cur_pos += tuple_size;
                } else if (i == VLAN_NUMBER) {
-                       uint8_t vlan_tag;
+                       uint32_t vlan_tag;
                        uint8_t vlan_num;
                        if (rule->key_conf.spec.tunnel_type == 0)
                                vlan_num = rule->key_conf.vlan_num;
@@ -893,7 +898,7 @@ static int hns3_insert_fdir_filter(struct hns3_hw *hw,
        if (ret < 0) {
                rte_spinlock_unlock(&fdir_info->flows_lock);
                hns3_err(hw, "Hash table full? err:%d(%s)!", ret,
-                        strerror(ret));
+                        strerror(-ret));
                return ret;
        }
 
@@ -945,12 +950,12 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns,
                                          false);
                if (ret)
                        hns3_err(hw, "Failed to delete fdir: %d src_ip:%x "
-                                "dst_ip:%x src_port:%d dst_port:%d",
+                                "dst_ip:%x src_port:%d dst_port:%d ret = %d",
                                 rule->location,
                                 rule->key_conf.spec.src_ip[IP_ADDR_KEY_ID],
                                 rule->key_conf.spec.dst_ip[IP_ADDR_KEY_ID],
                                 rule->key_conf.spec.src_port,
-                                rule->key_conf.spec.dst_port);
+                                rule->key_conf.spec.dst_port, ret);
                else
                        hns3_remove_fdir_filter(hw, fdir_info, &rule->key_conf);
 
@@ -986,12 +991,12 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns,
        rte_spinlock_unlock(&fdir_info->flows_lock);
        if (ret) {
                hns3_err(hw, "Failed to config fdir: %d src_ip:%x dst_ip:%x "
-                        "src_port:%d dst_port:%d",
+                        "src_port:%d dst_port:%d ret = %d",
                         rule->location,
                         rule->key_conf.spec.src_ip[IP_ADDR_KEY_ID],
                         rule->key_conf.spec.dst_ip[IP_ADDR_KEY_ID],
                         rule->key_conf.spec.src_port,
-                        rule->key_conf.spec.dst_port);
+                        rule->key_conf.spec.dst_port, ret);
                (void)hns3_remove_fdir_filter(hw, fdir_info, &rule->key_conf);
        }
 
@@ -1023,7 +1028,7 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns)
        }
 
        if (ret) {
-               hns3_err(hw, "Fail to delete FDIR filter!");
+               hns3_err(hw, "Fail to delete FDIR filter, ret = %d", ret);
                ret = -EIO;
        }
        return ret;
@@ -1050,7 +1055,7 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns)
        }
 
        if (err) {
-               hns3_err(hw, "Fail to restore FDIR filter!");
+               hns3_err(hw, "Fail to restore FDIR filter, ret = %d", ret);
                return -EIO;
        }
        return 0;