be2net: Fix VF driver load on newer Lancer FW
authorPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Sat, 20 Oct 2012 06:03:49 +0000 (06:03 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Oct 2012 02:15:37 +0000 (22:15 -0400)
PF driver should enable VF so that VF goes to ready state in
new Lancer FW.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/emulex/benet/be_cmds.c
drivers/net/ethernet/emulex/benet/be_cmds.h
drivers/net/ethernet/emulex/benet/be_main.c

index 15202d07cf8a3dc979652406fde3a4f17de7b9c8..8d35750eace84beaff468b8245667b84e0e8da3c 100644 (file)
@@ -3131,6 +3131,38 @@ err:
        return status;
 }
 
+/* Uses sync mcc */
+int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain)
+{
+       struct be_mcc_wrb *wrb;
+       struct be_cmd_enable_disable_vf *req;
+       int status;
+
+       if (!lancer_chip(adapter))
+               return 0;
+
+       spin_lock_bh(&adapter->mcc_lock);
+
+       wrb = wrb_from_mccq(adapter);
+       if (!wrb) {
+               status = -EBUSY;
+               goto err;
+       }
+
+       req = embedded_payload(wrb);
+
+       be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
+                              OPCODE_COMMON_ENABLE_DISABLE_VF, sizeof(*req),
+                              wrb, NULL);
+
+       req->hdr.domain = domain;
+       req->enable = 1;
+       status = be_mcc_notify_wait(adapter);
+err:
+       spin_unlock_bh(&adapter->mcc_lock);
+       return status;
+}
+
 int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload,
                        int wrb_payload_size, u16 *cmd_status, u16 *ext_status)
 {
index a43877764994cf492bd392d58690f23a983a8153..68de6c6b786cb66719226ca2c36643c1379e372f 100644 (file)
@@ -203,6 +203,7 @@ struct be_mcc_mailbox {
 #define OPCODE_COMMON_GET_FN_PRIVILEGES                        170
 #define OPCODE_COMMON_READ_OBJECT                      171
 #define OPCODE_COMMON_WRITE_OBJECT                     172
+#define OPCODE_COMMON_ENABLE_DISABLE_VF                        196
 
 #define OPCODE_ETH_RSS_CONFIG                          1
 #define OPCODE_ETH_ACPI_CONFIG                         2
@@ -1802,6 +1803,12 @@ struct be_cmd_resp_set_profile_config {
        struct be_cmd_req_hdr hdr;
 };
 
+struct be_cmd_enable_disable_vf {
+       struct be_cmd_req_hdr hdr;
+       u8 enable;
+       u8 rsvd[3];
+};
+
 static inline bool check_privilege(struct be_adapter *adapter, u32 flags)
 {
        return flags & adapter->cmd_privileges ? true : false;
@@ -1929,3 +1936,4 @@ extern int be_cmd_get_profile_config(struct be_adapter *adapter, u32 *cap_flags,
 
 extern int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps,
                                     u8 domain);
+extern int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain);
index 410834deb8d418bfd4ceabb990dc52f92bb0b92d..136ed64ae1528fe69417f7b49520759e1f83021c 100644 (file)
@@ -2731,6 +2731,8 @@ static int be_vf_setup(struct be_adapter *adapter)
                if (status)
                        goto err;
                vf_cfg->def_vid = def_vlan;
+
+               be_cmd_enable_vf(adapter, vf + 1);
        }
        return 0;
 err: