Add a driver ioctl to clear a port's MAC statistics.

Submitted by:	gnn@
MFC after:	3 days
This commit is contained in:
Navdeep Parhar 2012-10-10 19:27:40 +00:00
parent 3c2824b9ef
commit c2e35e3f37
2 changed files with 11 additions and 0 deletions

View File

@ -50,6 +50,7 @@ enum {
T4_LOAD_FW, /* flash firmware */
T4_GET_MEM, /* read memory */
T4_GET_I2C, /* read from i2c addressible device */
T4_CLEAR_STATS, /* clear a port's MAC statistics */
};
struct t4_reg {
@ -234,4 +235,5 @@ struct t4_mem_range {
#define CHELSIO_T4_LOAD_FW _IOW('f', T4_LOAD_FW, struct t4_data)
#define CHELSIO_T4_GET_MEM _IOW('f', T4_GET_MEM, struct t4_mem_range)
#define CHELSIO_T4_GET_I2C _IOWR('f', T4_GET_I2C, struct t4_i2c_data)
#define CHELSIO_T4_CLEAR_STATS _IOW('f', T4_CLEAR_STATS, uint32_t)
#endif

View File

@ -5400,6 +5400,15 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, int fflag,
rc = read_i2c(sc, (struct t4_i2c_data *)data);
ADAPTER_UNLOCK(sc);
break;
case CHELSIO_T4_CLEAR_STATS: {
u_int port_id = *(uint32_t *)data;
if (port_id >= sc->params.nports)
return (EINVAL);
t4_clr_port_stats(sc, port_id);
break;
}
default:
rc = EINVAL;
}