summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
22e4a85)
return container_of(sw, struct rtl8366rb, dev);
}
return container_of(sw, struct rtl8366rb, dev);
}
-static int rtl8366rb_reset_chip(struct rtl8366rb *rtl)
+static inline struct rtl8366_smi *sw_to_rtl8366_smi(struct switch_dev *sw)
+{
+ struct rtl8366rb *rtl = sw_to_rtl8366rb(sw);
+ return &rtl->smi;
+}
+
+static int rtl8366rb_reset_chip(struct rtl8366_smi *smi)
- struct rtl8366_smi *smi = &rtl->smi;
int timeout = 10;
u32 data;
int timeout = 10;
u32 data;
-static int rtl8366_get_mib_counter(struct rtl8366rb *rtl, int counter,
+static int rtl8366_get_mib_counter(struct rtl8366_smi *smi, int counter,
int port, unsigned long long *val)
{
int port, unsigned long long *val)
{
- struct rtl8366_smi *smi = &rtl->smi;
int i;
int err;
u32 addr, data;
int i;
int err;
u32 addr, data;
-static int rtl8366rb_get_vlan_4k(struct rtl8366rb *rtl, u32 vid,
+static int rtl8366rb_get_vlan_4k(struct rtl8366_smi *smi, u32 vid,
struct rtl8366_vlan_4k *vlan4k)
{
struct rtl8366_vlan_4k *vlan4k)
{
- struct rtl8366_smi *smi = &rtl->smi;
struct rtl8366rb_vlan_4k vlan4k_priv;
int err;
u32 data;
struct rtl8366rb_vlan_4k vlan4k_priv;
int err;
u32 data;
-static int rtl8366rb_set_vlan_4k(struct rtl8366rb *rtl,
+static int rtl8366rb_set_vlan_4k(struct rtl8366_smi *smi,
const struct rtl8366_vlan_4k *vlan4k)
{
const struct rtl8366_vlan_4k *vlan4k)
{
- struct rtl8366_smi *smi = &rtl->smi;
struct rtl8366rb_vlan_4k vlan4k_priv;
int err;
u32 data;
struct rtl8366rb_vlan_4k vlan4k_priv;
int err;
u32 data;
-static int rtl8366rb_get_vlan_mc(struct rtl8366rb *rtl, u32 index,
+static int rtl8366rb_get_vlan_mc(struct rtl8366_smi *smi, u32 index,
struct rtl8366_vlan_mc *vlanmc)
{
struct rtl8366_vlan_mc *vlanmc)
{
- struct rtl8366_smi *smi = &rtl->smi;
struct rtl8366rb_vlan_mc vlanmc_priv;
int err;
u32 addr;
struct rtl8366rb_vlan_mc vlanmc_priv;
int err;
u32 addr;
-static int rtl8366rb_set_vlan_mc(struct rtl8366rb *rtl, u32 index,
+static int rtl8366rb_set_vlan_mc(struct rtl8366_smi *smi, u32 index,
const struct rtl8366_vlan_mc *vlanmc)
{
const struct rtl8366_vlan_mc *vlanmc)
{
- struct rtl8366_smi *smi = &rtl->smi;
struct rtl8366rb_vlan_mc vlanmc_priv;
int err;
u32 addr;
struct rtl8366rb_vlan_mc vlanmc_priv;
int err;
u32 addr;
-static int rtl8366rb_get_port_vlan_index(struct rtl8366rb *rtl, int port,
+static int rtl8366rb_get_port_vlan_index(struct rtl8366_smi *smi, int port,
- struct rtl8366_smi *smi = &rtl->smi;
-static int rtl8366rb_get_vlan_port_pvid(struct rtl8366rb *rtl, int port,
+static int rtl8366rb_get_vlan_port_pvid(struct rtl8366_smi *smi, int port,
int *val)
{
struct rtl8366_vlan_mc vlanmc;
int err;
int index;
int *val)
{
struct rtl8366_vlan_mc vlanmc;
int err;
int index;
- err = rtl8366rb_get_port_vlan_index(rtl, port, &index);
+ err = rtl8366rb_get_port_vlan_index(smi, port, &index);
- err = rtl8366rb_get_vlan_mc(rtl, index, &vlanmc);
+ err = rtl8366rb_get_vlan_mc(smi, index, &vlanmc);
-static int rtl8366rb_set_port_vlan_index(struct rtl8366rb *rtl, int port,
+static int rtl8366rb_set_port_vlan_index(struct rtl8366_smi *smi, int port,
- struct rtl8366_smi *smi = &rtl->smi;
-static int rtl8366rb_set_vlan_port_pvid(struct rtl8366rb *rtl, int port, int val)
+static int rtl8366rb_set_vlan_port_pvid(struct rtl8366_smi *smi, int port,
+ int val)
{
int i;
struct rtl8366_vlan_mc vlanmc;
{
int i;
struct rtl8366_vlan_mc vlanmc;
return -EINVAL;
/* Updating the 4K entry; lookup it and change the port member set */
return -EINVAL;
/* Updating the 4K entry; lookup it and change the port member set */
- rtl8366rb_get_vlan_4k(rtl, val, &vlan4k);
+ rtl8366rb_get_vlan_4k(smi, val, &vlan4k);
vlan4k.member |= ((1 << port) | RTL8366_PORT_CPU);
vlan4k.untag = RTL8366_PORT_ALL_BUT_CPU;
vlan4k.member |= ((1 << port) | RTL8366_PORT_CPU);
vlan4k.untag = RTL8366_PORT_ALL_BUT_CPU;
- rtl8366rb_set_vlan_4k(rtl, &vlan4k);
+ rtl8366rb_set_vlan_4k(smi, &vlan4k);
/*
* For the 16 entries more work needs to be done. First see if such
* VID is already there and change it
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
/*
* For the 16 entries more work needs to be done. First see if such
* VID is already there and change it
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
- rtl8366rb_get_vlan_mc(rtl, i, &vlanmc);
+ rtl8366rb_get_vlan_mc(smi, i, &vlanmc);
/* Try to find an existing vid and update port member set */
if (val == vlanmc.vid) {
vlanmc.member |= ((1 << port) | RTL8366_PORT_CPU);
/* Try to find an existing vid and update port member set */
if (val == vlanmc.vid) {
vlanmc.member |= ((1 << port) | RTL8366_PORT_CPU);
- rtl8366rb_set_vlan_mc(rtl, i, &vlanmc);
+ rtl8366rb_set_vlan_mc(smi, i, &vlanmc);
/* Now update PVID register settings */
/* Now update PVID register settings */
- rtl8366rb_set_port_vlan_index(rtl, port, i);
+ rtl8366rb_set_port_vlan_index(smi, port, i);
* has no member ports) with new one
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
* has no member ports) with new one
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
- rtl8366rb_get_vlan_mc(rtl, i, &vlanmc);
+ rtl8366rb_get_vlan_mc(smi, i, &vlanmc);
/*
* See if this vlan member configuration is unused. It is
/*
* See if this vlan member configuration is unused. It is
vlanmc.member = ((1 << port) | RTL8366_PORT_CPU);
vlanmc.fid = 0;
vlanmc.member = ((1 << port) | RTL8366_PORT_CPU);
vlanmc.fid = 0;
- rtl8366rb_set_vlan_mc(rtl, i, &vlanmc);
+ rtl8366rb_set_vlan_mc(smi, i, &vlanmc);
/* Now update PVID register settings */
/* Now update PVID register settings */
- rtl8366rb_set_port_vlan_index(rtl, port, i);
+ rtl8366rb_set_port_vlan_index(smi, port, i);
"All 16 vlan member configurations are in use\n");
return -EINVAL;
}
"All 16 vlan member configurations are in use\n");
return -EINVAL;
}
-static int rtl8366rb_vlan_set_vlan(struct rtl8366rb *rtl, int enable)
+static int rtl8366rb_vlan_set_vlan(struct rtl8366_smi *smi, int enable)
- struct rtl8366_smi *smi = &rtl->smi;
u32 data = 0;
rtl8366_smi_read_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, &data);
u32 data = 0;
rtl8366_smi_read_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, &data);
return rtl8366_smi_write_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, data);
}
return rtl8366_smi_write_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, data);
}
-static int rtl8366rb_vlan_set_4ktable(struct rtl8366rb *rtl, int enable)
+static int rtl8366rb_vlan_set_4ktable(struct rtl8366_smi *smi, int enable)
- struct rtl8366_smi *smi = &rtl->smi;
u32 data = 0;
rtl8366_smi_read_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, &data);
u32 data = 0;
rtl8366_smi_read_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, &data);
return rtl8366_smi_write_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, data);
}
return rtl8366_smi_write_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, data);
}
-static int rtl8366rb_reset_vlan(struct rtl8366rb *rtl)
+static int rtl8366rb_reset_vlan(struct rtl8366_smi *smi)
{
struct rtl8366_vlan_4k vlan4k;
struct rtl8366_vlan_mc vlanmc;
{
struct rtl8366_vlan_4k vlan4k;
struct rtl8366_vlan_mc vlanmc;
vlanmc.untag = 0;
vlanmc.fid = 0;
for (i = 0; i < RTL8366_NUM_VLANS; i++) {
vlanmc.untag = 0;
vlanmc.fid = 0;
for (i = 0; i < RTL8366_NUM_VLANS; i++) {
- err = rtl8366rb_set_vlan_mc(rtl, i, &vlanmc);
+ err = rtl8366rb_set_vlan_mc(smi, i, &vlanmc);
vlan4k.member = RTL8366_PORT_ALL;
vlan4k.untag = RTL8366_PORT_ALL;
vlan4k.fid = 0;
vlan4k.member = RTL8366_PORT_ALL;
vlan4k.untag = RTL8366_PORT_ALL;
vlan4k.fid = 0;
- err = rtl8366rb_set_vlan_4k(rtl, &vlan4k);
+ err = rtl8366rb_set_vlan_4k(smi, &vlan4k);
if (err)
return err;
/* Set all ports PVID to default VLAN */
for (i = 0; i < RTL8366_NUM_PORTS; i++) {
if (err)
return err;
/* Set all ports PVID to default VLAN */
for (i = 0; i < RTL8366_NUM_PORTS; i++) {
- err = rtl8366rb_set_vlan_port_pvid(rtl, i, 0);
+ err = rtl8366rb_set_vlan_port_pvid(smi, i, 0);
size_t count, loff_t *ppos)
{
struct rtl8366rb *rtl = (struct rtl8366rb *)file->private_data;
size_t count, loff_t *ppos)
{
struct rtl8366rb *rtl = (struct rtl8366rb *)file->private_data;
+ struct rtl8366_smi *smi = &rtl->smi;
int i, j, len = 0;
char *buf = rtl->buf;
int i, j, len = 0;
char *buf = rtl->buf;
for (j = 0; j < RTL8366_NUM_PORTS; ++j) {
unsigned long long counter = 0;
for (j = 0; j < RTL8366_NUM_PORTS; ++j) {
unsigned long long counter = 0;
- if (!rtl8366_get_mib_counter(rtl, i, j, &counter))
+ if (!rtl8366_get_mib_counter(smi, i, j, &counter))
len += snprintf(buf + len,
sizeof(rtl->buf) - len,
"[%llu]", counter);
len += snprintf(buf + len,
sizeof(rtl->buf) - len,
"[%llu]", counter);
size_t count, loff_t *ppos)
{
struct rtl8366rb *rtl = (struct rtl8366rb *)file->private_data;
size_t count, loff_t *ppos)
{
struct rtl8366rb *rtl = (struct rtl8366rb *)file->private_data;
+ struct rtl8366_smi *smi = &rtl->smi;
int i, j, len = 0;
char *buf = rtl->buf;
int i, j, len = 0;
char *buf = rtl->buf;
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
struct rtl8366_vlan_mc vlanmc;
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
struct rtl8366_vlan_mc vlanmc;
- rtl8366rb_get_vlan_mc(rtl, i, &vlanmc);
+ rtl8366rb_get_vlan_mc(smi, i, &vlanmc);
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"\t[%d] \t %d \t %d \t 0x%04x \t 0x%04x \t %d "
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"\t[%d] \t %d \t %d \t 0x%04x \t 0x%04x \t %d "
for (j = 0; j < RTL8366_NUM_PORTS; ++j) {
int index = 0;
for (j = 0; j < RTL8366_NUM_PORTS; ++j) {
int index = 0;
- if (!rtl8366rb_get_port_vlan_index(rtl, j, &index)) {
+ if (!rtl8366rb_get_port_vlan_index(smi, j, &index)) {
if (index == i)
len += snprintf(buf + len,
sizeof(rtl->buf) - len,
if (index == i)
len += snprintf(buf + len,
sizeof(rtl->buf) - len,
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data = 0;
if (val->value.i == 1) {
u32 data = 0;
if (val->value.i == 1) {
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data;
if (attr->ofs == 1) {
u32 data;
if (attr->ofs == 1) {
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data;
rtl8366_smi_read_reg(smi, RTL8366_LED_BLINKRATE_REG, &data);
u32 data;
rtl8366_smi_read_reg(smi, RTL8366_LED_BLINKRATE_REG, &data);
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data;
if (val->value.i >= 6)
u32 data;
if (val->value.i >= 6)
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- return rtl8366rb_vlan_set_vlan(rtl, val->value.i);
+ return rtl8366rb_vlan_set_vlan(smi, val->value.i);
- return rtl8366rb_vlan_set_4ktable(rtl, val->value.i);
+ return rtl8366rb_vlan_set_4ktable(smi, val->value.i);
}
static const char *rtl8366rb_speed_str(unsigned speed)
}
static const char *rtl8366rb_speed_str(unsigned speed)
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
+ struct rtl8366_smi *smi = &rtl->smi;
char *buf = rtl->buf;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
char *buf = rtl->buf;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
memset(buf, '\0', sizeof(rtl->buf));
memset(buf, '\0', sizeof(rtl->buf));
- rtl8366rb_get_vlan_mc(rtl, val->port_vlan, &vlanmc);
- rtl8366rb_get_vlan_4k(rtl, vlanmc.vid, &vlan4k);
+ rtl8366rb_get_vlan_mc(smi, val->port_vlan, &vlanmc);
+ rtl8366rb_get_vlan_4k(smi, vlanmc.vid, &vlan4k);
len += snprintf(buf + len, sizeof(rtl->buf) - len, "VLAN %d: Ports: ",
val->port_vlan);
for (i = 0; i < RTL8366_NUM_PORTS; ++i) {
int index = 0;
len += snprintf(buf + len, sizeof(rtl->buf) - len, "VLAN %d: Ports: ",
val->port_vlan);
for (i = 0; i < RTL8366_NUM_PORTS; ++i) {
int index = 0;
- if (!rtl8366rb_get_port_vlan_index(rtl, i, &index) &&
+ if (!rtl8366rb_get_port_vlan_index(smi, i, &index) &&
index == val->port_vlan)
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d", i);
index == val->port_vlan)
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d", i);
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_PORTS)
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_PORTS)
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_LEDGROUPS)
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_LEDGROUPS)
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_PORTS)
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_PORTS)
struct switch_val *val)
{
struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
struct switch_val *val)
{
struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
+ struct rtl8366_smi *smi = &rtl->smi;
int i, len = 0;
unsigned long long counter = 0;
char *buf = rtl->buf;
int i, len = 0;
unsigned long long counter = 0;
char *buf = rtl->buf;
for (i = 0; i < RTL8366S_MIB_COUNT; ++i) {
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d:%s\t", i, rtl8366rb_mib_counters[i].name);
for (i = 0; i < RTL8366S_MIB_COUNT; ++i) {
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d:%s\t", i, rtl8366rb_mib_counters[i].name);
- if (!rtl8366_get_mib_counter(rtl, i, val->port_vlan, &counter))
+ if (!rtl8366_get_mib_counter(smi, i, val->port_vlan, &counter))
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"[%llu]\n", counter);
else
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"[%llu]\n", counter);
else
struct switch_val *val)
{
struct rtl8366_vlan_mc vlanmc;
struct switch_val *val)
{
struct rtl8366_vlan_mc vlanmc;
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
struct switch_port *port;
int i;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
return -EINVAL;
struct switch_port *port;
int i;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
return -EINVAL;
- rtl8366rb_get_vlan_mc(rtl, val->port_vlan, &vlanmc);
+ rtl8366rb_get_vlan_mc(smi, val->port_vlan, &vlanmc);
port = &val->value.ports[0];
val->len = 0;
port = &val->value.ports[0];
val->len = 0;
{
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
{
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
struct switch_port *port;
int i;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
return -EINVAL;
struct switch_port *port;
int i;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
return -EINVAL;
- rtl8366rb_get_vlan_mc(rtl, val->port_vlan, &vlanmc);
- rtl8366rb_get_vlan_4k(rtl, vlanmc.vid, &vlan4k);
+ rtl8366rb_get_vlan_mc(smi, val->port_vlan, &vlanmc);
+ rtl8366rb_get_vlan_4k(smi, vlanmc.vid, &vlan4k);
vlanmc.untag = 0;
vlanmc.member = 0;
vlanmc.untag = 0;
vlanmc.member = 0;
vlan4k.member = vlanmc.member;
vlan4k.untag = vlanmc.untag;
vlan4k.member = vlanmc.member;
vlan4k.untag = vlanmc.untag;
- rtl8366rb_set_vlan_mc(rtl, val->port_vlan, &vlanmc);
- rtl8366rb_set_vlan_4k(rtl, &vlan4k);
+ rtl8366rb_set_vlan_mc(smi, val->port_vlan, &vlanmc);
+ rtl8366rb_set_vlan_4k(smi, &vlan4k);
return 0;
}
static int rtl8366rb_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
{
return 0;
}
static int rtl8366rb_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- return rtl8366rb_get_vlan_port_pvid(rtl, port, val);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+ return rtl8366rb_get_vlan_port_pvid(smi, port, val);
}
static int rtl8366rb_sw_set_port_pvid(struct switch_dev *dev, int port, int val)
{
}
static int rtl8366rb_sw_set_port_pvid(struct switch_dev *dev, int port, int val)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
- return rtl8366rb_set_vlan_port_pvid(rtl, port, val);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+ return rtl8366rb_set_vlan_port_pvid(smi, port, val);
}
static int rtl8366rb_sw_reset_switch(struct switch_dev *dev)
{
}
static int rtl8366rb_sw_reset_switch(struct switch_dev *dev)
{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- err = rtl8366rb_reset_chip(rtl);
+ err = rtl8366rb_reset_chip(smi);
- return rtl8366rb_reset_vlan(rtl);
+ return rtl8366rb_reset_vlan(smi);
}
static struct switch_attr rtl8366rb_globals[] = {
}
static struct switch_attr rtl8366rb_globals[] = {
static int rtl8366rb_setup(struct rtl8366rb *rtl)
{
static int rtl8366rb_setup(struct rtl8366rb *rtl)
{
+ struct rtl8366_smi *smi = &rtl->smi;
- ret = rtl8366rb_reset_chip(rtl);
+ ret = rtl8366rb_reset_chip(smi);
return container_of(sw, struct rtl8366s, dev);
}
return container_of(sw, struct rtl8366s, dev);
}
-static int rtl8366s_reset_chip(struct rtl8366s *rtl)
+static inline struct rtl8366_smi *sw_to_rtl8366_smi(struct switch_dev *sw)
+{
+ struct rtl8366s *rtl = sw_to_rtl8366s(sw);
+ return &rtl->smi;
+}
+
+static int rtl8366s_reset_chip(struct rtl8366_smi *smi)
- struct rtl8366_smi *smi = &rtl->smi;
int timeout = 10;
u32 data;
int timeout = 10;
u32 data;
-static int rtl8366_get_mib_counter(struct rtl8366s *rtl, int counter,
+static int rtl8366_get_mib_counter(struct rtl8366_smi *smi, int counter,
int port, unsigned long long *val)
{
int port, unsigned long long *val)
{
- struct rtl8366_smi *smi = &rtl->smi;
int i;
int err;
u32 addr, data;
int i;
int err;
u32 addr, data;
-static int rtl8366s_get_vlan_4k(struct rtl8366s *rtl, u32 vid,
+static int rtl8366s_get_vlan_4k(struct rtl8366_smi *smi, u32 vid,
struct rtl8366_vlan_4k *vlan4k)
{
struct rtl8366_vlan_4k *vlan4k)
{
- struct rtl8366_smi *smi = &rtl->smi;
struct rtl8366s_vlan_4k vlan4k_priv;
int err;
u32 data;
struct rtl8366s_vlan_4k vlan4k_priv;
int err;
u32 data;
-static int rtl8366s_set_vlan_4k(struct rtl8366s *rtl,
+static int rtl8366s_set_vlan_4k(struct rtl8366_smi *smi,
const struct rtl8366_vlan_4k *vlan4k)
{
const struct rtl8366_vlan_4k *vlan4k)
{
- struct rtl8366_smi *smi = &rtl->smi;
struct rtl8366s_vlan_4k vlan4k_priv;
int err;
u32 data;
struct rtl8366s_vlan_4k vlan4k_priv;
int err;
u32 data;
-static int rtl8366s_get_vlan_mc(struct rtl8366s *rtl, u32 index,
+static int rtl8366s_get_vlan_mc(struct rtl8366_smi *smi, u32 index,
struct rtl8366_vlan_mc *vlanmc)
{
struct rtl8366_vlan_mc *vlanmc)
{
- struct rtl8366_smi *smi = &rtl->smi;
struct rtl8366s_vlan_mc vlanmc_priv;
int err;
u32 addr;
struct rtl8366s_vlan_mc vlanmc_priv;
int err;
u32 addr;
-static int rtl8366s_set_vlan_mc(struct rtl8366s *rtl, u32 index,
+static int rtl8366s_set_vlan_mc(struct rtl8366_smi *smi, u32 index,
const struct rtl8366_vlan_mc *vlanmc)
{
const struct rtl8366_vlan_mc *vlanmc)
{
- struct rtl8366_smi *smi = &rtl->smi;
struct rtl8366s_vlan_mc vlanmc_priv;
int err;
u32 addr;
struct rtl8366s_vlan_mc vlanmc_priv;
int err;
u32 addr;
-static int rtl8366s_get_port_vlan_index(struct rtl8366s *rtl, int port,
+static int rtl8366s_get_port_vlan_index(struct rtl8366_smi *smi, int port,
- struct rtl8366_smi *smi = &rtl->smi;
-static int rtl8366s_get_vlan_port_pvid(struct rtl8366s *rtl, int port,
+static int rtl8366s_get_vlan_port_pvid(struct rtl8366_smi *smi, int port,
int *val)
{
struct rtl8366_vlan_mc vlanmc;
int err;
int index;
int *val)
{
struct rtl8366_vlan_mc vlanmc;
int err;
int index;
- err = rtl8366s_get_port_vlan_index(rtl, port, &index);
+ err = rtl8366s_get_port_vlan_index(smi, port, &index);
- err = rtl8366s_get_vlan_mc(rtl, index, &vlanmc);
+ err = rtl8366s_get_vlan_mc(smi, index, &vlanmc);
-static int rtl8366s_set_port_vlan_index(struct rtl8366s *rtl, int port,
+static int rtl8366s_set_port_vlan_index(struct rtl8366_smi *smi, int port,
- struct rtl8366_smi *smi = &rtl->smi;
-static int rtl8366s_set_vlan_port_pvid(struct rtl8366s *rtl, int port, int val)
+static int rtl8366s_set_vlan_port_pvid(struct rtl8366_smi *smi, int port, int val)
{
int i;
struct rtl8366_vlan_mc vlanmc;
{
int i;
struct rtl8366_vlan_mc vlanmc;
return -EINVAL;
/* Updating the 4K entry; lookup it and change the port member set */
return -EINVAL;
/* Updating the 4K entry; lookup it and change the port member set */
- rtl8366s_get_vlan_4k(rtl, val, &vlan4k);
+ rtl8366s_get_vlan_4k(smi, val, &vlan4k);
vlan4k.member |= ((1 << port) | RTL8366_PORT_CPU);
vlan4k.untag = RTL8366_PORT_ALL_BUT_CPU;
vlan4k.member |= ((1 << port) | RTL8366_PORT_CPU);
vlan4k.untag = RTL8366_PORT_ALL_BUT_CPU;
- rtl8366s_set_vlan_4k(rtl, &vlan4k);
+ rtl8366s_set_vlan_4k(smi, &vlan4k);
/*
* For the 16 entries more work needs to be done. First see if such
* VID is already there and change it
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
/*
* For the 16 entries more work needs to be done. First see if such
* VID is already there and change it
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
- rtl8366s_get_vlan_mc(rtl, i, &vlanmc);
+ rtl8366s_get_vlan_mc(smi, i, &vlanmc);
/* Try to find an existing vid and update port member set */
if (val == vlanmc.vid) {
vlanmc.member |= ((1 << port) | RTL8366_PORT_CPU);
/* Try to find an existing vid and update port member set */
if (val == vlanmc.vid) {
vlanmc.member |= ((1 << port) | RTL8366_PORT_CPU);
- rtl8366s_set_vlan_mc(rtl, i, &vlanmc);
+ rtl8366s_set_vlan_mc(smi, i, &vlanmc);
/* Now update PVID register settings */
/* Now update PVID register settings */
- rtl8366s_set_port_vlan_index(rtl, port, i);
+ rtl8366s_set_port_vlan_index(smi, port, i);
* has no member ports) with new one
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
* has no member ports) with new one
*/
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
- rtl8366s_get_vlan_mc(rtl, i, &vlanmc);
+ rtl8366s_get_vlan_mc(smi, i, &vlanmc);
/*
* See if this vlan member configuration is unused. It is
/*
* See if this vlan member configuration is unused. It is
vlanmc.member = ((1 << port) | RTL8366_PORT_CPU);
vlanmc.fid = 0;
vlanmc.member = ((1 << port) | RTL8366_PORT_CPU);
vlanmc.fid = 0;
- rtl8366s_set_vlan_mc(rtl, i, &vlanmc);
+ rtl8366s_set_vlan_mc(smi, i, &vlanmc);
/* Now update PVID register settings */
/* Now update PVID register settings */
- rtl8366s_set_port_vlan_index(rtl, port, i);
+ rtl8366s_set_port_vlan_index(smi, port, i);
"All 16 vlan member configurations are in use\n");
return -EINVAL;
}
"All 16 vlan member configurations are in use\n");
return -EINVAL;
}
-static int rtl8366s_vlan_set_vlan(struct rtl8366s *rtl, int enable)
+static int rtl8366s_vlan_set_vlan(struct rtl8366_smi *smi, int enable)
- struct rtl8366_smi *smi = &rtl->smi;
u32 data = 0;
rtl8366_smi_read_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, &data);
u32 data = 0;
rtl8366_smi_read_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, &data);
return rtl8366_smi_write_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, data);
}
return rtl8366_smi_write_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, data);
}
-static int rtl8366s_vlan_set_4ktable(struct rtl8366s *rtl, int enable)
+static int rtl8366s_vlan_set_4ktable(struct rtl8366_smi *smi, int enable)
- struct rtl8366_smi *smi = &rtl->smi;
u32 data = 0;
rtl8366_smi_read_reg(smi, RTL8366S_VLAN_TB_CTRL_REG, &data);
u32 data = 0;
rtl8366_smi_read_reg(smi, RTL8366S_VLAN_TB_CTRL_REG, &data);
return rtl8366_smi_write_reg(smi, RTL8366S_VLAN_TB_CTRL_REG, data);
}
return rtl8366_smi_write_reg(smi, RTL8366S_VLAN_TB_CTRL_REG, data);
}
-static int rtl8366s_reset_vlan(struct rtl8366s *rtl)
+static int rtl8366s_reset_vlan(struct rtl8366_smi *smi)
{
struct rtl8366_vlan_4k vlan4k;
struct rtl8366_vlan_mc vlanmc;
{
struct rtl8366_vlan_4k vlan4k;
struct rtl8366_vlan_mc vlanmc;
vlanmc.untag = 0;
vlanmc.fid = 0;
for (i = 0; i < RTL8366_NUM_VLANS; i++) {
vlanmc.untag = 0;
vlanmc.fid = 0;
for (i = 0; i < RTL8366_NUM_VLANS; i++) {
- err = rtl8366s_set_vlan_mc(rtl, i, &vlanmc);
+ err = rtl8366s_set_vlan_mc(smi, i, &vlanmc);
vlan4k.member = RTL8366_PORT_ALL;
vlan4k.untag = RTL8366_PORT_ALL;
vlan4k.fid = 0;
vlan4k.member = RTL8366_PORT_ALL;
vlan4k.untag = RTL8366_PORT_ALL;
vlan4k.fid = 0;
- err = rtl8366s_set_vlan_4k(rtl, &vlan4k);
+ err = rtl8366s_set_vlan_4k(smi, &vlan4k);
if (err)
return err;
/* Set all ports PVID to default VLAN */
for (i = 0; i < RTL8366_NUM_PORTS; i++) {
if (err)
return err;
/* Set all ports PVID to default VLAN */
for (i = 0; i < RTL8366_NUM_PORTS; i++) {
- err = rtl8366s_set_vlan_port_pvid(rtl, i, 0);
+ err = rtl8366s_set_vlan_port_pvid(smi, i, 0);
size_t count, loff_t *ppos)
{
struct rtl8366s *rtl = (struct rtl8366s *)file->private_data;
size_t count, loff_t *ppos)
{
struct rtl8366s *rtl = (struct rtl8366s *)file->private_data;
+ struct rtl8366_smi *smi = &rtl->smi;
int i, j, len = 0;
char *buf = rtl->buf;
int i, j, len = 0;
char *buf = rtl->buf;
for (j = 0; j < RTL8366_NUM_PORTS; ++j) {
unsigned long long counter = 0;
for (j = 0; j < RTL8366_NUM_PORTS; ++j) {
unsigned long long counter = 0;
- if (!rtl8366_get_mib_counter(rtl, i, j, &counter))
+ if (!rtl8366_get_mib_counter(smi, i, j, &counter))
len += snprintf(buf + len,
sizeof(rtl->buf) - len,
"[%llu]", counter);
len += snprintf(buf + len,
sizeof(rtl->buf) - len,
"[%llu]", counter);
size_t count, loff_t *ppos)
{
struct rtl8366s *rtl = (struct rtl8366s *)file->private_data;
size_t count, loff_t *ppos)
{
struct rtl8366s *rtl = (struct rtl8366s *)file->private_data;
+ struct rtl8366_smi *smi = &rtl->smi;
int i, j, len = 0;
char *buf = rtl->buf;
int i, j, len = 0;
char *buf = rtl->buf;
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
struct rtl8366_vlan_mc vlanmc;
for (i = 0; i < RTL8366_NUM_VLANS; ++i) {
struct rtl8366_vlan_mc vlanmc;
- rtl8366s_get_vlan_mc(rtl, i, &vlanmc);
+ rtl8366s_get_vlan_mc(smi, i, &vlanmc);
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"\t[%d] \t %d \t %d \t 0x%04x \t 0x%04x \t %d "
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"\t[%d] \t %d \t %d \t 0x%04x \t 0x%04x \t %d "
for (j = 0; j < RTL8366_NUM_PORTS; ++j) {
int index = 0;
for (j = 0; j < RTL8366_NUM_PORTS; ++j) {
int index = 0;
- if (!rtl8366s_get_port_vlan_index(rtl, j, &index)) {
+ if (!rtl8366s_get_port_vlan_index(smi, j, &index)) {
if (index == i)
len += snprintf(buf + len,
sizeof(rtl->buf) - len,
if (index == i)
len += snprintf(buf + len,
sizeof(rtl->buf) - len,
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data = 0;
if (val->value.i == 1) {
u32 data = 0;
if (val->value.i == 1) {
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data;
if (attr->ofs == 1) {
u32 data;
if (attr->ofs == 1) {
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data;
rtl8366_smi_read_reg(smi, RTL8366_LED_BLINKRATE_REG, &data);
u32 data;
rtl8366_smi_read_reg(smi, RTL8366_LED_BLINKRATE_REG, &data);
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data;
if (val->value.i >= 6)
u32 data;
if (val->value.i >= 6)
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- return rtl8366s_vlan_set_vlan(rtl, val->value.i);
+ return rtl8366s_vlan_set_vlan(smi, val->value.i);
- return rtl8366s_vlan_set_4ktable(rtl, val->value.i);
+ return rtl8366s_vlan_set_4ktable(smi, val->value.i);
}
static const char *rtl8366s_speed_str(unsigned speed)
}
static const char *rtl8366s_speed_str(unsigned speed)
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
struct rtl8366s *rtl = sw_to_rtl8366s(dev);
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
struct rtl8366s *rtl = sw_to_rtl8366s(dev);
+ struct rtl8366_smi *smi = &rtl->smi;
char *buf = rtl->buf;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
char *buf = rtl->buf;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
memset(buf, '\0', sizeof(rtl->buf));
memset(buf, '\0', sizeof(rtl->buf));
- rtl8366s_get_vlan_mc(rtl, val->port_vlan, &vlanmc);
- rtl8366s_get_vlan_4k(rtl, vlanmc.vid, &vlan4k);
+ rtl8366s_get_vlan_mc(smi, val->port_vlan, &vlanmc);
+ rtl8366s_get_vlan_4k(smi, vlanmc.vid, &vlan4k);
len += snprintf(buf + len, sizeof(rtl->buf) - len, "VLAN %d: Ports: ",
val->port_vlan);
for (i = 0; i < RTL8366_NUM_PORTS; ++i) {
int index = 0;
len += snprintf(buf + len, sizeof(rtl->buf) - len, "VLAN %d: Ports: ",
val->port_vlan);
for (i = 0; i < RTL8366_NUM_PORTS; ++i) {
int index = 0;
- if (!rtl8366s_get_port_vlan_index(rtl, i, &index) &&
+ if (!rtl8366s_get_port_vlan_index(smi, i, &index) &&
index == val->port_vlan)
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d", i);
index == val->port_vlan)
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d", i);
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_PORTS ||
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_PORTS ||
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_LEDGROUPS)
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_LEDGROUPS)
const struct switch_attr *attr,
struct switch_val *val)
{
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
- struct rtl8366_smi *smi = &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_PORTS)
u32 data = 0;
if (val->port_vlan >= RTL8366_NUM_PORTS)
struct switch_val *val)
{
struct rtl8366s *rtl = sw_to_rtl8366s(dev);
struct switch_val *val)
{
struct rtl8366s *rtl = sw_to_rtl8366s(dev);
+ struct rtl8366_smi *smi = &rtl->smi;
int i, len = 0;
unsigned long long counter = 0;
char *buf = rtl->buf;
int i, len = 0;
unsigned long long counter = 0;
char *buf = rtl->buf;
for (i = 0; i < RTL8366S_MIB_COUNT; ++i) {
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d:%s\t", i, rtl8366s_mib_counters[i].name);
for (i = 0; i < RTL8366S_MIB_COUNT; ++i) {
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"%d:%s\t", i, rtl8366s_mib_counters[i].name);
- if (!rtl8366_get_mib_counter(rtl, i, val->port_vlan, &counter))
+ if (!rtl8366_get_mib_counter(smi, i, val->port_vlan, &counter))
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"[%llu]\n", counter);
else
len += snprintf(buf + len, sizeof(rtl->buf) - len,
"[%llu]\n", counter);
else
static int rtl8366s_sw_get_vlan_ports(struct switch_dev *dev,
struct switch_val *val)
{
static int rtl8366s_sw_get_vlan_ports(struct switch_dev *dev,
struct switch_val *val)
{
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_mc vlanmc;
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
struct switch_port *port;
int i;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
return -EINVAL;
struct switch_port *port;
int i;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
return -EINVAL;
- rtl8366s_get_vlan_mc(rtl, val->port_vlan, &vlanmc);
+ rtl8366s_get_vlan_mc(smi, val->port_vlan, &vlanmc);
port = &val->value.ports[0];
val->len = 0;
port = &val->value.ports[0];
val->len = 0;
static int rtl8366s_sw_set_vlan_ports(struct switch_dev *dev,
struct switch_val *val)
{
static int rtl8366s_sw_set_vlan_ports(struct switch_dev *dev,
struct switch_val *val)
{
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
struct rtl8366_vlan_mc vlanmc;
struct rtl8366_vlan_4k vlan4k;
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
struct switch_port *port;
int i;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
return -EINVAL;
struct switch_port *port;
int i;
if (val->port_vlan == 0 || val->port_vlan >= RTL8366_NUM_VLANS)
return -EINVAL;
- rtl8366s_get_vlan_mc(rtl, val->port_vlan, &vlanmc);
- rtl8366s_get_vlan_4k(rtl, vlanmc.vid, &vlan4k);
+ rtl8366s_get_vlan_mc(smi, val->port_vlan, &vlanmc);
+ rtl8366s_get_vlan_4k(smi, vlanmc.vid, &vlan4k);
vlanmc.untag = 0;
vlanmc.member = 0;
vlanmc.untag = 0;
vlanmc.member = 0;
vlan4k.member = vlanmc.member;
vlan4k.untag = vlanmc.untag;
vlan4k.member = vlanmc.member;
vlan4k.untag = vlanmc.untag;
- rtl8366s_set_vlan_mc(rtl, val->port_vlan, &vlanmc);
- rtl8366s_set_vlan_4k(rtl, &vlan4k);
+ rtl8366s_set_vlan_mc(smi, val->port_vlan, &vlanmc);
+ rtl8366s_set_vlan_4k(smi, &vlan4k);
return 0;
}
static int rtl8366s_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
{
return 0;
}
static int rtl8366s_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
- return rtl8366s_get_vlan_port_pvid(rtl, port, val);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+ return rtl8366s_get_vlan_port_pvid(smi, port, val);
}
static int rtl8366s_sw_set_port_pvid(struct switch_dev *dev, int port, int val)
{
}
static int rtl8366s_sw_set_port_pvid(struct switch_dev *dev, int port, int val)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
- return rtl8366s_set_vlan_port_pvid(rtl, port, val);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+ return rtl8366s_set_vlan_port_pvid(smi, port, val);
}
static int rtl8366s_sw_reset_switch(struct switch_dev *dev)
{
}
static int rtl8366s_sw_reset_switch(struct switch_dev *dev)
{
- struct rtl8366s *rtl = sw_to_rtl8366s(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- err = rtl8366s_reset_chip(rtl);
+ err = rtl8366s_reset_chip(smi);
- return rtl8366s_reset_vlan(rtl);
+ return rtl8366s_reset_vlan(smi);
}
static struct switch_attr rtl8366s_globals[] = {
}
static struct switch_attr rtl8366s_globals[] = {
static int rtl8366s_setup(struct rtl8366s *rtl)
{
static int rtl8366s_setup(struct rtl8366s *rtl)
{
+ struct rtl8366_smi *smi = &rtl->smi;
- ret = rtl8366s_reset_chip(rtl);
+ ret = rtl8366s_reset_chip(smi);