* [PATCH 1/5][v2] phylib: Add Clause 45 read/write functions
From: shh.xie @ 2013-11-26 9:51 UTC (permalink / raw)
To: davem, jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel
Cc: Emilian.Medve, madalin.bucur
From: Andy Fleming <afleming@freescale.com>
Need an extra parameter to read or write Clause 45 PHYs, so
need a different API with the extra parameter.
Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
v2: no change.
include/linux/phy.h | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 48a4dc3..2549b42 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -498,6 +498,21 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum)
}
/**
+ * phy_read_mmd - Convenience function for reading a register
+ * from an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ *
+ * Same rules as for phy_read();
+ */
+static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
+{
+ return mdiobus_read(phydev->bus, phydev->addr,
+ MII_ADDR_C45 | (devad << 16) | (regnum & 0xffff));
+}
+
+/**
* phy_write - Convenience function for writing a given PHY register
* @phydev: the phy_device struct
* @regnum: register number to write
@@ -533,6 +548,24 @@ static inline bool phy_is_internal(struct phy_device *phydev)
return phydev->is_internal;
}
+/**
+ * phy_write_mmd - Convenience function for writing a register
+ * on an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ * @val: value to write to @regnum
+ *
+ * Same rules as for phy_write();
+ */
+static inline int phy_write_mmd(struct phy_device *phydev, int devad,
+ u32 regnum, u16 val)
+{
+ regnum = MII_ADDR_C45 | ((devad & 0x1f) << 16) | (regnum & 0xffff);
+
+ return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
+}
+
struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
bool is_c45, struct phy_c45_device_ids *c45_ids);
struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
--
1.8.4.1
^ permalink raw reply related
* Re: bridge vlan filtering question
From: Mike Rapoport @ 2013-11-26 9:46 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: netdev
In-Reply-To: <529394BC.5060805@gmail.com>
On Mon, Nov 25, 2013 at 8:19 PM, Vlad Yasevich <vyasevich@gmail.com> wrote:
> On 11/25/2013 02:54 AM, Mike Rapoport wrote:
>> Hi all,
>>
>> I'm trying to use brigde vlan filtering and I cannot get any traffic
>> through the bridge.
>> After looking at the code I've noticed that br_get_pvid is always
>> returning VLAN_N_VID because VLAN_TAG_PRESENT is never set in the pvid
>> field of net_port_vlans.
>> Am I missing something or is this an actual bug?
>>
>
> It's a bug. It's been fixed upstream and has been queued to stable.
Thanks a lot.
> commit d1c6c708c4da9d104e0b7c116654cb449bff9b5f
> Author: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
> Date: Wed Oct 16 17:07:15 2013 +0900
>
> bridge: Fix the way the PVID is referenced
>
>
> -vlad
--
Sincerely yours,
Mike.
^ permalink raw reply
* Re: [PATCH] ipv6 addrconf: source address selection, Rule 7: Prefer temporary addresses (RFC 6724)
From: Hannes Frederic Sowa @ 2013-11-26 8:54 UTC (permalink / raw)
To: fx.lebail
Cc: netdev, David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, dcbw, jiri
In-Reply-To: <1385396205-6105-1-git-send-email-fx.lebail@yahoo.com>
[Added Jiri and Dan]
On Mon, Nov 25, 2013 at 05:16:45PM +0100, fx.lebail@yahoo.com wrote:
> The RFC 6724 change the default recommendation for source address selection
> Rule 7 to prefer temporary addresses rather than public addresses,
> while providing an administrative override.
>
> The administrative override is based on the prefer_src_public sysctl.
I like the idea and it could be useful in addition to the new
IFA_F_MANAGETEMPADDR flag which should show up any time soon.
With IFA_F_MANAGETEMPADDR iproute/netlink could add a public address
and indicate the kernel it should also generate a new temporary address
without touching the use_tempaddr knob. So there is no possiblity to
change the priority of public and temporary addresses any more. This
patch could restore that.
A netconf API for this would be nice, too.
Jiri, Dan do you agree?
Greetings,
Hannes
^ permalink raw reply
* Re: [ovs-dev] [PATCH v2.51 0/5] MPLS actions and matches
From: Simon Horman @ 2013-11-26 8:08 UTC (permalink / raw)
To: dev, netdev, Jesse Gross, Ben Pfaff; +Cc: Ravi K
In-Reply-To: <1385005606-30130-1-git-send-email-horms@verge.net.au>
On Thu, Nov 21, 2013 at 12:46:41PM +0900, Simon Horman wrote:
> Hi,
>
> This series implements MPLS actions and matches based on work by
> Ravi K, Leo Alterman, Yamahata-san and Joe Stringer.
>
> This series provides three changes
>
> * Patches 1 - 3
>
> Provide user-space support for the VLAN/MPLS tag insertion order
> up to and including OpenFlow 1.2, and the different ordering
> specified from OpenFlow 1.3. In a nutshell the datapath always
> uses the OpenFlow 1.3 ordering, which is to always insert tags
> immediately after the L2 header, regardless of the presence of other
> tags. And ovs-vswtichd provides compatibility for the behaviour up
> to OpenFlow 1.2, which is that MPLS tags should follow VLAN tags
> if present.
>
> Ben, these are for you to review.
Hi Ben,
I wonder if you could find some time to look over these.
I believe that the first patch has not previously been reviewed
but other than that there should be few areas of excitement.
>
> * Patches 4 and 5
>
> Adding basic MPLS action and match support to the kernel datapath
>
> Jesse, these are for you to review after patches 1 - 4 are reviewed.
>
>
> Difference between v2.51 and v2.50:
>
> * New approach to consistency checking actions using of OpenFlow1.3+ tag order
> * Use OF1.2 for all ovs-ofctl commands for new OF1.2 tests. Likewise for OF1.3.
> * Add write_actions check for OF1.3.
> This further exercises consistency checking using OpenFlow1.3+ tag order.
>
>
> Difference between v2.50 and v2.49:
>
> * Correct typo in comment
>
>
> Difference between v2.49 and v2.48:
>
> * Include action consistency checking changes.
>
>
> Difference between v2.48 and v2.47:
> * Manual rebase for
> - "OF 1.1 set vlan vid/pcp compatibility"
> - "Native Set-Field action"
> * Only use OpenFlow1.2 actions in OpenFlow1.2 tests
>
>
> Difference between v2.47 and v2.46:
>
> * Rebase of patch 4 for HAVE_RHEL_OVS_HOOK and OVS_KEY_ATTR_TCP_FLAGS
>
>
> Difference between v2.46 and v2.45:
>
> * Update changelog of "odp: Allow VLAN actions after MPLS actions"
> to reflect the current implementation
>
>
> Difference between v2.45 and v2.44:
>
> * As pointed out by Ben Pfaff and Joe Stringer
> + Update VLAN handling in the presence of MPLS push
>
> Previously the test for committing ODP VLAN actions after MPLS actions
> was that the VLAN TCI differed before and after the MPLS push action.
> This results in a false negative in some cases including if a VLAN tag
> is pushed after the MPLS push action in such a way that it duplicates
> the VLAN tag present before the MPLS push action.
>
> This is resolved by ensuring the VLAN_CFI bit of the value used to
> track the desired VLAN TCI after an MPLS push action is zero unless
> VLAN actions should be committed after MPLS actions.
>
> + Update tests to use ovs-ofctl monitor "-m" to allow full inspection of
> MPLS LSE and VLAN tags present in packets.
>
> Differences between v2.44 and v2.43:
>
> * Rebase for the following changes:
> f47ea02 ("Set datapath mask bits when setting a flow field.")
> 7fdb60a ("Add support for write-actions")
> 7358063 ("odp-util: Elaborate the comment for odp_flow_format() function.")
> * Correct final_vlan_tci and next_vlan_tci initialisation in xlate_actions__()
>
>
> Differences between v2.43 and v2.42:
>
> * As suggested by Ben Pfaff
> Move vlan state into struct xlate_ctx
> 1. Add final_vlan_tci member to struct xlate_ctx instead of vlan_tci member
> struct xlate_xin. This seems to be a better palace for it as it does
> not need to be accessible from the caller.
> 2. Move local vlan_tci variable of do_xlate_actions() to be the
> next_vlan_tci member of strict xlate_ctx. This allows for it to work
> across resubmit actions and goto table instructions.
> * Code contributed by Ben Pfaff
> + Use enum for to control order of MPLS LSE insertion
> This makes the logic somewhat clearer
> * Add a helper push_mpls_from_openflow() to consolidate
> the same logic that appears in three locations.
>
>
> Differences between v2.42 and v2.41:
>
> * Rebase for:
> + 0585f7a ("datapath: Simplify mega-flow APIs.")
> + a097c0b ("datapath: Restructure datapath.c and flow.c")
> * As suggested by Jesse Gross
> + Take into account that push_mpls() will have freed the skb on error
> + Remove dubious !eth_p_mpls(skb->protocol) condition from push_mpls
> The !eth_p_mpls(skb->protocol) condition on setting inner_protocol
> has no effect. Its motivation was to ensure that inner_protocol was
> only set the first time that mpls_push occured. However this is already
> ensured by the !ovs_skb_get_inner_protocol(skb) condition.
> + Return -EINVAL instead of -ENOMEM from pop_mpls() if the skb is too short
> + Do not add @inner_protocol to kernel doc for struct ovs_skb_cb.
> The patch no longer adds an inner_protocol member to struct ovs_skb_cb
> + Do not add and set otherwise unsued inner_protocol variable in
> rpl_dev_queue_xmit()
> * As suggested by Pravin Shelar
> + Implement compatibility code in existing rpl_skb_gso_segment
> rather than introducing to use rpl___skb_gso_segment
>
>
> Differences between v2.41 and v2.40:
>
> * As suggested by Ben Pfaff
> + Expand struct ofpact_reg_load to include a mpls_before_vlan field
> rather than using the compat field of the ofpact field of
> struct ofpact_reg_load.
> + Pass version to ofpacts_pull_openflow11_actions and
> ofpacts_pull_openflow11_instructions. This removes the invalid
> assumption that that these functions are passed a full message and are
> thus able to deduce the OpenFlow version.
>
>
> Differences between v2.40 and v2.39:
>
> * Rebase for:
> + New dev_queue_xmit compat code
> + Updated put_vlan()
> + Removal of mpls_depth field from struct flow
> * As suggested by Jesse Gross
> + Remove bogus mac_len update from push_mpls()
> + Slightly simplify push_mpls() by using eth_hdr()
> + Remove dubious condition !eth_p_mpls(inner_protocol) on
> an skb being considered to be MPLS in netdev_send()
> + Only use compatibility code for MPLS GSO segmentation on kernels
> older than 3.11
> + Revamp setting of inner_protocol
> 1. Do not unconditionally set inner_protocol to the value of
> skb->protocol in ovs_execute_actions().
> 2. Initialise inner_protocol it to zero only if compatibility code is in
> use. In the case where compatibility code is not in use it will either
> be zero due since the allocation of the skb or some other value set
> by some other user.
> 3. Conditionally set the inner_protocol in push_mpls() to the value of
> skb->protocol when entering push_mpls(). The condition is that
> inner_protocol is zero and the value of skb->protocol is not an MPLS
> ethernet type.
> - This new scheme:
> + Pushes logic to set inner_protocol closer to the case where it is
> needed.
> + Avoids over-writing values set by other users.
> * As suggested by Pravin Shelar
> + Only set and restore skb->protocol in rpl___skb_gso_segment() in the
> case of MPLS
> + Add inner_protocol field to struct ovs_gso_cb instead of ovs_skb_cb.
> This moves compatibility code closer to where it is used
> and creates fewer differences with mainline.
> * Update comment on mac_len updates in datapath/actions.c
> * Remove HAVE_INNER_PROCOTOL and instead just check
> against kernel version 3.11 directly.
> HAVE_INNER_PROCOTOL is a hang-over from work done prior
> to the merge of inner_protocol into the kernel.
> * Remove dubious condition !eth_p_mpls(inner_protocol) on
> using inner_protocol as the type in rpl_skb_network_protocol()
> * Do not update type of features in rpl_dev_queue_xmit.
> Though arguably correct this is not an inherent part of
> the changes made by this patch.
> * Use skb_cow_head() in push_mpls()
> + Call skb_cow_head(skb, MPLS_HLEN) instead of
> make_writable(skb, skb->mac_len) to ensure that there is enough head
> room to push an MPLS LSE regardless of whether the skb is cloned or not.
> + This is consistent with the behaviour of rpl__vlan_put_tag().
> + This is a fix for crashes reported when performing mpls_push
> with headroom less than 4. This problem was introduced in v3.36.
> * Skip popping in mpls_pop if the skb is too short to contain an MPLS LSE
>
>
> Differences between v2.39 and v2.38:
>
> * Rebase for removal of vlan, checksum and skb->mark compat code
> - This includes adding adding a new patch,
> "[PATCH v2.39 6/7] datapath: Break out deacceleration portion of
> vlan_push" to allow re-use of some existing code.
>
>
> Differences between v2.38 and v2.37:
>
> * Rebase for SCTP support
> * Refactor validate_tp_port() to iterate over eth_types rather
> than open-coding the loop. With the addition of SCTP this logic
> is now used three times.
>
>
> Differences between v2.37 and v2.36:
>
> * Rebase
>
>
> Differences between v2.36 and v2.35:
>
> * Rebase
>
> * Do not add set_ethertype() to datapath/actions.c.
> As this patch has evolved this function had devolved into
> to sets of functionality wrapped into a single function with
> only one line of common code. Refactor things to simply
> open-code setting the ether type in the two locations where
> set_ethertype() was previously used. The aim here is to improve
> readability.
>
> * Update setting skb->ethertype after mpls push and pop.
> - In the case of push_mpls it should be set unconditionally
> as in v2.35 the behaviour of this function to always push
> an MPLS LSE before any VLAN tags.
> - In the case of mpls_pop eth_p_mpls(skb->protocol) is a better
> test than skb->protocol != htons(ETH_P_8021Q) as it will give the
> correct behaviour in the presence of other VLAN ethernet types,
> for example 0x88a8 which is used by 802.1ad. Moreover, it seems
> correct to update the ethernet type if it was previously set
> according to the top-most MPLS LSE.
>
> * Deaccelerate VLANs when pushing MPLS tags the
> - Since v2.35 MPLS push will insert an MPLS LSE before any VLAN tags.
> This means that if an accelerated tag is present it should be
> deaccelerated to ensure it ends up in the correct position.
>
> * Update skb->mac_len in push_mpls() so that it will be correct
> when used by a subsequent call to pop_mpls().
>
> As things stand I do not believe this is strictly necessary as
> ovs-vswitchd will not send a pop MPLS action after a push MPLS action.
> However, I have added this in order to code more defensively as I believe
> that if such a sequence did occur it would be rather unobvious why
> it didn't work.
>
> * Do not add skb_cow_head() call in push_mpls().
> It is unnecessary as there is a make_writable() call.
> This change was also made in v2.30 but some how the
> code regressed between then and v2.35.
>
>
> Differences between v2.35 and v2.34:
>
> * Add support for the tag ordering specified up until OpenFlow 1.2 and
> the ordering specified from OpenFlow 1.3.
>
> * Correct error in datapath patch's handling of GSO in the presence
> of MPLS and absence of VLANs.
>
>
> To aid review this series is available in git at:
>
> git://github.com/horms/openvswitch.git devel/mpls-v2.51
>
>
> Patch list and overall diffstat:
>
> Joe Stringer (1):
> odp: Allow VLAN actions after MPLS actions
>
> Simon Horman (4):
> ofp-actions: Allow Consistency checking of OF1.3+ VLAN actions after
> mpls_push
> lib: Support pushing of MPLS LSE before or after VLAN tag
> datapath: Break out deacceleration portion of vlan_push
> datapath: Add basic MPLS support to kernel
>
> OPENFLOW-1.1+ | 12 -
> datapath/Modules.mk | 1 +
> datapath/actions.c | 157 ++++-
> datapath/datapath.c | 4 +-
> datapath/flow.c | 29 +
> datapath/flow.h | 17 +-
> datapath/flow_netlink.c | 286 +++++++-
> datapath/flow_netlink.h | 2 +-
> datapath/linux/compat/gso.c | 70 +-
> datapath/linux/compat/gso.h | 41 ++
> datapath/linux/compat/include/linux/netdevice.h | 6 +-
> datapath/linux/compat/netdevice.c | 10 +-
> datapath/mpls.h | 15 +
> include/linux/openvswitch.h | 7 +-
> lib/flow.c | 2 +-
> lib/odp-util.c | 12 +-
> lib/odp-util.h | 3 +-
> lib/ofp-actions.c | 194 +++++-
> lib/packets.c | 10 +-
> lib/packets.h | 2 +-
> ofproto/ofproto-dpif-xlate.c | 161 ++++-
> tests/ofproto-dpif.at | 869 ++++++++++++++++++++++++
> 22 files changed, 1765 insertions(+), 145 deletions(-)
> create mode 100644 datapath/mpls.h
>
> --
> 1.8.4
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
^ permalink raw reply
* [PATCH] ipv6: judge the accept_ra_defrtr before calling rt6_route_rcv
From: Duan Jiong @ 2013-11-26 7:46 UTC (permalink / raw)
To: David Miller; +Cc: netdev
when dealing with a RA message, if accept_ra_defrtr is false,
the kernel will not add the default route, and then deal with
the following route information options. Unfortunately, those
options maybe contain default route, so let's judge the
accept_ra_defrtr before calling rt6_route_rcv.
Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
net/ipv6/ndisc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 3512177..3008651 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1277,6 +1277,9 @@ skip_linkparms:
ri->prefix_len == 0)
continue;
#endif
+ if (ri->prefix_len == 0 &&
+ !in6_dev->cnf.accept_ra_defrtr)
+ continue;
if (ri->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
continue;
rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v2 2/6] net: MOXA ART: connect to PHY
From: Florian Fainelli @ 2013-11-26 7:49 UTC (permalink / raw)
To: Jonas Jensen; +Cc: netdev, davem, linux-arm-kernel, linux-kernel, bhutchings
In-Reply-To: <1385393228-22416-2-git-send-email-jonas.jensen@gmail.com>
Le lundi 25 novembre 2013, 16:27:04 Jonas Jensen a écrit :
> The kernel now has a MDIO bus driver and a phy_driver (RTL8201CP),
> connect to this PHY using OF.
>
> Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
Looks good:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>
> Notes:
> Thanks for reviewing!
>
> Changes since v1:
>
> 1. split ethtool support to separate patch
> 2. changes to devicetree binding document
> 3. add moxart_mac_update_duplex()
> 4. compare previous link state/speed/duplex on link adjust
> 5. use of_get_phy_mode() not PHY_INTERFACE_MODE_MII
> 6. bail on of_parse_phandle() failure
> 7. remove "if (!priv->phy_dev) return -ENODEV;"
> moxart_do_ioctl()
> 8. remove "if (priv->phy_dev)"
> moxart_mac_open(), moxart_mac_stop()
>
> Applies to next-20131125
>
> .../devicetree/bindings/net/moxa,moxart-mac.txt | 47 ++++++++++-
> drivers/net/ethernet/moxa/moxart_ether.c | 92
> +++++++++++++++++++++- drivers/net/ethernet/moxa/moxart_ether.h |
> 2 +
> 3 files changed, 138 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
> b/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt index
> 583418b..56f0374 100644
> --- a/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
> +++ b/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
> @@ -1,21 +1,64 @@
> MOXA ART Ethernet Controller
>
> +Integrated MDIO bus node:
> +
> +- compatible: "moxa,moxart-mdio"
> +- Inherets from MDIO bus node binding[1]
> +
> +[1] Documentation/devicetree/bindings/net/phy.txt
> +
> +
> +Ethernet node:
> +
> Required properties:
>
> - compatible : Must be "moxa,moxart-mac"
> - reg : Should contain register location and length
> - interrupts : Should contain the mac interrupt number
>
> +Optional Properties:
> +
> +- phy-handle : the phandle to a PHY node
> +
> +
> Example:
>
> + mdio0: mdio@90900090 {
> + compatible = "moxa,moxart-mdio";
> + reg = <0x90900090 0x8>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + ethphy0: ethernet-phy@1 {
> + device_type = "ethernet-phy";
> + compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
> + reg = <1>;
> + };
> + };
> +
> + mdio1: mdio@92000090 {
> + compatible = "moxa,moxart-mdio";
> + reg = <0x92000090 0x8>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + ethphy1: ethernet-phy@1 {
> + device_type = "ethernet-phy";
> + compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
> + reg = <1>;
> + };
> + };
> +
> mac0: mac@90900000 {
> compatible = "moxa,moxart-mac";
> - reg = <0x90900000 0x100>;
> + reg = <0x90900000 0x90>;
> interrupts = <25 0>;
> + phy-handle = <ðphy0>;
> };
>
> mac1: mac@92000000 {
> compatible = "moxa,moxart-mac";
> - reg = <0x92000000 0x100>;
> + reg = <0x92000000 0x90>;
> interrupts = <27 0>;
> + phy-handle = <ðphy1>;
> };
> diff --git a/drivers/net/ethernet/moxa/moxart_ether.c
> b/drivers/net/ethernet/moxa/moxart_ether.c index 3c14afd..1b87034 100644
> --- a/drivers/net/ethernet/moxa/moxart_ether.c
> +++ b/drivers/net/ethernet/moxa/moxart_ether.c
> @@ -26,6 +26,9 @@
> #include <linux/of_irq.h>
> #include <linux/crc32.h>
> #include <linux/crc32c.h>
> +#include <linux/phy.h>
> +#include <linux/of_mdio.h>
> +#include <linux/of_net.h>
>
> #include "moxart_ether.h"
>
> @@ -61,6 +64,16 @@ static int moxart_set_mac_address(struct net_device
> *ndev, void *addr) return 0;
> }
>
> +static int moxart_do_ioctl(struct net_device *ndev, struct ifreq *ir, int
> cmd) +{
> + struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> +
> + if (!netif_running(ndev))
> + return -EINVAL;
> +
> + return phy_mii_ioctl(priv->phy_dev, ir, cmd);
> +}
> +
> static void moxart_mac_free_memory(struct net_device *ndev)
> {
> struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> @@ -110,6 +123,19 @@ static void moxart_mac_enable(struct net_device *ndev)
> writel(priv->reg_maccr, priv->base + REG_MAC_CTRL);
> }
>
> +static void moxart_mac_update_duplex(struct net_device *ndev)
> +{
> + struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> +
> + priv->reg_maccr &= ~(FULLDUP | ENRX_IN_HALFTX);
> + if (priv->duplex)
> + priv->reg_maccr |= FULLDUP;
> + else
> + priv->reg_maccr |= ENRX_IN_HALFTX;
> +
> + writel(priv->reg_maccr, priv->base + REG_MAC_CTRL);
> +}
> +
> static void moxart_mac_setup_desc_ring(struct net_device *ndev)
> {
> struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> @@ -169,6 +195,9 @@ static int moxart_mac_open(struct net_device *ndev)
> moxart_update_mac_address(ndev);
> moxart_mac_setup_desc_ring(ndev);
> moxart_mac_enable(ndev);
> +
> + phy_start(priv->phy_dev);
> +
> netif_start_queue(ndev);
>
> netdev_dbg(ndev, "%s: IMR=0x%x, MACCR=0x%x\n",
> @@ -184,6 +213,8 @@ static int moxart_mac_stop(struct net_device *ndev)
>
> napi_disable(&priv->napi);
>
> + phy_stop(priv->phy_dev);
> +
> netif_stop_queue(ndev);
>
> /* disable all interrupts */
> @@ -429,12 +460,49 @@ static struct net_device_ops moxart_netdev_ops = {
> .ndo_set_mac_address = moxart_set_mac_address,
> .ndo_validate_addr = eth_validate_addr,
> .ndo_change_mtu = eth_change_mtu,
> + .ndo_do_ioctl = moxart_do_ioctl,
> };
>
> +static void moxart_adjust_link(struct net_device *ndev)
> +{
> + struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> + unsigned long flags;
> + int status_change = 0;
> +
> + if (priv->phy_dev->link) {
> + if (priv->speed != priv->phy_dev->speed) {
> + priv->speed = priv->phy_dev->speed;
> + status_change = 1;
> + }
> +
> + if (priv->duplex != priv->phy_dev->duplex) {
> + spin_lock_irqsave(&priv->txlock, flags);
> +
> + priv->duplex = priv->phy_dev->duplex;
> + moxart_mac_update_duplex(ndev);
> +
> + spin_unlock_irqrestore(&priv->txlock, flags);
> + status_change = 1;
> + }
> + }
> +
> + if (priv->link != priv->phy_dev->link) {
> + if (!priv->phy_dev->link) {
> + priv->speed = 0;
> + priv->duplex = -1;
> + }
> + priv->link = priv->phy_dev->link;
> + status_change = 1;
> + }
> +
> + if (status_change)
> + phy_print_status(priv->phy_dev);
> +}
> +
> static int moxart_mac_probe(struct platform_device *pdev)
> {
> struct device *p_dev = &pdev->dev;
> - struct device_node *node = p_dev->of_node;
> + struct device_node *node = p_dev->of_node, *phy_node;
> struct net_device *ndev;
> struct moxart_mac_priv_t *priv;
> struct resource *res;
> @@ -455,6 +523,28 @@ static int moxart_mac_probe(struct platform_device
> *pdev) priv = netdev_priv(ndev);
> priv->ndev = ndev;
>
> + priv->link = 0;
> + priv->speed = 0;
> + priv->duplex = -1;
> +
> + phy_node = of_parse_phandle(node, "phy-handle", 0);
> + if (!phy_node) {
> + dev_err(p_dev, "of_parse_phandle failed\n");
> + ret = -ENODEV;
> + goto init_fail;
> + }
> +
> + if (phy_node) {
> + priv->phy_dev = of_phy_connect(priv->ndev, phy_node,
> + &moxart_adjust_link,
> + 0, of_get_phy_mode(node));
> + if (!priv->phy_dev) {
> + dev_err(p_dev, "of_phy_connect failed\n");
> + ret = -ENODEV;
> + goto init_fail;
> + }
> + }
> +
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> ndev->base_addr = res->start;
> priv->base = devm_ioremap_resource(p_dev, res);
> diff --git a/drivers/net/ethernet/moxa/moxart_ether.h
> b/drivers/net/ethernet/moxa/moxart_ether.h index 2be9280..b8877bf 100644
> --- a/drivers/net/ethernet/moxa/moxart_ether.h
> +++ b/drivers/net/ethernet/moxa/moxart_ether.h
> @@ -297,6 +297,8 @@ struct moxart_mac_priv_t {
> unsigned int reg_imr;
> struct napi_struct napi;
> struct net_device *ndev;
> + struct phy_device *phy_dev;
> + int speed, duplex, link;
>
> dma_addr_t rx_base;
> dma_addr_t rx_mapping[RX_DESC_NUM];
--
Florian
^ permalink raw reply
* [PATCH 11/17] net: ixgbe calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:54 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index bd8f523..9973eaf 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1233,7 +1233,9 @@ static inline void ixgbe_rx_hash(struct ixgbe_ring *ring,
struct sk_buff *skb)
{
if (ring->netdev->features & NETIF_F_RXHASH)
- skb->rxhash = le32_to_cpu(rx_desc->wb.lower.hi_dword.rss);
+ skb_set_rxhash(skb,
+ le32_to_cpu(rx_desc->wb.lower.hi_dword.rss),
+ RXHASH_TYPE_L3);
}
#ifdef IXGBE_FCOE
--
1.8.4.1
^ permalink raw reply related
* [PATCH 17/17] net: vmxnet3 calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:59 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/vmxnet3/vmxnet3_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 7e2788c..88d8ff8 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1235,7 +1235,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
#ifdef VMXNET3_RSS
if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE &&
(adapter->netdev->features & NETIF_F_RXHASH))
- ctx->skb->rxhash = le32_to_cpu(rcd->rssHash);
+ skb_set_rxhash(skb, le32_to_cpu(rcd->rssHash),
+ RXHASH_TYPE_L3);
#endif
skb_put(ctx->skb, rcd->len);
--
1.8.4.1
^ permalink raw reply related
* [PATCH 16/17] net: sun-niu calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:58 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/sun/niu.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 388540f..805808d 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -3493,10 +3493,12 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
rh = (struct rx_pkt_hdr1 *) skb->data;
if (np->dev->features & NETIF_F_RXHASH)
- skb->rxhash = ((u32)rh->hashval2_0 << 24 |
- (u32)rh->hashval2_1 << 16 |
- (u32)rh->hashval1_1 << 8 |
- (u32)rh->hashval1_2 << 0);
+ skb_set_rxhash(skb,
+ ((u32)rh->hashval2_0 << 24 |
+ (u32)rh->hashval2_1 << 16 |
+ (u32)rh->hashval1_1 << 8 |
+ (u32)rh->hashval1_2 << 0),
+ RXHASH_TYPE_L3);
skb_pull(skb, sizeof(*rh));
rp->rx_packets++;
--
1.8.4.1
^ permalink raw reply related
* [PATCH 15/17] net: sfc calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:57 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/sfc/rx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index 8f09e68..b51466e 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -439,7 +439,8 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf,
}
if (efx->net_dev->features & NETIF_F_RXHASH)
- skb->rxhash = efx_rx_buf_hash(efx, eh);
+ skb_set_rxhash(skb, efx_rx_buf_hash(efx, eh),
+ RXHASH_TYPE_L3);
skb->ip_summed = ((rx_buf->flags & EFX_RX_PKT_CSUMMED) ?
CHECKSUM_UNNECESSARY : CHECKSUM_NONE);
--
1.8.4.1
^ permalink raw reply related
* [PATCH 14/17] net: vxge calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:57 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/neterion/vxge/vxge-main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c
index 8614eeb..17749a2 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -507,7 +507,8 @@ vxge_rx_1b_compl(struct __vxge_hw_ring *ringh, void *dtr,
* if rss is disabled/enabled, so key off of that.
*/
if (ext_info.rth_value)
- skb->rxhash = ext_info.rth_value;
+ skb_set_rxhash(skb, ext_info.rth_value,
+ RXHASH_TYPE_L3);
vxge_rx_complete(ring, skb, ext_info.vlan,
pkt_length, &ext_info);
--
1.8.4.1
^ permalink raw reply related
* [PATCH 06/17] net: cisco-enic calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:51 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index ff78dfa..ea30551 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1036,11 +1036,12 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
skb->protocol = eth_type_trans(skb, netdev);
skb_record_rx_queue(skb, q_number);
if (netdev->features & NETIF_F_RXHASH) {
- skb->rxhash = rss_hash;
- if (rss_type & (NIC_CFG_RSS_HASH_TYPE_TCP_IPV6_EX |
- NIC_CFG_RSS_HASH_TYPE_TCP_IPV6 |
- NIC_CFG_RSS_HASH_TYPE_TCP_IPV4))
- skb->l4_rxhash = true;
+ skb_set_rxhash(skb, rss_hash,
+ (rss_type & (NIC_CFG_RSS_HASH_TYPE_TCP_IPV6_EX |
+ NIC_CFG_RSS_HASH_TYPE_TCP_IPV6 |
+ NIC_CFG_RSS_HASH_TYPE_TCP_IPV4)) ?
+ RXHASH_TYPE_L4 : RXHASH_TYPE_L3);
+
}
if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc) {
--
1.8.4.1
^ permalink raw reply related
* [PATCH 05/17] net: cxgb4 calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:50 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/chelsio/cxgb4/sge.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index ac311f5..c9fd598 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -1630,7 +1630,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
skb->ip_summed = CHECKSUM_UNNECESSARY;
skb_record_rx_queue(skb, rxq->rspq.idx);
if (rxq->rspq.netdev->features & NETIF_F_RXHASH)
- skb->rxhash = (__force u32)pkt->rsshdr.hash_val;
+ skb_set_rxhash(skb, (__force u32)pkt->rsshdr.hash_val,
+ RXHASH_TYPE_L3);
if (unlikely(pkt->vlan_ex)) {
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan));
@@ -1686,7 +1687,8 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
skb->protocol = eth_type_trans(skb, q->netdev);
skb_record_rx_queue(skb, q->idx);
if (skb->dev->features & NETIF_F_RXHASH)
- skb->rxhash = (__force u32)pkt->rsshdr.hash_val;
+ skb_set_rxhash(skb, (__force u32)pkt->rsshdr.hash_val,
+ RXHASH_TYPE_L3);
rxq->stats.pkts++;
--
1.8.4.1
^ permalink raw reply related
* [PATCH 13/17] net: mlx4 calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:56 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 07a1d0f..3e48c44 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -747,7 +747,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
}
if (dev->features & NETIF_F_RXHASH)
- gro_skb->rxhash = be32_to_cpu(cqe->immed_rss_invalid);
+ skb_set_rxhash(gro_skb, be32_to_cpu(cqe->immed_rss_invalid), RXHASH_TYPE_L3);
skb_record_rx_queue(gro_skb, cq->ring);
@@ -789,7 +789,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
skb_record_rx_queue(skb, cq->ring);
if (dev->features & NETIF_F_RXHASH)
- skb->rxhash = be32_to_cpu(cqe->immed_rss_invalid);
+ skb_set_rxhash(skb, be32_to_cpu(cqe->immed_rss_invalid), RXHASH_TYPE_L3);
if ((be32_to_cpu(cqe->vlan_my_qpn) &
MLX4_CQE_VLAN_PRESENT_MASK) &&
--
1.8.4.1
^ permalink raw reply related
* [PATCH 12/17] net: sky2 calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:55 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/marvell/sky2.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index a7df981..abfe57a 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -2495,7 +2495,7 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2,
skb_copy_from_linear_data(re->skb, skb->data, length);
skb->ip_summed = re->skb->ip_summed;
skb->csum = re->skb->csum;
- skb->rxhash = re->skb->rxhash;
+ skb_set_rxhash(skb, re->skb->rxhash, RXHASH_TYPE_L3);
skb->vlan_proto = re->skb->vlan_proto;
skb->vlan_tci = re->skb->vlan_tci;
@@ -2503,7 +2503,7 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2,
length, PCI_DMA_FROMDEVICE);
re->skb->vlan_proto = 0;
re->skb->vlan_tci = 0;
- re->skb->rxhash = 0;
+ skb_clear_rxhash(re->skb);
re->skb->ip_summed = CHECKSUM_NONE;
skb_put(skb, length);
}
@@ -2723,7 +2723,7 @@ static void sky2_rx_hash(struct sky2_port *sky2, u32 status)
struct sk_buff *skb;
skb = sky2->rx_ring[sky2->rx_next].skb;
- skb->rxhash = le32_to_cpu(status);
+ skb_set_rxhash(skb, le32_to_cpu(status), RXHASH_TYPE_L3);
}
/* Process status response ring */
--
1.8.4.1
^ permalink raw reply related
* [PATCH 04/17] net: bnx2x calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:49 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index dcafbda..7c1d45d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -728,8 +728,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
skb_reserve(skb, pad + NET_SKB_PAD);
skb_put(skb, len);
- skb->rxhash = tpa_info->rxhash;
- skb->l4_rxhash = tpa_info->l4_rxhash;
+ skb_set_rxhash(skb, tpa_info->rxhash,
+ tpa_info->l4_rxhash ? RXHASH_TYPE_L4 : RXHASH_TYPE_L3);
skb->protocol = eth_type_trans(skb, bp->dev);
skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -846,6 +846,7 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
enum eth_rx_cqe_type cqe_fp_type;
u16 len, pad, queue;
u8 *data;
+ u32 rxhash;
bool l4_rxhash;
#ifdef BNX2X_STOP_ON_ERROR
@@ -987,8 +988,9 @@ reuse_rx:
skb->protocol = eth_type_trans(skb, bp->dev);
/* Set Toeplitz hash for a none-LRO skb */
- skb->rxhash = bnx2x_get_rxhash(bp, cqe_fp, &l4_rxhash);
- skb->l4_rxhash = l4_rxhash;
+ rxhash = bnx2x_get_rxhash(bp, cqe_fp, &l4_rxhash);
+ skb_set_rxhash(skb, rxhash,
+ l4_rxhash ? RXHASH_TYPE_L4 : RXHASH_TYPE_L3);
skb_checksum_none_assert(skb);
--
1.8.4.1
^ permalink raw reply related
* [PATCH 10/17] net: igb calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:54 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/intel/igb/igb_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index ebe6370..4e8e2b2 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6412,7 +6412,9 @@ static inline void igb_rx_hash(struct igb_ring *ring,
struct sk_buff *skb)
{
if (ring->netdev->features & NETIF_F_RXHASH)
- skb->rxhash = le32_to_cpu(rx_desc->wb.lower.hi_dword.rss);
+ skb_set_rxhash(skb,
+ le32_to_cpu(rx_desc->wb.lower.hi_dword.rss),
+ RXHASH_TYPE_L3);
}
/**
--
1.8.4.1
^ permalink raw reply related
* [PATCH 09/17] net: i40e calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:52 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index f1f03bc..203048d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1029,7 +1029,8 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
goto next_desc;
}
- skb->rxhash = i40e_rx_hash(rx_ring, rx_desc);
+ skb_set_rxhash(skb, i40e_rx_hash(rx_ring, rx_desc),
+ RXHASH_TYPE_L3);
i40e_rx_checksum(vsi, skb, rx_status, rx_error);
/* probably a little skewed due to removing CRC */
--
1.8.4.1
^ permalink raw reply related
* [PATCH 08/17] net: e1000e calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:52 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 4ef7867..128534f 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -885,7 +885,7 @@ static inline void e1000_rx_hash(struct net_device *netdev, __le32 rss,
struct sk_buff *skb)
{
if (netdev->features & NETIF_F_RXHASH)
- skb->rxhash = le32_to_cpu(rss);
+ skb_set_rxhash(skb, le32_to_cpu(rss), RXHASH_TYPE_L3);
}
/**
--
1.8.4.1
^ permalink raw reply related
* [PATCH 07/17] net: emulex-benet calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:51 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 741d3bf..4678858 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1581,7 +1581,7 @@ static void be_rx_compl_process(struct be_rx_obj *rxo, struct napi_struct *napi,
skb->protocol = eth_type_trans(skb, netdev);
skb_record_rx_queue(skb, rxo - &adapter->rx_obj[0]);
if (netdev->features & NETIF_F_RXHASH)
- skb->rxhash = rxcp->rss_hash;
+ skb_set_rxhash(skb, rxcp->rss_hash, RXHASH_TYPE_L3);
skb_mark_napi_id(skb, napi);
if (rxcp->vlanf)
@@ -1639,7 +1639,7 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo,
skb->ip_summed = CHECKSUM_UNNECESSARY;
skb_record_rx_queue(skb, rxo - &adapter->rx_obj[0]);
if (adapter->netdev->features & NETIF_F_RXHASH)
- skb->rxhash = rxcp->rss_hash;
+ skb_set_rxhash(skb, rxcp->rss_hash, RXHASH_TYPE_L3);
skb_mark_napi_id(skb, napi);
if (rxcp->vlanf)
--
1.8.4.1
^ permalink raw reply related
* Subject: [PATCH 03/17] net: bnx2 calls skb_get_rxhash
From: Tom Herbert @ 2013-11-26 5:48 UTC (permalink / raw)
To: davem, netdev
Drivers should call skb_get_rxhash to set the rxhash and its type
in an skbuff.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/ethernet/broadcom/bnx2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index d9980ad..0d7bea2b 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -3234,7 +3234,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
if ((bp->dev->features & NETIF_F_RXHASH) &&
((status & L2_FHDR_STATUS_USE_RXHASH) ==
L2_FHDR_STATUS_USE_RXHASH))
- skb->rxhash = rx_hdr->l2_fhdr_hash;
+ skb_set_rxhash(skb, rx_hdr->l2_fhdr_hash,
+ RXHASH_TYPE_L3);
skb_record_rx_queue(skb, bnapi - &bp->bnx2_napi[0]);
napi_gro_receive(&bnapi->napi, skb);
--
1.8.4.1
^ permalink raw reply related
* [PATCH 02/17] net: Add function to set the rxhash
From: Tom Herbert @ 2013-11-26 5:48 UTC (permalink / raw)
To: davem, netdev
The function skb_set_rxash was added for drivers to call to set
the rxhash in an skb. The type of hash is also specified as
a parameter (L2, L3, L4, or unknown type).
Signed-off-by: Tom Herbert <therbert@google.com>
---
include/linux/skbuff.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 76d3aa9..25f190e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -703,6 +703,20 @@ unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
unsigned int to, struct ts_config *config,
struct ts_state *state);
+enum rxhash_types {
+ RXHASH_TYPE_NONE, /* Undefined type */
+ RXHASH_TYPE_L2, /* Uses L2 information (addresses) */
+ RXHASH_TYPE_L3, /* Uses L3 information */
+ RXHASH_TYPE_L4, /* Uses L4 information (ports) */
+};
+
+static inline void
+skb_set_rxhash(struct sk_buff *skb, __u32 hash, enum rxhash_types type)
+{
+ skb->l4_rxhash = (type == RXHASH_TYPE_L4);
+ skb->rxhash = hash;
+}
+
void __skb_get_rxhash(struct sk_buff *skb);
static inline __u32 skb_get_rxhash(struct sk_buff *skb)
{
--
1.8.4.1
^ permalink raw reply related
* [PATCH 01/17] net: Add utility function to clear rxhash
From: Tom Herbert @ 2013-11-26 5:46 UTC (permalink / raw)
To: davem, netdev
In several places 'skb->rxhash = 0' is being done to clear the
rxhash value in an skb. This does not clear l4_rxhash which could
still be set so that the rxhash wouldn't be recalculated on subsequent
call to skb_get_rxhash. This patch adds an explict function to clear
all the rxhash related information in the skb properly.
Signed-off-by: Tom Herbert <therbert@google.com>
---
include/linux/skbuff.h | 6 ++++++
net/ipv4/ip_fragment.c | 2 +-
net/ipv4/ip_tunnel_core.c | 4 ++--
net/openvswitch/actions.c | 10 +++++-----
4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 215b5ea..76d3aa9 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -712,6 +712,12 @@ static inline __u32 skb_get_rxhash(struct sk_buff *skb)
return skb->rxhash;
}
+static inline void skb_clear_rxhash(struct sk_buff *skb)
+{
+ skb->rxhash = 0;
+ skb->l4_rxhash = 0;
+}
+
#ifdef NET_SKBUFF_DATA_USES_OFFSET
static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
{
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 2481993..3bc1d0d 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -704,7 +704,7 @@ struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
if (ip_defrag(skb, user))
return NULL;
- skb->rxhash = 0;
+ skb_clear_rxhash(skb);
}
}
return skb;
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 42ffbc8..2148c1d 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -56,7 +56,7 @@ int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb,
skb_scrub_packet(skb, xnet);
- skb->rxhash = 0;
+ skb_clear_rxhash(skb);
skb_dst_set(skb, &rt->dst);
memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
@@ -108,7 +108,7 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto)
nf_reset(skb);
secpath_reset(skb);
if (!skb->l4_rxhash)
- skb->rxhash = 0;
+ skb_clear_rxhash(skb);
skb_dst_drop(skb);
skb->vlan_tci = 0;
skb_set_queue_mapping(skb, 0);
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 65cfaa8..ab0d925 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -165,7 +165,7 @@ static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh,
}
csum_replace4(&nh->check, *addr, new_addr);
- skb->rxhash = 0;
+ skb_clear_rxhash(skb);
*addr = new_addr;
}
@@ -199,7 +199,7 @@ static void set_ipv6_addr(struct sk_buff *skb, u8 l4_proto,
if (recalculate_csum)
update_ipv6_checksum(skb, l4_proto, addr, new_addr);
- skb->rxhash = 0;
+ skb_clear_rxhash(skb);
memcpy(addr, new_addr, sizeof(__be32[4]));
}
@@ -296,7 +296,7 @@ static void set_tp_port(struct sk_buff *skb, __be16 *port,
{
inet_proto_csum_replace2(check, skb, *port, new_port, 0);
*port = new_port;
- skb->rxhash = 0;
+ skb_clear_rxhash(skb);
}
static void set_udp_port(struct sk_buff *skb, __be16 *port, __be16 new_port)
@@ -310,7 +310,7 @@ static void set_udp_port(struct sk_buff *skb, __be16 *port, __be16 new_port)
uh->check = CSUM_MANGLED_0;
} else {
*port = new_port;
- skb->rxhash = 0;
+ skb_clear_rxhash(skb);
}
}
@@ -381,7 +381,7 @@ static int set_sctp(struct sk_buff *skb,
/* Carry any checksum errors through. */
sh->checksum = old_csum ^ old_correct_csum ^ new_csum;
- skb->rxhash = 0;
+ skb_clear_rxhash(skb);
}
return 0;
--
1.8.4.1
^ permalink raw reply related
* [PATCH 0/17] net: Add rxhash utility hash functions
From: Tom Herbert @ 2013-11-26 5:45 UTC (permalink / raw)
To: davem, netdev
This patch series introduce skb_set_rxhash and skb_clear_rxhash
which are called to set the rxhash (from network drivers) and
to clear the rxhash. This API should be used instead of updating
fields in the skbuff directly.
Verified that the drivers compiled with the changes (verified
bnx2x is operational).
By my count 15 NIC drivers set the rxhash, but only two of them
mark the hash as L4. It looks like several of those have capability
do determine an L4 hash was done.
^ permalink raw reply
* Re: [PATCH 1/5] tg3: Convert to use hwmon_device_register_with_groups
From: Guenter Roeck @ 2013-11-26 2:47 UTC (permalink / raw)
To: Nithin Nayak Sujir, netdev
Cc: e1000-devel, Bruce Allan, Jesse Brandeburg, lm-sensors,
Michael Chan, David S. Miller
In-Reply-To: <5293FEFA.4000700@broadcom.com>
On 11/25/2013 05:52 PM, Nithin Nayak Sujir wrote:
>
>
> On 11/22/2013 10:07 PM, Guenter Roeck wrote:
>> Use new hwmon API to simplify code, provide missing mandatory 'name'
>> sysfs attribute, and attach hwmon attributes to hwmon device instead
>> of pci device.
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>> drivers/net/ethernet/broadcom/tg3.c | 25 ++++++-------------------
>> 1 file changed, 6 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
>> index a9e0684..369b736 100644
>> --- a/drivers/net/ethernet/broadcom/tg3.c
>> +++ b/drivers/net/ethernet/broadcom/tg3.c
>> @@ -10629,10 +10629,8 @@ static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
>> static ssize_t tg3_show_temp(struct device *dev,
>> struct device_attribute *devattr, char *buf)
>> {
>> - struct pci_dev *pdev = to_pci_dev(dev);
>> - struct net_device *netdev = pci_get_drvdata(pdev);
>> - struct tg3 *tp = netdev_priv(netdev);
>> struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
>> + struct tg3 *tp = dev_get_drvdata(dev);
>
>
> Shouldn't this be
> struct tg3 *tp = netdev_priv(dev_get_drvdata(dev));
>
'struct tg3 *tp' is attached to the hwmon device in
hwmon_device_register_with_groups(), so it can be retrieved
with dev_get_drvdata() from there. Keep in mind that 'dev'
is no longer the pci device but the hwmon device.
Guenter
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox