Commit c977ac49 authored by David S. Miller's avatar David S. Miller

Merge branch 'net-flash-modees-firmware' into main

Danielle Ratson says:

====================
Add ability to flash modules' firmware

CMIS compliant modules such as QSFP-DD might be running a firmware that
can be updated in a vendor-neutral way by exchanging messages between
the host and the module as described in section 7.2.2 of revision
4.0 of the CMIS standard.

According to the CMIS standard, the firmware update process is done
using a CDB commands sequence.

CDB (Command Data Block Message Communication) reads and writes are
performed on memory map pages 9Fh-AFh according to the CMIS standard,
section 8.12 of revision 4.0.

Add a pair of new ethtool messages that allow:

* User space to trigger firmware update of transceiver modules

* The kernel to notify user space about the progress of the process

The user interface is designed to be asynchronous in order to avoid RTNL
being held for too long and to allow several modules to be updated
simultaneously. The interface is designed with CMIS compliant modules in
mind, but kept generic enough to accommodate future use cases, if these
arise.

The kernel interface that will implement the firmware update using CDB
command will include 2 layers that will be added under ethtool:

* The upper layer that will be triggered from the module layer, is
 cmis_ fw_update.
* The lower one is cmis_cdb.

In the future there might be more operations to implement using CDB
commands. Therefore, the idea is to keep the cmis_cdb interface clean and
the cmis_fw_update specific to the cdb commands handling it.

The communication between the kernel and the driver will be done using
two ethtool operations that enable reading and writing the transceiver
module EEPROM.
The operation ethtool_ops::get_module_eeprom_by_page, that is already
implemented, will be used for reading from the EEPROM the CDB reply,
e.g. reading module setting, state, etc.
The operation ethtool_ops::set_module_eeprom_by_page, that is added in
the current patchset, will be used for writing to the EEPROM the CDB
command such as start firmware image, run firmware image, etc.

Therefore in order for a driver to implement module flashing, that
driver needs to implement the two functions mentioned above.

Patchset overview:
Patch #1-#2: Implement the EEPROM writing in mlxsw.
Patch #3: Define the interface between the kernel and user space.
Patch #4: Add ability to notify the flashing firmware progress.
Patch #5: Veto operations during flashing.
Patch #6: Add extended compliance codes.
Patch #7: Add the cdb layer.
Patch #8: Add the fw_update layer.
Patch #9: Add ability to flash transceiver modules' firmware.

v8:
	Patch #7:
	* In the ethtool_cmis_wait_for_cond() evaluate the condition once more
	  to decide if the error code should be -ETIMEDOUT or something else.
	* s/netdev_err/netdev_err_once.

v7:
	Patch #4:
		* Return -ENOMEM instead of PTR_ERR(attr) on
		  ethnl_module_fw_flash_ntf_put_err().
	Patch #9:
		* Fix Warning for not unlocking the spin_lock in the error flow
          	  on module_flash_fw_work_list_add().
		* Avoid the fall-through on ethnl_sock_priv_destroy().

v6:
	* Squash some of the last patch to patch #5 and patch #9.
	Patch #3:
		* Add paragraph in .rst file.
	Patch #4:
		* Reserve '1' more place on SKB for NUL terminator in
		  the error message string.
		* Add more prints on error flow, re-write the printing
		  function and add ethnl_module_fw_flash_ntf_put_err().
		* Change the communication method so notification will be
		  sent in unicast instead of multicast.
		* Add new 'struct ethnl_module_fw_flash_ntf_params' that holds
		  the relevant info for unicast communication and use it to
		  send notification to the specific socket.
		* s/nla_put_u64_64bit/nla_put_uint/
	Patch #7:
		* In ethtool_cmis_cdb_init(), Use 'const' for the 'params'
		  parameter.
	Patch #8:
		* Add a list field to struct ethtool_module_fw_flash for
		  module_fw_flash_work_list that will be presented in the next
		  patch.
		* Move ethtool_cmis_fw_update() cleaning to a new function that
		  will be represented in the next patch.
		* Move some of the fields in struct ethtool_module_fw_flash to
		  a separate struct, so ethtool_cmis_fw_update() will get only
		  the relevant parameters for it.
		* Edit the relevant functions to get the relevant params for
		  them.
		* s/CMIS_MODULE_READY_MAX_DURATION_USEC/CMIS_MODULE_READY_MAX_DURATION_MSEC
	Patch #9:
		* Add a paragraph in the commit message.
		* Rename labels in module_flash_fw_schedule().
		* Add info to genl_sk_priv_*() and implement the relevant
		  callbacks, in order to handle properly a scenario of closing
		  the socket from user space before the work item was ended.
		* Add a list the holds all the ethtool_module_fw_flash struct
		  that corresponds to the in progress work items.
		* Add a new enum for the socket types.
		* Use both above to identify a flashing socket, add it to the
		  list and when closing socket affect only the flashing type.
		* Create a new function that will get the work item instead of
		  ethtool_cmis_fw_update().
		* Edit the relevant functions to get the relevant params for
		  them.
		* The new function will call the old ethtool_cmis_fw_update(),
		  and do the cleaning, so the existence of the list should be
		  completely isolated in module.c.
===================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 8fda5371 32b4c8b5
...@@ -20,6 +20,10 @@ definitions: ...@@ -20,6 +20,10 @@ definitions:
name: header-flags name: header-flags
type: flags type: flags
entries: [ compact-bitsets, omit-reply, stats ] entries: [ compact-bitsets, omit-reply, stats ]
-
name: module-fw-flash-status
type: enum
entries: [ started, in_progress, completed, error ]
attribute-sets: attribute-sets:
- -
...@@ -1004,6 +1008,32 @@ attribute-sets: ...@@ -1004,6 +1008,32 @@ attribute-sets:
- -
name: burst-tmr name: burst-tmr
type: u32 type: u32
-
name: module-fw-flash
attributes:
-
name: header
type: nest
nested-attributes: header
-
name: file-name
type: string
-
name: password
type: u32
-
name: status
type: u32
enum: module-fw-flash-status
-
name: status-msg
type: string
-
name: done
type: uint
-
name: total
type: uint
operations: operations:
enum-model: directional enum-model: directional
...@@ -1764,3 +1794,28 @@ operations: ...@@ -1764,3 +1794,28 @@ operations:
name: mm-ntf name: mm-ntf
doc: Notification for change in MAC Merge configuration. doc: Notification for change in MAC Merge configuration.
notify: mm-get notify: mm-get
-
name: module-fw-flash-act
doc: Flash transceiver module firmware.
attribute-set: module-fw-flash
do:
request:
attributes:
- header
- file-name
- password
-
name: module-fw-flash-ntf
doc: Notification for firmware flashing progress and status.
attribute-set: module-fw-flash
event:
attributes:
- header
- status
- status-msg
- done
- total
...@@ -228,6 +228,7 @@ Userspace to kernel: ...@@ -228,6 +228,7 @@ Userspace to kernel:
``ETHTOOL_MSG_PLCA_GET_STATUS`` get PLCA RS status ``ETHTOOL_MSG_PLCA_GET_STATUS`` get PLCA RS status
``ETHTOOL_MSG_MM_GET`` get MAC merge layer state ``ETHTOOL_MSG_MM_GET`` get MAC merge layer state
``ETHTOOL_MSG_MM_SET`` set MAC merge layer parameters ``ETHTOOL_MSG_MM_SET`` set MAC merge layer parameters
``ETHTOOL_MSG_MODULE_FW_FLASH_ACT`` flash transceiver module firmware
===================================== ================================= ===================================== =================================
Kernel to userspace: Kernel to userspace:
...@@ -274,6 +275,7 @@ Kernel to userspace: ...@@ -274,6 +275,7 @@ Kernel to userspace:
``ETHTOOL_MSG_PLCA_GET_STATUS_REPLY`` PLCA RS status ``ETHTOOL_MSG_PLCA_GET_STATUS_REPLY`` PLCA RS status
``ETHTOOL_MSG_PLCA_NTF`` PLCA RS parameters ``ETHTOOL_MSG_PLCA_NTF`` PLCA RS parameters
``ETHTOOL_MSG_MM_GET_REPLY`` MAC merge layer status ``ETHTOOL_MSG_MM_GET_REPLY`` MAC merge layer status
``ETHTOOL_MSG_MODULE_FW_FLASH_NTF`` transceiver module flash updates
======================================== ================================= ======================================== =================================
``GET`` requests are sent by userspace applications to retrieve device ``GET`` requests are sent by userspace applications to retrieve device
...@@ -2041,6 +2043,73 @@ The attributes are propagated to the driver through the following structure: ...@@ -2041,6 +2043,73 @@ The attributes are propagated to the driver through the following structure:
.. kernel-doc:: include/linux/ethtool.h .. kernel-doc:: include/linux/ethtool.h
:identifiers: ethtool_mm_cfg :identifiers: ethtool_mm_cfg
MODULE_FW_FLASH_ACT
===================
Flashes transceiver module firmware.
Request contents:
======================================= ====== ===========================
``ETHTOOL_A_MODULE_FW_FLASH_HEADER`` nested request header
``ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME`` string firmware image file name
``ETHTOOL_A_MODULE_FW_FLASH_PASSWORD`` u32 transceiver module password
======================================= ====== ===========================
The firmware update process consists of three logical steps:
1. Downloading a firmware image to the transceiver module and validating it.
2. Running the firmware image.
3. Committing the firmware image so that it is run upon reset.
When flash command is given, those three steps are taken in that order.
This message merely schedules the update process and returns immediately
without blocking. The process then runs asynchronously.
Since it can take several minutes to complete, during the update process
notifications are emitted from the kernel to user space updating it about
the status and progress.
The ``ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME`` attribute encodes the firmware
image file name. The firmware image is downloaded to the transceiver module,
validated, run and committed.
The optional ``ETHTOOL_A_MODULE_FW_FLASH_PASSWORD`` attribute encodes a password
that might be required as part of the transceiver module firmware update
process.
The firmware update process can take several minutes to complete. Therefore,
during the update process notifications are emitted from the kernel to user
space updating it about the status and progress.
Notification contents:
+---------------------------------------------------+--------+----------------+
| ``ETHTOOL_A_MODULE_FW_FLASH_HEADER`` | nested | reply header |
+---------------------------------------------------+--------+----------------+
| ``ETHTOOL_A_MODULE_FW_FLASH_STATUS`` | u32 | status |
+---------------------------------------------------+--------+----------------+
| ``ETHTOOL_A_MODULE_FW_FLASH_STATUS_MSG`` | string | status message |
+---------------------------------------------------+--------+----------------+
| ``ETHTOOL_A_MODULE_FW_FLASH_DONE`` | uint | progress |
+---------------------------------------------------+--------+----------------+
| ``ETHTOOL_A_MODULE_FW_FLASH_TOTAL`` | uint | total |
+---------------------------------------------------+--------+----------------+
The ``ETHTOOL_A_MODULE_FW_FLASH_STATUS`` attribute encodes the current status
of the firmware update process. Possible values are:
.. kernel-doc:: include/uapi/linux/ethtool.h
:identifiers: ethtool_module_fw_flash_status
The ``ETHTOOL_A_MODULE_FW_FLASH_STATUS_MSG`` attribute encodes a status message
string.
The ``ETHTOOL_A_MODULE_FW_FLASH_DONE`` and ``ETHTOOL_A_MODULE_FW_FLASH_TOTAL``
attributes encode the completed and total amount of work, respectively.
Request translation Request translation
=================== ===================
...@@ -2147,4 +2216,5 @@ are netlink only. ...@@ -2147,4 +2216,5 @@ are netlink only.
n/a ``ETHTOOL_MSG_PLCA_GET_STATUS`` n/a ``ETHTOOL_MSG_PLCA_GET_STATUS``
n/a ``ETHTOOL_MSG_MM_GET`` n/a ``ETHTOOL_MSG_MM_GET``
n/a ``ETHTOOL_MSG_MM_SET`` n/a ``ETHTOOL_MSG_MM_SET``
n/a ``ETHTOOL_MSG_MODULE_FW_FLASH_ACT``
=================================== ===================================== =================================== =====================================
...@@ -513,6 +513,63 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, ...@@ -513,6 +513,63 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core,
} }
EXPORT_SYMBOL(mlxsw_env_get_module_eeprom_by_page); EXPORT_SYMBOL(mlxsw_env_get_module_eeprom_by_page);
int
mlxsw_env_set_module_eeprom_by_page(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack)
{
struct mlxsw_env *mlxsw_env = mlxsw_core_env(mlxsw_core);
u32 bytes_written = 0;
u16 device_addr;
int err;
if (!mlxsw_env_linecard_is_active(mlxsw_env, slot_index)) {
NL_SET_ERR_MSG_MOD(extack,
"Cannot write to EEPROM of a module on an inactive line card");
return -EIO;
}
err = mlxsw_env_validate_module_type(mlxsw_core, slot_index, module);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "EEPROM is not equipped on port module type");
return err;
}
device_addr = page->offset;
while (bytes_written < page->length) {
char mcia_pl[MLXSW_REG_MCIA_LEN];
char eeprom_tmp[128] = {};
u8 size;
size = min_t(u8, page->length - bytes_written,
mlxsw_env->max_eeprom_len);
mlxsw_reg_mcia_pack(mcia_pl, slot_index, module, page->page,
device_addr + bytes_written, size,
page->i2c_address);
mlxsw_reg_mcia_bank_number_set(mcia_pl, page->bank);
memcpy(eeprom_tmp, page->data + bytes_written, size);
mlxsw_reg_mcia_eeprom_memcpy_to(mcia_pl, eeprom_tmp);
err = mlxsw_reg_write(mlxsw_core, MLXSW_REG(mcia), mcia_pl);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Failed to access module's EEPROM");
return err;
}
err = mlxsw_env_mcia_status_process(mcia_pl, extack);
if (err)
return err;
bytes_written += size;
}
return 0;
}
EXPORT_SYMBOL(mlxsw_env_set_module_eeprom_by_page);
static int mlxsw_env_module_reset(struct mlxsw_core *mlxsw_core, u8 slot_index, static int mlxsw_env_module_reset(struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module) u8 module)
{ {
......
...@@ -28,6 +28,12 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, ...@@ -28,6 +28,12 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core,
const struct ethtool_module_eeprom *page, const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
int
mlxsw_env_set_module_eeprom_by_page(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack);
int mlxsw_env_reset_module(struct net_device *netdev, int mlxsw_env_reset_module(struct net_device *netdev,
struct mlxsw_core *mlxsw_core, u8 slot_index, struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module, u32 *flags); u8 module, u32 *flags);
......
...@@ -140,6 +140,20 @@ mlxsw_m_get_module_eeprom_by_page(struct net_device *netdev, ...@@ -140,6 +140,20 @@ mlxsw_m_get_module_eeprom_by_page(struct net_device *netdev,
page, extack); page, extack);
} }
static int
mlxsw_m_set_module_eeprom_by_page(struct net_device *netdev,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack)
{
struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core;
return mlxsw_env_set_module_eeprom_by_page(core,
mlxsw_m_port->slot_index,
mlxsw_m_port->module,
page, extack);
}
static int mlxsw_m_reset(struct net_device *netdev, u32 *flags) static int mlxsw_m_reset(struct net_device *netdev, u32 *flags)
{ {
struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev); struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
...@@ -181,6 +195,7 @@ static const struct ethtool_ops mlxsw_m_port_ethtool_ops = { ...@@ -181,6 +195,7 @@ static const struct ethtool_ops mlxsw_m_port_ethtool_ops = {
.get_module_info = mlxsw_m_get_module_info, .get_module_info = mlxsw_m_get_module_info,
.get_module_eeprom = mlxsw_m_get_module_eeprom, .get_module_eeprom = mlxsw_m_get_module_eeprom,
.get_module_eeprom_by_page = mlxsw_m_get_module_eeprom_by_page, .get_module_eeprom_by_page = mlxsw_m_get_module_eeprom_by_page,
.set_module_eeprom_by_page = mlxsw_m_set_module_eeprom_by_page,
.reset = mlxsw_m_reset, .reset = mlxsw_m_reset,
.get_module_power_mode = mlxsw_m_get_module_power_mode, .get_module_power_mode = mlxsw_m_get_module_power_mode,
.set_module_power_mode = mlxsw_m_set_module_power_mode, .set_module_power_mode = mlxsw_m_set_module_power_mode,
......
...@@ -1067,6 +1067,20 @@ mlxsw_sp_get_module_eeprom_by_page(struct net_device *dev, ...@@ -1067,6 +1067,20 @@ mlxsw_sp_get_module_eeprom_by_page(struct net_device *dev,
module, page, extack); module, page, extack);
} }
static int
mlxsw_sp_set_module_eeprom_by_page(struct net_device *dev,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack)
{
struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
u8 slot_index = mlxsw_sp_port->mapping.slot_index;
u8 module = mlxsw_sp_port->mapping.module;
return mlxsw_env_set_module_eeprom_by_page(mlxsw_sp->core, slot_index,
module, page, extack);
}
static int static int
mlxsw_sp_get_ts_info(struct net_device *netdev, struct ethtool_ts_info *info) mlxsw_sp_get_ts_info(struct net_device *netdev, struct ethtool_ts_info *info)
{ {
...@@ -1256,6 +1270,7 @@ const struct ethtool_ops mlxsw_sp_port_ethtool_ops = { ...@@ -1256,6 +1270,7 @@ const struct ethtool_ops mlxsw_sp_port_ethtool_ops = {
.get_module_info = mlxsw_sp_get_module_info, .get_module_info = mlxsw_sp_get_module_info,
.get_module_eeprom = mlxsw_sp_get_module_eeprom, .get_module_eeprom = mlxsw_sp_get_module_eeprom,
.get_module_eeprom_by_page = mlxsw_sp_get_module_eeprom_by_page, .get_module_eeprom_by_page = mlxsw_sp_get_module_eeprom_by_page,
.set_module_eeprom_by_page = mlxsw_sp_set_module_eeprom_by_page,
.get_ts_info = mlxsw_sp_get_ts_info, .get_ts_info = mlxsw_sp_get_ts_info,
.get_eth_phy_stats = mlxsw_sp_get_eth_phy_stats, .get_eth_phy_stats = mlxsw_sp_get_eth_phy_stats,
.get_eth_mac_stats = mlxsw_sp_get_eth_mac_stats, .get_eth_mac_stats = mlxsw_sp_get_eth_mac_stats,
......
...@@ -506,17 +506,16 @@ struct ethtool_ts_stats { ...@@ -506,17 +506,16 @@ struct ethtool_ts_stats {
#define ETH_MODULE_MAX_I2C_ADDRESS 0x7f #define ETH_MODULE_MAX_I2C_ADDRESS 0x7f
/** /**
* struct ethtool_module_eeprom - EEPROM dump from specified page * struct ethtool_module_eeprom - plug-in module EEPROM read / write parameters
* @offset: Offset within the specified EEPROM page to begin read, in bytes. * @offset: When @offset is 0-127, it is used as an address to the Lower Memory
* @length: Number of bytes to read. * (@page must be 0). Otherwise, it is used as an address to the
* @page: Page number to read from. * Upper Memory.
* @bank: Page bank number to read from, if applicable by EEPROM spec. * @length: Number of bytes to read / write.
* @page: Page number.
* @bank: Bank number, if supported by EEPROM spec.
* @i2c_address: I2C address of a page. Value less than 0x7f expected. Most * @i2c_address: I2C address of a page. Value less than 0x7f expected. Most
* EEPROMs use 0x50 or 0x51. * EEPROMs use 0x50 or 0x51.
* @data: Pointer to buffer with EEPROM data of @length size. * @data: Pointer to buffer with EEPROM data of @length size.
*
* This can be used to manage pages during EEPROM dump in ethtool and pass
* required information to the driver.
*/ */
struct ethtool_module_eeprom { struct ethtool_module_eeprom {
u32 offset; u32 offset;
...@@ -824,6 +823,8 @@ struct ethtool_rxfh_param { ...@@ -824,6 +823,8 @@ struct ethtool_rxfh_param {
* @get_module_eeprom_by_page: Get a region of plug-in module EEPROM data from * @get_module_eeprom_by_page: Get a region of plug-in module EEPROM data from
* specified page. Returns a negative error code or the amount of bytes * specified page. Returns a negative error code or the amount of bytes
* read. * read.
* @set_module_eeprom_by_page: Write to a region of plug-in module EEPROM,
* from kernel space only. Returns a negative error code or zero.
* @get_eth_phy_stats: Query some of the IEEE 802.3 PHY statistics. * @get_eth_phy_stats: Query some of the IEEE 802.3 PHY statistics.
* @get_eth_mac_stats: Query some of the IEEE 802.3 MAC statistics. * @get_eth_mac_stats: Query some of the IEEE 802.3 MAC statistics.
* @get_eth_ctrl_stats: Query some of the IEEE 802.3 MAC Ctrl statistics. * @get_eth_ctrl_stats: Query some of the IEEE 802.3 MAC Ctrl statistics.
...@@ -958,6 +959,9 @@ struct ethtool_ops { ...@@ -958,6 +959,9 @@ struct ethtool_ops {
int (*get_module_eeprom_by_page)(struct net_device *dev, int (*get_module_eeprom_by_page)(struct net_device *dev,
const struct ethtool_module_eeprom *page, const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
int (*set_module_eeprom_by_page)(struct net_device *dev,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack);
void (*get_eth_phy_stats)(struct net_device *dev, void (*get_eth_phy_stats)(struct net_device *dev,
struct ethtool_eth_phy_stats *phy_stats); struct ethtool_eth_phy_stats *phy_stats);
void (*get_eth_mac_stats)(struct net_device *dev, void (*get_eth_mac_stats)(struct net_device *dev,
......
...@@ -1990,6 +1990,8 @@ enum netdev_reg_state { ...@@ -1990,6 +1990,8 @@ enum netdev_reg_state {
* *
* @threaded: napi threaded mode is enabled * @threaded: napi threaded mode is enabled
* *
* @module_fw_flash_in_progress: Module firmware flashing is in progress.
*
* @net_notifier_list: List of per-net netdev notifier block * @net_notifier_list: List of per-net netdev notifier block
* that follow this device when it is moved * that follow this device when it is moved
* to another network namespace. * to another network namespace.
...@@ -2374,7 +2376,7 @@ struct net_device { ...@@ -2374,7 +2376,7 @@ struct net_device {
bool proto_down; bool proto_down;
bool threaded; bool threaded;
unsigned wol_enabled:1; unsigned wol_enabled:1;
unsigned module_fw_flash_in_progress:1;
struct list_head net_notifier_list; struct list_head net_notifier_list;
#if IS_ENABLED(CONFIG_MACSEC) #if IS_ENABLED(CONFIG_MACSEC)
......
...@@ -284,6 +284,12 @@ enum { ...@@ -284,6 +284,12 @@ enum {
SFF8024_ID_QSFP_8438 = 0x0c, SFF8024_ID_QSFP_8438 = 0x0c,
SFF8024_ID_QSFP_8436_8636 = 0x0d, SFF8024_ID_QSFP_8436_8636 = 0x0d,
SFF8024_ID_QSFP28_8636 = 0x11, SFF8024_ID_QSFP28_8636 = 0x11,
SFF8024_ID_QSFP_DD = 0x18,
SFF8024_ID_OSFP = 0x19,
SFF8024_ID_DSFP = 0x1B,
SFF8024_ID_QSFP_PLUS_CMIS = 0x1E,
SFF8024_ID_SFP_DD_CMIS = 0x1F,
SFF8024_ID_SFP_PLUS_CMIS = 0x20,
SFF8024_ENCODING_UNSPEC = 0x00, SFF8024_ENCODING_UNSPEC = 0x00,
SFF8024_ENCODING_8B10B = 0x01, SFF8024_ENCODING_8B10B = 0x01,
......
...@@ -877,6 +877,24 @@ enum ethtool_mm_verify_status { ...@@ -877,6 +877,24 @@ enum ethtool_mm_verify_status {
ETHTOOL_MM_VERIFY_STATUS_DISABLED, ETHTOOL_MM_VERIFY_STATUS_DISABLED,
}; };
/**
* enum ethtool_module_fw_flash_status - plug-in module firmware flashing status
* @ETHTOOL_MODULE_FW_FLASH_STATUS_STARTED: The firmware flashing process has
* started.
* @ETHTOOL_MODULE_FW_FLASH_STATUS_IN_PROGRESS: The firmware flashing process
* is in progress.
* @ETHTOOL_MODULE_FW_FLASH_STATUS_COMPLETED: The firmware flashing process was
* completed successfully.
* @ETHTOOL_MODULE_FW_FLASH_STATUS_ERROR: The firmware flashing process was
* stopped due to an error.
*/
enum ethtool_module_fw_flash_status {
ETHTOOL_MODULE_FW_FLASH_STATUS_STARTED = 1,
ETHTOOL_MODULE_FW_FLASH_STATUS_IN_PROGRESS,
ETHTOOL_MODULE_FW_FLASH_STATUS_COMPLETED,
ETHTOOL_MODULE_FW_FLASH_STATUS_ERROR,
};
/** /**
* struct ethtool_gstrings - string set for data tagging * struct ethtool_gstrings - string set for data tagging
* @cmd: Command number = %ETHTOOL_GSTRINGS * @cmd: Command number = %ETHTOOL_GSTRINGS
......
...@@ -57,6 +57,7 @@ enum { ...@@ -57,6 +57,7 @@ enum {
ETHTOOL_MSG_PLCA_GET_STATUS, ETHTOOL_MSG_PLCA_GET_STATUS,
ETHTOOL_MSG_MM_GET, ETHTOOL_MSG_MM_GET,
ETHTOOL_MSG_MM_SET, ETHTOOL_MSG_MM_SET,
ETHTOOL_MSG_MODULE_FW_FLASH_ACT,
/* add new constants above here */ /* add new constants above here */
__ETHTOOL_MSG_USER_CNT, __ETHTOOL_MSG_USER_CNT,
...@@ -109,6 +110,7 @@ enum { ...@@ -109,6 +110,7 @@ enum {
ETHTOOL_MSG_PLCA_NTF, ETHTOOL_MSG_PLCA_NTF,
ETHTOOL_MSG_MM_GET_REPLY, ETHTOOL_MSG_MM_GET_REPLY,
ETHTOOL_MSG_MM_NTF, ETHTOOL_MSG_MM_NTF,
ETHTOOL_MSG_MODULE_FW_FLASH_NTF,
/* add new constants above here */ /* add new constants above here */
__ETHTOOL_MSG_KERNEL_CNT, __ETHTOOL_MSG_KERNEL_CNT,
...@@ -1018,6 +1020,23 @@ enum { ...@@ -1018,6 +1020,23 @@ enum {
ETHTOOL_A_MM_MAX = (__ETHTOOL_A_MM_CNT - 1) ETHTOOL_A_MM_MAX = (__ETHTOOL_A_MM_CNT - 1)
}; };
/* MODULE_FW_FLASH */
enum {
ETHTOOL_A_MODULE_FW_FLASH_UNSPEC,
ETHTOOL_A_MODULE_FW_FLASH_HEADER, /* nest - _A_HEADER_* */
ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME, /* string */
ETHTOOL_A_MODULE_FW_FLASH_PASSWORD, /* u32 */
ETHTOOL_A_MODULE_FW_FLASH_STATUS, /* u32 */
ETHTOOL_A_MODULE_FW_FLASH_STATUS_MSG, /* string */
ETHTOOL_A_MODULE_FW_FLASH_DONE, /* uint */
ETHTOOL_A_MODULE_FW_FLASH_TOTAL, /* uint */
/* add new constants above here */
__ETHTOOL_A_MODULE_FW_FLASH_CNT,
ETHTOOL_A_MODULE_FW_FLASH_MAX = (__ETHTOOL_A_MODULE_FW_FLASH_CNT - 1)
};
/* generic netlink info */ /* generic netlink info */
#define ETHTOOL_GENL_NAME "ethtool" #define ETHTOOL_GENL_NAME "ethtool"
#define ETHTOOL_GENL_VERSION 1 #define ETHTOOL_GENL_VERSION 1
......
...@@ -8,4 +8,4 @@ ethtool_nl-y := netlink.o bitset.o strset.o linkinfo.o linkmodes.o rss.o \ ...@@ -8,4 +8,4 @@ ethtool_nl-y := netlink.o bitset.o strset.o linkinfo.o linkmodes.o rss.o \
linkstate.o debug.o wol.o features.o privflags.o rings.o \ linkstate.o debug.o wol.o features.o privflags.o rings.o \
channels.o coalesce.o pause.o eee.o tsinfo.o cabletest.o \ channels.o coalesce.o pause.o eee.o tsinfo.o cabletest.o \
tunnels.o fec.o eeprom.o stats.o phc_vclocks.o mm.o \ tunnels.o fec.o eeprom.o stats.o phc_vclocks.o mm.o \
module.o pse-pd.o plca.o mm.o module.o cmis_fw_update.o cmis_cdb.o pse-pd.o plca.o mm.o
/* SPDX-License-Identifier: GPL-2.0-only */
#define ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH 120
#define ETHTOOL_CMIS_CDB_CMD_PAGE 0x9F
#define ETHTOOL_CMIS_CDB_PAGE_I2C_ADDR 0x50
/**
* struct ethtool_cmis_cdb - CDB commands parameters
* @cmis_rev: CMIS revision major.
* @read_write_len_ext: Allowable additional number of byte octets to the LPL
* in a READ or a WRITE CDB commands.
* @max_completion_time: Maximum CDB command completion time in msec.
*/
struct ethtool_cmis_cdb {
u8 cmis_rev;
u8 read_write_len_ext;
u16 max_completion_time;
};
enum ethtool_cmis_cdb_cmd_id {
ETHTOOL_CMIS_CDB_CMD_QUERY_STATUS = 0x0000,
ETHTOOL_CMIS_CDB_CMD_MODULE_FEATURES = 0x0040,
ETHTOOL_CMIS_CDB_CMD_FW_MANAGMENT_FEATURES = 0x0041,
ETHTOOL_CMIS_CDB_CMD_START_FW_DOWNLOAD = 0x0101,
ETHTOOL_CMIS_CDB_CMD_WRITE_FW_BLOCK_LPL = 0x0103,
ETHTOOL_CMIS_CDB_CMD_COMPLETE_FW_DOWNLOAD = 0x0107,
ETHTOOL_CMIS_CDB_CMD_RUN_FW_IMAGE = 0x0109,
ETHTOOL_CMIS_CDB_CMD_COMMIT_FW_IMAGE = 0x010A,
};
/**
* struct ethtool_cmis_cdb_request - CDB commands request fields as decribed in
* the CMIS standard
* @id: Command ID.
* @epl_len: EPL memory length.
* @lpl_len: LPL memory length.
* @chk_code: Check code for the previous field and the payload.
* @resv1: Added to match the CMIS standard request continuity.
* @resv2: Added to match the CMIS standard request continuity.
* @payload: Payload for the CDB commands.
*/
struct ethtool_cmis_cdb_request {
__be16 id;
struct_group(body,
__be16 epl_len;
u8 lpl_len;
u8 chk_code;
u8 resv1;
u8 resv2;
u8 payload[ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH];
);
};
#define CDB_F_COMPLETION_VALID BIT(0)
#define CDB_F_STATUS_VALID BIT(1)
#define CDB_F_MODULE_STATE_VALID BIT(2)
/**
* struct ethtool_cmis_cdb_cmd_args - CDB commands execution arguments
* @req: CDB command fields as described in the CMIS standard.
* @max_duration: Maximum duration time for command completion in msec.
* @read_write_len_ext: Allowable additional number of byte octets to the LPL
* in a READ or a WRITE commands.
* @msleep_pre_rpl: Waiting time before checking reply in msec.
* @rpl_exp_len: Expected reply length in bytes.
* @flags: Validation flags for CDB commands.
* @err_msg: Error message to be sent to user space.
*/
struct ethtool_cmis_cdb_cmd_args {
struct ethtool_cmis_cdb_request req;
u16 max_duration;
u8 read_write_len_ext;
u8 msleep_pre_rpl;
u8 rpl_exp_len;
u8 flags;
char *err_msg;
};
/**
* struct ethtool_cmis_cdb_rpl_hdr - CDB commands reply header arguments
* @rpl_len: Reply length.
* @rpl_chk_code: Reply check code.
*/
struct ethtool_cmis_cdb_rpl_hdr {
u8 rpl_len;
u8 rpl_chk_code;
};
/**
* struct ethtool_cmis_cdb_rpl - CDB commands reply arguments
* @hdr: CDB commands reply header arguments.
* @payload: Payload for the CDB commands reply.
*/
struct ethtool_cmis_cdb_rpl {
struct ethtool_cmis_cdb_rpl_hdr hdr;
u8 payload[ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH];
};
u32 ethtool_cmis_get_max_payload_size(u8 num_of_byte_octs);
void ethtool_cmis_cdb_compose_args(struct ethtool_cmis_cdb_cmd_args *args,
enum ethtool_cmis_cdb_cmd_id cmd, u8 *pl,
u8 lpl_len, u16 max_duration,
u8 read_write_len_ext, u16 msleep_pre_rpl,
u8 rpl_exp_len, u8 flags);
void ethtool_cmis_cdb_check_completion_flag(u8 cmis_rev, u8 *flags);
void ethtool_cmis_page_init(struct ethtool_module_eeprom *page_data,
u8 page, u32 offset, u32 length);
void ethtool_cmis_page_fini(struct ethtool_module_eeprom *page_data);
struct ethtool_cmis_cdb *
ethtool_cmis_cdb_init(struct net_device *dev,
const struct ethtool_module_fw_flash_params *params,
struct ethnl_module_fw_flash_ntf_params *ntf_params);
void ethtool_cmis_cdb_fini(struct ethtool_cmis_cdb *cdb);
int ethtool_cmis_wait_for_cond(struct net_device *dev, u8 flags, u8 flag,
u16 max_duration, u32 offset,
bool (*cond_success)(u8), bool (*cond_fail)(u8), u8 *state);
int ethtool_cmis_cdb_execute_cmd(struct net_device *dev,
struct ethtool_cmis_cdb_cmd_args *args);
This diff is collapsed.
This diff is collapsed.
...@@ -91,6 +91,12 @@ static int get_module_eeprom_by_page(struct net_device *dev, ...@@ -91,6 +91,12 @@ static int get_module_eeprom_by_page(struct net_device *dev,
{ {
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
if (dev->module_fw_flash_in_progress) {
NL_SET_ERR_MSG(extack,
"Module firmware flashing is in progress");
return -EBUSY;
}
if (dev->sfp_bus) if (dev->sfp_bus)
return sfp_get_module_eeprom_by_page(dev->sfp_bus, page_data, extack); return sfp_get_module_eeprom_by_page(dev->sfp_bus, page_data, extack);
......
...@@ -658,6 +658,9 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) ...@@ -658,6 +658,9 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr)
if (!dev->ethtool_ops->get_link_ksettings) if (!dev->ethtool_ops->get_link_ksettings)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (dev->module_fw_flash_in_progress)
return -EBUSY;
memset(&link_ksettings, 0, sizeof(link_ksettings)); memset(&link_ksettings, 0, sizeof(link_ksettings));
err = dev->ethtool_ops->get_link_ksettings(dev, &link_ksettings); err = dev->ethtool_ops->get_link_ksettings(dev, &link_ksettings);
if (err < 0) if (err < 0)
...@@ -1449,6 +1452,9 @@ static int ethtool_reset(struct net_device *dev, char __user *useraddr) ...@@ -1449,6 +1452,9 @@ static int ethtool_reset(struct net_device *dev, char __user *useraddr)
if (!dev->ethtool_ops->reset) if (!dev->ethtool_ops->reset)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (dev->module_fw_flash_in_progress)
return -EBUSY;
if (copy_from_user(&reset, useraddr, sizeof(reset))) if (copy_from_user(&reset, useraddr, sizeof(reset)))
return -EFAULT; return -EFAULT;
...@@ -2462,6 +2468,9 @@ int ethtool_get_module_info_call(struct net_device *dev, ...@@ -2462,6 +2468,9 @@ int ethtool_get_module_info_call(struct net_device *dev,
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
struct phy_device *phydev = dev->phydev; struct phy_device *phydev = dev->phydev;
if (dev->module_fw_flash_in_progress)
return -EBUSY;
if (dev->sfp_bus) if (dev->sfp_bus)
return sfp_get_module_info(dev->sfp_bus, modinfo); return sfp_get_module_info(dev->sfp_bus, modinfo);
...@@ -2499,6 +2508,9 @@ int ethtool_get_module_eeprom_call(struct net_device *dev, ...@@ -2499,6 +2508,9 @@ int ethtool_get_module_eeprom_call(struct net_device *dev,
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
struct phy_device *phydev = dev->phydev; struct phy_device *phydev = dev->phydev;
if (dev->module_fw_flash_in_progress)
return -EBUSY;
if (dev->sfp_bus) if (dev->sfp_bus)
return sfp_get_module_eeprom(dev->sfp_bus, ee, data); return sfp_get_module_eeprom(dev->sfp_bus, ee, data);
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0-only */
#include <uapi/linux/ethtool.h>
#include "netlink.h"
/**
* struct ethnl_module_fw_flash_ntf_params - module firmware flashing
* notifications parameters
* @portid: Netlink portid of sender.
* @seq: Sequence number of sender.
* @closed_sock: Indicates whether the socket was closed from user space.
*/
struct ethnl_module_fw_flash_ntf_params {
u32 portid;
u32 seq;
bool closed_sock;
};
/**
* struct ethtool_module_fw_flash_params - module firmware flashing parameters
* @password: Module password. Only valid when @pass_valid is set.
* @password_valid: Whether the module password is valid or not.
*/
struct ethtool_module_fw_flash_params {
__be32 password;
u8 password_valid:1;
};
/**
* struct ethtool_cmis_fw_update_params - CMIS firmware update specific
* parameters
* @dev: Pointer to the net_device to be flashed.
* @params: Module firmware flashing parameters.
* @ntf_params: Module firmware flashing notification parameters.
* @fw: Firmware to flash.
*/
struct ethtool_cmis_fw_update_params {
struct net_device *dev;
struct ethtool_module_fw_flash_params params;
struct ethnl_module_fw_flash_ntf_params ntf_params;
const struct firmware *fw;
};
/**
* struct ethtool_module_fw_flash - module firmware flashing
* @list: List node for &module_fw_flash_work_list.
* @dev_tracker: Refcount tracker for @dev.
* @work: The flashing firmware work.
* @fw_update: CMIS firmware update specific parameters.
*/
struct ethtool_module_fw_flash {
struct list_head list;
netdevice_tracker dev_tracker;
struct work_struct work;
struct ethtool_cmis_fw_update_params fw_update;
};
void ethnl_module_fw_flash_sock_destroy(struct ethnl_sock_priv *sk_priv);
void
ethnl_module_fw_flash_ntf_err(struct net_device *dev,
struct ethnl_module_fw_flash_ntf_params *params,
char *err_msg, char *sub_err_msg);
void
ethnl_module_fw_flash_ntf_start(struct net_device *dev,
struct ethnl_module_fw_flash_ntf_params *params);
void
ethnl_module_fw_flash_ntf_complete(struct net_device *dev,
struct ethnl_module_fw_flash_ntf_params *params);
void
ethnl_module_fw_flash_ntf_in_progress(struct net_device *dev,
struct ethnl_module_fw_flash_ntf_params *params,
u64 done, u64 total);
void ethtool_cmis_fw_update(struct ethtool_cmis_fw_update_params *params);
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/ethtool_netlink.h> #include <linux/ethtool_netlink.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include "netlink.h" #include "netlink.h"
#include "module_fw.h"
static struct genl_family ethtool_genl_family; static struct genl_family ethtool_genl_family;
...@@ -30,6 +31,35 @@ const struct nla_policy ethnl_header_policy_stats[] = { ...@@ -30,6 +31,35 @@ const struct nla_policy ethnl_header_policy_stats[] = {
ETHTOOL_FLAGS_STATS), ETHTOOL_FLAGS_STATS),
}; };
int ethnl_sock_priv_set(struct sk_buff *skb, struct net_device *dev, u32 portid,
enum ethnl_sock_type type)
{
struct ethnl_sock_priv *sk_priv;
sk_priv = genl_sk_priv_get(&ethtool_genl_family, NETLINK_CB(skb).sk);
if (IS_ERR(sk_priv))
return PTR_ERR(sk_priv);
sk_priv->dev = dev;
sk_priv->portid = portid;
sk_priv->type = type;
return 0;
}
static void ethnl_sock_priv_destroy(void *priv)
{
struct ethnl_sock_priv *sk_priv = priv;
switch (sk_priv->type) {
case ETHTOOL_SOCK_TYPE_MODULE_FW_FLASH:
ethnl_module_fw_flash_sock_destroy(sk_priv);
break;
default:
break;
}
}
int ethnl_ops_begin(struct net_device *dev) int ethnl_ops_begin(struct net_device *dev)
{ {
int ret; int ret;
...@@ -239,6 +269,11 @@ void *ethnl_bcastmsg_put(struct sk_buff *skb, u8 cmd) ...@@ -239,6 +269,11 @@ void *ethnl_bcastmsg_put(struct sk_buff *skb, u8 cmd)
cmd); cmd);
} }
void *ethnl_unicast_put(struct sk_buff *skb, u32 portid, u32 seq, u8 cmd)
{
return genlmsg_put(skb, portid, seq, &ethtool_genl_family, 0, cmd);
}
int ethnl_multicast(struct sk_buff *skb, struct net_device *dev) int ethnl_multicast(struct sk_buff *skb, struct net_device *dev)
{ {
return genlmsg_multicast_netns(&ethtool_genl_family, dev_net(dev), skb, return genlmsg_multicast_netns(&ethtool_genl_family, dev_net(dev), skb,
...@@ -760,10 +795,22 @@ static void ethnl_notify_features(struct netdev_notifier_info *info) ...@@ -760,10 +795,22 @@ static void ethnl_notify_features(struct netdev_notifier_info *info)
static int ethnl_netdev_event(struct notifier_block *this, unsigned long event, static int ethnl_netdev_event(struct notifier_block *this, unsigned long event,
void *ptr) void *ptr)
{ {
struct netdev_notifier_info *info = ptr;
struct netlink_ext_ack *extack;
struct net_device *dev;
dev = netdev_notifier_info_to_dev(info);
extack = netdev_notifier_info_to_extack(info);
switch (event) { switch (event) {
case NETDEV_FEAT_CHANGE: case NETDEV_FEAT_CHANGE:
ethnl_notify_features(ptr); ethnl_notify_features(ptr);
break; break;
case NETDEV_PRE_UP:
if (dev->module_fw_flash_in_progress) {
NL_SET_ERR_MSG(extack, "Can't set port up while flashing module firmware");
return NOTIFY_BAD;
}
} }
return NOTIFY_DONE; return NOTIFY_DONE;
...@@ -1125,6 +1172,13 @@ static const struct genl_ops ethtool_genl_ops[] = { ...@@ -1125,6 +1172,13 @@ static const struct genl_ops ethtool_genl_ops[] = {
.policy = ethnl_mm_set_policy, .policy = ethnl_mm_set_policy,
.maxattr = ARRAY_SIZE(ethnl_mm_set_policy) - 1, .maxattr = ARRAY_SIZE(ethnl_mm_set_policy) - 1,
}, },
{
.cmd = ETHTOOL_MSG_MODULE_FW_FLASH_ACT,
.flags = GENL_UNS_ADMIN_PERM,
.doit = ethnl_act_module_fw_flash,
.policy = ethnl_module_fw_flash_act_policy,
.maxattr = ARRAY_SIZE(ethnl_module_fw_flash_act_policy) - 1,
},
}; };
static const struct genl_multicast_group ethtool_nl_mcgrps[] = { static const struct genl_multicast_group ethtool_nl_mcgrps[] = {
...@@ -1141,6 +1195,8 @@ static struct genl_family ethtool_genl_family __ro_after_init = { ...@@ -1141,6 +1195,8 @@ static struct genl_family ethtool_genl_family __ro_after_init = {
.resv_start_op = ETHTOOL_MSG_MODULE_GET + 1, .resv_start_op = ETHTOOL_MSG_MODULE_GET + 1,
.mcgrps = ethtool_nl_mcgrps, .mcgrps = ethtool_nl_mcgrps,
.n_mcgrps = ARRAY_SIZE(ethtool_nl_mcgrps), .n_mcgrps = ARRAY_SIZE(ethtool_nl_mcgrps),
.sock_priv_size = sizeof(struct ethnl_sock_priv),
.sock_priv_destroy = ethnl_sock_priv_destroy,
}; };
/* module setup */ /* module setup */
......
...@@ -21,6 +21,7 @@ struct sk_buff *ethnl_reply_init(size_t payload, struct net_device *dev, u8 cmd, ...@@ -21,6 +21,7 @@ struct sk_buff *ethnl_reply_init(size_t payload, struct net_device *dev, u8 cmd,
void **ehdrp); void **ehdrp);
void *ethnl_dump_put(struct sk_buff *skb, struct netlink_callback *cb, u8 cmd); void *ethnl_dump_put(struct sk_buff *skb, struct netlink_callback *cb, u8 cmd);
void *ethnl_bcastmsg_put(struct sk_buff *skb, u8 cmd); void *ethnl_bcastmsg_put(struct sk_buff *skb, u8 cmd);
void *ethnl_unicast_put(struct sk_buff *skb, u32 portid, u32 seq, u8 cmd);
int ethnl_multicast(struct sk_buff *skb, struct net_device *dev); int ethnl_multicast(struct sk_buff *skb, struct net_device *dev);
/** /**
...@@ -283,6 +284,19 @@ struct ethnl_reply_data { ...@@ -283,6 +284,19 @@ struct ethnl_reply_data {
int ethnl_ops_begin(struct net_device *dev); int ethnl_ops_begin(struct net_device *dev);
void ethnl_ops_complete(struct net_device *dev); void ethnl_ops_complete(struct net_device *dev);
enum ethnl_sock_type {
ETHTOOL_SOCK_TYPE_MODULE_FW_FLASH,
};
struct ethnl_sock_priv {
struct net_device *dev;
u32 portid;
enum ethnl_sock_type type;
};
int ethnl_sock_priv_set(struct sk_buff *skb, struct net_device *dev, u32 portid,
enum ethnl_sock_type type);
/** /**
* struct ethnl_request_ops - unified handling of GET and SET requests * struct ethnl_request_ops - unified handling of GET and SET requests
* @request_cmd: command id for request (GET) * @request_cmd: command id for request (GET)
...@@ -441,6 +455,7 @@ extern const struct nla_policy ethnl_plca_set_cfg_policy[ETHTOOL_A_PLCA_MAX + 1] ...@@ -441,6 +455,7 @@ extern const struct nla_policy ethnl_plca_set_cfg_policy[ETHTOOL_A_PLCA_MAX + 1]
extern const struct nla_policy ethnl_plca_get_status_policy[ETHTOOL_A_PLCA_HEADER + 1]; extern const struct nla_policy ethnl_plca_get_status_policy[ETHTOOL_A_PLCA_HEADER + 1];
extern const struct nla_policy ethnl_mm_get_policy[ETHTOOL_A_MM_HEADER + 1]; extern const struct nla_policy ethnl_mm_get_policy[ETHTOOL_A_MM_HEADER + 1];
extern const struct nla_policy ethnl_mm_set_policy[ETHTOOL_A_MM_MAX + 1]; extern const struct nla_policy ethnl_mm_set_policy[ETHTOOL_A_MM_MAX + 1];
extern const struct nla_policy ethnl_module_fw_flash_act_policy[ETHTOOL_A_MODULE_FW_FLASH_PASSWORD + 1];
int ethnl_set_features(struct sk_buff *skb, struct genl_info *info); int ethnl_set_features(struct sk_buff *skb, struct genl_info *info);
int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info); int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info);
...@@ -448,6 +463,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info); ...@@ -448,6 +463,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info);
int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info); int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info);
int ethnl_tunnel_info_start(struct netlink_callback *cb); int ethnl_tunnel_info_start(struct netlink_callback *cb);
int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb); int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb);
int ethnl_act_module_fw_flash(struct sk_buff *skb, struct genl_info *info);
extern const char stats_std_names[__ETHTOOL_STATS_CNT][ETH_GSTRING_LEN]; extern const char stats_std_names[__ETHTOOL_STATS_CNT][ETH_GSTRING_LEN];
extern const char stats_eth_phy_names[__ETHTOOL_A_STATS_ETH_PHY_CNT][ETH_GSTRING_LEN]; extern const char stats_eth_phy_names[__ETHTOOL_A_STATS_ETH_PHY_CNT][ETH_GSTRING_LEN];
......
...@@ -16,7 +16,8 @@ get_hdr_inc=-D$(1) -include $(UAPI_PATH)/linux/$(2) ...@@ -16,7 +16,8 @@ get_hdr_inc=-D$(1) -include $(UAPI_PATH)/linux/$(2)
CFLAGS_devlink:=$(call get_hdr_inc,_LINUX_DEVLINK_H_,devlink.h) CFLAGS_devlink:=$(call get_hdr_inc,_LINUX_DEVLINK_H_,devlink.h)
CFLAGS_dpll:=$(call get_hdr_inc,_LINUX_DPLL_H,dpll.h) CFLAGS_dpll:=$(call get_hdr_inc,_LINUX_DPLL_H,dpll.h)
CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_H_,ethtool_netlink.h) CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_H,ethtool.h) \
$(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_H_,ethtool_netlink.h)
CFLAGS_handshake:=$(call get_hdr_inc,_LINUX_HANDSHAKE_H,handshake.h) CFLAGS_handshake:=$(call get_hdr_inc,_LINUX_HANDSHAKE_H,handshake.h)
CFLAGS_mptcp_pm:=$(call get_hdr_inc,_LINUX_MPTCP_PM_H,mptcp_pm.h) CFLAGS_mptcp_pm:=$(call get_hdr_inc,_LINUX_MPTCP_PM_H,mptcp_pm.h)
CFLAGS_netdev:=$(call get_hdr_inc,_LINUX_NETDEV_H,netdev.h) CFLAGS_netdev:=$(call get_hdr_inc,_LINUX_NETDEV_H,netdev.h)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment