Lines Matching +full:port +full:- +full:number
1 // SPDX-License-Identifier: GPL-2.0
13 /* Port X Control 0 register.
14 * The datasheet specifies: Port 1 - 0x10, Port 2 - 0x20, Port 3 - 0x30.
15 * However, the driver uses get_port_addr(), which maps Port 1 to offset 0.
59 /* ksz_supported_apptrust[] - Supported apptrust selectors and Priority Order
63 * the index within the array indicates the priority of the selector - lower
70 * non-configurable precedence where certain types of priority information
73 * 1. Tail Tag - Highest priority, overrides ACL, VLAN PCP, and DSCP priorities.
74 * 2. ACL - Overrides VLAN PCP and DSCP priorities.
75 * 3. VLAN PCP - Overrides DSCP priority.
76 * 4. DSCP - Lowest priority, does not override any other priority source.
82 * DCB_APP_SEL_PCP - Priority Code Point selector
83 * IEEE_8021QAZ_APP_SEL_DSCP - Differentiated Services Code Point selector
109 * ksz_get_dscp_prio_reg - Retrieves the DSCP-to-priority-mapping register
112 * @per_reg: Pointer to the number of DSCP values per register
115 * This function retrieves the DSCP to priority mapping register, the number of
137 * ksz_get_apptrust_map_and_reg - Retrieves the apptrust map and register
163 * ksz_port_get_default_prio - Retrieves the default priority for a port on a
166 * @port: Port number from which to get the default priority
168 * This function fetches the default priority for the specified port on a KSZ
171 * Return: The default priority of the port on success, or a negative error
174 int ksz_port_get_default_prio(struct dsa_switch *ds, int port) in ksz_port_get_default_prio() argument
176 struct ksz_device *dev = ds->priv; in ksz_port_get_default_prio()
182 ret = ksz_pread8(dev, port, reg, &data); in ksz_port_get_default_prio()
190 * ksz_port_set_default_prio - Sets the default priority for a port on a KSZ
193 * @port: Port number for which to set the default priority
196 * This function sets the default priority for the specified port on a KSZ
201 int ksz_port_set_default_prio(struct dsa_switch *ds, int port, u8 prio) in ksz_port_set_default_prio() argument
203 struct ksz_device *dev = ds->priv; in ksz_port_set_default_prio()
207 if (prio >= dev->info->num_ipms) in ksz_port_set_default_prio()
208 return -EINVAL; in ksz_port_set_default_prio()
212 return ksz_prmw8(dev, port, reg, mask, (prio << shift) & mask); in ksz_port_set_default_prio()
216 * ksz_port_get_dscp_prio - Retrieves the priority for a DSCP value on a KSZ
219 * @port: Port number for which to get the priority
222 * This function fetches the priority value from switch global DSCP-to-priorty
228 int ksz_port_get_dscp_prio(struct dsa_switch *ds, int port, u8 dscp) in ksz_port_get_dscp_prio() argument
230 struct ksz_device *dev = ds->priv; in ksz_port_get_dscp_prio()
236 /* If DSCP remapping is disabled, DSCP bits 3-5 are used as Internal in ksz_port_get_dscp_prio()
244 /* If DSCP remapping is disabled, DSCP bits 3-5 are used as in ksz_port_get_dscp_prio()
266 * ksz_set_global_dscp_entry - Sets the global DSCP-to-priority mapping entry
271 * This function sets the global DSCP-to-priority mapping entry for the
290 * ksz_init_global_dscp_map - Initializes the global DSCP-to-priority mapping
293 * This function initializes the global DSCP-to-priority mapping table for the
331 ipm = ieee8021q_tt_to_tc(tt, dev->info->num_tx_queues); in ksz_init_global_dscp_map()
344 * ksz_port_add_dscp_prio - Adds a DSCP-to-priority mapping entry for a port on
347 * @port: Port number for which to add the DSCP-to-priority mapping entry
353 int ksz_port_add_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio) in ksz_port_add_dscp_prio() argument
355 struct ksz_device *dev = ds->priv; in ksz_port_add_dscp_prio()
357 if (prio >= dev->info->num_ipms) in ksz_port_add_dscp_prio()
358 return -ERANGE; in ksz_port_add_dscp_prio()
364 * ksz_port_del_dscp_prio - Deletes a DSCP-to-priority mapping entry for a port
367 * @port: Port number for which to delete the DSCP-to-priority mapping entry
373 int ksz_port_del_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio) in ksz_port_del_dscp_prio() argument
375 struct ksz_device *dev = ds->priv; in ksz_port_del_dscp_prio()
378 if (ksz_port_get_dscp_prio(ds, port, dscp) != prio) in ksz_port_del_dscp_prio()
383 dev->info->num_tx_queues); in ksz_port_del_dscp_prio()
394 * ksz_apptrust_error - Prints an error message for an invalid apptrust selector
415 dev_err(dev->dev, "Invalid apptrust selector or priority order. Supported: %s\n", in ksz_apptrust_error()
420 * ksz_port_set_apptrust_validate - Validates the apptrust selectors
422 * @port: Port number for which to set the apptrust selectors
424 * @nsel: Number of apptrust selectors in the array
432 * 1. DCB_APP_SEL_PCP - Priority Code Point selector (highest priority)
433 * 2. IEEE_8021QAZ_APP_SEL_DSCP - Differentiated Services Code Point selector
438 static int ksz_port_set_apptrust_validate(struct ksz_device *dev, int port, in ksz_port_set_apptrust_validate() argument
474 return -EINVAL; in ksz_port_set_apptrust_validate()
478 * ksz_port_set_apptrust - Sets the apptrust selectors for a port on a KSZ
481 * @port: Port number for which to set the apptrust selectors
483 * @nsel: Number of apptrust selectors in the array
485 * This function sets the apptrust selectors for the specified port on a KSZ
490 int ksz_port_set_apptrust(struct dsa_switch *ds, int port, in ksz_port_set_apptrust() argument
494 struct ksz_device *dev = ds->priv; in ksz_port_set_apptrust()
499 ret = ksz_port_set_apptrust_validate(dev, port, sel, nsel); in ksz_port_set_apptrust()
517 return ksz_prmw8(dev, port, reg, mask, data); in ksz_port_set_apptrust()
521 * ksz_port_get_apptrust - Retrieves the apptrust selectors for a port on a KSZ
524 * @port: Port number for which to get the apptrust selectors
526 * @nsel: Number of apptrust selectors in the array
528 * This function fetches the apptrust selectors for the specified port on a KSZ
533 int ksz_port_get_apptrust(struct dsa_switch *ds, int port, u8 *sel, int *nsel) in ksz_port_get_apptrust() argument
536 struct ksz_device *dev = ds->priv; in ksz_port_get_apptrust()
543 ret = ksz_pread8(dev, port, reg, &data); in ksz_port_get_apptrust()
557 * ksz_dcb_init_port - Initializes the DCB configuration for a port on a KSZ
559 * @port: Port number for which to initialize the DCB configuration
561 * This function initializes the DCB configuration for the specified port on a
562 * KSZ switch. Particular DCB configuration is set for the port, including the
569 int ksz_dcb_init_port(struct ksz_device *dev, int port) in ksz_dcb_init_port() argument
576 dev->info->num_tx_queues); in ksz_dcb_init_port()
583 /* Set the default priority for the port to Best Effort */ in ksz_dcb_init_port()
584 ret = ksz_port_set_default_prio(dev->ds, port, ipm); in ksz_dcb_init_port()
588 return ksz_port_set_apptrust(dev->ds, port, ksz_default_apptrust, in ksz_dcb_init_port()
593 * ksz_dcb_init - Initializes the DCB configuration for a KSZ switch
597 * DSCP-to-priority mapping table is initialized.