qed*: Tx-switching configuration
authorYuval Mintz <Yuval.Mintz@qlogic.com>
Wed, 11 May 2016 13:36:25 +0000 (16:36 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 May 2016 04:04:08 +0000 (00:04 -0400)
Device should be configured by default to VEB once VFs are active.
This changes the configuration of both PFs' and VFs' vports into enabling
tx-switching once sriov is enabled.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_l2.c
drivers/net/ethernet/qlogic/qed/qed_l2.h
drivers/net/ethernet/qlogic/qed/qed_main.c
drivers/net/ethernet/qlogic/qed/qed_sp.h
drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
drivers/net/ethernet/qlogic/qed/qed_sriov.c
drivers/net/ethernet/qlogic/qed/qed_vf.c
drivers/net/ethernet/qlogic/qede/qede_main.c
include/linux/qed/qed_eth_if.h
include/linux/qed/qed_if.h

index acaa2866dae35e7bf1ff3469427e0caadb045f36..6fb6016409c6bbd33a60f18575a08d7ae5607124 100644 (file)
@@ -688,7 +688,8 @@ static int qed_hw_init_pf(struct qed_hwfn *p_hwfn,
                qed_int_igu_enable(p_hwfn, p_ptt, int_mode);
 
                /* send function start command */
-               rc = qed_sp_pf_start(p_hwfn, p_tunn, p_hwfn->cdev->mf_mode);
+               rc = qed_sp_pf_start(p_hwfn, p_tunn, p_hwfn->cdev->mf_mode,
+                                    allow_npar_tx_switch);
                if (rc)
                        DP_NOTICE(p_hwfn, "Function start ramrod failed\n");
        }
index e0275a78b121e002c410a05aa44215263c8879ad..8fba87dd48afaf6ce9ce756bdb24112e7d921176 100644 (file)
@@ -99,6 +99,8 @@ int qed_sp_eth_vport_start(struct qed_hwfn *p_hwfn,
                break;
        }
 
+       p_ramrod->tx_switching_en = p_params->tx_switching;
+
        /* Software Function ID in hwfn (PFs are 0 - 15, VFs are 16 - 135) */
        p_ramrod->sw_fid = qed_concrete_to_sw_fid(p_hwfn->cdev,
                                                  p_params->concrete_fid);
@@ -1792,6 +1794,8 @@ static int qed_update_vport(struct qed_dev *cdev,
                params->update_vport_active_flg;
        sp_params.vport_active_rx_flg = params->vport_active_flg;
        sp_params.vport_active_tx_flg = params->vport_active_flg;
+       sp_params.update_tx_switching_flg = params->update_tx_switching_flg;
+       sp_params.tx_switching_flg = params->tx_switching_flg;
        sp_params.accept_any_vlan = params->accept_any_vlan;
        sp_params.update_accept_any_vlan_flg =
                params->update_accept_any_vlan_flg;
index a04fb7f061eaa70691873dc9bb5a70a2ada4663b..0021145434511f445c8c973d8df963fe29fc9f35 100644 (file)
@@ -94,6 +94,7 @@ enum qed_tpa_mode {
 struct qed_sp_vport_start_params {
        enum qed_tpa_mode tpa_mode;
        bool remove_inner_vlan;
+       bool tx_switching;
        bool only_untagged;
        bool drop_ttl0;
        u8 max_buffers_per_cqe;
index dcb782c14e5cb4620843bd0125e4fbc87603b624..6ffc21da14156e8ebc8bbbc1d1a1f45f84868b1b 100644 (file)
@@ -216,6 +216,7 @@ int qed_fill_dev_info(struct qed_dev *cdev,
                dev_info->fw_rev = FW_REVISION_VERSION;
                dev_info->fw_eng = FW_ENGINEERING_VERSION;
                dev_info->mf_mode = cdev->mf_mode;
+               dev_info->tx_switching = true;
        } else {
                qed_vf_get_fw_version(&cdev->hwfns[0], &dev_info->fw_major,
                                      &dev_info->fw_minor, &dev_info->fw_rev,
index c2999cb5d1e28e46608e079a18c980a8129795cb..ab5549f4e5ea2567ed027a0a6b68f42804aeb1dd 100644 (file)
@@ -344,13 +344,14 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn,
  * @param p_hwfn
  * @param p_tunn
  * @param mode
+ * @param allow_npar_tx_switch
  *
  * @return int
  */
 
 int qed_sp_pf_start(struct qed_hwfn *p_hwfn,
                    struct qed_tunn_start_params *p_tunn,
-                   enum qed_mf_mode mode);
+                   enum qed_mf_mode mode, bool allow_npar_tx_switch);
 
 /**
  * @brief qed_sp_pf_stop - PF Function Stop Ramrod
index ed90947c451db155cddeb21d8f1191610e530177..8c555ed1f949a87841e45f822de8f5606ec7e8aa 100644 (file)
@@ -299,7 +299,7 @@ qed_tunn_set_pf_start_params(struct qed_hwfn *p_hwfn,
 
 int qed_sp_pf_start(struct qed_hwfn *p_hwfn,
                    struct qed_tunn_start_params *p_tunn,
-                   enum qed_mf_mode mode)
+                   enum qed_mf_mode mode, bool allow_npar_tx_switch)
 {
        struct pf_start_ramrod_data *p_ramrod = NULL;
        u16 sb = qed_int_get_sp_sb_id(p_hwfn);
@@ -358,6 +358,9 @@ int qed_sp_pf_start(struct qed_hwfn *p_hwfn,
                                     &p_ramrod->tunnel_config);
        p_hwfn->hw_info.personality = PERSONALITY_ETH;
 
+       if (IS_MF_SI(p_hwfn))
+               p_ramrod->allow_npar_tx_switching = allow_npar_tx_switch;
+
        if (p_hwfn->cdev->p_iov_info) {
                struct qed_hw_sriov_info *p_iov = p_hwfn->cdev->p_iov_info;
 
index 6af8fd9fd560b376629ce6a9304b33bfb609e559..d4df406ac0a46c0e57aca5d58228e654aecee72a 100644 (file)
@@ -1490,6 +1490,7 @@ static void qed_iov_vf_mbx_start_vport(struct qed_hwfn *p_hwfn,
 
        params.tpa_mode = start->tpa_mode;
        params.remove_inner_vlan = start->inner_vlan_removal;
+       params.tx_switching = true;
 
        params.only_untagged = vf_info->bulletin.p_virt->default_only_untagged;
        params.drop_ttl0 = false;
index db14e230c9a496134b414451576392d8e626b99a..72e69c0ec10d0444f9735b99d4753b35df9b8877 100644 (file)
@@ -633,6 +633,18 @@ int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
                }
        }
 
+       if (p_params->update_tx_switching_flg) {
+               struct vfpf_vport_update_tx_switch_tlv *p_tx_switch_tlv;
+
+               size = sizeof(struct vfpf_vport_update_tx_switch_tlv);
+               tlv = CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH;
+               p_tx_switch_tlv = qed_add_tlv(p_hwfn, &p_iov->offset,
+                                             tlv, size);
+               resp_size += sizeof(struct pfvf_def_resp_tlv);
+
+               p_tx_switch_tlv->tx_switching = p_params->tx_switching_flg;
+       }
+
        if (p_params->update_approx_mcast_flg) {
                struct vfpf_vport_update_mcast_bin_tlv *p_mcast_tlv;
 
index 7130ee7f87da9a50decb576934d561a7dda3e7e8..8114541f327cfe5ecd7e9b7629c593f886db835f 100644 (file)
@@ -137,10 +137,26 @@ static int qede_set_vf_mac(struct net_device *ndev, int vfidx, u8 *mac)
 static int qede_sriov_configure(struct pci_dev *pdev, int num_vfs_param)
 {
        struct qede_dev *edev = netdev_priv(pci_get_drvdata(pdev));
+       struct qed_dev_info *qed_info = &edev->dev_info.common;
+       int rc;
 
        DP_VERBOSE(edev, QED_MSG_IOV, "Requested %d VFs\n", num_vfs_param);
 
-       return edev->ops->iov->configure(edev->cdev, num_vfs_param);
+       rc = edev->ops->iov->configure(edev->cdev, num_vfs_param);
+
+       /* Enable/Disable Tx switching for PF */
+       if ((rc == num_vfs_param) && netif_running(edev->ndev) &&
+           qed_info->mf_mode != QED_MF_NPAR && qed_info->tx_switching) {
+               struct qed_update_vport_params params;
+
+               memset(&params, 0, sizeof(params));
+               params.vport_id = 0;
+               params.update_tx_switching_flg = 1;
+               params.tx_switching_flg = num_vfs_param ? 1 : 0;
+               edev->ops->vport_update(edev->cdev, &params);
+       }
+
+       return rc;
 }
 #endif
 
@@ -3291,6 +3307,12 @@ static int qede_start_queues(struct qede_dev *edev)
        vport_update_params.update_vport_active_flg = 1;
        vport_update_params.vport_active_flg = 1;
 
+       if ((qed_info->mf_mode == QED_MF_NPAR || pci_num_vf(edev->pdev)) &&
+           qed_info->tx_switching) {
+               vport_update_params.update_tx_switching_flg = 1;
+               vport_update_params.tx_switching_flg = 1;
+       }
+
        /* Fill struct with RSS params */
        if (QEDE_RSS_CNT(edev) > 1) {
                vport_update_params.update_rss_flg = 1;
index e0f6e6482031e366c8f4f096dd52e3af93d20dd1..6ae8cb4a61d39969283a382076c8cf261a77bfa6 100644 (file)
@@ -35,6 +35,8 @@ struct qed_update_vport_params {
        u8 vport_id;
        u8 update_vport_active_flg;
        u8 vport_active_flg;
+       u8 update_tx_switching_flg;
+       u8 tx_switching_flg;
        u8 update_accept_any_vlan_flg;
        u8 accept_any_vlan;
        u8 update_rss_flg;
index 76a6f168a19086e10da74c9d8c890b543d4f6a8c..0fd8f247e65f8e7831fe54e3d7307c8cd76f811e 100644 (file)
@@ -93,6 +93,7 @@ struct qed_dev_info {
 
        u32             flash_size;
        u8              mf_mode;
+       bool            tx_switching;
 };
 
 enum qed_sb_type {