o These operations will be supported only through PFs (SR-IOV and non-SR-IOV).
Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
 int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac)
 {
        struct qlcnic_hardware_context *ahw = adapter->ahw;
-       struct qlcnic_dcb *dcb;
        int err = 0;
 
        ahw->msix_supported = !!qlcnic_use_msi_x;
        if (err)
                goto disable_mbx_intr;
 
-       dcb = adapter->dcb;
-
-       if (dcb && qlcnic_dcb_attach(dcb))
-               qlcnic_clear_dcb_ops(dcb);
-
        /* Periodically monitor device status */
        qlcnic_83xx_idc_poll_dev_state(&adapter->fw_work.work);
        return 0;
 
 {
        struct qlcnic_dcb *dcb;
 
+       if (qlcnic_sriov_vf_check(adapter))
+               return 0;
+
        dcb = kzalloc(sizeof(struct qlcnic_dcb), GFP_ATOMIC);
        if (!dcb)
                return -ENOMEM;
 
        if (dcb && dcb->ops->init_dcbnl_ops)
                dcb->ops->init_dcbnl_ops(dcb);
 }
+
+static inline void qlcnic_dcb_enable(struct qlcnic_dcb *dcb)
+{
+       if (dcb && qlcnic_dcb_attach(dcb))
+               qlcnic_clear_dcb_ops(dcb);
+}
 #endif
 
        struct qlcnic_hardware_context *ahw;
        int err, pci_using_dac = -1;
        char board_name[QLCNIC_MAX_BOARD_NAME_LEN + 19]; /* MAC + ": " + name */
-       struct qlcnic_dcb *dcb;
 
        if (pdev->is_virtfn)
                return -ENODEV;
 
                adapter->flags |= QLCNIC_NEED_FLR;
 
-               dcb = adapter->dcb;
-
-               if (dcb && qlcnic_dcb_attach(dcb))
-                       qlcnic_clear_dcb_ops(dcb);
        } else if (qlcnic_83xx_check(adapter)) {
                qlcnic_83xx_check_vf(adapter, ent);
                adapter->portnum = adapter->ahw->pci_func;
                goto err_out_free_hw;
        }
 
+       qlcnic_dcb_enable(adapter->dcb);
+
        if (qlcnic_read_mac_addr(adapter))
                dev_warn(&pdev->dev, "failed to read mac addr\n");
 
 
 static int qlcnic_sriov_setup_vf(struct qlcnic_adapter *adapter,
                                 int pci_using_dac)
 {
-       struct qlcnic_dcb *dcb;
        int err;
 
        INIT_LIST_HEAD(&adapter->vf_mc_list);
        if (err)
                goto err_out_send_channel_term;
 
-       dcb = adapter->dcb;
-
-       if (dcb && qlcnic_dcb_attach(dcb))
-               qlcnic_clear_dcb_ops(dcb);
-
        err = qlcnic_setup_netdev(adapter, adapter->netdev, pci_using_dac);
        if (err)
                goto err_out_send_channel_term;
        if (err)
                goto err_out_term_channel;
 
-       qlcnic_dcb_get_info(adapter->dcb);
-
        return 0;
 
 err_out_term_channel:
 
        QLCNIC_CMD_GET_STATISTICS,
        QLCNIC_CMD_GET_PORT_CONFIG,
        QLCNIC_CMD_GET_LINK_STATUS,
-       QLCNIC_CMD_DCB_QUERY_CAP,
-       QLCNIC_CMD_DCB_QUERY_PARAM,
        QLCNIC_CMD_INIT_NIC_FUNC,
        QLCNIC_CMD_STOP_NIC_FUNC,
 };