Re: Adding data to SKB - odd checksum errors

2007-02-27 Thread Sergio Paracuellos
Hi, This is because if you change the skb you must calcutale checksum for tcp and ip headers changes again. For example: struct iphdr *new_iph = NULL; struct tcphdr *new_th = NULL; /* copy skb to another skb with skb_copy */ new_skb = skb_copy_expand(skb, skb_headroom(skb), MY_SIZE, GFP_ATOMIC);

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2019-01-10 Thread Sergio Paracuellos
ksz_i2c_read32(struct ksz_device *dev, u32 reg, u32 *val) > +{ > + int ret = ksz_i2c_read(dev, reg, (u8 *)val, 4); > + > + if (!ret) > + *val = be32_to_cpu(*val); > + > + return ret; > +} > + > +static int ksz_i2c_write8(struct ksz_device *dev, u32 reg, u8 value) > +{ > + return ksz_i2c_write(dev, reg, &value, 1); > +} > + > +static int ksz_i2c_write16(struct ksz_device *dev, u32 reg, u16 value) > +{ > + value = cpu_to_be16(value); > + return ksz_i2c_write(dev, reg, &value, 2); > +} > + > +static int ksz_i2c_write32(struct ksz_device *dev, u32 reg, u32 value) > +{ > + value = cpu_to_be32(value); > + return ksz_i2c_write(dev, reg, &value, 4); > +} > + > +static int ksz_i2c_get(struct ksz_device *dev, u32 reg, void *data, size_t > len) > +{ > + return ksz_i2c_read(dev, reg, data, len); > +} > + > +static int ksz_i2c_set(struct ksz_device *dev, u32 reg, void *data, size_t > len) > +{ > + return ksz_i2c_write(dev, reg, data, len); > +} > + > +#endif > -- > 1.9.1 > I don't know if at the end this is going to be changed together with spi etc to use regmap API but I tested this code as it is and it works. So you can add my Tested-by if you want: Tested-by: Sergio Paracuellos Best regards, Sergio Paracuellos

[PATCH v2] dt-bindings: net: dsa: ksz9477: fix indentation for switch spi bindings

2019-01-13 Thread Sergio Paracuellos
Switch bindings for spi managed mode are using spaces instead of tabs. Fix them to get a file with a proper kernel indentation style. Reviewed-by: Florian Fainelli Signed-off-by: Sergio Paracuellos --- Changes in v2: - Rebase onto net-next - Collect previous Reviewed-by tags

Re: [PATCH RFC v1] net: dsa: microchip: add KSZ9477 I2C driver

2019-01-17 Thread Sergio Paracuellos
> + .driver = { > + .name = "ksz9477-switch", > + .owner = THIS_MODULE, > + .of_match_table = of_match_ptr(ksz9477_dt_ids), > + }, > + .probe = ksz9477_i2c_probe, > + .remove = ksz9477_i2c_remov

Re: [PATCH RFC v1] net: dsa: microchip: add KSZ9477 I2C driver

2019-01-17 Thread Sergio Paracuellos
On Thu, Jan 17, 2019 at 10:36 AM Sergio Paracuellos wrote: > > On Thu, Jan 17, 2019 at 4:24 AM wrote: > > > > From: Tristram Ha > > > > Add KSZ9477 I2C driver support. The code ksz9477.c and ksz_common.c are > > used together to generate the I2C driver

[PATCH 2/2] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-15 Thread Sergio Paracuellos
Add device-tree binding example of the ksz9477 switch managed in i2c mode. Cc: devicet...@vger.kernel.org Signed-off-by: Sergio Paracuellos --- .../devicetree/bindings/net/dsa/ksz.txt | 50 +++ 1 file changed, 50 insertions(+) diff --git a/Documentation/devicetree

[PATCH 1/2] net: dsa: ksz9477: add I2C managed mode support

2018-12-15 Thread Sergio Paracuellos
In this mode the switch device and the internal phys will be managed via I2C interface. Signed-off-by: Sergio Paracuellos --- drivers/net/dsa/microchip/Kconfig | 6 + drivers/net/dsa/microchip/Makefile | 1 + drivers/net/dsa/microchip/ksz9477_i2c.c | 258

Re: [PATCH 2/2] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-16 Thread Sergio Paracuellos
On Sun, Dec 16, 2018 at 9:18 AM Andrew Lunn wrote: > > On Sun, Dec 16, 2018 at 08:57:41AM +0100, Sergio Paracuellos wrote: > > Add device-tree binding example of the ksz9477 switch managed in i2c mode. > > > > Cc: devicet...@vger.kernel.org > > Sig

Re: [PATCH 1/2] net: dsa: ksz9477: add I2C managed mode support

2018-12-16 Thread Sergio Paracuellos
On Sun, Dec 16, 2018 at 9:15 AM Andrew Lunn wrote: > > On Sun, Dec 16, 2018 at 08:57:40AM +0100, Sergio Paracuellos wrote: > > +static int ksz_i2c_read_reg(struct i2c_client *client, u32 reg, u8 *val, > > + unsigned int len) > > +{ > > +

[PATCH v2 1/2] net: dsa: ksz9477: add I2C managed mode support

2018-12-16 Thread Sergio Paracuellos
In this mode the switch device and the internal phys will be managed via I2C interface. Signed-off-by: Sergio Paracuellos --- Changes v2: - Use dev->txbuf as transmition buffer which is allocated using kernel allocators avoiding some possible DMA issues using the stack. driv

[PATCH v2 2/2] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-16 Thread Sergio Paracuellos
Add device-tree binding example of the ksz9477 switch managed in i2c mode. Cc: devicet...@vger.kernel.org Signed-off-by: Sergio Paracuellos --- Changes v2: - Use generic name for label of the switch and make sure reg and @X have the same value. .../devicetree/bindings/net/dsa/ksz.txt

Re: [PATCH 1/2] net: dsa: ksz9477: add I2C managed mode support

2018-12-17 Thread Sergio Paracuellos
Hi Dan, Thanks for the feedback. On Mon, Dec 17, 2018 at 7:55 AM Dan Carpenter wrote: > > On Sun, Dec 16, 2018 at 08:57:40AM +0100, Sergio Paracuellos wrote: > > +static int ksz_i2c_write(struct ksz_device *dev, u32 reg, u8 *val, > > +

Re: [PATCH v2 1/2] net: dsa: ksz9477: add I2C managed mode support

2018-12-17 Thread Sergio Paracuellos
On Mon, Dec 17, 2018 at 8:38 AM Andrew Lunn wrote: > > On Sun, Dec 16, 2018 at 10:49:52AM +0100, Sergio Paracuellos wrote: > > In this mode the switch device and the internal phys will be managed via > > I2C interface. > > > > Signed-off-by: Sergio Parac

[PATCH v3 1/2] net: dsa: ksz9477: add I2C managed mode support

2018-12-17 Thread Sergio Paracuellos
In this mode the switch device and the internal phys will be managed via I2C interface. Signed-off-by: Sergio Paracuellos --- Changes v3: - return -EINVAL if 'ksz_i2c_write' is called with len 0 to avoid a possible memory corruption. Changes v2: - Use dev->txbuf a

[PATCH v3 2/2] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-17 Thread Sergio Paracuellos
Add device-tree binding example of the ksz9477 switch managed in i2c mode. Cc: devicet...@vger.kernel.org Signed-off-by: Sergio Paracuellos --- Changes v3: - No changes. Just resent patches together. Changes v2: - Use generic name for label of the switch and make sure reg and @X

Re: [PATCH 1/2] net: dsa: ksz9477: add I2C managed mode support

2018-12-17 Thread Sergio Paracuellos
On Mon, Dec 17, 2018 at 8:11 PM Dan Carpenter wrote: > > On Mon, Dec 17, 2018 at 07:22:51PM +0100, Sergio Paracuellos wrote: > > > > +static int ksz_i2c_write(struct ksz_device *dev, u32 reg, u8 *val, > > > > + unsigned int len) > > &g

Re: [PATCH RFC net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-17 Thread Sergio Paracuellos
; +static int ksz_i2c_read16(struct ksz_device *dev, u32 reg, u16 *val) > +{ > + int ret = ksz_i2c_read(dev, reg, (u8 *)val, 2); > + > + if (!ret) > + *val = be16_to_cpu(*val); > + > + return ret; > +} > + > +static int ksz_i2c_read32(struct ksz_device *dev, u32 reg, u32 *val) > +{ > + int ret = ksz_i2c_read(dev, reg, (u8 *)val, 4); > + > + if (!ret) > + *val = be32_to_cpu(*val); > + > + return ret; > +} > + > +static int ksz_i2c_write8(struct ksz_device *dev, u32 reg, u8 value) > +{ > + return ksz_i2c_write(dev, reg, &value, 1); > +} > + > +static int ksz_i2c_write16(struct ksz_device *dev, u32 reg, u16 value) > +{ > + value = cpu_to_be16(value); > + return ksz_i2c_write(dev, reg, &value, 2); > +} > + > +static int ksz_i2c_write32(struct ksz_device *dev, u32 reg, u32 value) > +{ > + value = cpu_to_be32(value); > + return ksz_i2c_write(dev, reg, &value, 4); > +} > + > +static int ksz_i2c_get(struct ksz_device *dev, u32 reg, void *data, size_t > len) > +{ > + return ksz_i2c_read(dev, reg, data, len); > +} > + > +static int ksz_i2c_set(struct ksz_device *dev, u32 reg, void *data, size_t > len) > +{ > + return ksz_i2c_write(dev, reg, data, len); > +} > + > +#endif > -- > 1.9.1 > Best regards, Sergio Paracuellos

Re: [PATCH RFC net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-17 Thread Sergio Paracuellos
> A little out-of-topic is the modalias now returns a different string rather > than "i2c:ksz9477." This is done with the "cat > /sys/bus/i2c/devices/0-005f/modalias" command. The string looks legit but it > is difficult for regular users to get anything from it. > Thanks for clarification. Best regards, Sergio Paracuellos

Re: [PATCH v3 2/2] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-17 Thread Sergio Paracuellos
Hi Florian, On Mon, Dec 17, 2018 at 11:22 PM Florian Fainelli wrote: > > On 12/17/18 12:44 PM, Sergio Paracuellos wrote: > > Add device-tree binding example of the ksz9477 switch managed in i2c mode. > > > > Cc: devicet...@vger.kernel.org > > Signed-off-by: Serg

Re: [PATCH RFC net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-18 Thread Sergio Paracuellos
On Tue, Dec 18, 2018 at 9:06 AM Dan Carpenter wrote: > > Do we still need Sergio's device tree patch? I think is useful. If not at least add a clarification that the reg "5f" for the i2c is the one to use. > > regards, > dan carpenter > Thanks, Sergio Paracuellos

Re: [PATCH v3 2/2] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-18 Thread Sergio Paracuellos
Hi Rob, On Tue, Dec 18, 2018 at 4:10 PM Rob Herring wrote: > > On Mon, Dec 17, 2018 at 09:44:23PM +0100, Sergio Paracuellos wrote: > > Add device-tree binding example of the ksz9477 switch managed in i2c mode. > > > > Cc: devicet...@vger.kernel.org > > Sig

[PATCH v4] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-19 Thread Sergio Paracuellos
Add device-tree binding example of the ksz9477 switch managed in i2c mode. Cc: devicet...@vger.kernel.org Signed-off-by: Sergio Paracuellos --- Changes v4: - Use one tab formatting properly the binding sample. Changes v3: - No changes. Just resent patches together. Changes v2

Re: [PATCH v3 2/2] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-19 Thread Sergio Paracuellos
On Wed, Dec 19, 2018 at 7:26 PM Florian Fainelli wrote: > > On 12/18/18 10:23 PM, Sergio Paracuellos wrote: > > Hi Rob, > > > > On Tue, Dec 18, 2018 at 4:10 PM Rob Herring wrote: > >> > >> On Mon, Dec 17, 2018 at 09:44:23PM +0100, Sergio Paracuellos wr

[PATCH] dt-bindings: net: dsa: ksz9477: fix indentation for switch spi bindings

2018-12-22 Thread Sergio Paracuellos
Switch bindings for spi managed mode are using spaces instead of tabs. Fix them to get a file with a proper kernel indentation style. Signed-off-by: Sergio Paracuellos --- .../devicetree/bindings/net/dsa/ksz.txt | 110 +- 1 file changed, 55 insertions(+), 55 deletions

Re: [PATCH] dt-bindings: net: dsa: ksz9477: fix indentation for switch spi bindings

2018-12-25 Thread Sergio Paracuellos
Hi David, On Mon, Dec 24, 2018 at 11:15 PM David Miller wrote: > > From: Sergio Paracuellos > Date: Sat, 22 Dec 2018 08:39:09 +0100 > > > Switch bindings for spi managed mode are using spaces instead of tabs. > > Fix them to get a file with a proper kernel indentation s

Re: [PATCH] dt-bindings: net: dsa: ksz9477: fix indentation for switch spi bindings

2018-12-25 Thread Sergio Paracuellos
On Tue, Dec 25, 2018 at 1:39 PM Andrew Lunn wrote: > > On Tue, Dec 25, 2018 at 12:45:11PM +0100, Sergio Paracuellos wrote: > > Hi David, > > > > On Mon, Dec 24, 2018 at 11:15 PM David Miller wrote: > > > > > > From: Sergio Paracuellos &

Re: [PATCH v4] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-28 Thread Sergio Paracuellos
On Sat, Dec 29, 2018 at 1:03 AM Rob Herring wrote: > > On Wed, Dec 19, 2018 at 08:46:26PM +0100, Sergio Paracuellos wrote: > > Add device-tree binding example of the ksz9477 switch managed in i2c mode. > > > > Cc: devicet...@vger.kernel.org > > Sig