net/qede: fix device link structure
authorRasesh Mody <rasesh.mody@cavium.com>
Tue, 7 Nov 2017 08:34:20 +0000 (00:34 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 7 Nov 2017 23:49:59 +0000 (00:49 +0100)
8ea656f8c app/testpmd: request link status interrupt
requires QEDE PMD to populate the device link structure without
having to query the driver for link status change event.
This patch updates the device link structure when link status event is
received.
Remove unused param from qed_link_update()

Fixes: 86a2265e59d7 ("qede: add SRIOV support")
Fixes: ec94dbc57362 ("qede: add base driver")
Cc: stable@dpdk.org
Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
drivers/net/qede/base/bcm_osal.h
drivers/net/qede/base/ecore_mcp.c
drivers/net/qede/qede_ethdev.c
drivers/net/qede/qede_ethdev.h
drivers/net/qede/qede_main.c

index a384b01..52c2f0e 100644 (file)
@@ -30,7 +30,7 @@ enum ecore_mcp_protocol_type;
 union ecore_mcp_protocol_stats;
 enum ecore_hw_err_type;
 
-void qed_link_update(struct ecore_hwfn *hwfn, struct ecore_ptt *ptt);
+void qed_link_update(struct ecore_hwfn *hwfn);
 
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 #undef __BIG_ENDIAN
@@ -338,7 +338,7 @@ u32 qede_find_first_zero_bit(unsigned long *, u32);
 
 #define OSAL_BITMAP_WEIGHT(bitmap, count) 0
 
-#define OSAL_LINK_UPDATE(hwfn, ptt) qed_link_update(hwfn, ptt)
+#define OSAL_LINK_UPDATE(hwfn) qed_link_update(hwfn)
 #define OSAL_TRANSCEIVER_UPDATE(hwfn) nothing
 #define OSAL_DCBX_AEN(hwfn, mib_type) nothing
 
index 3802aa8..8edd2e9 100644 (file)
@@ -1420,7 +1420,7 @@ static void ecore_mcp_handle_link_change(struct ecore_hwfn *p_hwfn,
        if (p_hwfn->mcp_info->capabilities & FW_MB_PARAM_FEATURE_SUPPORT_EEE)
                ecore_mcp_read_eee_config(p_hwfn, p_ptt, p_link);
 
-       OSAL_LINK_UPDATE(p_hwfn, p_ptt);
+       OSAL_LINK_UPDATE(p_hwfn);
 out:
        OSAL_SPIN_UNLOCK(&p_hwfn->mcp_info->link_lock);
 }
index 43562bc..4ef08ad 100644 (file)
@@ -1159,6 +1159,9 @@ static int qede_dev_start(struct rte_eth_dev *eth_dev)
        /* Bring-up the link */
        qede_dev_set_link_state(eth_dev, true);
 
+       /* Update link status */
+       qede_link_update(eth_dev, 0);
+
        /* Start/resume traffic */
        qede_fastpath_start(edev);
 
@@ -1367,7 +1370,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,
 }
 
 /* return 0 means link status changed, -1 means not changed */
-static int
+int
 qede_link_update(struct rte_eth_dev *eth_dev, __rte_unused int wait_to_complete)
 {
        struct qede_dev *qdev = eth_dev->data->dev_private;
@@ -2625,6 +2628,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 
        /* Extract key data structures */
        adapter = eth_dev->data->dev_private;
+       adapter->ethdev = eth_dev;
        edev = &adapter->edev;
        pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
        pci_addr = pci_dev->addr;
index 3212020..6c051c0 100644 (file)
@@ -210,6 +210,7 @@ struct qede_dev {
        struct qede_fdir_info fdir_info;
        bool vlan_strip_flg;
        char drv_ver[QEDE_PMD_DRV_VER_STR_SIZE];
+       void *ethdev;
 };
 
 /* Non-static functions */
@@ -226,6 +227,9 @@ int qed_fill_eth_dev_info(struct ecore_dev *edev,
                                 struct qed_dev_eth_info *info);
 int qede_dev_set_link_state(struct rte_eth_dev *eth_dev, bool link_up);
 
+int qede_link_update(struct rte_eth_dev *eth_dev,
+                    __rte_unused int wait_to_complete);
+
 int qede_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type type,
                         enum rte_filter_op op, void *arg);
 
index a0c9e03..ae18732 100644 (file)
@@ -179,7 +179,7 @@ static void qed_handle_bulletin_change(struct ecore_hwfn *hwfn)
                rte_memcpy(hwfn->hw_info.hw_mac_addr, mac, ETH_ALEN);
 
        /* Always update link configuration according to bulletin */
-       qed_link_update(hwfn, NULL);
+       qed_link_update(hwfn);
 }
 
 static void qede_vf_task(void *arg)
@@ -629,11 +629,12 @@ static int qed_set_link(struct ecore_dev *edev, struct qed_link_params *params)
        return rc;
 }
 
-void qed_link_update(struct ecore_hwfn *hwfn, struct ecore_ptt *ptt)
+void qed_link_update(struct ecore_hwfn *hwfn)
 {
-       struct qed_link_output if_link;
+       struct ecore_dev *edev = hwfn->p_dev;
+       struct qede_dev *qdev = (struct qede_dev *)edev;
 
-       qed_fill_link(hwfn, ptt, &if_link);
+       qede_link_update((struct rte_eth_dev *)qdev->ethdev, 0);
 }
 
 static int qed_drain(struct ecore_dev *edev)