Dear Yiannis, It is done. After modify the driver source file ag71xx_ar7240.c to add the enable_learning attribute with help of the reference, tl-wr841n work well under openflow implementation, at least ping success. The modification is follow: file path: openwrt/build_dir/linux-ar71xx_generic/linux-3.3.8/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c modification of the structure switch_attr: static struct switch_attr ar7240_globals[] = { { .type = SWITCH_TYPE_INT, .name = "enable_learning", .description = "Enable learning", .set = ar7240_set_learning_enable, .get = ar7240_get_learning_enable, .max = 1 }, { .type = SWITCH_TYPE_INT, .name = "enable_vlan", .description = "Enable VLAN mode", .set = ar7240_set_vlan, .get = ar7240_get_vlan, .max = 1 }, };
add the set function: ar7240_set_learning_enable(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) { struct ar7240sw *as = sw_to_ar7240(dev); int i; u32 v; for (i = 0; i < AR7240_NUM_PORTS; i++) { v = ar7240sw_reg_read(as->mii_bus,AR7240_REG_PORT_CTRL(i)); v &= ~AR7240_PORT_CTRL_LEARN; if (val->value.i){ /* Enable port learning for ALL */ v |= AR7240_PORT_CTRL_LEARN; } ar7240sw_reg_write(as->mii_bus, AR7240_REG_PORT_CTRL(i), v); } return 0; } add the get function: static int ar7240_get_learning_enable(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) { struct ar7240sw *as = sw_to_ar7240(dev); u32 v; v = ar7240sw_reg_read(as->mii_bus, AR7240_REG_PORT_CTRL(0)); v &= AR7240_PORT_CTRL_LEARN; if (v == AR7240_PORT_CTRL_LEARN){ val->value.i = 1; } else { val->value.i = 0; } return 0; } Thanks for the reference: http://permalink.gmane.org/gmane.network.routing.openflow.general/1159
_______________________________________________ openflow-discuss mailing list openflow-discuss@lists.stanford.edu https://mailman.stanford.edu/mailman/listinfo/openflow-discuss