net/hns3: replace max private macro
[dpdk.git] / drivers / net / hns3 / hns3_fdir.c
index 4c5928f..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;
        }