aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-09-21 11:47:38 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-09-21 11:47:38 +0000
commit93c093057d1456d1f2451f72d8b78c7d64b691fa (patch)
tree82151b8c6b300cb9d40e07b33ad9997999586e32 /target
parentffb56132e43e067b1fe0c3ea848f689f5b57fc75 (diff)
downloadupstream-93c093057d1456d1f2451f72d8b78c7d64b691fa.tar.gz
upstream-93c093057d1456d1f2451f72d8b78c7d64b691fa.tar.bz2
upstream-93c093057d1456d1f2451f72d8b78c7d64b691fa.zip
generic: jumbo frames support for rtl8366s
This patch adds the option to enable jumbo frames on the rtl8366s switch. This is almost exactly the same as the first patch at https://dev.openwrt.org/ticket/7977 and it has been requested in a comment there. I have tested this and it successfully allows devices on the switch using jumbo frames to communicate. Signed-off-by: Ash Hughes <ashley.hughes@blueyonder.co.uk> SVN-Revision: 28267
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366s.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
index e2d8402cf6..30916589b3 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
@@ -655,6 +655,49 @@ static int rtl8366s_sw_set_blinkrate(struct switch_dev *dev,
val->value.i);
}
+static int rtl8366s_sw_get_max_length(struct switch_dev *dev,
+ const struct switch_attr *attr,
+ struct switch_val *val)
+{
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+ u32 data;
+
+ rtl8366_smi_read_reg(smi, RTL8366S_SGCR, &data);
+
+ val->value.i = ((data & (RTL8366S_SGCR_MAX_LENGTH_MASK)) >> 4);
+
+ return 0;
+}
+
+static int rtl8366s_sw_set_max_length(struct switch_dev *dev,
+ const struct switch_attr *attr,
+ struct switch_val *val)
+{
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+ char length_code;
+
+ switch (val->value.i) {
+ case 0:
+ length_code = RTL8366S_SGCR_MAX_LENGTH_1522;
+ break;
+ case 1:
+ length_code = RTL8366S_SGCR_MAX_LENGTH_1536;
+ break;
+ case 2:
+ length_code = RTL8366S_SGCR_MAX_LENGTH_1552;
+ break;
+ case 3:
+ length_code = RTL8366S_SGCR_MAX_LENGTH_16000;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return rtl8366_smi_rmwr(smi, RTL8366S_SGCR,
+ RTL8366S_SGCR_MAX_LENGTH_MASK,
+ length_code);
+}
+
static int rtl8366s_sw_get_learning_enable(struct switch_dev *dev,
const struct switch_attr *attr,
struct switch_val *val)
@@ -863,6 +906,14 @@ static struct switch_attr rtl8366s_globals[] = {
.set = rtl8366s_sw_set_blinkrate,
.get = rtl8366s_sw_get_blinkrate,
.max = 5
+ }, {
+ .type = SWITCH_TYPE_INT,
+ .name = "max_length",
+ .description = "Get/Set the maximum length of valid packets"
+ " (0 = 1522, 1 = 1536, 2 = 1552, 3 = 16000 (9216?))",
+ .set = rtl8366s_sw_set_max_length,
+ .get = rtl8366s_sw_get_max_length,
+ .max = 3,
},
};