]> git.baikalelectronics.ru Git - kernel.git/commitdiff
qed*: Fix possible overflow for status block id field.
authorsudarsana.kalluru@cavium.com <sudarsana.kalluru@cavium.com>
Thu, 4 May 2017 15:15:03 +0000 (08:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 May 2017 16:31:02 +0000 (12:31 -0400)
Value for status block id could be more than 256 in 100G mode, need to
update its data type from u8 to u16.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_dev_api.h
drivers/net/ethernet/qlogic/qed/qed_main.c
drivers/net/ethernet/qlogic/qede/qede_ethtool.c
include/linux/qed/qed_if.h

index 5f31140d0b77d3ce0ffb058526e413e2833bead5..5c6874af4b65d52055185e7601a118b310095589 100644 (file)
@@ -3586,7 +3586,7 @@ static int qed_set_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
 }
 
 int qed_set_rxq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
-                        u16 coalesce, u8 qid, u16 sb_id)
+                        u16 coalesce, u16 qid, u16 sb_id)
 {
        struct ustorm_eth_queue_zone eth_qzone;
        u8 timeset, timer_res;
@@ -3607,7 +3607,7 @@ int qed_set_rxq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
        }
        timeset = (u8)(coalesce >> timer_res);
 
-       rc = qed_fw_l2_queue(p_hwfn, (u16)qid, &fw_qid);
+       rc = qed_fw_l2_queue(p_hwfn, qid, &fw_qid);
        if (rc)
                return rc;
 
@@ -3628,7 +3628,7 @@ out:
 }
 
 int qed_set_txq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
-                        u16 coalesce, u8 qid, u16 sb_id)
+                        u16 coalesce, u16 qid, u16 sb_id)
 {
        struct xstorm_eth_queue_zone eth_qzone;
        u8 timeset, timer_res;
@@ -3649,7 +3649,7 @@ int qed_set_txq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
        }
        timeset = (u8)(coalesce >> timer_res);
 
-       rc = qed_fw_l2_queue(p_hwfn, (u16)qid, &fw_qid);
+       rc = qed_fw_l2_queue(p_hwfn, qid, &fw_qid);
        if (rc)
                return rc;
 
index cefe3ee9064a2670c4579f7ec1af3c17861200fe..12d16c096e3654ec3058dc97d81e304a17836569 100644 (file)
@@ -454,7 +454,7 @@ int qed_final_cleanup(struct qed_hwfn *p_hwfn,
  * @return int
  */
 int qed_set_rxq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
-                        u16 coalesce, u8 qid, u16 sb_id);
+                        u16 coalesce, u16 qid, u16 sb_id);
 
 /**
  * @brief qed_set_txq_coalesce - Configure coalesce parameters for a Tx queue
@@ -471,7 +471,7 @@ int qed_set_rxq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
  * @return int
  */
 int qed_set_txq_coalesce(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
-                        u16 coalesce, u8 qid, u16 sb_id);
+                        u16 coalesce, u16 qid, u16 sb_id);
 
 const char *qed_hw_get_resc_name(enum qed_resources res_id);
 #endif
index 59992cf20d42eb1f0245ae5f8446b40ff9a4903c..a5eef1abc5a1ed94b374b0dc7bfb02ef1561f50c 100644 (file)
@@ -1521,7 +1521,7 @@ static void qed_get_coalesce(struct qed_dev *cdev, u16 *rx_coal, u16 *tx_coal)
 }
 
 static int qed_set_coalesce(struct qed_dev *cdev, u16 rx_coal, u16 tx_coal,
-                           u8 qid, u16 sb_id)
+                           u16 qid, u16 sb_id)
 {
        struct qed_hwfn *hwfn;
        struct qed_ptt *ptt;
index 4dcfe9614731db70d673cc15aec6da26ff673743..b22753c5fd44ac43aad64acac1d3486476eacbb7 100644 (file)
@@ -706,8 +706,7 @@ static int qede_set_coalesce(struct net_device *dev,
 {
        struct qede_dev *edev = netdev_priv(dev);
        int i, rc = 0;
-       u16 rxc, txc;
-       u8 sb_id;
+       u16 rxc, txc, sb_id;
 
        if (!netif_running(dev)) {
                DP_INFO(edev, "Interface is down\n");
@@ -729,7 +728,7 @@ static int qede_set_coalesce(struct net_device *dev,
        for_each_queue(i) {
                sb_id = edev->fp_array[i].sb_info->igu_sb_id;
                rc = edev->ops->common->set_coalesce(edev->cdev, rxc, txc,
-                                                    (u8)i, sb_id);
+                                                    (u16)i, sb_id);
                if (rc) {
                        DP_INFO(edev, "Set coalesce error, rc = %d\n", rc);
                        return rc;
index 5544d7b2f2bb257387e6f1eb9d5907e9ce89c08b..c70ac13a97e66e9ded8a81f2716228619f55a98c 100644 (file)
@@ -635,7 +635,7 @@ struct qed_common_ops {
  * @return 0 on success, error otherwise.
  */
        int (*set_coalesce)(struct qed_dev *cdev, u16 rx_coal, u16 tx_coal,
-                           u8 qid, u16 sb_id);
+                           u16 qid, u16 sb_id);
 
 /**
  * @brief set_led - Configure LED mode