From: Sathya Perla <sathya.perla@emulex.com>
To: <netdev@vger.kernel.org>
Subject: [PATCH v2 net-next 08/12] be2net: define BE_MAX_MTU
Date: Tue, 2 Sep 2014 09:56:53 +0530 [thread overview]
Message-ID: <1409632017-15655-9-git-send-email-sathya.perla@emulex.com> (raw)
In-Reply-To: <1409632017-15655-1-git-send-email-sathya.perla@emulex.com>
From: Kalesh AP <kalesh.purayil@emulex.com>
This patch defines a new macro BE_MAX_MTU to make the code in be_change_mtu()
more readable.
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 2 ++
drivers/net/ethernet/emulex/benet/be_main.c | 14 +++++++-------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 069bdda..5ccfce7 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -86,6 +86,8 @@ static inline char *nic_name(struct pci_dev *pdev)
#define BE_MAX_JUMBO_FRAME_SIZE 9018
#define BE_MIN_MTU 256
+#define BE_MAX_MTU (BE_MAX_JUMBO_FRAME_SIZE - \
+ (ETH_HLEN + ETH_FCS_LEN))
#define BE_NUM_VLANS_SUPPORTED 64
#define BE_MAX_EQD 128u
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index cdad8bc..04a8092 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1073,15 +1073,15 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)
static int be_change_mtu(struct net_device *netdev, int new_mtu)
{
struct be_adapter *adapter = netdev_priv(netdev);
- if (new_mtu < BE_MIN_MTU ||
- new_mtu > (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN))) {
- dev_info(&adapter->pdev->dev,
- "MTU must be between %d and %d bytes\n",
- BE_MIN_MTU,
- (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN)));
+ struct device *dev = &adapter->pdev->dev;
+
+ if (new_mtu < BE_MIN_MTU || new_mtu > BE_MAX_MTU) {
+ dev_info(dev, "MTU must be between %d and %d bytes\n",
+ BE_MIN_MTU, BE_MAX_MTU);
return -EINVAL;
}
- dev_info(&adapter->pdev->dev, "MTU changed from %d to %d bytes\n",
+
+ dev_info(dev, "MTU changed from %d to %d bytes\n",
netdev->mtu, new_mtu);
netdev->mtu = new_mtu;
return 0;
--
1.7.1
next prev parent reply other threads:[~2014-09-02 4:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 4:26 [PATCH v2 net-next 00/12] be2net: patch set Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 01/12] be2net: add a few log messages Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 02/12] be2net: shorten AMAP_GET/SET_BITS() macro calls Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 03/12] be2net: add a description for counter rx_input_fifo_overflow_drop Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 04/12] be2net: Add TX completion error statistics in ethtool Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 05/12] be2net: Add a dma_mapping_error counter " Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 06/12] be2net: fix log messages in lancer FW download path Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 07/12] be2net: remove unncessary gotos Sathya Perla
2014-09-02 4:26 ` Sathya Perla [this message]
2014-09-02 4:26 ` [PATCH v2 net-next 09/12] be2net: make be_cmd_get_regs() return a status Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 10/12] be2net: get rid of TX budget Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 11/12] be2net: define macro for_all_tx_queues_on_eq() Sathya Perla
2014-09-02 4:26 ` [PATCH v2 net-next 12/12] be2net: query max_tx_qs for BE3 super-nic profile from FW Sathya Perla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409632017-15655-9-git-send-email-sathya.perla@emulex.com \
--to=sathya.perla@emulex.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).