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.
61 /* ksz_supported_apptrust[] - Supported apptrust selectors and Priority Order
65 * the index within the array indicates the priority of the selector - lower
72 * non-configurable precedence where certain types of priority information
75 * 1. Tail Tag - Highest priority, overrides ACL, VLAN PCP, and DSCP priorities.
76 * 2. ACL - Overrides VLAN PCP and DSCP priorities.
77 * 3. VLAN PCP - Overrides DSCP priority.
78 * 4. DSCP - Lowest priority, does not override any other priority source.
84 * DCB_APP_SEL_PCP - Priority Code Point selector
85 * IEEE_8021QAZ_APP_SEL_DSCP - Differentiated Services Code Point selector
113 * ksz_get_dscp_prio_reg - Retrieves the DSCP-to-priority-mapping register
116 * @per_reg: Pointer to the number of DSCP values per register
119 * This function retrieves the DSCP to priority mapping register, the number of
143 * ksz_get_apptrust_map_and_reg - Retrieves the apptrust map and register
171 * ksz_port_get_default_prio - Retrieves the default priority for a port on a
174 * @port: Port number from which to get the default priority
176 * This function fetches the default priority for the specified port on a KSZ
179 * Return: The default priority of the port on success, or a negative error
182 int ksz_port_get_default_prio(struct dsa_switch *ds, int port) in ksz_port_get_default_prio() argument
184 struct ksz_device *dev = ds->priv; in ksz_port_get_default_prio()
190 ret = ksz_pread8(dev, port, reg, &data); in ksz_port_get_default_prio()
198 * ksz_port_set_default_prio - Sets the default priority for a port on a KSZ
201 * @port: Port number for which to set the default priority
204 * This function sets the default priority for the specified port on a KSZ
209 int ksz_port_set_default_prio(struct dsa_switch *ds, int port, u8 prio) in ksz_port_set_default_prio() argument
211 struct ksz_device *dev = ds->priv; in ksz_port_set_default_prio()
215 if (prio >= dev->info->num_ipms) in ksz_port_set_default_prio()
216 return -EINVAL; in ksz_port_set_default_prio()
220 return ksz_prmw8(dev, port, reg, mask, (prio << shift) & mask); in ksz_port_set_default_prio()
224 * ksz_port_get_dscp_prio - Retrieves the priority for a DSCP value on a KSZ
227 * @port: Port number for which to get the priority
230 * This function fetches the priority value from switch global DSCP-to-priorty
236 int ksz_port_get_dscp_prio(struct dsa_switch *ds, int port, u8 dscp) in ksz_port_get_dscp_prio() argument
238 struct ksz_device *dev = ds->priv; in ksz_port_get_dscp_prio()
244 /* If DSCP remapping is disabled, DSCP bits 3-5 are used as Internal in ksz_port_get_dscp_prio()
252 /* If DSCP remapping is disabled, DSCP bits 3-5 are used as in ksz_port_get_dscp_prio()
274 * ksz_set_global_dscp_entry - Sets the global DSCP-to-priority mapping entry
279 * This function sets the global DSCP-to-priority mapping entry for the
298 * ksz_init_global_dscp_map - Initializes the global DSCP-to-priority mapping
301 * This function initializes the global DSCP-to-priority mapping table for the
339 ipm = ieee8021q_tt_to_tc(tt, dev->info->num_tx_queues); in ksz_init_global_dscp_map()
352 * ksz_port_add_dscp_prio - Adds a DSCP-to-priority mapping entry for a port on
355 * @port: Port number for which to add the DSCP-to-priority mapping entry
361 int ksz_port_add_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio) in ksz_port_add_dscp_prio() argument
363 struct ksz_device *dev = ds->priv; in ksz_port_add_dscp_prio()
365 if (prio >= dev->info->num_ipms) in ksz_port_add_dscp_prio()
366 return -ERANGE; in ksz_port_add_dscp_prio()
372 * ksz_port_del_dscp_prio - Deletes a DSCP-to-priority mapping entry for a port
375 * @port: Port number for which to delete the DSCP-to-priority mapping entry
381 int ksz_port_del_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, u8 prio) in ksz_port_del_dscp_prio() argument
383 struct ksz_device *dev = ds->priv; in ksz_port_del_dscp_prio()
386 if (ksz_port_get_dscp_prio(ds, port, dscp) != prio) in ksz_port_del_dscp_prio()
391 dev->info->num_tx_queues); in ksz_port_del_dscp_prio()
402 * ksz_apptrust_error - Prints an error message for an invalid apptrust selector
423 dev_err(dev->dev, "Invalid apptrust selector or priority order. Supported: %s\n", in ksz_apptrust_error()
428 * ksz_port_set_apptrust_validate - Validates the apptrust selectors
430 * @port: Port number for which to set the apptrust selectors
432 * @nsel: Number of apptrust selectors in the array
440 * 1. DCB_APP_SEL_PCP - Priority Code Point selector (highest priority)
441 * 2. IEEE_8021QAZ_APP_SEL_DSCP - Differentiated Services Code Point selector
446 static int ksz_port_set_apptrust_validate(struct ksz_device *dev, int port, in ksz_port_set_apptrust_validate() argument
482 return -EINVAL; in ksz_port_set_apptrust_validate()
486 * ksz_port_set_apptrust - Sets the apptrust selectors for a port on a KSZ
489 * @port: Port number for which to set the apptrust selectors
491 * @nsel: Number of apptrust selectors in the array
493 * This function sets the apptrust selectors for the specified port on a KSZ
498 int ksz_port_set_apptrust(struct dsa_switch *ds, int port, in ksz_port_set_apptrust() argument
502 struct ksz_device *dev = ds->priv; in ksz_port_set_apptrust()
507 ret = ksz_port_set_apptrust_validate(dev, port, sel, nsel); in ksz_port_set_apptrust()
525 return ksz_prmw8(dev, port, reg, mask, data); in ksz_port_set_apptrust()
529 * ksz_port_get_apptrust - Retrieves the apptrust selectors for a port on a KSZ
532 * @port: Port number for which to get the apptrust selectors
534 * @nsel: Number of apptrust selectors in the array
536 * This function fetches the apptrust selectors for the specified port on a KSZ
541 int ksz_port_get_apptrust(struct dsa_switch *ds, int port, u8 *sel, int *nsel) in ksz_port_get_apptrust() argument
544 struct ksz_device *dev = ds->priv; in ksz_port_get_apptrust()
551 ret = ksz_pread8(dev, port, reg, &data); in ksz_port_get_apptrust()
565 * ksz_dcb_init_port - Initializes the DCB configuration for a port on a KSZ
567 * @port: Port number for which to initialize the DCB configuration
569 * This function initializes the DCB configuration for the specified port on a
570 * KSZ switch. Particular DCB configuration is set for the port, including the
577 int ksz_dcb_init_port(struct ksz_device *dev, int port) in ksz_dcb_init_port() argument
584 dev->info->num_tx_queues); in ksz_dcb_init_port()
591 /* Set the default priority for the port to Best Effort */ in ksz_dcb_init_port()
592 ret = ksz_port_set_default_prio(dev->ds, port, ipm); in ksz_dcb_init_port()
596 return ksz_port_set_apptrust(dev->ds, port, ksz_default_apptrust, in ksz_dcb_init_port()
601 * ksz_dcb_init - Initializes the DCB configuration for a KSZ switch
605 * DSCP-to-priority mapping table is initialized.