|
140 | 140 |
|
141 | 141 |  |
142 | 142 |
|
| 143 | +## Custom SerDes attributes |
| 144 | + |
| 145 | +Custom SerDes attributes are vendor-specific SerDes settings that are not covered by standard `SAI_PORT_SERDES_*` attributes, especially those not suitable for public standardization in SAI (for example, proprietary ones). `SAI_PORT_SERDES_ATTR_CUSTOM_COLLECTION` was introduced to carry these settings as a single JSON string based attribute. |
| 146 | + |
| 147 | +In media_settings.json, define custom attributes under the top-level `CUSTOM_MEDIA_SETTINGS` section using keys prefixed with `CUSTOM:` (for example, `CUSTOM:XYZ`). `CUSTOM_MEDIA_SETTINGS` is keyed by physical port selectors and supports the same selector syntax as `GLOBAL_MEDIA_SETTINGS` (ranges, lists, list-of-ranges, and single-port keys). xcvrd's media_settings_parser strips the prefix, and aggregates them into a single JSON string field `custom_serdes_attrs` in APPL_DB `PORT_TABLE`. The JSON format is a list of attribute objects, each with a per-lane `value` array sized for the logical port, and portsorch maps that field to `SAI_PORT_SERDES_ATTR_CUSTOM_COLLECTION`. portsorch doesn't interpret the contents; it simply passes it through to SAI. |
| 148 | + |
| 149 | +Within each port selector, the media/vendor key matching, lane speed pattern matching, and `Default` fallback behavior are identical to traditional `GLOBAL_MEDIA_SETTINGS` and `PORT_MEDIA_SETTINGS`. |
| 150 | + |
| 151 | +### Value of `SAI_PORT_SERDES_ATTR_CUSTOM_COLLECTION` is a JSON string in the following format |
| 152 | + |
| 153 | +``` |
| 154 | +{ |
| 155 | + "attributes": [ |
| 156 | + { |
| 157 | + "XYZ": { |
| 158 | + "value": [10, 11, 12, 13] |
| 159 | + } |
| 160 | + }, |
| 161 | + { |
| 162 | + "ABC": { |
| 163 | + "value": ["mode_a", "mode_b", "mode_c", "mode_d"] |
| 164 | + } |
| 165 | + } |
| 166 | + ] |
| 167 | +} |
| 168 | +``` |
| 169 | + |
| 170 | +Note: The above JSON is formatted with spaces and newlines for readability to help understand the structure. The actual value written to APPL_DB by xcvrd is compressed (spaces and newlines removed) to achieve minimal payload size. |
| 171 | + |
| 172 | +### Example media_settings.json with only custom attributes |
| 173 | + |
| 174 | +``` |
| 175 | +{ |
| 176 | + "CUSTOM_MEDIA_SETTINGS": { |
| 177 | + "1-32": { |
| 178 | + "Default": { |
| 179 | + "CUSTOM:XYZ": { |
| 180 | + "lane0": 10, |
| 181 | + "lane1": 11, |
| 182 | + "lane2": 12, |
| 183 | + "lane3": 13 |
| 184 | + }, |
| 185 | + "CUSTOM:ABC": { |
| 186 | + "lane0": "mode_a", |
| 187 | + "lane1": "mode_b", |
| 188 | + "lane2": "mode_c", |
| 189 | + "lane3": "mode_d" |
| 190 | + } |
| 191 | + } |
| 192 | + } |
| 193 | + } |
| 194 | +} |
| 195 | +``` |
| 196 | + |
| 197 | +Example APPL_DB PORT_TABLE entry based on the above media_settings.json: |
| 198 | + |
| 199 | +``` |
| 200 | +# sonic-db-cli APPL_DB hgetall "PORT_TABLE:EthernetXXX" |
| 201 | +{ |
| 202 | + ... |
| 203 | + 'custom_serdes_attrs': '{"attributes":[{"XYZ":{"value":[10,11,12,13]}},{"ABC":{"value":["mode_a","mode_b","mode_c","mode_d"]}}]}' |
| 204 | + ... |
| 205 | +} |
| 206 | +``` |
| 207 | + |
| 208 | +### Example media_settings.json with mixed traditional and custom attributes |
| 209 | + |
| 210 | +``` |
| 211 | +{ |
| 212 | + "GLOBAL_MEDIA_SETTINGS": { |
| 213 | + "1-32": { |
| 214 | + "Default": { |
| 215 | + "preemphasis": { |
| 216 | + "lane0": "0x112233", |
| 217 | + "lane1": "0x112233", |
| 218 | + "lane2": "0x112244", |
| 219 | + "lane3": "0x443322" |
| 220 | + }, |
| 221 | + "idriver": { |
| 222 | + "lane0": "0xb", |
| 223 | + "lane1": "0xc", |
| 224 | + "lane2": "0xd", |
| 225 | + "lane3": "0xa" |
| 226 | + } |
| 227 | + } |
| 228 | + } |
| 229 | + }, |
| 230 | + "CUSTOM_MEDIA_SETTINGS": { |
| 231 | + "1-32": { |
| 232 | + "Default": { |
| 233 | + "CUSTOM:XYZ": { |
| 234 | + "lane0": 10, |
| 235 | + "lane1": 11, |
| 236 | + "lane2": 12, |
| 237 | + "lane3": 13 |
| 238 | + } |
| 239 | + } |
| 240 | + } |
| 241 | + } |
| 242 | +} |
| 243 | +``` |
| 244 | + |
| 245 | +Example APPL_DB PORT_TABLE entry based on the above media_settings.json: |
| 246 | + |
| 247 | +``` |
| 248 | +# sonic-db-cli APPL_DB hgetall "PORT_TABLE:EthernetXXX" |
| 249 | +{ |
| 250 | + ... |
| 251 | + 'preemphasis': '0x112233,0x112233,0x112244,0x443322', |
| 252 | + 'idriver': '0xb,0xc,0xd,0xa', |
| 253 | + 'custom_serdes_attrs': '{"attributes":[{"XYZ":{"value":[10,11,12,13]}}]}' |
| 254 | + ... |
| 255 | +} |
| 256 | +``` |
| 257 | + |
143 | 258 | ## Breakout Scenario: |
144 | 259 |
|
145 | 260 | For breakout scenario, there is no special handling or modification that needs to be done to media_settings.json. Currently breakout in SONiC is done by modifying port_config.ini and platform related files and doing a config reload. This config reload will stop and restart most of the daemons. Thus this sequence will be similar to the normal reboot sequence. When xcvrd is stopped and restarted it notifies portsorch about all media just as in normal reboot scenario. |
|
0 commit comments