]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
dpaa2-switch: reduce the size of the if_id bitmap to 64 bits
authorIoana Ciornei <ioana.ciornei@nxp.com>
Tue, 16 Mar 2021 14:55:10 +0000 (16:55 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Mar 2021 22:29:49 +0000 (15:29 -0700)
The maximum number of DPAA2 switch interfaces, including the control
interface, is 64. Even though this restriction existed from the first
place, the command structures which use an interface id bitmap were
poorly described and even though a single uint64_t is enough, all of
them used an array of 4 uint64_t's.
Fix this by reducing the size of the interface id field to a single
uint64_t.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/dpaa2/dpsw-cmd.h
drivers/net/ethernet/freescale/dpaa2/dpsw.c

index 2371fd5c40e320cf91133fd0286ae2c27b1e476c..996a59dcd01db8c8fadc7e638d997368216bc79f 100644 (file)
@@ -340,7 +340,7 @@ struct dpsw_cmd_vlan_manage_if {
        __le16 vlan_id;
        __le32 pad1;
        /* cmd word 1-4 */
-       __le64 if_id[4];
+       __le64 if_id;
 };
 
 struct dpsw_cmd_vlan_remove {
@@ -386,7 +386,7 @@ struct dpsw_cmd_fdb_multicast_op {
        u8 mac_addr[6];
        __le16 pad2;
        /* cmd word 2-5 */
-       __le64 if_id[4];
+       __le64 if_id;
 };
 
 struct dpsw_cmd_fdb_dump {
index ad7a4c03b130d9a8fcce1819faaf0c1966e92953..ef0f90ae683ff4ff44f1b7ae38972c9e68d85bd0 100644 (file)
@@ -773,16 +773,18 @@ int dpsw_vlan_add_if(struct fsl_mc_io *mc_io,
                     u16 vlan_id,
                     const struct dpsw_vlan_if_cfg *cfg)
 {
+       struct dpsw_cmd_vlan_add_if *cmd_params;
        struct fsl_mc_command cmd = { 0 };
-       struct dpsw_cmd_vlan_manage_if *cmd_params;
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPSW_CMDID_VLAN_ADD_IF,
                                          cmd_flags,
                                          token);
-       cmd_params = (struct dpsw_cmd_vlan_manage_if *)cmd.params;
+       cmd_params = (struct dpsw_cmd_vlan_add_if *)cmd.params;
        cmd_params->vlan_id = cpu_to_le16(vlan_id);
-       build_if_id_bitmap(cmd_params->if_id, cfg->if_id, cfg->num_ifs);
+       cmd_params->options = cpu_to_le16(cfg->options);
+       cmd_params->fdb_id = cpu_to_le16(cfg->fdb_id);
+       build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
@@ -820,7 +822,7 @@ int dpsw_vlan_add_if_untagged(struct fsl_mc_io *mc_io,
                                          token);
        cmd_params = (struct dpsw_cmd_vlan_manage_if *)cmd.params;
        cmd_params->vlan_id = cpu_to_le16(vlan_id);
-       build_if_id_bitmap(cmd_params->if_id, cfg->if_id, cfg->num_ifs);
+       build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
@@ -854,7 +856,7 @@ int dpsw_vlan_remove_if(struct fsl_mc_io *mc_io,
                                          token);
        cmd_params = (struct dpsw_cmd_vlan_manage_if *)cmd.params;
        cmd_params->vlan_id = cpu_to_le16(vlan_id);
-       build_if_id_bitmap(cmd_params->if_id, cfg->if_id, cfg->num_ifs);
+       build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
@@ -890,7 +892,7 @@ int dpsw_vlan_remove_if_untagged(struct fsl_mc_io *mc_io,
                                          token);
        cmd_params = (struct dpsw_cmd_vlan_manage_if *)cmd.params;
        cmd_params->vlan_id = cpu_to_le16(vlan_id);
-       build_if_id_bitmap(cmd_params->if_id, cfg->if_id, cfg->num_ifs);
+       build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
@@ -1140,7 +1142,7 @@ int dpsw_fdb_add_multicast(struct fsl_mc_io *mc_io,
        cmd_params->fdb_id = cpu_to_le16(fdb_id);
        cmd_params->num_ifs = cpu_to_le16(cfg->num_ifs);
        dpsw_set_field(cmd_params->type, ENTRY_TYPE, cfg->type);
-       build_if_id_bitmap(cmd_params->if_id, cfg->if_id, cfg->num_ifs);
+       build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs);
        for (i = 0; i < 6; i++)
                cmd_params->mac_addr[i] = cfg->mac_addr[5 - i];
 
@@ -1182,7 +1184,7 @@ int dpsw_fdb_remove_multicast(struct fsl_mc_io *mc_io,
        cmd_params->fdb_id = cpu_to_le16(fdb_id);
        cmd_params->num_ifs = cpu_to_le16(cfg->num_ifs);
        dpsw_set_field(cmd_params->type, ENTRY_TYPE, cfg->type);
-       build_if_id_bitmap(cmd_params->if_id, cfg->if_id, cfg->num_ifs);
+       build_if_id_bitmap(&cmd_params->if_id, cfg->if_id, cfg->num_ifs);
        for (i = 0; i < 6; i++)
                cmd_params->mac_addr[i] = cfg->mac_addr[5 - i];