diff options
author | Kalesh AP <kalesh.purayil@emulex.com> | 2015-01-20 03:51:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-24 20:22:42 -0500 |
commit | 0700d8161ec9d3809238c703ad8d37c02e658c15 (patch) | |
tree | 51704e65eec0b665bf29c59f7ac9a9e6113f464e /drivers/net/ethernet/emulex | |
parent | 5ec274250d55a3fb27caf994e891f86a9529a2cb (diff) |
be2net: move interface create code to a separate routine
This removes a bit of duplication of code that initializes the en_flags.
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index ed46610e5453..c40d7efa24c2 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -3183,13 +3183,32 @@ static int be_clear(struct be_adapter *adapter) | |||
3183 | return 0; | 3183 | return 0; |
3184 | } | 3184 | } |
3185 | 3185 | ||
3186 | static int be_if_create(struct be_adapter *adapter, u32 *if_handle, | ||
3187 | u32 cap_flags, u32 vf) | ||
3188 | { | ||
3189 | u32 en_flags; | ||
3190 | int status; | ||
3191 | |||
3192 | en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | | ||
3193 | BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS | | ||
3194 | BE_IF_FLAGS_RSS; | ||
3195 | |||
3196 | en_flags &= cap_flags; | ||
3197 | |||
3198 | status = be_cmd_if_create(adapter, cap_flags, en_flags, | ||
3199 | if_handle, vf); | ||
3200 | |||
3201 | return status; | ||
3202 | } | ||
3203 | |||
3186 | static int be_vfs_if_create(struct be_adapter *adapter) | 3204 | static int be_vfs_if_create(struct be_adapter *adapter) |
3187 | { | 3205 | { |
3188 | struct be_resources res = {0}; | 3206 | struct be_resources res = {0}; |
3189 | struct be_vf_cfg *vf_cfg; | 3207 | struct be_vf_cfg *vf_cfg; |
3190 | u32 cap_flags, en_flags, vf; | 3208 | u32 cap_flags, vf; |
3191 | int status = 0; | 3209 | int status; |
3192 | 3210 | ||
3211 | /* If a FW profile exists, then cap_flags are updated */ | ||
3193 | cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | | 3212 | cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | |
3194 | BE_IF_FLAGS_MULTICAST; | 3213 | BE_IF_FLAGS_MULTICAST; |
3195 | 3214 | ||
@@ -3201,18 +3220,13 @@ static int be_vfs_if_create(struct be_adapter *adapter) | |||
3201 | cap_flags = res.if_cap_flags; | 3220 | cap_flags = res.if_cap_flags; |
3202 | } | 3221 | } |
3203 | 3222 | ||
3204 | /* If a FW profile exists, then cap_flags are updated */ | 3223 | status = be_if_create(adapter, &vf_cfg->if_handle, |
3205 | en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED | | 3224 | cap_flags, vf + 1); |
3206 | BE_IF_FLAGS_BROADCAST | | ||
3207 | BE_IF_FLAGS_MULTICAST); | ||
3208 | status = | ||
3209 | be_cmd_if_create(adapter, cap_flags, en_flags, | ||
3210 | &vf_cfg->if_handle, vf + 1); | ||
3211 | if (status) | 3225 | if (status) |
3212 | goto err; | 3226 | return status; |
3213 | } | 3227 | } |
3214 | err: | 3228 | |
3215 | return status; | 3229 | return 0; |
3216 | } | 3230 | } |
3217 | 3231 | ||
3218 | static int be_vf_setup_init(struct be_adapter *adapter) | 3232 | static int be_vf_setup_init(struct be_adapter *adapter) |
@@ -3653,7 +3667,7 @@ int be_update_queues(struct be_adapter *adapter) | |||
3653 | static int be_setup(struct be_adapter *adapter) | 3667 | static int be_setup(struct be_adapter *adapter) |
3654 | { | 3668 | { |
3655 | struct device *dev = &adapter->pdev->dev; | 3669 | struct device *dev = &adapter->pdev->dev; |
3656 | u32 tx_fc, rx_fc, en_flags; | 3670 | u32 tx_fc, rx_fc; |
3657 | int status; | 3671 | int status; |
3658 | 3672 | ||
3659 | be_setup_init(adapter); | 3673 | be_setup_init(adapter); |
@@ -3669,13 +3683,8 @@ static int be_setup(struct be_adapter *adapter) | |||
3669 | if (status) | 3683 | if (status) |
3670 | goto err; | 3684 | goto err; |
3671 | 3685 | ||
3672 | en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | | 3686 | status = be_if_create(adapter, &adapter->if_handle, |
3673 | BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS; | 3687 | be_if_cap_flags(adapter), 0); |
3674 | if (adapter->function_caps & BE_FUNCTION_CAPS_RSS) | ||
3675 | en_flags |= BE_IF_FLAGS_RSS; | ||
3676 | en_flags = en_flags & be_if_cap_flags(adapter); | ||
3677 | status = be_cmd_if_create(adapter, be_if_cap_flags(adapter), en_flags, | ||
3678 | &adapter->if_handle, 0); | ||
3679 | if (status) | 3688 | if (status) |
3680 | goto err; | 3689 | goto err; |
3681 | 3690 | ||