aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c48
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h10
-rw-r--r--drivers/net/ethernet/emulex/benet/be_ethtool.c17
4 files changed, 65 insertions, 12 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 0048ef8e5f35..811f1351db7a 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -383,8 +383,10 @@ enum vf_state {
383 383
384#define BE_UC_PMAC_COUNT 30 384#define BE_UC_PMAC_COUNT 30
385#define BE_VF_UC_PMAC_COUNT 2 385#define BE_VF_UC_PMAC_COUNT 2
386
386/* Ethtool set_dump flags */ 387/* Ethtool set_dump flags */
387#define LANCER_INITIATE_FW_DUMP 0x1 388#define LANCER_INITIATE_FW_DUMP 0x1
389#define LANCER_DELETE_FW_DUMP 0x2
388 390
389struct phy_info { 391struct phy_info {
390 u8 transceiver; 392 u8 transceiver;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 791094c33535..4370ec1952ac 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -2240,6 +2240,34 @@ err_unlock:
2240 return status; 2240 return status;
2241} 2241}
2242 2242
2243int lancer_cmd_delete_object(struct be_adapter *adapter, const char *obj_name)
2244{
2245 struct lancer_cmd_req_delete_object *req;
2246 struct be_mcc_wrb *wrb;
2247 int status;
2248
2249 spin_lock_bh(&adapter->mcc_lock);
2250
2251 wrb = wrb_from_mccq(adapter);
2252 if (!wrb) {
2253 status = -EBUSY;
2254 goto err;
2255 }
2256
2257 req = embedded_payload(wrb);
2258
2259 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
2260 OPCODE_COMMON_DELETE_OBJECT,
2261 sizeof(*req), wrb, NULL);
2262
2263 strcpy(req->object_name, obj_name);
2264
2265 status = be_mcc_notify_wait(adapter);
2266err:
2267 spin_unlock_bh(&adapter->mcc_lock);
2268 return status;
2269}
2270
2243int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, 2271int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
2244 u32 data_size, u32 data_offset, const char *obj_name, 2272 u32 data_size, u32 data_offset, const char *obj_name,
2245 u32 *data_read, u32 *eof, u8 *addn_status) 2273 u32 *data_read, u32 *eof, u8 *addn_status)
@@ -3805,13 +3833,19 @@ bool dump_present(struct be_adapter *adapter)
3805 3833
3806int lancer_initiate_dump(struct be_adapter *adapter) 3834int lancer_initiate_dump(struct be_adapter *adapter)
3807{ 3835{
3836 struct device *dev = &adapter->pdev->dev;
3808 int status; 3837 int status;
3809 3838
3839 if (dump_present(adapter)) {
3840 dev_info(dev, "Previous dump not cleared, not forcing dump\n");
3841 return -EEXIST;
3842 }
3843
3810 /* give firmware reset and diagnostic dump */ 3844 /* give firmware reset and diagnostic dump */
3811 status = lancer_physdev_ctrl(adapter, PHYSDEV_CONTROL_FW_RESET_MASK | 3845 status = lancer_physdev_ctrl(adapter, PHYSDEV_CONTROL_FW_RESET_MASK |
3812 PHYSDEV_CONTROL_DD_MASK); 3846 PHYSDEV_CONTROL_DD_MASK);
3813 if (status < 0) { 3847 if (status < 0) {
3814 dev_err(&adapter->pdev->dev, "Firmware reset failed\n"); 3848 dev_err(dev, "FW reset failed\n");
3815 return status; 3849 return status;
3816 } 3850 }
3817 3851
@@ -3820,13 +3854,21 @@ int lancer_initiate_dump(struct be_adapter *adapter)
3820 return status; 3854 return status;
3821 3855
3822 if (!dump_present(adapter)) { 3856 if (!dump_present(adapter)) {
3823 dev_err(&adapter->pdev->dev, "Dump image not present\n"); 3857 dev_err(dev, "FW dump not generated\n");
3824 return -1; 3858 return -EIO;
3825 } 3859 }
3826 3860
3827 return 0; 3861 return 0;
3828} 3862}
3829 3863
3864int lancer_delete_dump(struct be_adapter *adapter)
3865{
3866 int status;
3867
3868 status = lancer_cmd_delete_object(adapter, LANCER_FW_DUMP_FILE);
3869 return be_cmd_status(status);
3870}
3871
3830/* Uses sync mcc */ 3872/* Uses sync mcc */
3831int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain) 3873int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain)
3832{ 3874{
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 03e8a15c6922..5284b825bba2 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -231,6 +231,7 @@ struct be_mcc_mailbox {
231#define OPCODE_COMMON_GET_FN_PRIVILEGES 170 231#define OPCODE_COMMON_GET_FN_PRIVILEGES 170
232#define OPCODE_COMMON_READ_OBJECT 171 232#define OPCODE_COMMON_READ_OBJECT 171
233#define OPCODE_COMMON_WRITE_OBJECT 172 233#define OPCODE_COMMON_WRITE_OBJECT 172
234#define OPCODE_COMMON_DELETE_OBJECT 174
234#define OPCODE_COMMON_MANAGE_IFACE_FILTERS 193 235#define OPCODE_COMMON_MANAGE_IFACE_FILTERS 193
235#define OPCODE_COMMON_GET_IFACE_LIST 194 236#define OPCODE_COMMON_GET_IFACE_LIST 194
236#define OPCODE_COMMON_ENABLE_DISABLE_VF 196 237#define OPCODE_COMMON_ENABLE_DISABLE_VF 196
@@ -1253,6 +1254,13 @@ struct lancer_cmd_resp_read_object {
1253 u32 eof; 1254 u32 eof;
1254}; 1255};
1255 1256
1257struct lancer_cmd_req_delete_object {
1258 struct be_cmd_req_hdr hdr;
1259 u32 rsvd1;
1260 u32 rsvd2;
1261 u8 object_name[104];
1262};
1263
1256/************************ WOL *******************************/ 1264/************************ WOL *******************************/
1257struct be_cmd_req_acpi_wol_magic_config{ 1265struct be_cmd_req_acpi_wol_magic_config{
1258 struct be_cmd_req_hdr hdr; 1266 struct be_cmd_req_hdr hdr;
@@ -2067,6 +2075,7 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
2067int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, 2075int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
2068 u32 data_size, u32 data_offset, const char *obj_name, 2076 u32 data_size, u32 data_offset, const char *obj_name,
2069 u32 *data_read, u32 *eof, u8 *addn_status); 2077 u32 *data_read, u32 *eof, u8 *addn_status);
2078int lancer_cmd_delete_object(struct be_adapter *adapter, const char *obj_name);
2070int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, 2079int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
2071 u16 optype, int offset); 2080 u16 optype, int offset);
2072int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, 2081int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
@@ -2120,6 +2129,7 @@ int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter,
2120 struct be_fat_conf_params *cfgs); 2129 struct be_fat_conf_params *cfgs);
2121int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask); 2130int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask);
2122int lancer_initiate_dump(struct be_adapter *adapter); 2131int lancer_initiate_dump(struct be_adapter *adapter);
2132int lancer_delete_dump(struct be_adapter *adapter);
2123bool dump_present(struct be_adapter *adapter); 2133bool dump_present(struct be_adapter *adapter);
2124int lancer_test_and_set_rdy_state(struct be_adapter *adapter); 2134int lancer_test_and_set_rdy_state(struct be_adapter *adapter);
2125int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name); 2135int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name);
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index 25f516d6eb9e..0cd3311409a8 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -681,22 +681,21 @@ static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump)
681 struct device *dev = &adapter->pdev->dev; 681 struct device *dev = &adapter->pdev->dev;
682 int status; 682 int status;
683 683
684 if (!lancer_chip(adapter)) { 684 if (!lancer_chip(adapter) ||
685 dev_err(dev, "FW dump not supported\n"); 685 !check_privilege(adapter, MAX_PRIVILEGES))
686 return -EOPNOTSUPP; 686 return -EOPNOTSUPP;
687 }
688
689 if (dump_present(adapter)) {
690 dev_err(dev, "Previous dump not cleared, not forcing dump\n");
691 return 0;
692 }
693 687
694 switch (dump->flag) { 688 switch (dump->flag) {
695 case LANCER_INITIATE_FW_DUMP: 689 case LANCER_INITIATE_FW_DUMP:
696 status = lancer_initiate_dump(adapter); 690 status = lancer_initiate_dump(adapter);
697 if (!status) 691 if (!status)
698 dev_info(dev, "F/w dump initiated successfully\n"); 692 dev_info(dev, "FW dump initiated successfully\n");
699 break; 693 break;
694 case LANCER_DELETE_FW_DUMP:
695 status = lancer_delete_dump(adapter);
696 if (!status)
697 dev_info(dev, "FW dump deleted successfully\n");
698 break;
700 default: 699 default:
701 dev_err(dev, "Invalid dump level: 0x%x\n", dump->flag); 700 dev_err(dev, "Invalid dump level: 0x%x\n", dump->flag);
702 return -EINVAL; 701 return -EINVAL;