From: Joe Perches <joe@perches.com>
To: "Kok, Auke" <auke-jan.h.kok@intel.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH 1/8] e1000: Convert boolean_t to bool
Date: Tue, 18 Mar 2008 09:41:16 -0700 [thread overview]
Message-ID: <1205858476.26361.34.camel@localhost> (raw)
In-Reply-To: <47DEA67F.9050205@intel.com>
On Mon, 2008-03-17 at 10:12 -0700, Kok, Auke wrote:
> Joe Perches wrote:
> > On Mon, 2008-03-17 at 09:29 -0700, Auke Kok wrote:
> >> On Thu, 2008-03-06 at 10:07 -0800, Kok, Auke wrote:
> >>> send me a patch for e1000 and for ixgb and I'll happily apply those :)
> > I gather you didn't run the little script to convert
> > the u[_]*int\(8|16|32|64\) to u\1 uses? (u_int8_t -> u8, etc)
> > Did you need or want actual patches to do that?
> I'll take a patch for that and yes, I was too busy to do this myself just now :)
I just sent you a bunch of patches to do this conversion.
I started on doing a kind-of checkpatch/Lindent pass on e1000.
Some of the functions in e1000 are heavily indented
and could be neatened with a little bit of rewrite.
For instance, here's a function in e1000_main.c
It's a little bit hard to understand with the indenting
and breakup of the lines. I think the rewrite below it
is shorter and easier to read.
Do you want these sorts of changes too?
static int
e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb)
{
struct e1000_hw *hw = &adapter->hw;
u16 length, offset;
if (vlan_tx_tag_present(skb)) {
if (!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) &&
( adapter->hw.mng_cookie.status &
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) )
return 0;
}
if (skb->len > MINIMUM_DHCP_PACKET_SIZE) {
struct ethhdr *eth = (struct ethhdr *) skb->data;
if ((htons(ETH_P_IP) == eth->h_proto)) {
const struct iphdr *ip =
(struct iphdr *)((u8 *)skb->data+14);
if (IPPROTO_UDP == ip->protocol) {
struct udphdr *udp =
(struct udphdr *)((u8 *)ip +
(ip->ihl << 2));
if (ntohs(udp->dest) == 67) {
offset = (u8 *)udp + 8 - skb->data;
length = skb->len - offset;
return e1000_mng_write_dhcp_info(hw,
(u8 *)udp + 8,
length);
}
}
}
}
return 0;
}
could be:
static int e1000_transfer_dhcp_info(struct e1000_adapter *adapter,
struct sk_buff *skb)
{
struct e1000_hw *hw = &adapter->hw;
struct ethhdr *eth;
const struct iphdr *ip;
struct udphdr *udp;
u16 length, offset;
if (vlan_tx_tag_present(skb) &&
(!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id)
&& (adapter->hw.mng_cookie.status
& E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT))))
return 0;
if (skb->len <= MINIMUM_DHCP_PACKET_SIZE)
return 0;
eth = (struct ethhdr *)skb->data;
if (eth->h_proto != htons(ETH_P_IP))
return 0;
ip = (struct iphdr *)((u8 *)skb->data + 14);
if (ip->protocol != IPPROTO_UDP)
return 0;
udp = (struct udphdr *)((u8 *)ip + (ip->ihl << 2));
if (ntohs(udp->dest) != 67)
return 0;
offset = (u8 *)udp + 8 - skb->data;
length = skb->len - offset;
return e1000_mng_write_dhcp_info(hw, (u8 *)udp + 8, length);
}
cheers, Joe
next prev parent reply other threads:[~2008-03-19 19:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-17 16:29 [PATCH 1/8] e1000: Convert boolean_t to bool Auke Kok
2008-03-17 16:29 ` [PATCH 2/8] ixgb: add explicit state checking Auke Kok
2008-03-17 16:29 ` [PATCH 3/8] ixgb: convert boolean_t to bool Auke Kok
2008-03-17 16:29 ` [PATCH 4/8] ixgb: move externs out of .c files Auke Kok
2008-03-17 16:30 ` [PATCH 5/8] e1000e: remove no longer used e1000e_read_nvm_spi Auke Kok
2008-03-17 16:30 ` [PATCH 6/8] e1000e: remove irq_sem Auke Kok
2008-03-17 16:30 ` [PATCH 7/8] e1000: " Auke Kok
2008-03-17 16:30 ` [PATCH 8/8] ixgb: " Auke Kok
[not found] ` <1205772403.26361.8.camel@localhost>
[not found] ` <47DEA67F.9050205@intel.com>
2008-03-18 16:41 ` Joe Perches [this message]
2008-03-18 17:04 ` [PATCH 1/8] e1000: Convert boolean_t to bool Kok, Auke
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=1205858476.26361.34.camel@localhost \
--to=joe@perches.com \
--cc=auke-jan.h.kok@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.