Loading drivers/net/benet/be_cmds.c +59 −0 Original line number Original line Diff line number Diff line Loading @@ -1118,6 +1118,65 @@ int be_cmd_reset_function(struct be_adapter *adapter) return status; return status; } } /* Uses sync mcc */ int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 bcn, u8 sts, u8 state) { struct be_mcc_wrb *wrb; struct be_cmd_req_enable_disable_beacon *req; int status; spin_lock_bh(&adapter->mcc_lock); wrb = wrb_from_mccq(adapter); req = embedded_payload(wrb); be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, OPCODE_COMMON_ENABLE_DISABLE_BEACON, sizeof(*req)); req->port_num = port_num; req->beacon_state = state; req->beacon_duration = bcn; req->status_duration = sts; status = be_mcc_notify_wait(adapter); spin_unlock_bh(&adapter->mcc_lock); return status; } /* Uses sync mcc */ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state) { struct be_mcc_wrb *wrb; struct be_cmd_req_get_beacon_state *req; int status; spin_lock_bh(&adapter->mcc_lock); wrb = wrb_from_mccq(adapter); req = embedded_payload(wrb); be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, OPCODE_COMMON_GET_BEACON_STATE, sizeof(*req)); req->port_num = port_num; status = be_mcc_notify_wait(adapter); if (!status) { struct be_cmd_resp_get_beacon_state *resp = embedded_payload(wrb); *state = resp->beacon_state; } spin_unlock_bh(&adapter->mcc_lock); return status; } int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, u32 flash_type, u32 flash_opcode, u32 buf_size) u32 flash_type, u32 flash_opcode, u32 buf_size) { { Loading drivers/net/benet/be_cmds.h +37 −0 Original line number Original line Diff line number Diff line Loading @@ -138,6 +138,8 @@ struct be_mcc_mailbox { #define OPCODE_COMMON_NTWK_PMAC_ADD 59 #define OPCODE_COMMON_NTWK_PMAC_ADD 59 #define OPCODE_COMMON_NTWK_PMAC_DEL 60 #define OPCODE_COMMON_NTWK_PMAC_DEL 60 #define OPCODE_COMMON_FUNCTION_RESET 61 #define OPCODE_COMMON_FUNCTION_RESET 61 #define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69 #define OPCODE_COMMON_GET_BEACON_STATE 70 #define OPCODE_ETH_ACPI_CONFIG 2 #define OPCODE_ETH_ACPI_CONFIG 2 #define OPCODE_ETH_PROMISCUOUS 3 #define OPCODE_ETH_PROMISCUOUS 3 Loading Loading @@ -699,6 +701,37 @@ struct be_cmd_resp_query_fw_cfg { u32 rsvd[26]; u32 rsvd[26]; }; }; /******************** Port Beacon ***************************/ #define BEACON_STATE_ENABLED 0x1 #define BEACON_STATE_DISABLED 0x0 struct be_cmd_req_enable_disable_beacon { struct be_cmd_req_hdr hdr; u8 port_num; u8 beacon_state; u8 beacon_duration; u8 status_duration; } __packed; struct be_cmd_resp_enable_disable_beacon { struct be_cmd_resp_hdr resp_hdr; u32 rsvd0; } __packed; struct be_cmd_req_get_beacon_state { struct be_cmd_req_hdr hdr; u8 port_num; u8 rsvd0; u16 rsvd1; } __packed; struct be_cmd_resp_get_beacon_state { struct be_cmd_resp_hdr resp_hdr; u8 beacon_state; u8 rsvd0[3]; } __packed; /****************** Firmware Flash ******************/ /****************** Firmware Flash ******************/ struct flashrom_params { struct flashrom_params { u32 op_code; u32 op_code; Loading Loading @@ -764,6 +797,10 @@ extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, u32 *cap); u32 *port_num, u32 *cap); extern int be_cmd_reset_function(struct be_adapter *adapter); extern int be_cmd_reset_function(struct be_adapter *adapter); extern int be_process_mcc(struct be_adapter *adapter); extern int be_process_mcc(struct be_adapter *adapter); extern int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon, u8 status, u8 state); extern int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state); extern int be_cmd_write_flashrom(struct be_adapter *adapter, extern int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, u32 flash_oper, struct be_dma_mem *cmd, u32 flash_oper, u32 flash_opcode, u32 buf_size); u32 flash_opcode, u32 buf_size); drivers/net/benet/be_ethtool.c +30 −0 Original line number Original line Diff line number Diff line Loading @@ -337,6 +337,35 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd) return status; return status; } } static int be_phys_id(struct net_device *netdev, u32 data) { struct be_adapter *adapter = netdev_priv(netdev); int status; u32 cur; if (!netif_running(netdev)) return 0; be_cmd_get_beacon_state(adapter, adapter->port_num, &cur); if (cur == BEACON_STATE_ENABLED) return 0; if (data < 2) data = 2; status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0, BEACON_STATE_ENABLED); set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(data*HZ); status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0, BEACON_STATE_DISABLED); return status; } static int static int be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) { { Loading Loading @@ -369,6 +398,7 @@ const struct ethtool_ops be_ethtool_ops = { .get_tso = ethtool_op_get_tso, .get_tso = ethtool_op_get_tso, .set_tso = ethtool_op_set_tso, .set_tso = ethtool_op_set_tso, .get_strings = be_get_stat_strings, .get_strings = be_get_stat_strings, .phys_id = be_phys_id, .get_sset_count = be_get_sset_count, .get_sset_count = be_get_sset_count, .get_ethtool_stats = be_get_ethtool_stats, .get_ethtool_stats = be_get_ethtool_stats, .flash_device = be_do_flash, .flash_device = be_do_flash, Loading Loading
drivers/net/benet/be_cmds.c +59 −0 Original line number Original line Diff line number Diff line Loading @@ -1118,6 +1118,65 @@ int be_cmd_reset_function(struct be_adapter *adapter) return status; return status; } } /* Uses sync mcc */ int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 bcn, u8 sts, u8 state) { struct be_mcc_wrb *wrb; struct be_cmd_req_enable_disable_beacon *req; int status; spin_lock_bh(&adapter->mcc_lock); wrb = wrb_from_mccq(adapter); req = embedded_payload(wrb); be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, OPCODE_COMMON_ENABLE_DISABLE_BEACON, sizeof(*req)); req->port_num = port_num; req->beacon_state = state; req->beacon_duration = bcn; req->status_duration = sts; status = be_mcc_notify_wait(adapter); spin_unlock_bh(&adapter->mcc_lock); return status; } /* Uses sync mcc */ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state) { struct be_mcc_wrb *wrb; struct be_cmd_req_get_beacon_state *req; int status; spin_lock_bh(&adapter->mcc_lock); wrb = wrb_from_mccq(adapter); req = embedded_payload(wrb); be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, OPCODE_COMMON_GET_BEACON_STATE, sizeof(*req)); req->port_num = port_num; status = be_mcc_notify_wait(adapter); if (!status) { struct be_cmd_resp_get_beacon_state *resp = embedded_payload(wrb); *state = resp->beacon_state; } spin_unlock_bh(&adapter->mcc_lock); return status; } int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, u32 flash_type, u32 flash_opcode, u32 buf_size) u32 flash_type, u32 flash_opcode, u32 buf_size) { { Loading
drivers/net/benet/be_cmds.h +37 −0 Original line number Original line Diff line number Diff line Loading @@ -138,6 +138,8 @@ struct be_mcc_mailbox { #define OPCODE_COMMON_NTWK_PMAC_ADD 59 #define OPCODE_COMMON_NTWK_PMAC_ADD 59 #define OPCODE_COMMON_NTWK_PMAC_DEL 60 #define OPCODE_COMMON_NTWK_PMAC_DEL 60 #define OPCODE_COMMON_FUNCTION_RESET 61 #define OPCODE_COMMON_FUNCTION_RESET 61 #define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69 #define OPCODE_COMMON_GET_BEACON_STATE 70 #define OPCODE_ETH_ACPI_CONFIG 2 #define OPCODE_ETH_ACPI_CONFIG 2 #define OPCODE_ETH_PROMISCUOUS 3 #define OPCODE_ETH_PROMISCUOUS 3 Loading Loading @@ -699,6 +701,37 @@ struct be_cmd_resp_query_fw_cfg { u32 rsvd[26]; u32 rsvd[26]; }; }; /******************** Port Beacon ***************************/ #define BEACON_STATE_ENABLED 0x1 #define BEACON_STATE_DISABLED 0x0 struct be_cmd_req_enable_disable_beacon { struct be_cmd_req_hdr hdr; u8 port_num; u8 beacon_state; u8 beacon_duration; u8 status_duration; } __packed; struct be_cmd_resp_enable_disable_beacon { struct be_cmd_resp_hdr resp_hdr; u32 rsvd0; } __packed; struct be_cmd_req_get_beacon_state { struct be_cmd_req_hdr hdr; u8 port_num; u8 rsvd0; u16 rsvd1; } __packed; struct be_cmd_resp_get_beacon_state { struct be_cmd_resp_hdr resp_hdr; u8 beacon_state; u8 rsvd0[3]; } __packed; /****************** Firmware Flash ******************/ /****************** Firmware Flash ******************/ struct flashrom_params { struct flashrom_params { u32 op_code; u32 op_code; Loading Loading @@ -764,6 +797,10 @@ extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, u32 *cap); u32 *port_num, u32 *cap); extern int be_cmd_reset_function(struct be_adapter *adapter); extern int be_cmd_reset_function(struct be_adapter *adapter); extern int be_process_mcc(struct be_adapter *adapter); extern int be_process_mcc(struct be_adapter *adapter); extern int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon, u8 status, u8 state); extern int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state); extern int be_cmd_write_flashrom(struct be_adapter *adapter, extern int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, u32 flash_oper, struct be_dma_mem *cmd, u32 flash_oper, u32 flash_opcode, u32 buf_size); u32 flash_opcode, u32 buf_size);
drivers/net/benet/be_ethtool.c +30 −0 Original line number Original line Diff line number Diff line Loading @@ -337,6 +337,35 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd) return status; return status; } } static int be_phys_id(struct net_device *netdev, u32 data) { struct be_adapter *adapter = netdev_priv(netdev); int status; u32 cur; if (!netif_running(netdev)) return 0; be_cmd_get_beacon_state(adapter, adapter->port_num, &cur); if (cur == BEACON_STATE_ENABLED) return 0; if (data < 2) data = 2; status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0, BEACON_STATE_ENABLED); set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(data*HZ); status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0, BEACON_STATE_DISABLED); return status; } static int static int be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) { { Loading Loading @@ -369,6 +398,7 @@ const struct ethtool_ops be_ethtool_ops = { .get_tso = ethtool_op_get_tso, .get_tso = ethtool_op_get_tso, .set_tso = ethtool_op_set_tso, .set_tso = ethtool_op_set_tso, .get_strings = be_get_stat_strings, .get_strings = be_get_stat_strings, .phys_id = be_phys_id, .get_sset_count = be_get_sset_count, .get_sset_count = be_get_sset_count, .get_ethtool_stats = be_get_ethtool_stats, .get_ethtool_stats = be_get_ethtool_stats, .flash_device = be_do_flash, .flash_device = be_do_flash, Loading