#define ROCKER_OP_FLAG_LEARNED BIT(2)
#define ROCKER_OP_FLAG_REFRESH BIT(3)
+static bool rocker_flags_nowait(int flags)
+{
+ return flags & ROCKER_OP_FLAG_NOWAIT;
+}
+
static void *__rocker_mem_alloc(struct switchdev_trans *trans, int flags,
size_t size)
{
const struct rocker_desc_info *desc_info,
void *priv);
-static int rocker_cmd_exec(struct rocker_port *rocker_port, int flags,
+static int rocker_cmd_exec(struct rocker_port *rocker_port, bool nowait,
rocker_cmd_prep_cb_t prepare, void *prepare_priv,
rocker_cmd_proc_cb_t process, void *process_priv)
{
struct rocker *rocker = rocker_port->rocker;
struct rocker_desc_info *desc_info;
struct rocker_wait *wait;
- bool nowait = !!(flags & ROCKER_OP_FLAG_NOWAIT);
unsigned long lock_flags;
int err;
static int rocker_cmd_get_port_settings_ethtool(struct rocker_port *rocker_port,
struct ethtool_cmd *ecmd)
{
- return rocker_cmd_exec(rocker_port, 0,
+ return rocker_cmd_exec(rocker_port, false,
rocker_cmd_get_port_settings_prep, NULL,
rocker_cmd_get_port_settings_ethtool_proc,
ecmd);
static int rocker_cmd_get_port_settings_macaddr(struct rocker_port *rocker_port,
unsigned char *macaddr)
{
- return rocker_cmd_exec(rocker_port, 0,
+ return rocker_cmd_exec(rocker_port, false,
rocker_cmd_get_port_settings_prep, NULL,
rocker_cmd_get_port_settings_macaddr_proc,
macaddr);
static int rocker_cmd_get_port_settings_mode(struct rocker_port *rocker_port,
u8 *p_mode)
{
- return rocker_cmd_exec(rocker_port, 0,
+ return rocker_cmd_exec(rocker_port, false,
rocker_cmd_get_port_settings_prep, NULL,
rocker_cmd_get_port_settings_mode_proc, p_mode);
}
static int rocker_cmd_set_port_settings_ethtool(struct rocker_port *rocker_port,
struct ethtool_cmd *ecmd)
{
- return rocker_cmd_exec(rocker_port, 0,
+ return rocker_cmd_exec(rocker_port, false,
rocker_cmd_set_port_settings_ethtool_prep,
ecmd, NULL, NULL);
}
static int rocker_cmd_set_port_settings_macaddr(struct rocker_port *rocker_port,
unsigned char *macaddr)
{
- return rocker_cmd_exec(rocker_port, 0,
+ return rocker_cmd_exec(rocker_port, false,
rocker_cmd_set_port_settings_macaddr_prep,
macaddr, NULL, NULL);
}
static int rocker_cmd_set_port_settings_mtu(struct rocker_port *rocker_port,
int mtu)
{
- return rocker_cmd_exec(rocker_port, 0,
+ return rocker_cmd_exec(rocker_port, false,
rocker_cmd_set_port_settings_mtu_prep,
&mtu, NULL, NULL);
}
static int rocker_port_set_learning(struct rocker_port *rocker_port,
bool learning)
{
- return rocker_cmd_exec(rocker_port, 0,
+ return rocker_cmd_exec(rocker_port, false,
rocker_cmd_set_port_learning_prep,
&learning, NULL, NULL);
}
spin_unlock_irqrestore(&rocker->flow_tbl_lock, lock_flags);
if (!switchdev_trans_ph_prepare(trans))
- return rocker_cmd_exec(rocker_port, flags,
+ return rocker_cmd_exec(rocker_port,
+ rocker_flags_nowait(flags),
rocker_cmd_flow_tbl_add,
found, NULL, NULL);
return 0;
if (found) {
if (!switchdev_trans_ph_prepare(trans))
- err = rocker_cmd_exec(rocker_port, flags,
+ err = rocker_cmd_exec(rocker_port,
+ rocker_flags_nowait(flags),
rocker_cmd_flow_tbl_del,
found, NULL, NULL);
rocker_kfree(trans, found);
spin_unlock_irqrestore(&rocker->group_tbl_lock, lock_flags);
if (!switchdev_trans_ph_prepare(trans))
- return rocker_cmd_exec(rocker_port, flags,
+ return rocker_cmd_exec(rocker_port,
+ rocker_flags_nowait(flags),
rocker_cmd_group_tbl_add,
found, NULL, NULL);
return 0;
if (found) {
if (!switchdev_trans_ph_prepare(trans))
- err = rocker_cmd_exec(rocker_port, flags,
+ err = rocker_cmd_exec(rocker_port,
+ rocker_flags_nowait(flags),
rocker_cmd_group_tbl_del,
found, NULL, NULL);
rocker_group_tbl_entry_free(trans, found);
struct port_name name = { .buf = buf, .len = len };
int err;
- err = rocker_cmd_exec(rocker_port, 0,
+ err = rocker_cmd_exec(rocker_port, false,
rocker_cmd_get_port_settings_prep, NULL,
rocker_cmd_get_port_settings_phys_name_proc,
&name);
static int rocker_cmd_get_port_stats_ethtool(struct rocker_port *rocker_port,
void *priv)
{
- return rocker_cmd_exec(rocker_port, 0,
+ return rocker_cmd_exec(rocker_port, false,
rocker_cmd_get_port_stats_prep, NULL,
rocker_cmd_get_port_stats_ethtool_proc,
priv);