Skip to content

Commit

Permalink
drop_monitor: Consider all monitoring states before performing config…
Browse files Browse the repository at this point in the history
…uration

The drop monitor configuration (e.g., alert mode) is global, but user
will be able to enable monitoring of only software or hardware drops.

Therefore, ensure that monitoring of both software and hardware drops are
disabled before allowing drop monitor configuration to take place.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ido Schimmel authored and David S. Miller committed Aug 17, 2019
1 parent edd3d00 commit 80cebed
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/core/drop_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,11 @@ static int set_all_monitor_traces(int state, struct netlink_ext_ack *extack)
return rc;
}

static bool net_dm_is_monitoring(void)
{
return trace_state == TRACE_ON || monitor_hw;
}

static int net_dm_alert_mode_get_from_info(struct genl_info *info,
enum net_dm_alert_mode *p_alert_mode)
{
Expand Down Expand Up @@ -694,8 +699,8 @@ static int net_dm_cmd_config(struct sk_buff *skb,
struct netlink_ext_ack *extack = info->extack;
int rc;

if (trace_state == TRACE_ON) {
NL_SET_ERR_MSG_MOD(extack, "Cannot configure drop monitor while tracing is on");
if (net_dm_is_monitoring()) {
NL_SET_ERR_MSG_MOD(extack, "Cannot configure drop monitor during monitoring");
return -EBUSY;
}

Expand Down

0 comments on commit 80cebed

Please sign in to comment.