Commit fe7cd2bf authored by Yuval Mintz's avatar Yuval Mintz Committed by David S. Miller

qed*: Conditions for changing link

There's some inconsistency in current logic determining whether the
link settings of a given interface can be changed; I.e., in all modes
other than the so-called `deault' mode the interfaces are forbidden from
changing the configuration - but even this rule is not applied to all
user APIs that may change the configuration.

Instead, let the core-module [qed] decide whether an interface can change
the configuration by supporting a new API function. We also revise the
current rule, allowing all interfaces to change their configurations while
laying the infrastructure for future modes where an interface would be
blocked from making such a configuration.
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f3e72109
...@@ -915,6 +915,11 @@ static u32 qed_sb_release(struct qed_dev *cdev, ...@@ -915,6 +915,11 @@ static u32 qed_sb_release(struct qed_dev *cdev,
return rc; return rc;
} }
static bool qed_can_link_change(struct qed_dev *cdev)
{
return true;
}
static int qed_set_link(struct qed_dev *cdev, static int qed_set_link(struct qed_dev *cdev,
struct qed_link_params *params) struct qed_link_params *params)
{ {
...@@ -1177,6 +1182,7 @@ const struct qed_common_ops qed_common_ops_pass = { ...@@ -1177,6 +1182,7 @@ const struct qed_common_ops qed_common_ops_pass = {
.sb_release = &qed_sb_release, .sb_release = &qed_sb_release,
.simd_handler_config = &qed_simd_handler_config, .simd_handler_config = &qed_simd_handler_config,
.simd_handler_clean = &qed_simd_handler_clean, .simd_handler_clean = &qed_simd_handler_clean,
.can_link_change = &qed_can_link_change,
.set_link = &qed_set_link, .set_link = &qed_set_link,
.get_link = &qed_get_current_link, .get_link = &qed_get_current_link,
.drain = &qed_drain, .drain = &qed_drain,
......
...@@ -239,9 +239,9 @@ static int qede_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -239,9 +239,9 @@ static int qede_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
struct qed_link_params params; struct qed_link_params params;
u32 speed; u32 speed;
if (!edev->dev_info.common.is_mf_default) { if (!edev->ops || !edev->ops->common->can_link_change(edev->cdev)) {
DP_INFO(edev, DP_INFO(edev,
"Link parameters can not be changed in non-default mode\n"); "Link settings are not allowed to be changed\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -350,6 +350,12 @@ static int qede_nway_reset(struct net_device *dev) ...@@ -350,6 +350,12 @@ static int qede_nway_reset(struct net_device *dev)
struct qed_link_output current_link; struct qed_link_output current_link;
struct qed_link_params link_params; struct qed_link_params link_params;
if (!edev->ops || !edev->ops->common->can_link_change(edev->cdev)) {
DP_INFO(edev,
"Link settings are not allowed to be changed\n");
return -EOPNOTSUPP;
}
if (!netif_running(dev)) if (!netif_running(dev))
return 0; return 0;
...@@ -450,9 +456,9 @@ static int qede_set_pauseparam(struct net_device *dev, ...@@ -450,9 +456,9 @@ static int qede_set_pauseparam(struct net_device *dev,
struct qed_link_params params; struct qed_link_params params;
struct qed_link_output current_link; struct qed_link_output current_link;
if (!edev->dev_info.common.is_mf_default) { if (!edev->ops || !edev->ops->common->can_link_change(edev->cdev)) {
DP_INFO(edev, DP_INFO(edev,
"Pause parameters can not be updated in non-default mode\n"); "Pause settings are not allowed to be changed\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -211,6 +211,16 @@ struct qed_common_ops { ...@@ -211,6 +211,16 @@ struct qed_common_ops {
void (*simd_handler_clean)(struct qed_dev *cdev, void (*simd_handler_clean)(struct qed_dev *cdev,
int index); int index);
/**
* @brief can_link_change - can the instance change the link or not
*
* @param cdev
*
* @return true if link-change is allowed, false otherwise.
*/
bool (*can_link_change)(struct qed_dev *cdev);
/** /**
* @brief set_link - set links according to params * @brief set_link - set links according to params
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment