Skip to content

Commit 641585b

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ixgbe: fwlog support for e610
The device support firmware logging feature. Use libie code to initialize it and allow reading the logs using debugfs. The commands are the same as in ice driver. Look at the description in commit 96a9a93 ("ice: configure FW logging") for more info. Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel) Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent f3b3fc1 commit 641585b

File tree

5 files changed

+47
-0
lines changed

5 files changed

+47
-0
lines changed

drivers/net/ethernet/intel/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ config IXGBE
146146
tristate "Intel(R) 10GbE PCI Express adapters support"
147147
depends on PCI
148148
depends on PTP_1588_CLOCK_OPTIONAL
149+
select LIBIE_FWLOG
149150
select MDIO
150151
select NET_DEVLINK
151152
select PLDMFW

drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3921,6 +3921,38 @@ static int ixgbe_read_pba_string_e610(struct ixgbe_hw *hw, u8 *pba_num,
39213921
return err;
39223922
}
39233923

3924+
static int __fwlog_send_cmd(void *priv, struct libie_aq_desc *desc, void *buf,
3925+
u16 size)
3926+
{
3927+
struct ixgbe_hw *hw = priv;
3928+
3929+
return ixgbe_aci_send_cmd(hw, desc, buf, size);
3930+
}
3931+
3932+
int ixgbe_fwlog_init(struct ixgbe_hw *hw)
3933+
{
3934+
struct ixgbe_adapter *adapter = hw->back;
3935+
struct libie_fwlog_api api = {
3936+
.pdev = adapter->pdev,
3937+
.send_cmd = __fwlog_send_cmd,
3938+
.debugfs_root = adapter->ixgbe_dbg_adapter,
3939+
.priv = hw,
3940+
};
3941+
3942+
if (hw->mac.type != ixgbe_mac_e610)
3943+
return -EOPNOTSUPP;
3944+
3945+
return libie_fwlog_init(&hw->fwlog, &api);
3946+
}
3947+
3948+
void ixgbe_fwlog_deinit(struct ixgbe_hw *hw)
3949+
{
3950+
if (hw->mac.type != ixgbe_mac_e610)
3951+
return;
3952+
3953+
libie_fwlog_deinit(&hw->fwlog);
3954+
}
3955+
39243956
static const struct ixgbe_mac_operations mac_ops_e610 = {
39253957
.init_hw = ixgbe_init_hw_generic,
39263958
.start_hw = ixgbe_start_hw_e610,

drivers/net/ethernet/intel/ixgbe/ixgbe_e610.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,7 @@ int ixgbe_aci_update_nvm(struct ixgbe_hw *hw, u16 module_typeid,
9696
bool last_command, u8 command_flags);
9797
int ixgbe_nvm_write_activate(struct ixgbe_hw *hw, u16 cmd_flags,
9898
u8 *response_flags);
99+
int ixgbe_fwlog_init(struct ixgbe_hw *hw);
100+
void ixgbe_fwlog_deinit(struct ixgbe_hw *hw);
99101

100102
#endif /* _IXGBE_E610_H_ */

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ static int debug = -1;
172172
module_param(debug, int, 0);
173173
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
174174

175+
MODULE_IMPORT_NS("LIBIE_FWLOG");
175176
MODULE_DESCRIPTION("Intel(R) 10 Gigabit PCI Express Network Driver");
176177
MODULE_LICENSE("GPL v2");
177178

@@ -3355,6 +3356,10 @@ static void ixgbe_handle_fw_event(struct ixgbe_adapter *adapter)
33553356
e_crit(drv, "%s\n", ixgbe_overheat_msg);
33563357
ixgbe_down(adapter);
33573358
break;
3359+
case libie_aqc_opc_fw_logs_event:
3360+
libie_get_fwlog_data(&hw->fwlog, event.msg_buf,
3361+
le16_to_cpu(event.desc.datalen));
3362+
break;
33583363
default:
33593364
e_warn(hw, "unknown FW async event captured\n");
33603365
break;
@@ -11998,6 +12003,10 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1199812003
ixgbe_devlink_init_regions(adapter);
1199912004
devl_register(adapter->devlink);
1200012005
devl_unlock(adapter->devlink);
12006+
12007+
if (ixgbe_fwlog_init(hw))
12008+
e_dev_info("Firmware logging not supported\n");
12009+
1200112010
return 0;
1200212011

1200312012
err_netdev:
@@ -12055,6 +12064,7 @@ static void ixgbe_remove(struct pci_dev *pdev)
1205512064
devl_lock(adapter->devlink);
1205612065
devl_unregister(adapter->devlink);
1205712066
ixgbe_devlink_destroy_regions(adapter);
12067+
ixgbe_fwlog_deinit(&adapter->hw);
1205812068
ixgbe_dbg_adapter_exit(adapter);
1205912069

1206012070
set_bit(__IXGBE_REMOVING, &adapter->state);

drivers/net/ethernet/intel/ixgbe/ixgbe_type.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/types.h>
88
#include <linux/mdio.h>
99
#include <linux/netdevice.h>
10+
#include <linux/net/intel/libie/fwlog.h>
1011
#include "ixgbe_type_e610.h"
1112

1213
/* Device IDs */
@@ -3752,6 +3753,7 @@ struct ixgbe_hw {
37523753
struct ixgbe_flash_info flash;
37533754
struct ixgbe_hw_dev_caps dev_caps;
37543755
struct ixgbe_hw_func_caps func_caps;
3756+
struct libie_fwlog fwlog;
37553757
};
37563758

37573759
struct ixgbe_info {

0 commit comments

Comments
 (0)