forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sfp-refactor] Add initial support for CMIS in sonic_xcvr (#220)
- Loading branch information
1 parent
8bb9c5a
commit 51a9aca
Showing
15 changed files
with
542 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from .sff8024 import Sff8024 | ||
|
||
class CmisCodes(Sff8024): | ||
POWER_CLASSES = { | ||
0: "Power Class 1", | ||
1: "Power Class 2", | ||
2: "Power Class 3", | ||
3: "Power Class 4", | ||
4: "Power Class 5", | ||
5: "Power Class 6", | ||
6: "Power Class 7", | ||
7: "Power Class 8" | ||
} | ||
|
||
MEDIA_TYPES = { | ||
0: "Undefined", | ||
1: "nm_850_media_interface", | ||
2: "sm_media_interface", | ||
3: "passive_copper_media_interface", | ||
4: "active_cable_media_interface", | ||
5: "base_t_media_interface", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from ..xcvr_field import NumberRegField | ||
from .. import consts | ||
|
||
class CableLenField(NumberRegField): | ||
def __init__(self, name, offset, *fields, **kwargs): | ||
super(CableLenField, self).__init__(name, offset, *fields, **kwargs) | ||
|
||
def decode(self, raw_data, **decoded_deps): | ||
base_len = super(CableLenField, self).decode(raw_data, **decoded_deps) | ||
len_mult = decoded_deps.get(consts.LEN_MULT_FIELD) | ||
|
||
mult = 10 ** (len_mult - 1) | ||
return base_len * mult |
Oops, something went wrong.